akhauriyash/Code-Regression huggingface dataset:
// g++ -std=c++14

/*

Today might be the chance to grasp the chance to let your talent bloom.
May be tomorrow, the day after, or next year...
May be even when you are 30. I'm not sure if physique has anything to do with it
but if you think that it will never come, it probably never will.

- Tooru Oikawa.

*/


#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define inf 1000000000000000001
#define pii pair<int, int>
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

#define int ll
// int g[405][405];
int fact[100000 + 10];
int ifact[100000 + 10];
const int mod = 1000000007;
int pw(int a,int b) {
    if(b == 0) return 1;
    if(b&1) return (a*pw(a,b-1))%mod;
    int x = pw(a,b/2);
    return (x*x)%mod;
}
int C(int n, int k) {
    int ans = (fact[n]*ifact[k])%mod*ifact[n-k]%mod;
    return ans;
}
void solve() {
    map<int,int> ma;
    for(int i = 0 ; i < 100000 + 5 ; i++) {
        if(i == 0) fact[i] = 1;
        else fact[i] = fact[i-1] * i % mod;
        ifact[i] = pw(fact[i], mod-2);
    }
    int n;
    cin >> n;
    int k;
    cin >> k;
    int arr[n];
    for(int i = 0 ; i < n ; i++) {
        cin >> arr[i];
    }
    int ans = 0;
    sort(arr,arr+n);
    for(int i = 0 ; i < n ; i++) {
        if(i >= k-1) {
            // tr(arr[i], "max in" , C(i+1, k-1));
            ans += (arr[i] * (C(i, k-1)))%mod;
            ans %= mod;
        }
        int left = n - i;
        if(left >= k) {
            // tr(arr[i], "min in" , C(left, k - 1));

            ans -= ((arr[i] * (C(left - 1, k-1))) % mod);
            ans += mod;
            ans %= mod;
        }
    }
    cout << ans << endl;

    


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

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, c = 0;
	cin >> N;
	long long num[100];
	for (int i = 0; i < N; ++i){
		cin >> num[i];
	}
	for(int i = 0; i < N-2; ++i){
		for(int j = i + 1; j < N-1; ++j){
			if(num[j] != num[i]){
				for(int k = j + 1; k < N; ++k){
					if(num[k] != num[j] && num[k] != num[i]){
						if((num[i] + num[j] > num[k]) && (num[i] + num[k] > num[j]) && (num[k] + num[j] > num[i])){
			                   c++;
						}
					}
				}
			}
		}
	}
	cout << c;
}


Measured memory_bytes: 3588
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}


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



Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int n;

int main()
{
	cin >> n;
	if (n / 10 == 9 || n % 10 == 9)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

using namespace std;

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

  cin >> s;
  int a = 1000000, z = 0, ans = 0;
  bool active = false;

  for (int i = 0; i < s.size(); i++)
  {
    if (s[i] == 'A')
    {
      if (a > i)
      {
        a = i;
      }
    }
    if (s[i] == 'Z')
    {
      if (z < i)
      {
        z = i;
      }
    }
  }

  cout << z - a + 1 << "\n";
}

Measured memory_bytes: 720
def resolve():
    MOD = 998244353
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    dp = [[0] * (S + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i in range(N):
        for j in range(S + 1):
            dp[i + 1][j] += 2 * dp[i][j]
            dp[i + 1][j] %= MOD
            if j + A[i] <= S:
                dp[i + 1][j + A[i]] += dp[i][j]
                dp[i + 1][j + A[i]] %= MOD
    print(dp[N][S])


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 132568
#include<bits/stdc++.h>
/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;

// #define  part ..


// end of #define 

// define globals ...


//write function from here ...
const int MAX = 1000001; 
  
// structure to store queries 
struct Query 
{ 
    int l, r, idx; 
}; 
  
// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 
  
// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 
  
// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 
  
void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
    // initialising bit array 
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
  
    // holds the rightmost index of any number 
    // as numbers of a[i] are less than or equal to 10^6 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
  
    // answer for each query 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        // If last visit is not -1 update -1 at the 
        // idx equal to last_visit[arr[i]] 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
  
        // Setting last_visit[arr[i]] as i and updating 
        // the bit array accordingly 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
  
        // If i is equal to r of any query  store answer 
        // for that query in ans[] 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                     query(queries[query_counter].r + 1, bit, n)- 
                     query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 
  
    // print answer for each query 
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 
  
// driver code 
int Main() 
{ 

    int n,q;
    cin>>n>>q;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    Query qry[q];
    for(int i=0;i<q;i++)
    {
		int ll,rr;
		
		cin>>ll>>rr;
		ll--,rr--;
		qry[i].l=ll;
		qry[i].r = rr;
		qry[i].idx= i;
		
	}
	sort(qry,qry+q,cmp);
	answeringQueries(a,n,qry,q);
	
    
    
    
    
    return 0;
    
} 














int main(){
	
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    int n;
    ll x;
    cin >> n >> x;
    vll a(n);
    forn(i, n) cin >> a[i];
    ll ans = 1e18;
    vll f(n);
    forn(i, n) f[i] = a[i];
    forn(j, n + 1){
        ll sum = 0;
        forn(i, n){
            f[i] = min(f[i], a[(i + n - j) % n]);
            sum += f[i];
        }
        ans = min(ans, sum + j * x);
    }
    cout << ans << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s,t;
    cin>>n;
    cin>>s>>t;
    for(int i=0;i<n;i++)
    {
        cout<<s[i]<<t[i];
    }
    cout<<endl;
    return 0;
}


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

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;


void solve(){
  int k;
  cin >> k;
  int n = 1;
  while(360 * n % k !=0){
    n++;
  }
  cout << 360 * n / k <<endl;  
}  
signed main(){
  fast;
  int t, i = 1;;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
    i++;
  }
}
/*
░░░░░░░░░░▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░██▀█▄░░▄██▀░░░░▄██▄░░░░░░░░░░░
░░░░░░░░██▄▄▄████████▄▄█▀░▀█░░░░░░░░░░░
░░░░░░░▄██████████████████▄█░░░░░░░░░░░
░░░░░░▄██████████████████████░░░░░░░░░░
░░░░░▄████████▀░▀█████████████░░░░░░░░░
░░░░░███████▀░░░░▀████████████▄░░░░░░░░
░░░░██████▀░░░░░░░░▀███████████▄▄▄▀▀▄░░
░▄▀▀████▀░░░▄▄░░░░░░░░░████████░░░░░█░░
█░░░▀█▀█░░░░▀▀░░░░░░██░░███░██▀░░░░▄▀░░
█░░░░▀██▄░░░▄░░░▀░░░▄░░░███░██▄▄▄▀▀░░░░
░▀▄▄▄▄███▄░░▀▄▄▄▀▄▄▄▀░░░███░█░░░░░░░░░░
░░░░░░████▄░░░░░░░░░░░░▄██░█░░░░░░░░▄▀▀
░░░░░░███▀▀█▀▄▄▄▄▄▄▄▄▄▀█████░░░░░░▄▀░░▄
░░░░░░█▀░░█░▀▄▄▄▄▄▄▄▄▄▀░███░█▀▀▀▄▀░░▄▀░
░░░░░░░░░▄▀░░░░░░░░░░░░░▀█▀░░█░░░░█▀░░░
░░░░░░░░░█░░░█░░░░░░░░░░░░░░░█░░░░░█░░░
░░░░░░░░░█▄▄█░▀▄░░█▄░░░░░░░░█░░▄█░░█░░░
░░░░░░░░░▀▄▄▀░░█▀▀█░▀▀▀▀█▀▀█▀▀▀▀█░█░░░░
hOi!!
I'm TemMie
*/



Measured memory_bytes: 3612
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<stdio.h>
#include<iomanip>
#include<algorithm>
#include<map>
#include<math.h>
#include<string.h>
#define ll long long
#define eb emplace_back
#define pb push_back
#define ins insert 
#define mp make_pair
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define inf 1000000000000000000
using namespace std;
const ll M =1e9+7;
void solve(){
    ll n;
    cin>>n;
    ll a[n][n];
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cin>>a[i][j];
        }
    }    
    vector<ll> dp(1<<n);
    dp[0]=1;
    for (int mask = 0; mask < 1<<n; ++mask)//mask corresponds to the number of women unpaired 
    {
        ll i=__builtin_popcount(mask);
        for (int j = 0; j < n; ++j)
        {
            if(a[i][j] && !(mask & (1<<j))){
                ll mask2=(mask ^ (1<<j));
                dp[mask2]=(dp[mask2]%M+dp[mask]%M)%M;
            }
        }
    }
    cout<<dp[(1<<n)-1];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1,t1=1;
    //cin>>t;
    while(t--){
        //cout<<"Case #"<<t1++<<": ";        
        solve();
    }
    return 0 ;
}

Measured memory_bytes: 16768
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner scanner = new Scanner(System.in)) {
			String n = scanner.next();
			int N = Integer.parseInt(n.substring(n.length() - 1));

			if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9) {
				System.out.print("hon");
			}else if (N == 0 || N == 1 || N == 6 || N == 8) {
				System.out.print("pon");
			} else {
				System.out.print("bon");
			}

		}
	}
}

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

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; cin >> n;
    rep(i,10) rep(j,i+1){
        if (i * j == n){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-10;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;cin>>n;
    ll a,b;cin>>a>>b;
    ll ans=beki(2,n,mod)-1+mod;
    ans%=mod;
    ll s1=1,s2=1;
    rep(i,1,a+1){
        (s1*=(n-i+1))%=mod;
        (s1*=gyaku(i,mod))%=mod;
    }
    rep(i,1,b+1){
        (s2*=(n-i+1))%=mod;
        (s2*=gyaku(i,mod))%=mod;
    }
    ans+=-s1+mod-s2+mod;
    cout<<ans%mod<<endl;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,M; cin >> N >> M;
  vector<ll> vec[N+10]; vector<pair<ll,ll>> memo;
  
   
  for(ll i = 0; i < M; i++){
    ll p,y; cin >> p >> y; memo.push_back(make_pair(p,y));
    vec[p].push_back(y);}
  
  
  for(ll i = 0; i < N+10; i++){ 
    if(vec[i].empty()){ continue;}
    sort(vec[i].begin(),vec[i].end());}
  
  for(ll i = 0; i < (ll) memo.size(); i++){
     ll p = memo[i].first; ll y = memo[i].second;
    ll itr = lower_bound(vec[p].begin(),vec[p].end(),y) - vec[p].begin();
    //itr+1　が、出力すべき下６桁
    cout << setfill('0')<< right << setw(6) << p ;
    cout << setfill('0') << right << setw(6) << itr+1 << endl;} 
  
  return 0;}
    
    
    
    
                               

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

const int X = 10000;

int f(vector<int>& A, vector<int>& B) {
    int a = 0, win = 0;
    rep(x, X) {
        int k = min(B[x], a);
        a -= k;
        win += k;
        a += A[x];
    }
    return win;
}

int g(vector<int>& A, vector<int>& B, int x) {
    B[x]--;
    int ans = f(A, B);
    B[x]++;
    return ans;
}

int main() {
    int N; cin >> N;
    vector<int> a(N);
    rep(i, N) {
        cin >> a[i];
        a[i]--;
    }
    vector<int> b(N);
    rep(i, N) {
        cin >> b[i];
        b[i]--;
    }
    sort(all(b));
    vector<int> A(X);
    rep(i, N) A[a[i]]++;
    vector<int> v(N);
    rep(i, N) {
        int M = b.size();
        vector<int> B(X);
        rep(j, M) B[b[j]]++;
        int x0 = a[i];
        A[x0]--;
        int m = upper_bound(all(b), x0) - b.begin();
        i_i ans = i_i{-1, -1};
        if (m > 0) {
            int win = g(A, B, b[0]);
            int lb = 0, ub = m;
            while (ub - lb > 1) {
                int j = (lb + ub) / 2;
                if (g(A, B, b[j]) == win) lb = j;
                else ub = j;
            }
            ans = max(ans, i_i{win, lb});
        }
        if (m < M) {
            int win = g(A, B, b[m]);
            int lb = m, ub = M;
            while (ub - lb > 1) {
                int j = (lb + ub) / 2;
                if (g(A, B, b[j]) == win) lb = j;
                else ub = j;
            }
            ans = max(ans, i_i{win + 1, lb});
        }
        int j = get<1>(ans);
        v[i] = b[j];
        b.erase(b.begin() + j);
    }
    rep(i, N) cout << v[i] + 1 << (i + 1 < N ? ' ' : '\n');
}



Measured memory_bytes: 3276
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;

	if (b - a == c - b)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}

	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

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

  if (S == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(S == "Cloudy"){
    cout << "Rainy" << endl;
  }else{
    cout << "Sunny" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int main() {
    int a = iin(), b = iin(), c = iin();
    if (a != b) {
        if (a != c && b != c) iout(3);
        else iout(2);
    } else {
        if (a != c) iout(2);
        else iout(1);
    }
    return 0;
}


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

const int N = 2333;

int n, m, q;
int se[N][N], sv[N][N];
int vert[N][N], diag[N][N];
char mp[N][N];

int check(int x, int y) {
    return mp[x][y] * ((x > 0 && mp[x - 1][y]) + (y > 0 && mp[x][y - 1]));
}

int main() {
    scanf("%d %d %d", &n, &m, &q);
    for (int i = 0; i < n; i++) {
        scanf("%s", mp[i]);
        for (int j = 0; j < m; j++) {
            mp[i][j] -= '0';
        }
    }

    for (int i = 0; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            cnt += mp[i][j];
            sv[i + 1][j + 1] = sv[i][j + 1] + cnt;
        }
    }

    for (int i = 1; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            if (mp[i][j] + mp[i - 1][j] == 2) {
                cnt++;
            }
            vert[i][j + 1] = cnt;
        }
    }

    for (int j = 1; j < m; j++) {
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (mp[i][j - 1] + mp[i][j] == 2) {
                cnt++;
            }
            diag[i + 1][j] = cnt;
        }
    }

    for (int i = 0; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            cnt += check(i, j);
            se[i + 1][j + 1] = se[i][j + 1] + cnt;
        }
    }

    for (int i = 0; i < q; i++) {
        int xa, ya, xb, yb;
        scanf("%d %d %d %d", &xa, &ya, &xb, &yb);
        int v = sv[xb][yb] + sv[xa - 1][ya - 1] - sv[xb][ya - 1] - sv[xa - 1][yb];
        int e = se[xb][yb] + se[xa - 1][ya - 1] - se[xb][ya - 1] - se[xa - 1][yb]
            - (vert[xa - 1][yb] - vert[xa - 1][ya - 1]) 
            - (diag[xb][ya - 1] - diag[xa - 1][ya - 1]);
        printf("%d\n", v - e);
    }
}


Measured memory_bytes: 87808
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = a;
		String f = sc.next();
		for(int i = 0; i < a - 1; i++){
			if(f.substring(i, i + 1).equals(f.substring(i + 1, i + 2))){
				b --;
			}
		} 
		System.out.println(b);
		
		
	}
}

Measured memory_bytes: 48980
#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;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll cnt[27];
string t;
string s; 

const int MOD = 1e9 + 7;
ll S[500011];
ll powr[500011];
ll ipowr[500011];
const int C = 2017;

ll add(ll a, ll b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}

ll mult(ll a, ll b)
{
	return (a*b)%MOD;
}

ll modpow(ll a, ll b)
{
	ll r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}

ll hsh(int l, int r)
{
	if(l>r) return 0;
	if(l==0) return S[r];
	return mult(ipowr[l],add(S[r],MOD-S[l-1]));
}

ll dp[111][27];
ll leng[111];
const ll INF=ll(2e18);

void solve(ll len, int idx, int v)
{	
	if(len==0) return ;
	if(idx==0)
	{
		for(int i=0;i<len;i++)
		{
			cnt[s[i]-'a']+=v;
		}
		return ;
	}
	if(idx==1)
	{
		for(int i=0;i<len;i++)
		{
			cnt[t[i]-'a']+=v;
		}
		return ;
	}
	if(len<=leng[idx-1])
	{
		solve(len,idx-1,v);
		return ;
	}
	for(int i=0;i<26;i++)
	{
		cnt[i]+=ll(v)*dp[idx-1][i];
	}
	solve(len-leng[idx-1],idx-2,v);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>s;
	s=s.substr(0,s.length()/2);
	int n=s.length();
	ll l,r; cin>>l>>r;
	powr[0]=1; ipowr[0]=1;
	ll iC = modpow(C,MOD-2);
	for(int i=1;i<=500000;i++)
	{
		powr[i]=mult(powr[i-1],C);
		ipowr[i]=mult(ipowr[i-1],iC);
	}
	for(int i=0;i<s.length();i++)
	{
		S[i] = mult((s[i]-'a'+1),powr[i]);
		if(i>0) S[i]=add(S[i-1],S[i]);
	}
	int minper = 0;
	for(int i=1;i<=n;i++)
	{
		bool pos=1;
		for(int j=0;j<n;j+=i)
		{
			int lm=j; int rm=min(j+i-1,n-1);
			int ren = rm - j;
			if(hsh(0,ren)!=hsh(lm,rm))
			{
				pos=0;
				break;
			}
		}
		if(pos)
		{
			minper=i;
			break;
		}
	}
	t=s+s.substr(0,minper);
	leng[0]=s.length(); leng[1]=t.length();
	for(int i=0;i<s.length();i++) dp[0][s[i]-'a']++;
	for(int i=0;i<t.length();i++) dp[1][t[i]-'a']++;
	for(int i=2;i<=100;i++)
	{
		leng[i]=leng[i-1]+leng[i-2];
		if(leng[i]>=INF) leng[i]=INF;
		for(int j=0;j<26;j++)
		{
			dp[i][j]=dp[i-1][j]+dp[i-2][j];
			if(dp[i][j]>=INF) dp[i][j]=INF;
		}
	}
	solve(r,100,1);
	solve(l-1,100,-1);
	for(int i=0;i<26;i++)
	{
		cout<<cnt[i];
		if(i+1<26) cout<<' ';
	}
	cout<<'\n';
}


Measured memory_bytes: 10960
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] abs = new int[N];

		for (int i = 0; i < N; i++) {
			int num = scan.nextInt();
			abs[num]++;
		}

		boolean flag = true;
		int num = 0;
		for (int i = (N + 1) % 2; i < N; i += 2) {
			if (i == 0) {
				if (abs[0] != 1) {
					flag = false;
					break;
				}
			}
			else if (abs[i] != 2) {
				flag = false;
				break;
			}
			else num++;
		}

		BigInteger answer = BigInteger.valueOf(2).modPow(BigInteger.valueOf(num), BigInteger.valueOf(1000000007));
		if (flag) System.out.println(answer);
		else System.out.println(0);
 	}
}

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

int main(){
    int k, a, b;
    scanf("%d%d%d", &k, &a, &b);
    if (b - a > 2){
        if (k < a){
            printf("%d\n", k);
        }
        else{
            printf("%lld\n", a + 1ll * (b - a) * ((k - a + 1) / 2) + ((k - a + 1) & 1));
        }
    }
    else{
        printf("%d\n", k + 1);
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define max(p,q)((p)>(q)?(p):(q))

int a[200010];
int main(){
	int k,n;
	scanf("%d%d",&k,&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int ans=a[0]+k-a[n-1];
	for(int i=0;i<n-1;i++)ans=max(ans,a[i+1]-a[i]);
	printf("%d",k-ans);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int L = S.size(); 
  int N = 0; 
  for (int i = 0; i <= L - 1; i++) {
   for (int j = i + 1; j <= L - 1; j++) {
  if(S.at(i) == S.at(j))
  N ++;  
   }
  }
  if(N == 0) cout << "yes" << endl;
  else cout << "no" << endl; 
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan =  null;
		try{
			scan = new Scanner(System.in);
			int aim;
			while((aim = scan.nextInt()) != 0){
				boolean check =false;
				for(int i = 0 ; i < 12 ; i++){
					aim -= scan.nextInt() - scan.nextInt();
					if(check == false && aim <=0){
						System.out.println(i + 1);
						check = true;
					}
				}
				if(!check){
					System.out.println("NA");
				}
			}
		}finally{
			if(scan !=null)scan.close();
		}
	}
}

Measured memory_bytes: 34600
N,A,B=map(int,input().split())
ans=[]
for i in range(1,N+1):
  j=i//10000+(i%10000)//1000+(i%1000)//100+(i%100)//10+(i%10)//1
  if A<=j<=B:
    ans.append(i)
  
print(sum(ans))

Measured memory_bytes: 9420
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int gcd(int a,int b){return a == 0 ? b : gcd(b%a,a);}

int n, a[maxn], l[maxn], r[maxn];
int main(){
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];
    for (int i=1;i<=n;i++) l[i] = gcd(l[i-1], a[i]);
    for (int i=n;i>=1;i--) r[i] = gcd(r[i+1], a[i]);

    int mx = 1;
    for (int i=1;i<=n;i++){
        int tmp = gcd( l[i-1], r[i+1]);
        if (tmp > mx) mx = tmp;
    }
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
         while(true){
         int H = sc.nextInt();
         int W = sc.nextInt();
         if(H == 0 && W == 0){
             break;
         }
         for(int i = 0; i < H; i++){
             for(int j= 0; j < W; j++){
                 System.out.print("#");
             }
             System.out.println("");
             }
             System.out.println("");
         }
}
}

Measured memory_bytes: 32504
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(100010), Mod(1e9 + 7);
int n, m, A[maxn], B[maxn], S[maxn], c[maxn], f[maxn], tot;
struct node { int x, y; } P[maxn];
inline bool operator == (const node &lhs, const node &rhs)
	{ return lhs.x == rhs.x && lhs.y == rhs.y; }
void Add(int x, int v) { for (; x <= tot; x += x & -x) c[x] = (c[x] + v) % Mod; }
int Sum(int x) { int ans = 0; for (; x; x -= x & -x) ans = (ans + c[x]) % Mod; return ans; }

int main()
{
	n = read(), m = read();
	for (int i = 1; i <= n; i++) A[i] = read();
	for (int i = 1; i <= m; i++) B[i] = read();
	P[tot = 1] = (node) {0, 0};
	for (int i = 1, j; i <= n; i++)
	{
		j = std::upper_bound(B + 1, B + m + 1, A[i]) - B;
		if (j > 1 && j <= m) P[++tot] = (node) {A[i] - B[j - 1], B[j] - A[i]};
	}
	P[n = ++tot] = (node) {(int)1e9, (int)1e9}, tot = 0;
	for (int i = 1; i <= n; i++) S[i] = P[i].y;
	std::sort(S + 1, S + n + 1), tot = std::unique(S + 1, S + n + 1) - S - 1;
	for (int i = 1; i <= n; i++)
		P[i].y = std::lower_bound(S + 1, S + tot + 1, P[i].y) - S;
	std::sort(P + 1, P + n + 1, [] (const node &lhs, const node &rhs)
			{ return lhs.x != rhs.x ? lhs.x < rhs.x : lhs.y < rhs.y; });
	n = std::unique(P + 1, P + n + 1) - P - 1;
	Add(P[1].y, 1);
	for (int i = 2, j; i <= n; i = j)
	{
		for (j = i; j <= n && P[j].x == P[i].x; j++);
		for (int k = i; k < j; k++) f[k] = Sum(P[k].y - 1);
		for (int k = i; k < j; k++) Add(P[k].y, f[k]);
	}
	printf("%d\n", f[n]);
	return 0;
}
//

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for(int i = 0; i < H; i++){
        cin >> a.at(i);
    }
    for(int i = 0; i < H + 2; i++){
        if(i == 0 || i == H + 1){
            for(int j = 0; j < W + 2; j++){
                cout << "#";
            }
        }else{
            for(int j = 0; j < W + 2; j++){
                if(j == 0 || j == W + 1){
                    cout << "#";
                }else{
                    cout << (a.at(i - 1)).at(j - 1);
                }
            }
        }
        cout << endl;
    }
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> ans(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int x;
    cin >> x;
    ans[x]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 3992
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var a=sc.I;
		var b=sc.I;
		var c=sc.I;
		var d=Max(a,b);
		Console.WriteLine("{0}",(c-1)/d+1);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13140
import sys
from collections import deque
import copy
def main():
    N, K = map(int, input().split())
    a = [int(i) for i in input().split()]
    ans = 10 ** 11
    for i in range(1 << N):
        now = a[0]
        count = 0
        copy_a = copy.copy(a)
        for j in range(1, N):
            if i >> j & 1:
                count += max(now + 1 - a[j], 0)
                copy_a[j] = max(now + 1, a[j])
            now = max(now, copy_a[j])
        now = 0
        color = 0
        for j in range(N):
            if now < copy_a[j]:
                color += 1
                now = copy_a[j]
        if color >= K:
            ans = min(ans, count)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	flag := true // means Takahashi's turn
	a, b, c, d := ScanInt(), ScanInt(), ScanInt(), ScanInt()
	for a > 0 && c > 0 {
		if flag {
			c -= b
		} else {
			a -= d
		}
		flag = !flag
	}
	if !flag {
		P("Yes")
	} else {
		P("No")
	}
	close(O)
	oWg.Wait()
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}


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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int x = 0, y = 0, score = 0;
    rep(i, n-1) if (s[i] == s[i+1]) ++score;
    rep(i, n-1) if (s[i]=='R' && s[i+1]=='L') ++x;
    if ((s[0]=='L') == (s[n-1]=='R')) {
        ++y;
        if (s[0] != 'L') --x;
    }
    score += min(x, k) * 2;
    k -= x;
    if (k > 0) score += y;
    cout << score << endl;
    return 0;
}


Measured memory_bytes: 3748
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str = br.readLine();
	    StringTokenizer st = new StringTokenizer(str, " ");

		int w  = Integer.parseInt(st.nextToken());
		int h  = Integer.parseInt(st.nextToken());
		int x  = Integer.parseInt(st.nextToken());
		int y  = Integer.parseInt(st.nextToken());
		int r  = Integer.parseInt(st.nextToken());

		if(w >= (x + r) && h >= (y + r ) && x >= r && y >= r ) {
			System.out.println("Yes");

		}else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 24356
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

const int MOD = 1e9+7;

int main() {
    ll N, B = 60;
    cin >> N;
    vl A(N), cnts(B);
    rep(i,N) {
        cin >> A[i];
        rep(j,B) {
            cnts[j] += (A[i]>>j) & 1;
        }
    }
    ll ans = 0, base = 1;
    rep(j,B) {
        (ans += (cnts[j] * (N - cnts[j])) % MOD * base) %= MOD;
        (base <<= 1) %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5564
a = [list(map(int, input().split()))for _ in range(3)]

n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b: a[j][k] =0
ans = "No"

for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]==0:ans="Yes"
  if a[0][i]==a[1][i]==a[2][i]==0:ans="Yes"
if a[0][0]==a[1][1]==a[2][2]==0:ans="Yes"
if a[2][0]==a[1][1]==a[0][2]==0:ans="Yes"
print(ans)

Measured memory_bytes: 3064
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict
from operator import mul
from functools import reduce


def nCr(n, r):
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


n, p = map(int, readline().split())
a = list(map(lambda x: int(x) % 2, readline().split()))
dict = defaultdict(int)
for aa in a:
    dict[aa] += 1
memo = 2 ** dict[0]
ans = 0
if p == 0:
    ans += memo
    m = 2
else:
    m = 1
for i in range(m, dict[1] + 1, 2):
    ans += nCr(dict[1], i) * memo
print(ans)


Measured memory_bytes: 3808
from collections import Counter

N, P = map(int, input().split())

# n以下の全ての素数のセットを返す関数
def prime_set(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5) + 1):
        primes.difference_update(range(i*2, n+1, i))
    return primes

# nを素因数分解して素因数の全リストを返す関数
def prime_factors(n):
    f = []
    for i in prime_set(int(n**0.5) + 1):
        while n % i == 0:
            f.append(i)
            n //= i
    if n > 1:
        f.append(n)
    return f

c = Counter(prime_factors(P))
ans = 1

for x in c.keys():
    ans *= pow(x, int(c[x]//N))

print(ans)

Measured memory_bytes: 84188
import math

N, K = map(int, input().split())
A = list(map(float, input().split()))


min_A = 0
max_A = 10**10

while( max_A - min_A > 1):
  now = (min_A + max_A) // 2
  temp = 0
  for i in A:
    if i > now:
      temp += (i // now)
  if temp > K:
    min_A = now
  else:
    max_A = now

print(int(min_A) + 1)

Measured memory_bytes: 98272
a =int(input())
b =int(input())
c =int(input())
d =int(input())
e =int(input())
k =int(input())
AC = [a, b, c, d, e]
for i in range(4):
  for j in range(i+1, 5):
    if AC[j]-AC[i] > k:
      print(":(")
      break
  else:
    continue
  break
if e-a <=k:
  print("Yay!")

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

using namespace std;

#define int long long

main() {
#ifdef HOME
    //freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k, h, x;
    cin >> n >> k;
    vector < int > a;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    k = min(k, n);
    int ans = 0;
    for (int j = 0; j < n - k; ++j) ans += a[j];
    cout << ans;
    return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> a(n * 3);
    for (int i = 0;i < n * 3; i++) cin >> a.at(i);
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    long long int ans = 0;
    int index = 1;
    for (int i = 0;i < n; i++) {
        ans += a.at(index);
        index += 2;
    }

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

Measured memory_bytes: 1408
use proconio::input;
//use itertools::Itertools;

fn main() {
    input!{n : i128};
    let mut cnt = 0;
    for _i in 0..n {
        input!{d1: i128, d2: i128};
        if d1 == d2 {
            cnt += 1;
            if cnt == 3 {
                println!("Yes");
                return;
            }
        } else {
            cnt = 0;
        }
    }
    println!("No");
}

Measured memory_bytes: 2160
N, K = map(int, input().split())
A = list(map(int, input().split()))
c = 0
for i in range(N):
    for j in range(i + 1, N):
        if A[i] > A[j]:
            c += 1
cc = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            cc += 1
ans = c * K
ans += cc * (K - 1) * K // 2
print(ans % 1000000007)


Measured memory_bytes: 3188
N, M = map(int, raw_input().split())
w = 0
x = [0]*N
y = [0]*N
z = [0]*N
ans = [0]*N
for i in range(0,N):
  x[i], y[i], z[i] = map(int, raw_input().split())

ar = [[1,1,1],[-1,1,1],[1,-1,1],[1,1,-1],[-1,-1,1],[1,-1,-1],[-1,1,-1],[-1,-1,-1]]

for t in range(0,8):
  for s in range(0,N):
    ans[s] = x[s]*ar[t][0]+y[s]*ar[t][1]+z[s]*ar[t][2]
  ans.sort()
  ans.reverse()
  v = 0
  for m in range(0,M):
    v += ans[m]
  w = max(v,w)
print(w)


Measured memory_bytes: 2820
n=int(input())
a=list(map(int,input().split()))
while len(a)>1:
  m=min(a)
  b=[m]
  for i in range(len(a)):
    x=a[i]%m
    if x!=0:
      b.append(x)
  a=list(set(b))
print(*a)

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


using namespace std;
 
int main(){
    long long int N,ans;
    ans = 1;
    cin >> N;
    for(long long int i = 1; i < N+1; i++){
        ans *= i;
        ans %= 1000000007;
    }

    cout << ans;

    
        return 0;
    

}


Measured memory_bytes: 384
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<utility>//pair
#include<list>
#include<vector>//可変長配列
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define all(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<ll,ll>
#define F first
#define S second
int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
int dy[8] = { 0,1,0,-1,1,1,-1,-1 };


string s;
int a[222222];
int t[222222];
int n;
const int m = 2019;
map<int, int>ta;
int main() {
	cin >> s;
	n = s.size();
	rep(i, n)t[i] = s[i] - '0';

	int ten=1;
	for(int i=n-1;i>=0;i--) {
		int d = (s[i] - '0') * ten % m;
		a[i] = (a[i + 1] + d) % m;
		ten *= 10;
		ten %= m;
	}

	int ans = 0;
	vector<int>cnt(m);
	for (int i = n; i >= 0; i--) {
		ans += cnt[a[i]];
		cnt[a[i]]++;
	}


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


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

int main(void){
	int n;
	int d;
	int i;
	int ans=0;

	scanf("%d %d",&n,&d);

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

	for(i=0;i<n;i++)
	  if(pow(pow(dis[i][0],2)+pow(dis[i][1],2),0.5)<=d)
	    ans+=1;
	
	printf("%d\n",ans);
    
	return 0;
}

Measured memory_bytes: 4356