akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
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; }

int h, w, k;
int main() {
    cin >> h >> w >> k;
    vector<vector<char>> s(h, vector<char>(w, '0'));
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            cin >> s.at(i).at(j);
        }
    }

    int ch = h-1;
    int cutmin = 1e9+7;
    for(int bit = 0; bit < (1<<ch); ++bit) {
        vector<int> cutline;
        for(int i = 0; i < ch; ++i) {
            if(bit & (1<<i)) {
                cutline.push_back(i);
            }
        }

        int cutcnt = cutline.size();
        cutline.push_back(h-1);
        int cutlen = cutline.size();
        vector<int> block(cutlen, 0);
        int right = 0;
        for(int left = 0; left < w; ++left) {
            int checkline = 0;
            for(int i = 0; i < h; ++i) {
                if(i > cutline.at(checkline)) checkline++;
                if(s.at(i).at(left) == '1') block.at(checkline)++;
            }
            bool flg = true;
            for(int l = 0; l < cutlen; ++l) {
                if(k < block.at(l)) {
                    cutcnt++;
                    flg = false;
                    break;
                }
            }

            bool flg2 = true;
            if(!flg) {
                for(int l = 0; l < cutlen; ++l) block.at(l) = 0;
                if(left == right) flg2 = false;
                else {
                    right = left;
                    left--;
                }
            }

            if(!flg2) {
                cutcnt = 1e9+7;
                break;
            }
        }
        chmin(cutmin, cutcnt);
    }
    cout << cutmin << endl;
}

Measured memory_bytes: 256
import math

A = []
m = 10
n = 0
for i in range(5):
    x = int(input())
    A.append(x)
    if m > x%10 > 0:
        m = x%10
        n = i

s = 0
for i,a in enumerate(A):
    if i == n:
        s += a
    else:
        s += math.ceil(a/10)*10

print(s)

Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
    int a;
    cin >> a;
    if(a%10==9 || a/10 ==9)
    cout << "Yes" << endl;
    else 
    cout << "No" << endl;
    
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    list<char>s;
    bool f = true;
    {
        string t;
        cin >> t;
        for(auto x : t)s.push_back(x);
    }
    int q;
    cin >> q;
    while(q--){
        int t;
        cin >> t;
        if(t == 1){
            f = !f;
        }else{
            int tt;
            cin >> tt;
            char c;
            cin >> c;
            if(f){
                if(tt == 2)s.push_back(c);
                else s.push_front(c);
            }else{
                if(tt == 2)s.push_front(c);
                else s.push_back(c);
            }
        }
    }
    if(f){
        for(auto x : s){
            cout << x;
        }
        cout << endl;
    }else{
        for(auto itr = s.rbegin(); itr!=s.rend(); itr++){
            cout << *itr;
        }
        cout << endl;
    }
}


Measured memory_bytes: 9964
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N, K;
    cin >>N >> K;
    vector <ll> A(N);
    vector <ll> pos(K+1, -1);
    loop(i,0,N) {
        cin >> A[i];
        pos[A[i]]=1;
    }
    sort(A.begin(), A.end());
    loop(i,1,K+1)
    {
        if (pos[i]==1) continue;
        if (i < A[0])
        {
            pos[i]=0; continue;
        }
        pos[i]=0;
        // Assume it to be a lost position
        loop(j,0,N)
        {
            if (i-A[j] >= 0)
            {
                if (pos[i-A[j]] == 0) {
                    // if removing any valid number (number contained in A[]) of stones, leads to losing position
                    // then this is a winning position.  
                    pos[i]=1;
                    break;
                }
            }
            else break;
        }
    }
    if (pos[K]) cout << "First\n";
    else cout << "Second\n";
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s,t;
  cin >> s >> t;
  rep(i,s.size()) {
    rotate(s.begin(),s.begin()+1,s.end());
    if(s==t) {
      pr("Yes");
      return;
    }
  }
  pr("No");

}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

macro_rules! input {
    (source = $s:expr; $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[allow(unused_imports)]
use std::cmp::*;
trait Each: Iterator {
    fn each<F>(self, mut f: F)
    where
        Self: Sized,
        F: FnMut(Self::Item),
    {
        self.fold((), move |(), item| f(item));
    }
}
impl<T: Iterator> Each for T {}

const SEPARATOR: &'static str = " ";

fn solve(source: &str) -> String {
    let mut result: Vec<String> = vec![];
    macro_rules! p {
        ([$x: expr]) => {
            $x.iter().each(|&x| p!(x))
        };
        ([$x: expr]; $s:expr)=>{
            p!($x.iter().map(|x|x.to_string()).collect::<Vec<_>>().join($s));
        };
        ($($x: expr),* $(,)*) => {
            $(result.push($x.to_string()));*
        };
    }
    //---------------------------------------------------------------//

    input! {
        source = source;
        n:usize,
        mut s:chars
    }
    s.dedup();
    p!(s.len());

    //---------------------------------------------------------------//
    return result.join(SEPARATOR);
}
fn main() {
    let mut s;
    let source = {
        use std::io::Read;
        s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s.as_str()
    };
    println!("{}", solve(source));
}
#[test]
fn testcase() {
    assert_eq!(
        solve(
            r"10
aabbbbaaca
"
        ),
        r"5"
    );
    assert_eq!(
        solve(
            r"5
aaaaa
"
        ),
        r"1"
    );
    assert_eq!(
        solve(
            r"20
xxzaffeeeeddfkkkkllq
"
        ),
        r"10"
    );
}


Measured memory_bytes: 4352
import sys


def alg_combination_mod(n, r, mod):
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    x, y = list(map(int, readline().split()))
    if (x + y) % 3 == 0:
        t = (x + y) // 3
        for i in range(0, t + 1):
            tx = i * 2 + (t - i)
            ty = i + (t - i) * 2
            if tx == x and ty == y:
                print(alg_combination_mod(t, i, mod))
                exit()
        print(0)
    else:
        print(0)


if __name__ == '__main__':
    solve()


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

const int MN = 500010;

void getPi(string &S, int *pi) {
    for(int i = 1, j = 0; i < S.size(); i++) {
        while(j && S[i] != S[j]) j = pi[j - 1];
        if(S[i] == S[j]) {
            pi[i] = ++j;
        }
    }
}

int N;
string S;
int pi[MN], rpi[MN];

int main() {
    cin >> S;
    getPi(S, pi);
    reverse(S.begin(), S.end());
    getPi(S, rpi);
    N = S.size();

    if(pi[N - 1] == 0 || N % (N - pi[N - 1])) {
        printf("1\n1");
        return 0;
    }
    if(pi[N - 1] == N - 1) {
        printf("%d\n1", N);
        return 0;
    }
    printf("2\n");

    int ans = 0;
    for(int i = 0; i < N - 1; i++) {
        bool ok = true;
        if(pi[i] && (i + 1) % (i + 1 - pi[i]) == 0) ok = false;
        if(rpi[N - 2 - i] && (N - 1 - i) % (N - 1 - i - rpi[N - 2 - i]) == 0) ok = false;
        if(ok) ans++;
    }
    printf("%d", ans);
}


Measured memory_bytes: 4740
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

  long long sum = 0;
  for(int i=1;i<=n;i++)
  {
    if(i%3 == 0) continue;
        if(i%5 == 0) continue;
    //cout << i << endl;
    sum+=i;
  }
  cout << sum << endl;
  return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n, x;
    cin >> n >> x;
    int l[n] = {};
    for (int i = 1; i < n + 1; i++) {
        cin >> l[i];
    }
    // check
    // rep(i, n + 1) {
    //     if (i > 0) cout << " ";
    //     cout << l[i];
    // }
    //     // 処理
    int cnt   = 0;
    int bound = 0;
    for (int i = 1; i <= n + 1; i++) {
        bound = bound + l[i - 1];
        if (bound > x) {
            break;
        }
        cnt++;
    }

    // 出力
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using namespace std;

#define inf 0x7f7f7f7f
#define maxn 100006
#define mod 1000000007
#define N 1
#define P 2


typedef long long ll;
typedef struct {
    int u, v, next, w;
} Edge;
Edge e[1];
int cnt, head[1];

inline void add(int u, int v,int w) {
    e[cnt].u = u;
    e[cnt].v = v;
    e[cnt].w = w;
    // e[cnt].f=f;
    e[cnt].next = head[u];
    head[u] = cnt++;
    e[cnt].u = v;
    e[cnt].v = u;
    e[cnt].w = w;
    //    e[cnt].f=-f;
    e[cnt].next = head[v];
    head[v] = cnt++;
}

inline void write(int x) {
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int root,n,a[105];

int dis(int x,int t){
    return (x-t)*(x-t);
}
int main(){
    n=read();
    int sum=0;
    for(int i=1;i<=n;i++)
        a[i]=read(),sum+=a[i];
    sum/=n;
    int res=0;
    for(int i=1;i<=n;i++){
        res+=dis(a[i],sum);
    }
    int res2=0;
    for(int i=1;i<=n;i++)
        res2+=dis(a[i],sum+1);
    cout<<min(res,res2)<<endl;
}




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

int main()
{	
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	
	ll div_c = B/C - (A-1)/C;
	ll div_d = B/D - (A-1)/D;
	ll CD = C*D / __gcd(C,D);
	ll div_cd = B/CD - (A-1)/CD;
	
	cout << (B-A+1) - (div_c + div_d - div_cd) << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int a[5],b[5];
int main(){
  int t=0;

  rep(i,5){
    cin>>a[i];
    t+=a[i];
  }
  rep(i,5){
    b[i]=(10-a[i]%10)%10;
  }
  sort(b,b+5);
  rep(i,4){
    //cerr<<b[i]<<endl;
    t+=b[i];
  }
  cout<<t<<endl;

}


Measured memory_bytes: 256
# 初期入力
N= int(input())
S =input().strip()

# RGBの各index
R =set([i for i, x in enumerate(S) if x == 'R'])
G =set([i for i, x in enumerate(S) if x == 'G'])
B =set([i for i, x in enumerate(S) if x == 'B'])


count =0
rgb =[]
for i in R:
    for j in G:
        k1 =j +(j -i)
        if k1 in B: #inはlistよりsetのほうが速い
            count +=1

for i in B:
    for j in R:
        k1 =j +(j -i)
        if k1 in G: #inはlistよりsetのほうが速い
            count +=1

for i in G:
    for j in B:
        k1 =j +(j -i)
        if k1 in R: #inはlistよりsetのほうが速い
            count +=1

all =len(R) *len(G) *len(B)
print(all -count)

Measured memory_bytes: 9312
a=1
n=input()
s=list(map(int,input().split()))

count=0
if 0 in s:
  print(0)
  count=1
else:
  a=1
  for i in s:
    a*=i
    if a>10**18:
      print(-1)
      break
if a<=10**18 and count!=1:
  print(a)

Measured memory_bytes: 21788
function gcd(a, b) {
	while (true) {
		if (a > b) {
			a = a % b;
			if (a === 0) return b;
		} else {
			b = b % a;
			if (b === 0) return a;
		}
	}
}

function Main(lines) {
const NS = lines[0].split(' ');
const N = Number(NS[0]);
const S = Number(NS[1]);
 
console.log(3 * (N - gcd(N - S, S)));
}
 
Main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n'));
 


Measured memory_bytes: 7500
n,d=map(int,input().split())

x=[list(map(int,input().split())) for i in range(n)]


ans=0
for i in range(n):
    for j in range(1+i,n):
        dist=0
        for k in range(d):
            dist+=(x[i][k]-x[j][k])**2
        dist=pow(dist,1/2)
        if dist%1==0:
            ans+=1

print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
#include <bitset>
typedef long long ll;
typedef long double ld;

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
vector<ll> par;

int root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
	if (par[x] == x) return x;
	return root(par[x]);
}

void unite(ll x, ll y) { // xとyの木を併合
	ll rx = root(x); //xの根をrx
	ll ry = root(y); //yの根をry
	if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
	par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
}

bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
	ll rx = root(x);
	ll ry = root(y);
	return rx == ry;
}

int main() {
	ll n, q,com,x,y;
	cin >> n >> q;
	rep(i,n)par.push_back(i);
	rep(i,q) {
		cin >> com >> x >> y;
		if(com==0) {
			unite(x,y);
		}
		else {
			int ans;
			if (same(x, y)) ans = 1;
			else ans = 0;
			cout << ans << endl;
		}
	}
	return 0;
}


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

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int INF = 2e18;
const ld EPS = 1e-9;
const int NN = 2e5 + 2;

string to_string(string s) {
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
    bool first = true;  string res = "{";
    for (const auto &x : v) {
        if (!first) { res += ", "; }
        first = false; res += to_string(x);
    }
    res += "}";   return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

// #define TRACE

#ifdef TRACE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(_VA_ARGS_)
#else
#define debug(...)
#endif
//============================================================================


void solve() {
    int i = 0, j = 0, k = 0, n = 0, m = 0;
    cin >> n;
    string s;
    cin >> s;
    int d = s[0] - '0';
    int h = stoi(s.substr(2, 2));
    debug(d, h);
    int ans = d * n + (h * n)/100;
    cout << ans << el;
}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
import java.io.PrintWriter
import kotlin.math.pow

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun Int.pow(n: Int) = pow(n.toLong())
fun Int.pow(n: Long) = toDouble().pow(n.toDouble()).toLong()
fun Long.pow(n: Int) = pow(n.toLong())
fun Long.pow(n: Long) = toDouble().pow(n.toDouble()).toLong()

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val S = next()
    val T = next()
    for (n in N downTo 1) {
        if (S.takeLast(n) == T.take(n)) {
            println(2 * N - n)
            return
        }
    }
    println(2 * N)
}

Measured memory_bytes: 35936
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> G[100000];

int main(){
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        int X;
        cin >> X;
        G[X%M].push_back(X);
    }
    for(int i = 0; i < M; i++){
        sort(G[i].begin(), G[i].end());
    }
    int cnt_all[100000] = {0};
    int cnt_odd[100000] = {0};
    for(int i = 0; i < M; i++){
        if(G[i].size() == 0) continue;
        int prev = G[i][0];
        int cnt_cur = 1;
        cnt_all[i] = G[i].size();
        for(int j = 1; j < G[i].size(); j++){
            //cout << j << endl;
            if(prev == G[i][j]){
                cnt_cur++;
            }else{
                if(cnt_cur%2 == 1)cnt_odd[i]++;
                prev = G[i][j];
                cnt_cur = 1;
            }
        }
    }
    int ans = G[0].size()/2;
    if(M%2 == 0) ans += G[M/2].size()/2;
    for(int i = 1; 2*i < M; i++){
        int k, l;
        if(G[i].size() < G[M-i].size()){
            k = i;
            l = M-i;
        }else{
            k = M-i;
            l = i;
        }
        if((G[l].size() - G[k].size()) <= cnt_all[l]-cnt_odd[l]){
            ans += G[k].size() + (G[l].size() - G[k].size())/2;
        }else{
            ans += G[k].size() + (cnt_all[l]-cnt_odd[l])/2;
        }
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), sorted(n);
  for ( int i = 0; i < n; i++ ) {
    cin >> a[i];
    sorted[i] = a[i];
  }
  sort(sorted.begin(), sorted.end());

  for ( int i = 0; i < n; i++ ) {
    int ans = ( a[i] != sorted[n-1] ) ? sorted[n-1] : sorted[n-2];
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 4844
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 6e5 + 111;
     
using namespace std;

int n, a[maxn], dp[maxn], t, q;

void solve(){    
	cin >> n;

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

	dp[2] = abs(a[2] - a[1]);

	for (int i = 3; i <= n; i++)
		dp[i] = min(dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i]));

	cout << dp[n];
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int n,ans;
    cin>>n;
    vector<int> w(n);
    for (int i=0; i<n; i++){
        cin>>w[i];
    }
    ans=10000000000;
    for (int i=0; i<n; i++){
        int l=0,r=0;
        for (int j=0; j<i; j++) l+=w[j];
        for (int j=i; j<n; j++) r+=w[j];
        ans=min(ans,abs(l-r));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
using Flow = int;
struct Edge {
	int s, d; Weight w; Flow c;
	Edge() {};
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}

template<typename T>
vector<T> compress(vector<T> v) {
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	return v;
}

template<typename T>
int index(const vector<T> &zip, T i) { return lower_bound(zip.begin(), zip.end(), i) - zip.begin(); }

vector<int> getPath(int s, int g, vector<int> prev) {
	vector<int> path;
	path.emplace_back(g);
	for (int i = g; i != s; ) {
		if (i == -1)
			return vector<int>();
		path.emplace_back(i = prev[i]);
	}
	reverse(path.begin(), path.end());
	return path;
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	using P = tuple<int, int>;
	vector<P> v;
	vector<int> p(M), q(M), c(M); rep(i, 0, M) {
		cin >> p[i] >> q[i] >> c[i];
		p[i]--, q[i]--;
		v.emplace_back(p[i], c[i]);
		v.emplace_back(q[i], c[i]);
	}

	vector<P> zip = compress(v);

	int n = zip.size();
	Graph g(n + N);
	rep(i, 0, M) {
		addEdge(g, index(zip, P(p[i], c[i])), index(zip, P(q[i], c[i])), 0);
	}

	rep(i, 0, n) {
		int cv, cc; tie(cv, cc) = zip[i];
		addEdge(g, n + cv, i, 1);
	}

	auto dijkstra = [&](const Graph &g, int s, Array &dist) {
		int n = g.size();
		vector<bool> vis(n);
		vector<int> prev(n, -1);
		dist.assign(n, INF);
		dist[s] = 0;
		using State = tuple<Weight, int, int>;
		priority_queue<State, vector<State>, greater<State>> pq;
		pq.emplace(0, s, -1);
		while (pq.size()) {
			Weight d; int v, p; tie(d, v, p) = pq.top(); pq.pop();
			if (dist[v] < d)continue;
			vis[v] = true;
			prev[v] = p;
			for (auto &e : g[v]) {
				if (vis[e.d])continue;
				if (dist[e.d] > dist[v] + e.w) {
					dist[e.d] = dist[v] + e.w;
					pq.emplace(dist[e.d], e.d, v);
				}
			}
		}
		return prev;
	};

	Array dist;
	vector<int> prev = dijkstra(g, n + 0, dist);
	dump(dist);
	cout << (dist[n + N - 1] == INF ? -1 : dist[n + N - 1] / 2) << endl;

	return 0;
}

Measured memory_bytes: 59500
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
from fractions import gcd
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	AB = []
	D = defaultdict(int)
	DJ = defaultdict(int)
	d0x = 0
	dx0 = 0
	d00 = 0
	for i in range(N):
		A, B = getlist()
		if A == 0 and B == 0:
			d00 += 1
		elif A == 0:
			dx0 += 1
		elif B == 0:
			d0x += 1
		else:
			GCD = gcd(A, B)
			a = int(A // GCD)
			b = int(B // GCD)
			if a < 0:
				a = -a
				b = -b
			AB.append([a, b])
			D[a * (10 ** 19) + b] += 1
			DJ[a * (10 ** 19) + b] = 1

	ans = 1

	for a, b in AB:
		a2 = b; b2 = -a
		if a2 < 0:
			a2 = -a2; b2 = -b2
		if DJ[a * (10 ** 19) + b] >= 0 and DJ[a2 * (10 ** 19) + b2] >= 0:
			DJ[a * (10 ** 19) + b] = -1
			DJ[a2 * (10 ** 19) + b2] = -1
			X = D[a * (10 ** 19) + b]
			Y = D[a2 * (10 ** 19) + b2]
			ans *= pow(2, X, con) + pow(2, Y, con) - 1
			ans %= con

	ans *= (pow(2, d0x, con) + pow(2, dx0, con)) - 1
	ans += d00
	ans %= con

	if ans == 0:
		print(10 ** 9  + 6)
	else:
		print(ans - 1)

if __name__ == '__main__':
	main()

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

long long a[55], p[55];

long long burger(int n, long long x) {
    if (n == 0) return x <= 0 ? 0 : 1;
    if (x <= 1 + a[n - 1]) return burger(n - 1, x - 1);
    else return p[n - 1] + 1 + burger(n - 1, x - 2 - a[n - 1]);
}

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

    a[0] = 1, p[0] = 1;
    for (int i = 1; i <= n; i++) {
        a[i] = a[i - 1] * 2 + 3;
        p[i] = p[i - 1] * 2 + 1;
    }

    cout << burger(n, x) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  ll n;
  cin >> n;

  if (n & 1) {
    cout << 0 << endl;
    return 0;
  }

  n /= 2;
  ll k = 5, ans = 0;
  while (n / k) {
    ans += n / k;
    k *= 5;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3628
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int n;
	
	cin >> n;

	ll a[n];

	ll count = 0;
	rep(i, n)
	{
		cin >> a[i];
		int j = 0;
		while( !(a[i] & (1 << j)))
		{
			j++;
		}
		count += j;
	}

	cout << count << endl;

	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const double pi = acos(-1.0);

int main() {
  double A, B, C;
  cin >> A >> B >> C;
  if(A * A * B / 2.0 > C) {
    double x = C * 2.0 / A / B;
    printf("%.10f\n", atan(B / x) / pi * 180.0);
  } else {
//    puts("!!");
    C = A * A * B - C;
    double x = C * 2.0 / A / A;
//    printf("%.10f\n", x);
    printf("%.10f\n", atan(x / A) / pi * 180.0);
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

string s;
int main(){
  cin >> s;
  int base = s.length();
  int lim = s.length();
  int i;
  for(i = 0; i < lim; i++){
     if (s[i] == '0' && s[i+1] == '1'){
      s.erase(i, 2);
      lim -= 2;
      i -= 2;
    }
    else if(s[i] == '1' && s[i + 1] == '0'){
      s.erase(i, 2);
      lim -= 2;
      i -= 2;
    }
  }

  cout << base - s.length();
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <string>
#include <bitset>

//DP

using namespace std;

struct guy{
	int M;
	int bit;
	unsigned long long int L;
	vector< int > S, E;
	guy(){
		bit = 0;
	}
};

int set( int p, vector< int > s, vector< int > e ) {
	for( int i = 0; i < s.size(); i++) {
		for( int j = 0; j < e[i] - s[i] ; j++) {
			p += ( 1 << ( j + s[i] ) );
		}
	}
	return p;
}

unsigned long long int max( unsigned long long int p, unsigned long long int q ) {
	if( p > q ) return p;
	return q;
}
 
int main(void){


	vector< vector< unsigned long long int > > dp( 100, vector< unsigned long long int> ( (1 << 16 ), 0 ) );

	while( true ) {
		int N;
		vector< guy > guys;

		/*
			dp[人の数][スケジュールのbit] = 効用の最大値
		*/
		
//		unsigned long long int dp[100][1 << 16] = {0};
		for( int i = 0; i < 100; i++) {
			for( int j = 0; j < ( 1 << 16 ) ; j++ ) {
				dp[i][j] = 0;
			}
		}

		unsigned long long int ans = 0;
		cin >> N;
		if( N == 0 ) break;

		for( int i = 0; i < N; i++ ) {
			guy g;
			cin >> g.M >> g.L;
			for( int j = 0; j < g.M; j++) {
				int tmp, tmp2;
				cin >> tmp >> tmp2;
				tmp -= 6;
				tmp2 -= 6;
				g.S.push_back( tmp );
				g.E.push_back( tmp2 );
			}
			g.bit = set( 0, g.S, g.E );
			guys.push_back( g );
		}

		for( int i = 0; i < N; i++ ) {
			dp[i][set(0, guys[i].S, guys[i].E )] = guys[i].L;
		}
		for( int i = 1; i < 16; i++) {
			for( int j = 0; j < 1 << 16; j++ ) {
				for( int k = 0; k < N; k++ ) {
					if( !( j & guys[k].bit ) ) {
						int tmp = ( j | guys[k].bit );
						dp[i][ tmp ] = max( dp[i][tmp], dp[i-1][j] + guys[k].L );
					}
				}
			}
		}

		for( int i = 0; i < 1 << 16; i++) {
			for( int j = 0; j < N; j++ )
				ans = max( dp[j][i], ans );
		}

		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;
const int N =2e6+1;
int a[N];
int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; ++i) {
        if (a[i] == a[i + 1]) {
            cout << "NO\n";
            return 0;
        }
    }
    cout <<"YES\n";
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
    int n;
    //1以上８６以下の整数
    cin>> n;
    
    long long int l[86];
    l[0]=2;
    l[1]=1;
    for(int i=2;i<=n;i++){
        l[i]=l[i-1]+l[i-2];
    }
    cout<< l[n] <<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  vector<long long> va;
  long long a;
  long long suma=0;
  long long sumao=0;
  for (long long i=0;i<N;i++){
    cin>>a;
    va.push_back(a);
    suma+=a;
    if (i%2==0){
      sumao+=a;
    }
  }
  long long bef=(2*sumao-suma)/2;
  cout<<2*bef;
  for (long long i=0;i<N-1;i++){
    cout<<" "<<2*(va[i]-bef);
    bef=va[i]-bef;
  }
  cout<<endl;

}


Measured memory_bytes: 2164
#include<cstdio>
#include<string.h>
using namespace std;
int main()
{
    int n,k,r,g,b,i,j;
    while(scanf("%d %d %d %d",&r,&g,&b,&n)==4)
    {
        int sum=0;
        for(i=0; i*r<=n; i++)
            for(j=0; j*g+i*r<=n; j++)
            {
                int num=n-j*g-i*r;
                if(num%b==0)
                    sum++;
            }
        printf("%d\n",sum);
    }

    return 0;
}



Measured memory_bytes: 128
#include "bits/stdc++.h"

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

int N, K;
int cost(int cl, int cr, int amari, vector<ll> V)
{
   vector<ll> A(cl + cr);
   int n = 0;
   for (int i = 0; i < cl; i++)
   {
      A[n] = V[i];
      n++;
   }
   for (int i = 0; i < cr; i++)
   {
      A[n] = V[N - i - 1];
      n++;
   }
   sort(A.begin(), A.end());
   int64_t sum = 0;
   for (int i = amari; i < n; i++)
      sum += A[i];
   return sum;
}

void Main()
{
   cin >> N >> K;
   vector<ll> V(N);
   FORV(v, V)
   cin >> v;
   int cl, cr;
   int64_t mm = LONG_MIN;
   int64_t sum;
   for (int k = 0; k <= K; k++)
   {
      for (int amari = 0; amari <= k / 2; amari++)
      {
         if (k - amari > N)
            continue;
         for (int cl = 0; cl <= k - amari; cl++)
         {
            sum = cost(cl, k - amari - cl, amari, V);
            mm = max(mm, sum);
         }
      }
   }
   cout << mm << endl;
}

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main() {
	double n;
	while (cin >> n) {
		if (n > 60) {
			//60超
			if (n > 75) {
				if (n > 81) {
					//91-
					if(n>91)cout << "heavy" << endl;
					//81-91
					else cout << "light heavy" << endl;
				}//75-81
				else cout << "middle" << endl;
			}
			//60超75以下
			else if (n > 69)//69-75
				cout << "light middle" << endl;
			else if(n>64)//64-69
				cout << "welter" << endl;
			else //60-64
				cout << "light welter" << endl;
		}
		else {
			//60以下
			if (n > 51) {
				if (n > 54) {
					if(n>57)//57-60
						cout << "light" << endl;
					else//54-57
						cout << "feather" << endl;
				}else//54-51
					cout << "bantam" << endl;
			}
			else {
				//51以下
				if (n > 48)//51-48
					cout << "fly" << endl;
				else //-48
					cout << "light fly" << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3068
#include <stdio.h>



int main ()
{
int A,B,C;
scanf("%d %d %d", &A, &B, &C);

if (A==B&&A!=C){
	printf ("Yes");
}
else if (A==C&&A!=B){
	printf("Yes");
}
else if(B==C&&B!=A){
	printf("Yes");
}
else {
	printf("No");
}
	return 0;
	}

Measured memory_bytes: 3228
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define mp make_pair
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int isprime(int n){
    int count =0;
    for(int i=2;i<=sqrt(n);i++)
    if(n%i==0)count++;
    if(count)return 0;
    return 1;
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
    if (a == b) 
        return a; 
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 
int main(){
    string s;
    cin>>s;
    int c =0;
    if(s[0]=='R')c++;
    if(s[2]=='R')c++;
    if(s[1]=='S'){
        if(c>0)cout<<1<<endl;
        else cout<<0<<endl;
    }
    else{
        cout<<c+1<<endl;
    }
    return 0;
}






Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
map<ll ,ll >mp;
int main()
{
   
    ll n,i;
    cin>>n;
    ll a[n];
    ll hash[1000001]={};
    for(i=0;i<n;i++)
       { cin>>a[i];hash[a[i]]++;if(hash[a[i]]==2) mp[a[i]]=1;}
    sort(a,a+n);
    for(i=0;i<n-1;i++)
    {
        for(ll j=a[i]*2;j<=a[n-1];j+=a[i])
        {
            mp[j]=1;
        }
    }
    ll cnt=0;
    for(i=0;i<n;i++)
    {
        if(mp[a[i]]==1)
            cnt++;
    }
    cout<<n-cnt<<"\n";
	return 0;
}

Measured memory_bytes: 75136
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,x;
  cin>>n>>x;
  vint a(n);
  rep(i,n){
    cin>>a[i];
  }
  sort(all(a));
  int count=0;
  rep(i,n-1){
    if(x-a[i]<0){
      break;
    }
    x-=a[i];
    count++;
  }
  if(x==a[n-1]){
    count++;
  }
  cout<<count<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int inf=3e3+9;
string a,b;
int dp[inf][inf],n,m,par[inf][inf];
int main(){

    cin>>a>>b;
    n=a.size();
    m=b.size();

    for(int i=0;i<n;i++){

        for(int j=0;j<m;j++){

            if(i==0 || j==0){
                dp[i][j]=(a[i]==b[j]);
                if(dp[i][j])
                    par[i][j]=-1;
                if(i && dp[i-1][j] )
                    dp[i][j]=1,par[i][j]=1;
                if(j && dp[i][j-1])
                    dp[i][j]=1,par[i][j]=2;
                continue;
            }
            if(dp[i-1][j]>dp[i][j-1])
                par[i][j]=1;
            else par[i][j]=2;
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            if(a[i]==b[j] && dp[i-1][j-1]+1>dp[i][j])
                dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1),par[i][j]=-1;
        }
    }
   string ans="";
   int l=n-1,r=m-1;
   while(l>=0 && r>=0){
    if(par[l][r]==1)
        l--;
    else if(par[l][r]==2)
        r--;
    else if(par[l][r]==-1)
        ans+=a[l],l--,r--;
    else l--,r--;
   }
   reverse(ans.begin(),ans.end());
   cout<<ans<<endl;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai 3.14159265358979323846264338327950288;
#define keta(n) cout << fixed << setprecision((n));
using ll = long long;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  cout<<a[n-1]-a[0]<<endl;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define rem 1000000007

typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
#define v(x) vector<x>
#define pb(x) push_back(x)
#define ppb() pop_back()
#define mp(x,y) make_pair(x,y)
#define mii map<ll,ll>
#define umii unordered_map<ll,ll>
#define mxheap priority_queue<ll> // Max Heap
#define mnheap priority_queue<ll,vi,greater<ll> > // Min Heap
#define da(type,arr,size) type *arr = new type[n] // Dynamically allocated array


#define f(i,n) for(ll i=0;i<(n);i++)
#define fa(i,a,b) for(ll i=(a);i<(b);i++)
#define far(i,a,b) for(ll i=(a);i>(b);i--)
#define T ll t; cin>>t; while(t--)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define sz size()

#define setbits(x) __builtin_popcountll(x) // Total set bits in a number
#define zerobits(x) __builtin_ctzll(x) // This will tell me number of zeroes till first set bit
#define all(c) (c).begin(),(c).end()
#define setp(x,y) fixed<<setprecision(y)<<x
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define INF 2e18


ll mod(ll n) {
	return n > 0 ? n : -1 * n;
}
ld dist(ll x1, ll y1, ll x2, ll y2) {
	ld ans = round(pow(mod(x2 - x1), 2)) + round(pow(mod(y2 - y1), 2));
	ans = sqrt(ans);
	return ans;
}

ld dist(pii a, pii b) {
	ld ans = round(pow(mod(b.ff - a.ff), 2)) + round(pow(mod(b.ss - a.ss), 2));
	ans = sqrt(ans);
	return ans;
}
umii isPrime;
void SieveOfEratosthenes(ll n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));

	for (int p = 2; p * p <= n; p++)
	{
		if (prime[p] == true)
		{
			for (ll i = p * p; i <= n; i += p)
				prime[i] = false;
		}
	}
	for (ll p = 2; p <= n; p++)
		if (prime[p])
			isPrime[p] = 1;
}
int *dp;
ll maxCompositeSummands(ll n) {
	if (n == 2 || n == 1 || n == 3) {
		return INT_MIN;
	}
	if (dp[n] != -1) {
		return dp[n];
	}
	ll mexx = INT_MIN;
	for (ll i = 4; i <= n; i++) {
		if (!isPrime[i]) {
			mexx = max(mexx, maxCompositeSummands(n - i));
		}
	}
	return dp[n] = mexx == INT_MIN ? mexx : mexx + 1;
}
int main() {
	fast
	ll r;
	cin >> r;
	long double pi = 3.1415;
	long double ans = 2 * pi * r;
	cout << setp(ans, 6) << endl;

}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  vl count(3, 0);
  rep(i,sz(s)){
    if(s[i]=='a'){
      count[0]++;
    }
    else if(s[i]=='b'){
      count[1]++;
    }
    else{
      count[2]++;
    }
  }
  ll m = sz(s) / 3;
  bool OK = true;
  rep(i,3){
    if(count[i]!=m&&count[i]!=m+1){
      OK = false;
    }
  }
  if(OK){
    print("YES");
  }
  else{
    print("NO");
  }
}


Measured memory_bytes: 3788
#include "bits/stdc++.h"
using namespace std;

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

    int res = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'B') {
            res++;
        }
    }

    string T = string(S.size() - res, 'W') + string(res, 'B');
    long long ans = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'B') {
            ans += S.size() - res - i;
            res--;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 828
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
using namespace std;
typedef long long int llint;
int main() {
	int a, b;
	cin >> a >> b;
	if (a%b == 0) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256