akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>


using namespace std;


int main()
{
    //int A,B,C;
    
    vector<int> a(3);
    
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());//昇順ソート
    
    cout << a[0] * a[1] /2 << endl;
    
    
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int w, h;

    while (cin >> h >> w, h)
    {
        char a[h][w];
        rep(i, h)
        {
            rep(j, w)
            {
                cin >> a[i][j];
            }
        }
        int x = 0, y = 0;
        bool flag = 0;
        rep(i, 10001)
        {
            if (a[y][x] == '<')
                x--;
            else if (a[y][x] == '>')
                x++;
            else if (a[y][x] == '^')
                y--;
            else if (a[y][x] == 'v')
                y++;
            else
            {
                flag = 1;
                break;
            }
        }

        if (flag == 1)
            cout << x << " " << y << endl;
        else
            OP("LOOP");
    }
    return 0;
}


Measured memory_bytes: 2992
#include <bits/stdc++.h>
using namespace std;
const int N=22,Z=(1<<N)-1;
int f[1<<N],d[1<<N],n,ans;
set<int> s[1<<N];
void zeta(){
  for(int i=0; i<N; i++) {
    for(int j=0; j<(1<<N); j++) {
      if(j&1<<i) continue;
      f[j]&=f[j|(1<<i)];
      d[j]|=d[j|(1<<i)];
      for(set<int>::iterator it=s[j|(1<<i)].begin(); it!=s[j|(1<<i)].end()&&s[j].size()<3; it++) s[j].insert(*it);
    }
  }
}
int main() {
  fill(f,f+(1<<N),Z);
  cin >> n;
  for(int i=0; i<n; i++) {
    int x=0,y,k;
    cin >> k;
    for(int j=0; j<k; j++) {
      cin >> y;
      x|=1<<(y-1);
    }
    f[x]=d[x]=x;
    s[x].insert(i);
  }
  zeta();
  for(int i=0; i<(1<<N)-1; i++) {
    if(s[i].size()>=3) ans=max(ans,__builtin_popcount(f[i])*__builtin_popcount(d[i]));
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,i,temp,j,sum=0;
    cin>>n>>m;
    priority_queue<ll> q;
    for(i=0;i<n;i++)
    {
        cin>>temp;
        q.push(temp);
        sum+=temp;
    }
    for(i=0;i<m;i++)
    {
        temp=q.top();
        sum-=temp;
        q.pop();
        temp=temp/2;
        q.push(temp);
        sum+=temp;
    }
    cout<<sum;

     

  return 0;
    
}
    


Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstdlib>

using namespace std;

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

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    if (b - a >= 2 * k){
        for (int i = a; i < a + k; i++){
            cout << i << endl;
        }
        for (int i = b - k + 1; i <= b; i++){
            cout << i << endl;
        }
    }else{
        for (int i = a; i <= b; i++){
            cout << i << endl;
        }
        
    }
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c,d[110],i,j,x=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=0;i<a;i++){
		scanf("%d",&d[i]);
	}
	for(i=0;i<a;i++){
		for(j=0;j<b;j=j){
			x++;
			j=j+d[i];
		}
	}
	printf("%d",x+c);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";

signed main()
{
	//freopen("input.txt", "r", stdin);
	
	int n; cin>>n;
	int a[n+1];
	for(int i=1; i<=n;i++)
	{
		int x; cin>>x;
		a[x] = i;
	}
	for(int i=1; i<=n; i++) cout<<a[i]<<" ";
}

Measured memory_bytes: 1536
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

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

bool solve() {
  static char s[200100];
  if (scanf("%s", s) != 1) { return false; }

  ll ans = 0;
  int cntA = 0, cntBC = 0;
  for (int i = 0; s[i]; ) {
    if (s[i] == 'A') {
      cntA++;
      i++;
    } else if (s[i] == 'B' && s[i + 1] == 'C') {
      cntBC++;
      ans += cntA;
      i += 2;
    } else {
      cntA = 0;
      cntBC = 0;
      i++;
    }
  }
  printf("%lld\n", ans);

  return true;
}

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


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

using namespace std;

const int N = 1e2+7;

int n, res;
int h[N];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> h[i];
        if (h[i] < h[i-1]) res += h[i-1]-h[i];
    }
    res += h[n];
    cout << res << endl;
    return 0;
}

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

using namespace std;
int main() {
  int n;
  cin >> n;
  int result = 0;
  for (int i = 1; i <= n; i++) {
    if (i < 10) result++;
    if (99 < i && i < 1000) result++;
    if (9999 < i && i < 100000) result++;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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; }
const ll INF = 1e18;

int main(){
    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double s = (h/6+m/360)*acos(-1.0);
    double t = (m/30)*acos(-1.0);
    double p = abs(t-s);
    double y = pow(a,2)+pow(b,2)-2*a*b*cos(p);
    double ans = pow(y,0.5);
    printf("%.16lf\n",ans);

    return 0;
}

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

int l[] = {1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,1};

int main() {
    string s;
    while (cin >> s) {
        if (s == "#") break;
        int cnt = 0;
        for (int i=1; i<(int)s.size(); ++i) {
            cnt += l[s[i-1] - 'a'] ^ l[s[i] - 'a'];
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1188
N, K = map(int, input().split())
p = list(map(int, input().split()))
Expected_val = []
for val in p:
    sum_val = (val * (val + 1)) // 2
    Expected_val.append(sum_val / val)
# print(Expected_val)

left = 0
right = K

ans = sum(Expected_val[left:right])
tmp_ans = ans
# print(ans)
for i in range(N - K):
    tmp_ans = tmp_ans - Expected_val[left + i] + Expected_val[right + i]
    if tmp_ans > ans:
        ans = tmp_ans
print(ans)


Measured memory_bytes: 77448
n = int(input())
a = [list(map(int,input().split())) for _ in range(2)]
s = 0
for i in range(n):
    s += a[0][i]
    a[0][i] = s
a[1][0] += a[0][0]
for i in range(1, n):
    a[1][i] += max(a[0][i], a[1][i - 1])
print(a[1][-1])

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

using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>s;


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

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

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n;
int a[maxn];
vector < int > one , two;
s st;
map < int , int > mp;

int main(){
    migmig
    cin >> n;
    for(int i = 0 ; i < n ; i ++)
		cin >> a[i];
	for(int i = 0 ; i < n ; i ++)
		if(i%2)
			two.pb(a[i]);
		else
			one.pb(a[i]);
	sort(one.begin() , one.end());
    sort(two.begin() , two.end());
    sort(a , a + n);
    for(int i = 0 ; i < n ; i ++){
		mp[a[i]] = i%2;
	}
    int p1 = 0 , p2 = 0;
    for(int i = 0 ; i < n ; i ++)
		if(i%2)
			a[i] = two[p1++];
		else
			a[i] = one[p2++];
	
	int ans = 0;
	for(int i = 0 ; i < n ; i ++){
		if(i%2!=mp[a[i]])ans++;
	}
	
	cout << ans /2;
    return(0);
}

Measured memory_bytes: 5756
N, M = [int(i) for i in input().split()]
AA = []
for _ in range(N):
    AA.append(input())
BB = []
for _ in range(M):
    BB.append(input())

for i in range(N - M + 1):
    for j in range(N - M + 1):
        for k in range(M):
            for l in range(M):
                if AA[i + k][j + l] != BB[k][l]:
                    break
            else:
                continue
            break
        else:
            print("Yes")
            exit()

print("No")


Measured memory_bytes: 3064
n = int(input())
a = [0] * n
b = [0] * n
arr = [[0] * 2 for _ in range(n)]

for i in range(n):
    a[i], b[i] = map(int, input().split())
    arr[i][0] = b[i]
    arr[i][1] = a[i]

arr.sort()
time = 0
flag = True
for i in range(n):
    time += arr[i][1]
    if time > arr[i][0]:
        flag = False
if flag:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 41328
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <stack>
using namespace std;
#define ll int64_t
const long mod = 1e9 + 7;


const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main() {
  long n,m,l;
  string s;
  cin >> n ;
  cin >> s;

  // vector<long> a(n);
  // vector<long> b(n);
  // cin >> b;
  long count = 0;

  for (int i = 0; i < n; ++i){
    if (s[i] =='R')count++;
  }



  bool an = true;

  an = (count > n/2);


  // cout << ans <<endl;
  cout << (an?"Yes":"No");






}




















Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
    while(true){
        int M, T, P, R;
        cin >> M >> T >> P >> R;
 
        if(M==0 && T==0 && P==0 && R==0)
            break;
 
        int CP[50], TT[50], PT[50][10];
        for(int i=0; i<T; i++){
            CP[i] = TT[i] = 0;
            for(int j=0; j<P; j++)
                PT[i][j] = 0;
        }
 
        for(int i=0; i<R; i++){
            int m, t, p, j;
            cin >> m >> t >> p >> j;
 
            if(j==0){
                CP[t-1]++;
                TT[t-1] += (m+PT[t-1][p-1]);
            }
            else{
                PT[t-1][p-1] += 20;
            }
        }
 
        int tnow, tpre = -1;
        bool flg[50];
        for(int i=0; i<T; i++)
            flg[i] = false;
 
        for(int i=0; i<T; i++){
            tnow = -1;
            for(int j=0; j<T; j++){
                if(flg[j])
                    continue;
 
                if(tnow==-1){
                    tnow = j;
                }
                else{
                    if(CP[j]>CP[tnow] || (CP[j]==CP[tnow] && TT[j]<=TT[tnow])){
                        tnow = j;
                    }
                }
            }
 
            if(tpre!=-1){
                if(CP[tnow]==CP[tpre] && TT[tnow]==TT[tpre])
                    cout << '=';
                else
                    cout << ',';
            }
            cout << tnow+1;
 
            flg[tnow] = true;
            tpre = tnow;
        }
        cout << endl;
    }
 
    return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)



void solve() {
	string s;
	cin>>s;
	int n=s.length();
	if(s[n-1]=='s')
	s.push_back('e');
	
	s.push_back('s');
	cout<<s<<endl;
	return;

}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    solve();

    
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<math.h>

#define MAX 500005

int n;
int A[MAX];

int parent(int i){  return (int)floor(i/2); }
int left(int i){ return 2*i; }
int right(int i){ return 2*i+1; }

void maxHeapify(int i){
  int temp,l,r,largest;

  l = left(i);
  r = right(i);

  if( l <= n && A[l] > A[i] ) largest = l;
  else largest = i;
  if( r <= n && A[r] > A[largest] )largest = r;

  if( largest != i ){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
    maxHeapify(largest);
  }

}

int main(){
  int i;

  scanf("%d",&n);

  for( i = 1 ; i <= n ; i++ ){
    scanf("%d",&A[i]);
  }

  for( i = (int)floor(n/2) ; i > 0 ; i-- )  maxHeapify(i);

  for( i = 1 ; i <= n ; i++ )
    {
      printf(" %d",A[i]);
    }
  printf("\n");

  return 0;
}

Measured memory_bytes: 2548
#pragma GCC optimize("Ofast")

#include <algorithm>      //sort,二分探索,など
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <iterator>       //集合演算(積集合,和集合,差集合など)
#include <map>            //map(辞書)
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;

void insertion_sort(int A[], int N) {
	for (int i = 1; i <= N; ++i) {
        for(int k = 0; k < N; ++k){
            cout << A[k];
            if(k != N-1) cout << " ";
        }
        cout << "\n";
        if(i == N) break;
		int v = A[i];
        int j = i - 1;
		for (; j >= 0 && A[j] > v; --j) {
			A[j + 1] = A[j];
		}
        A[j + 1] = v;
	}
}

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

	int A[100] = {};
	int N;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
    insertion_sort(A, N);
	return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int main()
{

  CIN(N);
  printf("AB%c\n", (N / 1000) + 67);

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    ans += a%2;
    ans += b%2;
    ans += c%2;
    if(ans >= 2){
        cout << "Hom" << endl;
    }else{
        cout << "Tem" << endl;
    }
}



Measured memory_bytes: 3112
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9+7;
const double EPS = 1e-11;
const double PI = 2 * acos(0.0);
using ll = long long;
using ull =  unsigned long long;

#define input freopen("input.txt", "r", stdin)
#define output freopen("output.txt", "w", stdout)
#define fast_io ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#define pf printf
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define sll(x,y) scanf("%lld %lld",&x,&y)

#define pii pair<int,int>
#define nl '\n'
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define uniq(a) a.erase(unique(a.begin(), a.end()), a.end())
#define out(x) cout <<"#x = "<<x<<endl
#define outt(x,y) cout <<"# "<<x<<" "<<y<<endl
#define mem(array,value) memset(array,value,sizeof(array))

const int MX = 3e3+2;
double coin[MX];
double dp[MX][MX];
int n;
double solve(int i,int head)
{
	if(i==n){
		if(head>n/2)return 1;
		else return 0;
	}
	if(dp[i][head]!=-1.0)return dp[i][head];
	double a = (coin[i]*solve(i+1,head+1))+((1-coin[i])*solve(i+1,head));
	return dp[i][head]=a;
}
int main()
{
	fast_io
	
	for(int i=0;i<MX;i++){
		for(int j=0;j<MX;j++){
			dp[i][j]=-1.0;
		}
	}
	//int n;
	cin >>n;
	for(int i=0;i<n;i++){
		cin >>coin[i];
	}
	double ans = solve(0,0);
	pf("%.10lf\n",ans);
}


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

mod = 10 ** 9 + 7
ans = 0

A_sum = [A[0] for i in range(N)]
for i in range(1, N):
    A_sum[i] = A_sum[i-1] + A[i]

for i in range(1, N):
    ans += A[i] * A_sum[i-1]
    ans %= mod

print(ans)


Measured memory_bytes: 102244
fun main(args: Array<String>) {
  val (N, M) = readInts()
  val HN = readInts()
  val AB = (1..M).map { readInts() }

  val badSet = mutableSetOf<Int>()

  AB.forEach {
    val a = it[0] - 1
    val b = it[1] - 1
    val ha = HN[a]
    val hb = HN[b]
    if (ha > hb) {
      badSet.add(b)
    }
    if (hb > ha) {
      badSet.add(a)
    }
    if (hb == ha) {
      badSet.add(a)
      badSet.add(b)
    }
  }

  println(N - badSet.size)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


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

int main()
{
    string s;
    cin >> s;
    
    int rs = 0;
    if(s[0] == 'R'){
        rs++;
        if(s[1] == 'R') {
            rs++;
            if(s[2] == 'R') rs++;
        }
    }
    else if(s[1] == 'R'){
        rs++;
        if(s[2] == 'R') rs++;
    }
    else if(s[2] == 'R') rs = 1;
    
    cout << rs << '\n';
    
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std ;
int main()
{
	int n;
	cin>>n;
	vector<pair<int ,int> > a;
	for(int i=0;i<n;i++){
		int v;
		cin>>v;
		a.push_back({v,0});
	}int ans=0;
	for(auto i : a){
		int c;
		cin>>c;
		i.second=c;
		if(i.first>i.second){
			ans+=i.first-i.second;
		}
	}
	cout<<ans<<endl;
} 

Measured memory_bytes: 256
import bisect
n=input()
a=list(map(int,input().split()))
if n=="2":print(abs(a[0]-a[1]))
else:
    s=[]
    x=0
    for i in a[:-1]:
        x+=i
        s.append(x)
    s.sort()
    s.append(float("inf"))
    y=bisect.bisect_left(s,sum(a)/2)
    print(min(abs(sum(a)-2*s[y]),abs(sum(a)-2*s[y-1])))

Measured memory_bytes: 23796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] a = in.readLine().split(" ");
		short A = Short.valueOf(a[0]); short B = Short.valueOf(a[1]);
		short total = 0;
		for(int i = 0; i < 2; i++) {
			if(A > B) {
				total += A;
				A--;
			}else {
				total += B;
				B--;
			}
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(12);
  int n;
  cin>>n;
  int a[1000];
  rep(i,n) cin>>a[i];
  sort(a,a+n);
  double ans=0;
  rep(i,n-2){
    ans=max((double)(a[n-1]+a[n-2])/(double)(a[i+1]-a[i]),ans);
  }
  ans=max((double)(a[n-3]+a[n-4])/(double)(a[n-1]-a[n-2]),ans);
  ans=max((double)(a[n-1]+a[n-4])/(double)(a[n-2]-a[n-3]),ans);
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 3296
import sys 
n, A, B, C = map(int, raw_input().split())
arr = []
for i in range(n):
    arr.append(int(raw_input()))
A, B, C = sorted([A, B, C], reverse=True)
def dfs(i, a, b, c, mp):
    if i == n:
        if a > 0 and b > 0 and c > 0:
            return abs(A-a) + abs(B-b) + abs(C-c) + mp - 30
        else:
            return sys.maxint
    ret0 = dfs(i+1, a, b, c, mp)
    ret1 = dfs(i+1, a+arr[i], b, c, mp+10)
    ret2 = dfs(i+1, a, b+arr[i], c, mp+10)
    ret3 = dfs(i+1, a, b, c+arr[i], mp+10)
    return min(ret0, ret1, ret2, ret3)
print dfs(0, 0, 0, 0, 0)

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

#ifdef _DEBUG
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout if (false) cout
#define debug() if (false)
#define dvout(v) if(false) vout(v)
#endif

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vec(v, n) vector<int> v(n, 0);
#define vecll(v, n) vector<ll> v(n, 0);
#define vecvec(v,n,m) vector<vector<int>> v(n, vector<int>(m));
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力

#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
#define next asdnext
#define prev asdprev
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"

//	LLONG_MAX 9.2*1e18	9223372036854775807LL = (2^63)-1
//	INT_MAX 2.1*1e9 2147483647 = (2^31)-1
//	O(1e8) 1.2sec

void Main()
{
	ll _max1=LLONG_MIN,_min1=LLONG_MAX;
	ll _max2=LLONG_MIN,_min2=LLONG_MAX;
	int N;
	cin>>N;
	ll x,y;
	rep(i,N){
		cin>>x>>y;
		_max1=max(x+y,_max1);
		_min1=min(x+y,_min1);
		_max2=max(y-x,_max2);
		_min2=min(y-x,_min2);
	}

	ll ans=max(_max1-_min1, _max2-_min2);

	cout<<ans<<_n;
}


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


Measured memory_bytes: 3600
# B - Frog2
import numpy as np

N, K = list(map(int, input().split()))
h = np.array(list(map(int, input().split()))+[0]*K)

dp = np.array([10**9]*(N+K))
dp[0] = 0

for i in range(N):
    dp[i+1:i+K+1] = np.minimum(dp[i+1:i+K+1], dp[i]+abs(h[i+1:i+K+1]-h[i]))
print(dp[N-1])

Measured memory_bytes: 22796
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    for(int i=0; i<M; i++){
        cin >> B.at(i);
    }
    vector<vector<int>> data(N,vector<int>(M));
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            cin >> data.at(i).at(j);
        }
    }

    int count=0;
    for(int i=0; i<N; i++){
        int sum=0;
        for(int j=0; j<M; j++){
            sum += data.at(i).at(j) * B.at(j);
        }
        sum += C;
        if(sum >0) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
A,B,C = map(int,input().split())

cnt = 0
A,B,C = sorted([A,B,C])
i = C - B
cnt += i
B += i
A += i

j = C - A
if j % 2 == 0:
  cnt += j // 2
else:
  cnt += j // 2 + 2
  
print(cnt)

Measured memory_bytes: 9096
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<cstring>
#include<bits/stdc++.h>
using namespace std; 
  
#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;

ll a[105];
int n;

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

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

using namespace std;

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

   int preva = 0;
   int i = 1;
   set<int> values;
   int ans = 0;
   while(true)
   {
	   int cura;
	   if (i == 1)
	   {
		   cura = preva = s;
		   values.insert(cura);
	   }
	   else
	   {
		   cura = (preva % 2 == 0) ? preva/2 : (3 * preva +  1);
		   auto ret = values.insert(cura);
		   if (ret.second == false)
		   {
			   ans = i;
			   break;
		   }
	   }

	   preva = cura;
	   i++;
   }

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




Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)
data = []
eaten_kind = Hash.new(false)
N.times do
  t, d = gets.split.map(&:to_i)
  data << { t: t, d: d }
end

data.sort_by! { |d| d[:d] }.reverse!

dup = []

lp = 0
data[0...K].each do |d|
  lp += d[:d]
  dup << d if eaten_kind[d[:t]]
  eaten_kind[d[:t]] = true
end

dup.sort_by! do |d|
  d[:d]
end

point = eaten_kind.size ** 2 + lp

data[K..-1].each do |d|
  next if eaten_kind[d[:t]]

  os = dup.shift
  break unless os

  lp = lp - os[:d] + d[:d]

  eaten_kind[d[:t]] = true

  point = [point, eaten_kind.size ** 2 + lp].max
end

p point


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

int main(void){
    long long int n,m;
    double a,k;
    scanf("%lld",&n);
    m=n%2;
    if (m==0) {
        printf("0.50000000000");
    }else{
        k=n+1;
        k=k/2;
        a=k/n;
        printf("%lf",a);
    }
    
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
using namespace std;
int n, m, *x, a, b;
unordered_map<int, vector<int> > mp;
int go(int i)
{
    if(mp.find(i) == mp.end())
        return 0;
    if(~x[i - 1])
        return x[i - 1];
    for(int j = 0; j < mp[i].size(); j++)
        x[i - 1] = max(x[i - 1], go(mp[i][j]) + 1);
    return x[i - 1];
}
int main()
{
    cin.tie(NULL); cout.tie(NULL);  ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    cin >> n >> m;
    x = new int[n];
    memset(x, -1, 4 * n);
    for(int i = 0; i < m; i++)
    {
        cin >> a >> b;
        mp[a].push_back(b);
    }
    for(unordered_map<int, vector<int> >::iterator it = mp.begin(); it != mp.end(); it++)
        x[it->first - 1] = go(it->first);
    int ans = 0;
    for(int i = 0; i < n; i++)
        ans = max(ans, max(x[i], 0));
    cout << ans;
}

Measured memory_bytes: 11172
chomp($n=<>);
@a=split//,$n;
$len=@a;
$cnt01=0;
for($i=0;$i<$len;$i++){
    if($i%2==0){
        if($a[$i] != 0){
            $cnt01++;
        }
    }else{
        if($a[$i] != 1){
            $cnt01++;
        }
    }
}

$cnt10=0;
for($i=0;$i<$len;$i++){
    if($i%2==0){
        if($a[$i] != 1){
            $cnt10++;
        }
    }else{
        if($a[$i] != 0){
            $cnt10++;
        }
    }
}

if($cnt01 <= $cnt10){
    $val=$cnt01;
}else{
    $val=$cnt10;
}
print $val;

Measured memory_bytes: 10880
n=int(input())
s=sorted([int(input()) for i in range(n)])
S=sum(s)
if S%10!=0:
    print(S)
else:
    flag=False
    for i in s:
        tmp=S-i
        if tmp%10!=0:
            flag=True
            break
    print(tmp if flag else 0)

Measured memory_bytes: 3064
module Main where
    import Debug.Trace
    import Data.List
    import qualified Data.Sequence as S
    import qualified Data.ByteString.Char8 as B
    import Data.Int
    import Data.Char
    import Data.Array
    import Data.Maybe
    import qualified Data.Map as M
    import Data.Ord
    import Data.Functor
    import Control.Applicative
    import Control.Monad
    
    solve ::[Int] -> [Int] -> [Bool]
    solve a = iter where
        iter [] = []
        iter (m:ms) = (sol a m):iter ms where
            sol [] m = False
            sol (a:as) m
                | m > a  = sol as m || sol as (m-a)
                | m < a  = False
                | m == a = True

    readIntLn:: IO Int
    readIntLn = (fst . fromJust . B.readInt) <$> B.getLine

    readIntList:: IO [Int]
    readIntList = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

    main :: IO() 
    main = do
        n <- readIntLn
        a <- readIntList
        q <- readIntLn
        m <- readIntList
        mapM_ (putStrLn . (\t-> if t then "yes" else "no")) $ solve (sort a) m



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

int main()
{
    string s,t;
    cin>>s;
    cin>>t;
    int ans=t.length();
    for(int i=0;i<=s.length()-t.length();i++)
    {
        int cnt=0;
        for(int j=0;j<t.length();j++)
        {
            if(s[i+j]!=t[j])
            cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
      std::cin.tie(NULL);
      long long a;
      string b;
      std::cin >>a>>b;
      long long ans = (b[0]-'0')*100 + (b[2]-'0')*10 + (b[3]-'0');
      std::cout << ((a*ans)/100) << '\n';
return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void solve()
{
   int n;int k;cin>>n>>k;
   vector<int>arr(n);
   for(int i=0;i<n;i++)
   cin>>arr[i];
   
  for(int i=0;i<n-k;i++)
  {
      if(arr[i+k]>arr[i])
      cout<<"Yes"<<endl;
      else
      cout<<"No"<<endl;
  }
}

int32_t main()
{
    rapido;
    int t;
    //cin>>t;
    t=1;
    
   while(t--)
   solve();
}





Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll dp[11111][2][100];
string s;
int d;


ll rec(int idx,int f,int x){
    if(idx == -1)return x == 0;
    if(dp[idx][f][x]!=-1)return dp[idx][f][x];
    ll ret=0;
    if(f){
        rep(i, 10){
            ret+=rec(idx - 1, f, (x - i + d) % d);
        }
    }
    else {
        int m = s[idx] - '0';
        rep(i, m){
            ret += rec(idx - 1, 1, (x - i + d) % d);
        }
        ret += rec(idx - 1, 0, (x - m + d) % d);
    }
    return dp[idx][f][x]=ret % mod;
}

int main(){
    cin >> s;
    cin >> d;
	int n = s.size();
	reverse(s.begin(),s.end());
    memset(dp,-1,sizeof(dp));
    cout << (rec(n - 1, 0, 0) + mod - 1) % mod <<endl;
    return 0;
}


Measured memory_bytes: 18432
#include<stdio.h>
int main(){
  char i,r=0,s[100],c[]={"AKIHABARA"};
  scanf("%s",s);
  for(i=0;s[i];i++){//printf("%c %c\n",s[i],c[r]);
    if(s[i]==c[r]){
      r++;
      continue;
    }
    if(c[r]=='A'){
      r++;
      i--;
    }
    else break;
  }
  if(c[r]=='A')r++;
  printf("%s\n",s[i]+c[r]?"NO":"YES");
  return 0;
}


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

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

const int M = 1000000;
const int P = 998244353;

int fact[M];

int powmod(int a, int b, int n){
  int x = 1, y = a; 
  while (b > 0) {
      if (b % 2 == 1) {
          x = x * y % n;
      }
      y = y * y % n;
      b /= 2;
  }
  return x % n;
}

int inv(int x) {
  return powmod(x, P-2, P);
}

int comb(int n, int k) {
  return fact[n] * inv(fact[k]) % P * inv(fact[n-k]) % P;
}

signed main() {
  ios::sync_with_stdio(false);
  
  fact[0] = 1;
  FOR(i, 1, M) {
    fact[i] = fact[i-1] * i % P;
  }

  int N, A, B, K;
  cin >> N >> A >> B >> K;

  int result = 0;
  REP(x, N+1) {
    if((K - A * x) % B != 0) {
      continue;
    }
    int y = (K - A * x) / B;
    if(y < 0 || N < y) {
      continue;
    }
    result = (result + comb(N, x) * comb(N, y) % P) % P;
  }
  cout << result << endl;
}


Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stdio.h>
typedef long long ll;
const int INF = 1e9+1;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;

int main() {
	string t;
	char s[1000000];
	vector<int> a(27);
	cin >> s;
	t = s;
	for (int i = 0; i <t.size() ; i++) {
		a.at(s[i] - 'a')++;
	}



	for (int i = 0; i < 26; i++) {
		if (a.at(i) == 0) {
			cout << (char)('a' + i )<< endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;


}

Measured memory_bytes: 3824
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#define  endl "\n"
using namespace std;

void FastInput() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
void OutputFile()
{
    freopen("output.txt","w",stdout);
}


string bigIntegr(string x,string y)
{
    string ans="";
    reverse(x.begin(),x.end());
    reverse(y.begin(),y.end());
    int result=0,carry=0,temp=0;

    for(int i=0;i<x.length();i++)
    {
        temp=x[i]-'0'+y[i]-'0';
        temp+=carry;
        result=temp%10;
        carry=temp/10;
        ans.push_back(result+'0');

    }
    if(carry>0)
        ans.push_back(carry+'0');
    reverse(ans.begin(),ans.end());
    return ans;
}


int main()
{
   FastInput();

  long long x,b=100;
  cin>>x;

  int i=1;
  while(b<=x)
  {
      b=b+(b/100);
     // cout<<b<<endl;
      if(b>=x)
      {
          cout<<i;
          break;
      }
      i++;

  }

    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<map>
#include<list>
#include<set>
#include<algorithm>
#include<limits.h>
#include<vector>
#define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();p++)
using namespace std;
#define MAX 5000000

bool notp[MAX];

int main()
{
    notp[0]=true;
    notp[1]=true;
    for(unsigned int i = 2;i<MAX;i++)
        if(!notp[i]) for(unsigned int j=2*i;j<MAX;j+=i)
        {
            notp[j]=true;
        }
    vector<int> primes;
    for(int i =0;i<MAX;i++)
    {
        if(!notp[i]) primes.push_back(i);
        if(primes.size()>100100)break;
    }
    //for(int l=0;l<25;l++)cout << primes[l] << endl;
    int n,p;
    cin >> n >> p;
    int k;

    while(n!=-1 && p!=-1)
    {
        list<int> mnps;
        for(k=0;;k++) 
        {
            if (primes[k] > n ) break;
        }
        for(int i =0;i<100;i++)for(int j=i;j<100;j++)
            mnps.push_back(primes[i+k]+primes[j+k]);

        mnps.sort();
        list<int>::iterator mit = mnps.begin();
        for(int i =0;i<p-1;i++)++mit;
        cout << *mit << endl;
        cin >> n >> p;
    }
    return 0;
}

Measured memory_bytes: 6312
S=list(map(int,input()))
ONE=0
ZERO=0
if S[0]==0:
  for i in range(1,len(S)):
    if i%2!=0:
      if S[i]==0:
        S[i]=1
        ZERO += 1
    else:
      if S[i]==1:
        S[i]=0
        ZERO += 1
else:
  for i in range(1,len(S)):
    if i%2!=0:
      if S[i]==1:
        S[i]=0
        ONE += 1
    else:
      if S[i]==0:
        S[i]=1
        ONE += 1
print(ONE+ZERO)

Measured memory_bytes: 3956
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#define PIE 3.14159265358979
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;


int main(){
    int N;
    cin>>N;
    vector<ll> A[2];
    ll sum[2]={0,0};
    vector<pair<ll,int> >C;
    A[0].resize(N);
    A[1].resize(N);
    C.resize(N);
    rep(i,N){
        cin>>A[0][i]>>A[1][i];
        C[i].first = A[0][i]+A[1][i];
        C[i].second = i;
    }
    sort(C.begin(),C.end(),greater<pair<ll,int> >());
    rep(i,N){
        int now = i%2;
        int index = C[i].second;
        sum[now]+=A[now][index];
    }
    cout<<sum[0]-sum[1]<<endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}


//cout<<""<<endl;
int main(){
  ll A,B;cin>>A>>B;
  cout<<max(max(A+B,A-B),A*B)<<endl;
}





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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll BallBoxCombination8(ll n,ll k){
	return (n>k) ? 0 : 1;
}

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

	ll N=in<ll>(),K=in<ll>();
	
	ll ans = BallBoxCombination8(N,K);
	out(ans);
	return 0;
}



Measured memory_bytes: 3132
#include <cstdio>
#include <algorithm>
#include <cstring>
#define int long long
using namespace std;
int mat[510][510],mat2[510][510],ans=0;
int h,w;
signed main(){
  scanf("%lld %lld",&h,&w);
  for(int i=1;i<=h;i++)
    for(int j=1;j<=w;j++)
      scanf("%lld",&mat[i][j]),mat2[i][j]=mat[i][j];
  for(int i=1;i<=h;i++)
    for(int j=1;j<=w-1;j++){
      if(mat2[i][j]%2==0)
        continue;
      else{
        ans++;
        mat2[i][j+1]++;
        mat2[i][j]--;
      }
      //ans+=mat2[i][j],mat2[i][j+1]+=mat2[i][j],mat2[i][j]=0;
    }
  for(int i=1;i<=h-1;i++){
    //ans+=mat2[i][w],mat2[i+1][w]+=mat2[i][w],mat2[i][w]=0;
    if(mat2[i][w]%2==0)
      continue;
    else{
      ans++;
      mat2[i+1][w]++;
      mat2[i][w]--;
    }
  }
  printf("%lld\n",ans);
  for(int j=1;j<=h;j++)
    for(int i=1;i<=w-1;i++){
      if(mat[j][i]%2==0)
        continue;
      else{
        printf("%lld %lld %lld %lld\n",j,i,j,i+1);
        mat[j][i+1]++;
        mat[j][i]--;
      }
//      for(int k=1;k<=mat[j][i];k++){
//        printf("%d %d %d %d\n",j,i,j,i+1);
//        mat[j][i+1]+=1;
//      }
//      mat[j][i]=0;
  }
  for(int i=1;i<=h-1;i++){
    if(mat[i][w]%2==0)
      continue;
    else{
      mat[i+1][w]++;
      mat[i][w]--;
      printf("%lld %lld %lld %lld\n",i,w,i+1,w);
    }
  }
//    for(int k=1;k<=mat[i][w];k++)
//      printf("%d %d %d %d\n",i,w,i+1,w),mat[i+1][w]++;
  return 0;
}


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

int main() {
	int a, b, c;
	int i=0;
	cin >> a >> b >> c;
	for(int x=a; x<=b; x++){
		if (c%x == 0){
			i++;
		}
	}
	cout << i << endl;
		
	return 0;
}


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

#define ll long long
#define ld long double

ll ceil(ll a, ll b) {
    if(a % b) return a/b + 1LL;
    return a/b;
}

void solve() {
    ll sum = 0;
    string s;
    cin >> s;
    for(char it:s) sum += (it - '0');
    
    // cout << sum << "\n";
    (sum % 9) ? cout << "No\n" : cout << "Yes\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    // int t;
    // cin >> t;
    // while(t--)
        solve();
    
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>

int main() {
	int *a = malloc(sizeof(int)), *b = malloc(sizeof(int));
	scanf("%d %d", &a, &b);
	if (a == b)
		printf("Draw");
	else if ((a > b && b != 1) || (a == 1))
		printf("Alice");
	else
		printf("Bob");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    string o,e;
    cin >> o >> e;
    int len_o = o.length(), len_e = e.length();
    int len;
    bool f;
    if(len_o== len_e){
        for(int i = 0; i < len_e; i++){
            cout << o[i] << e[i];
        }
        cout << endl;
        return 0;
    }else{
        len = min(len_e,len_o);
        for(int i = 0; i < len; i++){
            cout << o[i] << e[i];
        }
        if(len_o < len_e) cout << e[len] << endl;
        else cout << o[len] << endl;
        return 0;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long int ll;
#define MOD (1000000007);
#define INF (2e9)

void ans(int tt[],int n){
	for(int i=0;i<n;i++){
		if(tt[i]==1){
			cout<<"S";
		}else{
			cout<<"W";
		}
	}
}

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

	char *s=new char[n+1];
	cin>>s;
	int tt[100005],tf[100005],ft[100005],ff[100005];
	tt[0]=1;
	tt[1]=1;
	tf[0]=1;
	tf[1]=-1;
	ft[0]=-1;
	ft[1]=1;
	ff[0]=-1;
	ff[1]=-1;
	for(int i=1;i<n+1;i++){
		if(s[i%n]=='o'){
			tt[i+1]=tt[i-1]*tt[i];
			tf[i+1]=tf[i-1]*tf[i];
			ft[i+1]=ft[i-1]*ft[i];
			ff[i+1]=ff[i-1]*ff[i];
		}else{
			tt[i+1]=tt[i-1]*tt[i]*-1;
			tf[i+1]=tf[i-1]*tf[i]*-1;
			ft[i+1]=ft[i-1]*ft[i]*-1;
			ff[i+1]=ff[i-1]*ff[i]*-1;
		}
	}
	if(tt[0]==tt[n]&&tt[1]==tt[n+1]){
		ans(tt,n);
	}else if(tf[0]==tf[n]&&tf[1]==tf[n+1]){
		ans(tf,n);
	}else if(ft[0]==ft[n]&&ft[1]==ft[n+1]){
		ans(ft,n);
	}else if(ff[0]==ff[n]&&ff[1]==ff[n+1]){
		ans(ff,n);
	}else{
		cout<<-1;
	}
	cout<<endl;
	delete(s);
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;

  vector<int> a(M);
  for (int i = 0; i < M; ++i) cin >> a.at(i);
  sort(a.begin(), a.end());

  vector<int> b(M - 1);
  for (int i = 0; i < M - 1; ++i) {
    b.at(i) = a.at(i + 1) - a.at(i);
  }
  sort(b.begin(), b.end());

  for (int i = 0; i < N - 1; ++i) b.pop_back();

  int ans = 0;
  for (int i = 0; i < M - N; ++i) ans += b.at(i);
  cout << ans << endl;
}

Measured memory_bytes: 1024
import std.stdio,
			 std.array,
			 std.conv,
			 std.string,
			 std.algorithm;

void main() {
	int bars[];
	int w = readln.chomp.to!int;
	bars = new int[w+1];
	foreach (int i; 1..(w+1)) {
		bars[i] = i;
	}
	int n = readln.chomp.to!int;
	foreach (int i; 0..n) {
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(bars[a], bars[b]);
	}
	foreach (int i; 1..w+1) {
		writeln(bars[i]);
	}
}

Measured memory_bytes: 1048
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950


bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}

//////////////////////////////////////////////////// Lets Do It ////////////////////////////////////////////////////////
bool cmp(const pair<int,int> &a,  const pair<int,int> &b) 
{ 
    if(a.ff == b.ff)
        return a.ss>b.ss;
    return (a.ff < b.ff); 
} 
void solve(){

    ll n,k;
    cin>>n>>k;
    vec a;
    inpvec(a,n);
    sort(all(a));


    ll asu =0;
    loop(i,0,k){
        asu +=a[i];
    }
    cout<<asu;

    return;    
} 
 
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
} 

Measured memory_bytes: 3676
import math
import sys

def f(b,n):
    if n<b:
        return n 
    else:
        return f(b,n//b)+n%b

def make_divisors(n):
    lsls=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            lsls.append(n//i)
    lsls.sort()
    return lsls

n=int(input())
s=int(input())
if n==s:
    print(n+1)
    sys.exit()
if n<s:
    print(-1)
    sys.exit()

for i in range(2,int(math.sqrt(n))+1):
    if f(i,n)==s:
        print(i)
        break
else:
    lst=make_divisors(n-s)
    for u in lst:
        if f(u+1,n)==s:
            print(u+1)
            break
    else:
        print(-1)

Measured memory_bytes: 41968