akhauriyash/Code-Regression huggingface dataset:
N,M = map(int,input().split())
L = [list(map(int,input().split())) for i in range(M)]
L.sort()
ans = 0
l,r = 0,0
for a,b in L:
    l = a
    if r <= a:
        ans += 1
        r = b
    else:
        r = min(r,b)
print(ans)


Measured memory_bytes: 27876
// ALDS1_5_A: Exhaustive Search

use std::str::FromStr;

fn scan() -> usize {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let v = s.trim().parse().ok().unwrap();
    v
}

fn scan_vec() -> Vec<u32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let vec = s.split_whitespace().map(|n| u32::from_str(n).unwrap()).collect::<Vec<u32>>();
    vec
}

fn solve(a: &Vec<u32>, n: usize, i: usize, m: u32) -> bool {
    if m == 0 {
        return true;
    } 
    if i >= n {
        return false;
    }
    solve(a, n, i + 1, m) || solve(a, n, i+1, m - a[i])
}

fn main() {
    let n = scan();
    let a = scan_vec();
    let q = scan();
    let m = scan_vec();

    for i in 0..q {
        if solve(&a, n, 0, m[i]) {
            println!("yes");
        } else {
            println!("no");
        }
    }
}


Measured memory_bytes: 5024
/*
*                                 Name : chaitanya
*
*                         Institute : ANITS,Visakhapatnam
*   "Don't regret anything you do, because in the end it makes you who you are."
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#include<sstream>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
using namespace std;

int main()
{
    int n,ans = 0;
    cin >> n;
   cout << (1000-n%1000)%1000;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

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

    ll v;
    for(ll i=1;i*i<=n;i++){
        if(i*(n/i)==n){
            v=n/i;
        }
    }
    ll ans=0;
    for(;v>0;v/=10) ans++;
    cout<<ans<<endl;

	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main (void) {
    string a;
    string b;
    int ab;
    int n;

    cin >> a >> b;

    ab = stoi(a + b);
    n = sqrt(ab);

    if (n * n == ab) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;

int main(){
  IO; string s, t = ""; cin >> s;
  FORE(i, s) t += 'x'; cout << t;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), d = sc.nextInt();
        System.out.println(Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d) ? "Yes" : "No");
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }

}


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

int main(){
    int A, B;
    cin >> A >> B;
    int ans;
    if(A+B > A-B){
        if(A+B > A*B){
            cout << A+B << endl;
        }else{
            cout << A*B << endl;
        }
    }else{
        if(A-B > A*B){
            cout << A-B << endl;
        }else{
            cout << A*B << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int A[N] = {0};
  int ans[N] = {0};
  
  for(int i=0;i<N-1;i++){
    cin >> A[i+1];
  }
  
  for(int i=1;i<N;i++){
    ans[A[i]-1]++;
  }

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

Measured memory_bytes: 5188
#include<stdio.h>
int main()
{
	int a,b,s,d;
	scanf("%d%d",&a,&b);
	if(b%a==0)
	{
		s=a+b;
		printf("%d\n",s);
	}
	else
	{
		d=b-a;
		printf("%d\n",d);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pq priority_queue
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define elif else if

using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using pll=pair<ll,ll>;
using pss=pair<string,string>;
using pdd=pair<ld,ld>;
using graph=vector<vector<int>>;
using wgraph=vector<vector<pll>>;

const ll MOD=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ex[8]={1,1,0,-1,-1,-1,0,1};
const int ey[8]={0,1,1,1,0,-1,-1,-1};
const ld E=1e-9;

template<class T> void chmin(T &a, T b){a=min(a, b);}
template<class T> void chmax(T &a, T b){a=max(a, b);}

ll abs1(ll a){if(a>=0)return a;else return -a;}
ll pow1(ll a,ll b,ll p=LLONG_MAX){
  ll ret=1;
  while(b!=0){
    if((b&1)==1)ret*=a;
    a*=a;
    if(a>=p)a%=p;if(ret>=p)ret%=p;
    b=b>>1;
  }
  return ret;
}
int digit(ll a,ll b=10){int i=0;while(a!=0){a/=b;i++;}return i;}
ll gcd1(ll a,ll b){
  if(a==0 || b==0)return 0;
  ll n;while(a%b!=0){n=a%b;a=b;b=n;}return b;
}
ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];a[0]=n;b[0]=m;int i=1;
  while(b[i-1]!=0){a[i]=b[i-1];b[i]=a[i-1]%b[i-1];i++;}
  n=i;if(c%a[n-1]!=0)return 0;
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){ll cnt=x;x=y;y=cnt-(a[n-i-1]/b[n-i-1])*y;}
  return x;
}
ll modRev(ll a,ll p=MOD){
  a%=p;ll n=solveLinear(a,p,1);
  n%=p;if(n<0)return n+p;
  return n;
}
ll fact(ll n,ll p=MOD){
  if(n<0)return 0;
  ll ret=1;
  for(int i=1;i<=n;i++){ret=ret*i;if(ret>=p)ret%=p;}
  return ret;
}
ll perm(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  ll ret=1;
  rep(i,k){ret=ret*(n-i);if(ret>=p)ret%=p;}
  return ret;
}
ll binom(ll n,ll k,ll p=MOD){
  return (perm(n,k,p)*modRev(fact(k)))%p;
}
int bis(vector<int> v,int key){
  int left=-1,right=v.size();
  while(abs1(right-left)>1){
    int mid=left+(right-left)/2;
    if(v[mid]<=key)left=mid;
    else right=mid;
  }
  return left;
}

ll k;
ll dfs(const graph& g,int v,int p){
  ll ret=1;
  ll cnt=2;
  if(p==-1)cnt=1;
  for(auto i:g[v]){
    if(i==p)continue;
    ret=ret*(k-cnt++)%MOD;
    ret=ret*dfs(g,i,v)%MOD;
  }
  return ret;
}

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n>>k;
  graph g(n);
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  cout<<(k*dfs(g,0,-1))%MOD<<endl;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef vector<int> vi;

int main() {

	int n, i, t = 0;
	cin >> n;
	vi ns(n);
	for (i = 0; i < n; i++) {
		cin >> ns[i];
		if (ns[i] == t + 1)
			t++;
	}
	cout << (t == 0 ? -1 : n - t) << "\n";
	return 0;
}

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

int main(){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k%2==0) cout<<a-b<<endl;
    else cout<<b-a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main()
{
	int n, count{};
	while (std::cin >> n)
	{
		count = 0;
		for (int a = 0; a < 10 && a <= n; ++a)
		{
			if (a + 27 < n) continue;
			for (int b = 0; b < 10 && a + b <= n; ++b)
			{
				if (a + b + 18 < n) continue;
				for (int c = 0; c < 10 && a + b + c <= n; ++c)
				{
					if (a + b + c + 9 < n) continue;
					count++;
				}
			}
		}
		std::cout << count << std::endl;
	}
	return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

  ll ans = 0;
  for (ll i = 1; i * i < n; i++)
    if ((n - i) % i == 0)
      if (n / ((n - i) / i) == n % ((n - i) / i))  // 念の為確認
        ans += (n - i) / i;

  cout << ans << endl;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [usize; n]
    }
    let mut w = v.clone();
    w.sort();
    let mut ans = 0;
    for i in 0..n {
        let j = w.binary_search(&v[i]).unwrap();
        if i % 2 == 0 && j % 2 == 1 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;

namespace hello_world
{class Program
	{
		static void Main(string[] args)
		{
			string s = Console.ReadLine();
			if (s == "ABC")
				Console.WriteLine("ARC");
			else if (s =="ARC")
				Console.WriteLine("ABC");
		  
		}
	}

}


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

using namespace std;

int answer(string str) {
    int ans = 0;
    int size = (int)str.size();
    int end = size/2;
    for (int n=0; n<=end; ++n) {
        int back = size-n-1;
        if (n == back)
            return ans;
        if (str[n] != str[back]) {
            str[n] = str[back];
            ++ans;
        }
    }
    return ans;
}

int main() {
    string str;
    cin >> str;
    int ans = answer(str);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.Char

shuf :: [Int] -> String -> String
shuf [] x = x
shuf (h:hs) x = let r = shuf hs x in drop h r ++ take h r

main = do
  w <- getLine
  if(w == "-") then return()
  else do
    m <- readLn ::IO Int
    h <- replicateM m readLn :: IO [Int]
    putStrLn $ shuf (reverse h) w
    main

Measured memory_bytes: 4088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();

            if(S == T.Substring(0,S.Length))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

main(){
  int N;
  cin >> N;
  int V[N];
  int C[N];
  for(int ii=0;ii<N;ii++){
    cin >> V[ii];
  }
  for(int ii=0;ii<N;ii++){
    cin >> C[ii];
  }
  int ans=0;
  for(int ii=0;ii<N;ii++){
    if(V[ii]>C[ii])ans+=V[ii]-C[ii];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

g = []
for i, v in enumerate(a):
    g.extend([i+1]*v)

k = 0
for i in range(h):
    l = []
    for j in range(w):
        l.append(g[k])
        k += 1
    if i%2:
        print(*l[::-1])
    else:
        print(*l)

Measured memory_bytes: 41840
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn min<T: std::cmp::PartialOrd>(a: T, b: T) -> T {
    if a < b {
        return a;
    } else {
        return b;
    }
}

fn main() {
    let n: usize = read();
    let k: usize = read();
    let hi: Vec<i32> = (0..n).map(|_| read()).collect();

    let mut dp = vec![std::i32::MAX; n];
    dp[0] = 0;

    for i in 1..n {
        for j in 1..k+1 {
            if i < j {
                break;
            }
            dp[i] = min(dp[i], dp[i-j] + (hi[i] - hi[i-j]).abs());
        }
    }

    println!("{}", dp[n-1]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main() {
	double a, b, C;
	double PI = acos(-1);
	cin >> a >> b >> C;
	double rad = C * PI / 180.0;
	double s = a * b * sin(rad) / 2.0;
	double c = sqrt(a * a + b * b - 2.0 * a * b * cos(rad));
	printf("%.8lf %.8lf %.8lf", s, a + b + c, s * 2.0 / a);
}


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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

int main() {
    {
        _time time(disable);
        string str; cin >> str;
        reverse(_all(str));
        cout << str << endl;
    }
    return 0;
}


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

typedef long long ll;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main() {
    int N,K; cin >> N >> K;
    vector<ll> R(100100,INF);
    vector<ll> L(100100,INF);

    int r=1,l=1;

    L[0]=0;
    R[0]=0;

    REP(i,N){
        ll x; cin >> x;
        if(x>=0) R[r]=x, r++;
        else L[l]=-x, l++;
    }
    sort(ALL(L));

    ll ans = LINF;

    REP(i,K+1){
        ans = min(ans, 2*L[i]+R[K-i]);
        ans = min(ans, L[i]+2*R[K-i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4788
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  int r=0,b=0;
  cin>>a;
  int i=0;
  while(a[i]!='\0'){
    if(a[i]=='0') r++;
    if(a[i]=='1') b++;
    i++;
  }
  cout<<i-abs(r-b)<<endl;
  return(0);
}


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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n; cin >> n;

    int ans = 0;

    for (int i = 0; i < n; ++i) {
        int l, r; cin >> l >> r;

        ans += r - l + 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    string s, ans;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0) {
            ans.push_back(s[i]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 592
import numpy as np

inf = float("inf")

n = int(input())
a = np.array(input().split()).astype(float)
b = np.zeros(n).astype(float)
b[0] = a[0]
for i in range(1, n):
    b[i] = b[i - 1] + a[i]
sum = b[len(b) - 1]
mini = inf
split = 0
for i in range(n - 1):
    if mini > abs(b[i] - (sum - b[i])):
        split = b[i]
        mini = abs(b[i] - (sum - b[i]))
if abs(split - (sum - split)) * 2 % 2 == 1:
    print(int(abs(split - (sum - split)) * 2))
else:
    print(int(abs(split - (sum - split))))


Measured memory_bytes: 43588
#include<bits/stdc++.h>
using namespace std;
typedef unsigned char uc;
int main(){
  int m;
  cin>>m;
  int l[m],r[m];
  map<string,int> ms;
  for(int i=0;i<m;i++){
    string s;
    cin>>s>>l[i]>>r[i];
    ms[s]=i;
  }
  int n;
  cin>>n;
  string ss[n];
  for(int i=0;i<n;i++) cin>>ss[i];
  bool f=0;
  time_t start=clock();
  srand((unsigned)time(NULL));
  while((double)(clock()-start)/CLOCKS_PER_SEC<1.7&&!f){
    stack<uc> sc;
    for(int i=0;!f&&i<n;i++){
      //cout<<i<<":"<<ss[i]<<endl;
      if(ms.find(ss[i])!=ms.end()){ 
	int j=ms[ss[i]],k=l[j];
	if(r[j]!=l[j]) k+=(rand()%(r[j]-l[j]));
	//cout<<ss[i]<<":"<<k<<endl;
	sc.push(k);
      }else if(isdigit(ss[i][0])){
	uc a=0;
	for(int j=0;j<(int)ss[i].size();j++) a=(uc)(a*10+ss[i][j]-'0');
	sc.push(a);
      }else{
	uc a,b;
	b=sc.top();sc.pop();
	a=sc.top();sc.pop();
	if(ss[i]=="+") sc.push(a+b);
	if(ss[i]=="-") sc.push(a-b);
	if(ss[i]=="*") sc.push(a*b);
	if(ss[i]=="/"){
	  if(b) sc.push(a/b);
	  else{
	    f=1;
	    break;
	  }
	}
      }
    }
  }
  cout<<(!f?"correct":"error")<<endl;
  return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

void solve_129C(){
    int n, m;
    cin >> n >> m;
    vector<bool> a(n+1, true);
    REP(i,m){
        int x;
        cin >> x;
        a[x] = false;
    }

    vector<int> dp(n+10, 0);
    dp[0] = 1;
    
    if(a[1]) dp[1] = 1;
    for(int i = 2; i < n + 5; i++){
        if(a[i]) dp[i] += dp[i-1] % MOD;
        if(a[i]) dp[i] += dp[i-2] % MOD;
    }
    
    cout << dp[n] % MOD << endl;
}

int main(void){
    solve_129C();
    
    return 0;
}

Measured memory_bytes: 640
num = input()
lst = list(map(int, num))
ele = lst[-1]
if ele==2 or ele==4 or ele==5 or ele==7 or ele==9:
  	print("hon")
elif ele==0 or ele==1 or ele==6 or ele==8:
 	print("pon")
elif ele==3:
	print("bon")

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    ll n ; cin >> n;
    set<ll> s;
    rep(i,n){
        ll x; cin >> x;
        if(s.count(x)){
            cout << "NO" << endl;
            return 0;
        }else{
            s.insert(x);
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll D_MAX = 100000000;
constexpr ll N_MAX = 1000000000;

ll Q, H, S, D;
ll N;

void input() {
	scanf("%lld%lld%lld%lld", &Q, &H, &S, &D);
	scanf("%lld", &N);
}

void solve() {
	vector<ll> v({Q*4, H*2, S});
	ll s=*min_element(all(v));
	if(s*2<D){
		printf("%lld\n", N*s);
	}else{
		if(N%2){
			printf("%lld\n", s+((N-1)/2)*D);
		}else{
			printf("%lld\n", N/2*D);
		}
	}


	
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int H[MAXN];
bool Bad[MAXN];

int main()
{
    int N, M;
    cin >>  N >> M;
    for(int i = 1; i <= N; ++i)
     cin >> H[i];

    for(int i = 1; i <= M; ++i)
    {
        int u, v;
        cin >> u >> v;

        if(H[u] <= H[v])
            Bad[u] = true;
        if(H[v] <= H[u])
            Bad[v] = true;
    }

    int ans = 0;
    for(int i = 1; i <= N; ++i)
        if(!Bad[i])
            ans++;


    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4088
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    a = 0
    res = 0
    for i in s:
        if i == 'S':
            a += 1
        else:
            if a <= 0:
                res += 1
            else:
                a -= 1
    print(res+a)

if __name__ == '__main__':
    main()

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

const int N = 2005, mod = 924844033;
typedef long long LL;

void reduce(int &x) { x += x >> 31 & mod; }

int n, k, dp[N][N], max, f[N];
void calc(int n) {
	dp[0][0] = 1;
	dp[1][1] = 1;
	dp[2][0] = 1;
	dp[2][1] = mod - 2;
	dp[2][2] = 1;
	
	for (int i = 3; i <= n; ++i) {
		for (int j = 0; j <= i; ++j) {
			int &ret = dp[i][j] = 0;
			reduce(ret -= dp[i - 1][j]);
			if (j) reduce(ret += dp[i - 1][j - 1] - mod);
			if (i > 1) reduce(ret += dp[i - 2][j] - mod);
			if (i > 1 && j) reduce(ret -= dp[i - 2][j - 1]);
			if (i > 2) reduce(ret += dp[i - 3][j] - mod);
		}
	}
}
void update(int *A) {
	static int B[N];
	for (int i = 0; i <= n; ++i) B[i] = 0;
	for (int i = 0; i <= max; ++i)
		for (int j = 0; j <= n - i; ++j)
			B[i + j] = (B[i + j] + (LL) A[i] * f[j]) % mod;
	for (int i = 0; i <= n; ++i) f[i] = B[i];
}
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> k, calc(max = (n + k - 1) / k);
	int t = (n - 1) % k + 1;
	f[0] = 1;
	for (int i = 0; i < t; ++i) update(dp[max]);
	for (int i = t; i < k; ++i) update(dp[max - 1]);
	int factor = 1, ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans = (ans + (LL) f[i] * factor) % mod;
		factor = (LL) factor * (i + 1) % mod;
	}
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,K;
    cin >> N >> K;
    vector<int>a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int ans = INF;
    for(int bit = 0; bit < (1 << N); bit++) {
        int cnt = 0;
        int sum = 0;
        int memo = 0;
        for(int i = 0; i < N; i++) {
            if(1 & (bit >> i)) {
                cnt++;
                if(cnt != 1){
                    if(memo >= a[i]) {
                        sum+=memo+1-a[i];
                        memo = memo+1;
                    }
                }
            }
            memo = max(memo,a[i]);
        }
        if(cnt >= K) {
            ans = min(ans,sum);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int> 
#define rep(a,n) for(int i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

vin result(1000,1);

void soin(int N){
    for(int i=2;i<=37;i++){
        while(N%i==0){
            N/=i;
            result.at(i-1)++;
        }
    }
    if(N!=1){
        result.at(N-1)++;
    }
}

void fin(int n,vin &a){
    rep(0,n){
        cin>>a.at(i);
    } 
} 

signed main() {
    int N;
    cin>>N;
    rep(2,N+1){
        soin(i);
    }

    int sum=1;
    rep(0,1000){
        sum*=result.at(i);
        sum%=INF;
    }
    cout<<sum<<endl;

return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lec12A
{
    public class Ver
    {
        public int id;
        public int  state = 0;
        public int d;
        public int p;
        public int[] arr;

        public  Ver (int n)
        {
            arr = new int[n];
        }

    }
    class Program
    {
        const int Inf = 1000000000;
        public static  int res;

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Ver [] array = new Ver [n];
            for (int i = 0; i < n; i++)
            {

                array[i] = new Ver(n);
                string[] inp = (Console.ReadLine()).Split(' ');
                for (int j = 0; j < n; j++)
                {
                    int k = int.Parse(inp[j+1]);
                    if (k < 0)
                    {
                        array[i].arr[j] = Inf;
                    }
                    else
                    {
                        array[i].arr[j] = k;
                    }

                }
                array[i].d = Inf;
                array[i].id = i;
            }

            Prim(array ,n);

            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                if(array[i].p != -1)
                {
                    ans += array[i].arr[array[i].p];
                }
            }

            Console.WriteLine(ans);

            Console.ReadLine();

        }

        static void Prim(Ver [] v , int n)
        {
            v[0].d = 0;
            v[0].p = -1;

            while (true)
            {
                int u = 0;
                res = Inf;
                for (int i = 0; i < n; i++)
                {
                    if (v[i].state != 2 && v[i].d < res)
                    {
                        res = v[i].d;
                        u = i;
                    }
                }

                if (res == Inf)
                {
                    break;
                }

                v[u].state = 2;

                for (int i = 0; i < n;i++)
                {
                    if (v[i].state != 2 && v[i].arr[u] < Inf)
                    {
                        if (v[i].arr[u] < v[i].d)
                        {
                            v[i].d = v[i].arr[u];
                            v[i].p = u;
                            v[i].state = 1;
                        }
                    }
                }
            }
        }
    }
}




Measured memory_bytes: 15980
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

void solve()
{
    ll r;
    cin >> r;

    cout << 3 * pow(r, 2) << endl;
    return;
}

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


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
int a, b, c, x, y;
long long ans = 0, res = 0;
int main() {
    scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
    res = 2LL * c * std::max(x, y);
    if (x > y) {
        ans += 1LL * (x - y) * a;
        x = y;
    }
    if (x < y) {
        ans += 1LL * (y - x) * b;
        y = x;
    }
    ans += std::min(2LL * x * c, 1LL * (a + b) * x);
    printf("%lld\n", std::min(ans, res));
    return 0;
}

Measured memory_bytes: 128
import math
PI = math.pi

a,b,h,m = map(int,input().split())

rad_h = (h/12 + m/60/12) * 2 * PI
rad_m = m/60 * 2 * PI

ans = a**2 + b**2 - 2*a*b*math.cos(rad_h-rad_m)
print(ans**0.5)

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

	using namespace std;

	typedef long long ll;

	ll tot = 0;

	int main(){
		ios_base::sync_with_stdio(false);
		cin.tie(0);
		int N, K;
		cin >> N >> K;
		for (int i = K+1; i <= N; ++i){
			tot += (N - min(K,N%i+1) - (N/(i))*(K));
			if (K > 0) tot++; 	
		}
		cout << tot << '\n';
		cout << flush;
		//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
	}

Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
ll dp[101][100001];

int main(int argc, char const* argv[])
{
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n)cin >> a[i];
  dp[0][0] = 1;
  rep(i, n){
    rep(j, k+1){
      dp[i+1][j] = dp[i][j];
      if(j > 0)dp[i+1][j] = (dp[i+1][j] + dp[i+1][j-1]) % mod;
      if(j - a[i] - 1 >= 0)dp[i+1][j] = (dp[i+1][j] - dp[i][j-a[i]-1]) % mod;
      if(dp[i+1][j] < 0)dp[i+1][j] += mod;
    }
  }
  cout << dp[n][k] << endl;
	return 0;
}


Measured memory_bytes: 78336
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt(), m = scanner.nextInt();
        long ans = 0;
        List<Store> list = IntStream.range(0, n).mapToObj(i -> new Store(scanner.nextInt(), scanner.nextInt())).sorted(Comparator.comparingLong(store -> store.a)).collect(Collectors.toList());
        for (Store store : list) {
            if (store.b >= m) {
                System.out.println(ans + store.a * m);
                return;
            }
            m -= store.b;
            ans += store.a * store.b;
        }
    }

    static class Store {
        long a, b;
        Store(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }
}

Measured memory_bytes: 96272
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N;
vector<int> A;

vector<vector<int>> lose;

int dfs(int now){
    int depth=0;
    vector<int> v;
    for(auto nex:lose[now]){
        int val=dfs(nex);
        v.push_back(val);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    for(int i=0;i<v.size();i++) depth=max(depth,v[i]+i+1);
    return depth;
}

int main(){
  cin>>N;
  A.resize(N+1,0);
  for(int i=2;i<=N;i++) cin>>A[i];

  lose.resize(N+1);
  for(int i=2;i<=N;i++){
      lose[A[i]].push_back(i);
  }

  cout<<dfs(1)<<endl;

  return 0;
}


Measured memory_bytes: 13952
#include<stdio.h>

int main(){
	int i,in,ans[3]={0,0,0},t,s,l;
	
	for(i=0;i<10;i++){
		scanf(" %d",&in);
		for(l=0;l<3;l++){
			if(in>ans[l]){
				t=ans[l];
				ans[l]=in;
				in=t;
			}
		}
	}
	
	for(i=0;i<3;i++)printf("%d\n",ans[i]);
	
    return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;

const int C = 2005;
const int mod = 1e9 + 7;
int dp[2*C][2*C];
int factorial[4*C];

int my_pow(int a, int b) {
	int r = 1;
	while(b) {
		if(b % 2) r = (ll) r * a % mod;
		a = (ll) a * a % mod;
		b /= 2;
	}
	return r;
}
int my_inv(int a) { return my_pow(a, mod - 2); }
int my_div(int a, int b) { return a * (ll) my_inv(b) % mod; }

int bin(int a, int b) { return my_div(factorial[a], (ll) factorial[b] * factorial[a-b] % mod); }

int main() {
	int n;
	scanf("%d", &n);
	vector<pair<int,int>> in;
	while(n--) {
		int x, y;
		scanf("%d%d", &x, &y);
		in.push_back({x, y});
		dp[C-x][C-y]++;
	}
	for(int i = 0; i < 2 * C - 1; ++i)
		for(int j = 0; j < 2 * C - 1; ++j) {
			dp[i][j] %= mod;
			dp[i+1][j] += dp[i][j];
			dp[i][j+1] += dp[i][j];
		}
	int answer = 0;
	for(pair<int,int> p : in) {
		answer = (answer + dp[C+p.first][C+p.second]) % mod;
	}
	factorial[0] = 1;
	for(int i = 1; i < 4 * C; ++i)
		factorial[i] = (ll) factorial[i-1] * i % mod;
	for(pair<int,int> p : in) {
		//~ cerr << dp[2*(p.first+p.second)][2*p.first] << "\n";
		answer = (answer + mod - bin(2*(p.first+p.second), 2 * p.first)) % mod;
	}
	printf("%d\n", my_div(answer, 2));
}


Measured memory_bytes: 64752
#include<iostream>

using namespace std;

int ans = 0;
void dfs(int n,int s,int depth){
	//if (s < 0) return;  //
	if (s == 0 and n == 0){ // ?§£??????????????£??????
		ans++;
		return;
	}
	if (n == 0) return;	

	depth++;
	if (depth == 10)return;
	//???????????´???
	dfs(n-1,s-depth,depth);
	//?????°????????£?????´???
	dfs(n,s,depth);
return;
}

int main(){
	while(1){
		ans = 0;
		int n,s; cin >> n >> s;
		if (n + s == 0)	break;
		dfs(n,s,-1);
		cout << ans << endl;
	}

return 0;
}

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

int main() {
	string a;
	cin>>a;
	int max=0,flag=0,temp=0;
	for(int i=0;i<a.size();i++){
	    if(a[i]=='R'){
	        if(flag==0){
	            flag=1;
	            temp=1;
	        }
	        
	        else
	        temp++;
	    }
	    else{
	        if(max<temp)
	        max=temp;
	        flag=0;
	        temp=0;
	    }
	}
	if(max<temp)
	max=temp;
	cout<<max;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) (n); i++)
#define ll long long
#define scout cout << fixed << setprecision(20)
ll INF = 9e17;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	bool ok = false;
	for(int i=1;i<=9;i++) {
		for(int j = 1; j<=9;j++) {
			if(i*j==n) {
              ok = true;
              break;
            }
		}
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
data = []
for i in range(n):
    x,l = map(int,input().split())
    data.append([x-l,x+l])
data.sort(key=lambda x:x[1])

ans = 0
t = -10**10
for i in range(n):
    if t <= data[i][0]:
        ans += 1
        t = data[i][1]

print(ans)

Measured memory_bytes: 64856
def p_f():
    from sys import stdin
    input = stdin.readline
    N, u, v = map(int, input().split())
    edges = [list(map(int, input().split())) for i in range(N - 1)]
    if u == v:
        print(0)
        exit()

    def BFS(K, edges, N):
        roots = [[] for i in range(N)]
        for a, b in edges:
            roots[a - 1] += [(b - 1, 1)]
            roots[b - 1] += [(a - 1, 1)]
        dist = [-1] * N
        stack = []
        stack.append(K)
        dist[K] = 0
        while stack:
            label = stack.pop(-1)
            for i, c in roots[label]:
                if dist[i] == -1:
                    dist[i] = dist[label] + c
                    stack += [i]
        return dist

    dist_v = BFS(v - 1, edges, N)
    dist_u = BFS(u - 1, edges, N)
    ans = 0
    for du, dv in zip(dist_u, dist_v):
        if du < dv and ans < dv - 1:
            ans = dv - 1
    print(ans)


if __name__ == '__main__':
    p_f()


Measured memory_bytes: 94684
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main() {
  int n;
  cin >> n;
  int a[n+2], b[n+2];
  a[0] = 0;
  b[n+1] = 0;
  REP(i, n)cin >> a[i+1];
  REP(i, n)cin >> b[i+1];
  a[n+1] = a[n];
  b[0] = b[1];
  ll ans = 1;
  REP(i, n+1){
    if(a[i] == a[i+1] && b[i] == b[i+1]){
      if(a[i] == b[i] && a[i-1] != a[i]) continue;
      ans *= min(a[i+1], b[i+1]);
      ans %= MOD;
    }
    else if(b[i] == b[i+1]){
      if(a[i+1] > b[i+1]) ans = 0;
    }
    else if(a[i] == a[i+1]){
      if(b[i] > a[i]) ans = 0;
    }
    else ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int a,o=0;
    bool n[1000000];
    for(int i=2;i<=999999;i++){
        n[i]=true;
    }
    n[0]=n[1]=false;
        for( int j=2;j*j<=999999;j++){
            if(n[j]){
                for(int k=j*2;k<=999999;k+=j){
                n[k]=false;
                }
            }
        }
        while(cin>>a){
    for(int k=2;k<=a;k++) if(n[k]) o++;
    cout<<o<<endl;
    o=0;
        }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> a(3*N);
    REP(i, 3*N) cin >> a[i];

    priority_queue<ll, vector<ll>, greater<ll>> zen;
    priority_queue<ll> kou;
    ll zensum=0, kousum=0;
    vector<ll> zen_res(N+1), kou_res(N+1);

    REP(i, N){
    	zen.push(a[i]);
    	zensum += a[i];
    }
    zen_res[0] = zensum;
    REP(i, N){
    	ll tmp = zen.top();
    	if(tmp < a[i+N]){
    		zen.pop();
    		zen.push(a[i+N]);
    		zensum += a[i+N];
    		zensum -= tmp;
    	}
    	zen_res[i+1] = zensum;
    }

    reverse(a.begin(), a.end());

    REP(i, N){
    	kou.push(a[i]);
    	kousum += a[i];
    }
    kou_res[0] = kousum;
    REP(i, N){
    	ll tmp = kou.top();
    	if(tmp > a[i+N]){
    		kou.pop();
    		kou.push(a[i+N]);
    		kousum += a[i+N];
    		kousum -= tmp;
    	}
    	kou_res[i+1] = kousum;
    }
    
    ll res = -(1ll << 60);
    REP(i, N+1){
    	res = max(res, zen_res[i] - kou_res[N-i]);
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 6516