akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define fore(i, s, e) for(int i = s; i < e;i++)
#define pb push_back
#define fst first
#define snd second

typedef long long ll;

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    ll res = 0, aa = a;
    while(aa <= t) { aa += a, res += b; }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
  
int main() {
  int n;
  cin >> n;
  vector<int> s(n);
  rep(i,n) cin >> s.at(i);
  
  int ans=n;
  rep(i,101) {
    int count = 0;
    rep(j,n) {
      if(s.at(j)==i) count++;
    }
    if(count>=2) ans -= count - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  string s1,s2,s3;
  ll arr[5];
  cin>>s1>>s2;
  cin>>arr[0]>>arr[1];
  cin>>s3;
  if(s3==s1){
    arr[0] -= 1;
  }
  else{
    arr[1] -= 1;
  }
  cout<<arr[0]<<" "<<arr[1]<<"\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

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

int main() {
	//入力
	int H, W, h, w;
	cin >> H >> W;
	cin >> h >> w;

	//出力
	cout << (H - h) * (W - w) << endl;
	return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define debug(x) cerr << #x << ": " << x << "\n"
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}


int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
    
    
    double a ,b,C;
    cin >>a>>b>>C;

    double PI =acos(-1);
    C=C*PI/180;

    double s =a*b*sin(C)/2;
    double L =a + b +sqrt(a*a + b*b -2*a*b*cos(C));
    double h = b*sin(C);

    cout<<fixed<<setprecision(6);
    cout<<s<<endl;
    cout<<L<<setprecision(6)<<endl;
    cout<<h<<setprecision(6)<<endl;

}


Measured memory_bytes: 3660
n = int(input())
s = input()
c = [0 for i in range(n)]
for i in range(0+1, n):
    if s[i] == 'E':
        c[0] += 1

for i in range(1, n):
    c[i] = c[i-1]
    if s[i] == 'E':
        c[i] -= 1
    if s[i-1] == 'W':
        c[i] += 1
print(min(c))

Measured memory_bytes: 62308
#include <iostream>
using namespace std;
#define MAXL 100

int main(){
    //char str[MAXL + 1] = "atcoder";
    int n, ans = 0;
    char str[MAXL + 1];
    cin >> n >> str;
    for(int slash = 1; slash < n - 1; slash++){
        int char_left[26] = {}, char_right[26] = {};
        for(int l = 0; l < slash; l++){
            for(int num = 0; num < 26; num++){
                if(str[l] == 'a' + num && char_left[num] == 0){
                    char_left[num] = 1;
                    break;
                }
            }
        }

        for(int r = slash; str[r] != '\0'; r++){
            for(int num = 0; num < 26; num++){
                if(str[r] == 'a' + num && char_right[num] == 0){
                    char_right[num] = 1;
                    break;
                }
            }
        }

        int sum = 0;
        for(int i = 0; i < 26; i++){
            sum += char_left[i] * char_right[i];
            if(sum > ans){
                ans = sum;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cassert>
#include <cmath>


using namespace std;
using ll = long long int;

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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  ll N, M; cin >> N >> M;
  ll sum = 0;
  rep(i, M) {
    ll tmp; cin >> tmp;
    sum += tmp;
  }

  if (N < sum) {
    cout << -1 << endl;
  } else {
    cout << N - sum << endl;
  }

  return 0;
}

Measured memory_bytes: 3148
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,m,v,p,i,a[100005],l,r,mid;
bool chk(ll ch)
{
	ll sum=0,cnt=0;
	sum=m;
	for(i=1;cnt<p-1;i++)
	{
		if(i==ch)continue;
		sum+=m;
		cnt++;
	}
	for(i;i<=n;i++)
	{
		if(i==ch)continue;
		if(a[i]>a[ch]+m)return false;
		sum+=min(a[ch]+m-a[i],m);
	}
	if(sum>=m*v)return true;
	else return false;
}
bool cmp(ll a,ll b){return a>b;}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	for(i=1;i<=n;i++)scanf("%lld",&a[i]);
	sort(a+1,a+n+1,cmp);
	l=1;r=n+1;
	while(l<r)
	{
		mid=(l+r)/2;
		if(chk(mid))l=mid+1;
		else r=mid;
	}
	printf("%lld\n",l-1);
	return 0;	
} 

Measured memory_bytes: 896
#include <stdio.h>
  
int main(void){
    int i,j,k,a[2][7];
      
    for(i=0;i<2;i++)
      for(j=1;j<7;j++)
        scanf("%d", &a[i][j]);
     
    for(i=0;i<6;i++){
      if(a[0][1]==a[1][1])
        for(j=0;j<4;j++){
           for(k=1;k<7;k++)
            if(a[0][k]!=a[1][k]) break;
  
          if(k==7){
            printf("Yes\n");
            return 0;
          }
           a[1][0] = a[1][2];
          a[1][2] = a[1][3];
          a[1][3] = a[1][5];
          a[1][5] = a[1][4];
          a[1][4] = a[1][0];
       }
       //回転
      a[1][0] = a[1][1];
      switch(i){
          case 2:
              a[1][1] = a[1][3];
              a[1][3] = a[1][6];
              a[1][6] = a[1][4];
              a[1][4] = a[1][0];
              break;
              
          default:
              a[1][1] = a[1][2];
              a[1][2] = a[1][6];
              a[1][6] = a[1][5];
              a[1][5] = a[1][0];
              break;
         
          }
    }
    printf("No\n");
    return 0;
}




Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll int val[101],wt[101], n,w;
void knap_sack()
{ll int ara[n+1][w+1];
for(int i=0;i<n+1;i++)ara[i][0]=0;
for(int i=0;i<w+1;i++)ara[0][i]=0;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            int l=j-wt[i];
            if(l>=0)ara[i][j]=max(ara[i-1][j],ara[i-1][l]+val[i]);
            else ara[i][j]=ara[i-1][j];
        }
    }
    cout<<ara[n][w]<<endl;
}
int main()
{
    cin>>n>>w;
    for(int i=1;i<=n;i++)cin>>wt[i]>>val[i];
    knap_sack();

}


Measured memory_bytes: 79104
function Main(input) {
    input = input.split("\n");
    params = input[0].split(" ");
    n = parseInt(params[0]);
    m = parseInt(params[1]);
    x = parseInt(params[2]);
    fee_stations = input[1].split(" ");

    sum = 0;
    for(var i=0; i < m; i++){
        pos = parseInt(fee_stations[i]);
        if( pos > x){
            break;
        }
        else{
            sum += 1;
        }
    }
    if( sum < m/2 ){
        console.log(sum);
    }
    else{
        console.log(m - sum);
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a+b==15){
        cout << '+' << '\n';
    }
    else if(a*b==15){
        cout << '*' << '\n';
    }
    else{
        cout << 'x' << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=100005;

int n,cnt,last[N],sg[N];
struct edge{int to,next;}e[N*2];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

void addedge(int u,int v)
{
	e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
	e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}

void dfs(int x,int fa)
{
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		dfs(e[i].to,x);
		sg[x]^=sg[e[i].to]+1;
	}
}

int main()
{
	n=read();
	for (int i=1;i<n;i++)
	{
		int x=read(),y=read();
		addedge(x,y);
	}
	dfs(1,0);
	if (sg[1]) puts("Alice");
	else puts("Bob");
	return 0;
}

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

int main(int argc, char const *argv[])
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    long long r = 0;
    long long g = 0;
    long long b = 0;

    for (char s : S)
    {
        if (s == 'R')
        {
            r++;
        }
        if (s == 'G')
        {
            g++;
        }
        if (s == 'B')
        {
            b++;
        }
    }
    long long sum = r * b * g;

    int d;
    for (int i = 0; i < S.size(); i++)
    {
        for (int j = i + 1; j < S.size(); j++)
        {
            d = j - i;
            if (j + d >= S.size())
            {
                break;
            }

            if (S[i] == S[j])
            {
                continue;
            }

            if (S[j] == S[j + d])
            {
                continue;
            }
            if (S[i] != S[j + d])
            {
                sum--;
            }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(string& T, int K, int r, int s, int p) {
        int n = T.length();
        int res = 0;

        string rsp = "rsp";
        for (auto& c : T) {
            int p = rsp.find_first_of(c);
            c = rsp[(p - 1 + rsp.length()) % rsp.length()];
        }

        for (int i = 0; i < K; ++i) {
            for (int j = i; j < n; j += K) {
                int cnt = 1;
                while (j + K < n && T[j] == T[j + K]) {
                    j += K;
                    ++cnt;
                }
                int sc = T[j] == 'r' ? r : T[j] == 's' ? s : p;
                res += (cnt + 1) / 2 * sc;
            }
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int k;
    cin >> k;
    int r, s, p;
    cin >> r >> s >> p;
    string T;
    cin >> T;
    Solution sol;
    cout << sol.solve(T, k, r, s, p) << "\n";

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n; cin >> n;
    int a[100010] = {};
    rep(i,0,n) cin >> a[i];
    ll ans = 0;
    rep(i,0,n) {
        ans += a[i] / 2;
        a[i] -= a[i] / 2 * 2;
        if(a[i] != 0 && i != n-1 && a[i+1] != 0) {
            a[i]--;
            a[i+1]--;
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
bool is_prime(lli x) {
  for(lli i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}
int main() {
  lli A,B,C=INF,D=0,E=0,F=0,G=0,H=0,N,M;
  cin >> N;
  string S,K,L;
  cin >> S >> K >> L;
  rep(i,0,N){
    if(S[i]!=K[i])D++;
    if(S[i]!=L[i]){
      D++;
      if(K[i]==L[i])D--;
  }
  }
  Out(D);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}
 
 
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;
 
	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}
 
	return num;
}
*/
ll n;
ll a[MAX],b[MAX];
int main(){FAST;
cin>>n;
for(ll i=1;i<=n+1;i++){
	cin>>a[i];
}
for(ll i=1;i<=n;i++){
	cin>>b[i];
}
ll ans = 0;
for(ll i=1;i<=n;i++){
	ll del = min(a[i],b[i]);
	ans+=del;
	b[i]-=del;
	a[i]-=del;
	del = min(a[i+1],b[i]);
	ans+=del;
	b[i]-=del;
	a[i+1]-=del;
}
cout<<ans;
return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N,K;
  cin>>N>>K;
  vector<int64_t>A(N);
  vector<int64_t>F(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  sort(A.begin(),A.end());
    for(int64_t i=0;i<N;i++)
    cin>>F.at(i);
  sort(F.begin(),F.end());
  reverse(F.begin(),F.end());
  int64_t left=-1;int64_t right=1000000000000;
  while(1<right-left){
  int64_t mid=left+(right-left)/2;
    int64_t sum=0;
    for(int i=0;i<N;i++){
    int64_t b=mid/F[i];
      b=A[i]-b;
      if(0<=b)sum+=b;
    }
      
    if(sum<=K)
      right=mid;
    else
      left=mid;
  }cout<<right<<endl;
  
   return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int maxn=0;
    double sum=0;
    for(int i=0;i<n;i++)
    {
    	int x ;
    	cin>>x;
    	sum=sum+x;
    	maxn=max(maxn,x);
	}
	sum=sum-maxn/2;
	cout<<sum;
    return 0;
}


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

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)


int main(){
#define int long long

	int N;	cin >> N;
	int cnt1 = 0;


	for (int i0 = 1; i0 <= N; i0 = i0 + 2){
		int cnt0 = 0;


		for (int i1 = 1; i1 <= i0; i1++){
			if (i0%i1 == 0)	cnt0++;
		}
		if (cnt0 == 8)	{ cnt1++; }
		
		
		cnt0 = 0;
	}

	
	
	int ans = cnt1;
	cout << ans << endl;
  
	return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> w(n);
  std::cin >> w;

  const auto sum = summation(w.cbegin(), w.cend());
  int64_t min = sum;

  for (auto itr = w.cbegin(); itr != w.cend(); itr++) {
    const auto p = summation(w.cbegin(), itr);
    min = std::min(std::abs(sum - p - p), min);
  }

  std::cout << min << std::endl;
  return 0;
}


Measured memory_bytes: 256
#define CIN_ONLY 1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
const int MOD = 1000000007;
const ld PI = acos(ld(-1));
int fix(ll n) { return (n % MOD + MOD) % MOD; }
int fix(ll n, int MOD) { return (n % MOD + MOD) % MOD; }

int cnt[2600];

int main()
{
  if (CIN_ONLY) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    ++cnt[s[i]];
  }
  ll ans = 1;
  for (int i = 'a'; i <= 'z'; ++i) {
    ans = (ans * (cnt[i] + 1)) % MOD;
  }
  cout << ans - 1 << endl;
  return 0;
}


Measured memory_bytes: 512
package main

import(
      "fmt"
)

func main(){

  var n,m int
  ans := 0
  fmt.Scan(&n,&m)
  if n*2<=m {
    ans+=n
    m-=2*n
    ans+=m/4
  }else{
    ans+=m/2
  }
  fmt.Println(ans)
}

//====  ↓↓↓ template functions ↓↓↓  ======================

func min(a, b int) int{
  if a < b {
    return a
  }
  return b
}

func max(a, b int) int{
  if a > b {
    return a
  }
  return b
}

func abs(x int) int{
  if x < 0 {
    return -x
  }
  return x
}

func gcd(a, b int) int{
  if b == 0 {
    return a
  }else{
    return gcd(b, a%b)
  }
}

func lcm(a, b int) int{
  return a*b/gcd(a, b);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define MOD 1000000007
#define PI acos(-1)
int main()
{
	IOS
	string s;
	cin>>s;
	s=' '+s;
	int n=s.length();
	int i=1;
	while(i<n)
	{
		if(i&1)
		{
			if(s[i]=='L')
			{
				cout<<"No";
				return 0;
			}
		}
		else
		{
			if(s[i]=='R')
			{
				cout<<"No";
				return 0;
			}
		}
		i++;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long int n,a,b,c;
    cin>>n>>a>>b;
    if(a>b){
        c=a,a=b,b=c;
    }
    
    for(int i=0;i<n-2;i++){
        cin>>c;
        if(c<a) a=c;
        if(c>b) b=c;
    }
    
    cout<<b-a;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

ostream& operator<<(ostream& stream, const mint& n){
  stream << n.x;
  return stream;
};

struct comb{
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  ll h, w, a, b;
  cin >> h >> w >> a >> b;
  comb c(h+w);
  mint ans = 0;
  REP(i, h-a){
    ans += c(i+b-1, i) * c(h-i+w-b-2, h-i-1);
  }
  cout << ans << endl;
  return 0;
}

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

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

using namespace std;

int main(){
    string str1, str2;

    cin >> str1;
    cin >> str2;

    rep(i, str1.length()) {
        if (str1[i] != str2[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;

}



Measured memory_bytes: 3624
a_1 = int(input())
a_list = []
a_list.append(a_1)

count = 0
for i in range(1000001):
    tester = a_list[i]
    if a_list.count(tester) == 2:
        print(count + 1)
        break
    else:
        count += 1
        if tester % 2 == 0:
            tester = int(tester / 2)
            a_list.append(tester)
        else:
            tester = 3 * tester + 1
            a_list.append(tester)
        

Measured memory_bytes: 2940
require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').map(function(z){i=z.split(' ');console.log(x=((i[2]*i[4]-i[1]*i[5])/(i[0]*i[4]-i[1]*i[3])).toFixed(3),((i[2]-i[0]*x)/i[1]).toFixed(3))})


Measured memory_bytes: 15152
n=int(input())
s=[int(input()) for _ in range(n)]
b=[x%10 for x in s]
f=[x for x in s if x%10>0]
if sum(s)%10>0:
    print(sum(s))
elif b.count(0)==n:
    print(0)
else:
    print(sum(s)-min(f))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n;
  cin >> n;
  int x=0;
  int a[n];
  for(int i=0;i<n;i++)
  {
	cin >> a[i];
    x^=a[i];
  }
  for(int i=0;i<n;i++)
  {
    cout<<(x^a[i])<<" "; 
  }


	return 0;
}


Measured memory_bytes: 4384
N,K = map(int,input().split())
L = list(map(int,input().split()))

dp = [0 for i in range(N)]

if N <= K :
    ans = abs(L[0] - L[-1])
else :
    for i in range(1,K+1) :
        dp[i] = abs(L[0] - L[i])
    for i in range(K+1,N) :
        cost = float("inf")
        for j in range(i-K,i) :
            calc = dp[j] + abs(L[j] - L[i])
            if cost > calc :
                cost = calc
        dp[i] = cost
    ans = dp[N-1]
print(ans)


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

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    int count = 0;
    for(int i = 0; i< n;i++){
        cin >> v[i];
        // cin >> c[i];
        // if(v[i] > c[i]){
        //     count += (v[i] - c[i]);
        //     cout << count << endl;
        // }
    }
    for(int i = 0; i< n;i++){
        cin >> c[i];
        // cin >> c[i];
        // if(v[i] > c[i]){
        //     count += (v[i] - c[i]);
        //     cout << count << endl;
        // }
    }
    for(int i = 0; i< n;i++){
        if(v[i] > c[i]){
            count += (v[i] - c[i]);
        }
    }
    cout << count << endl;
    return 0;
}


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

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


Measured memory_bytes: 5180
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] n = saori.nextHayami().split("");
		int a = saori.saori_hayami();
		int num = n.length-3;
		if(n.length < 3){
			num = 0;
		}
		String str = "";
		for(int i = num;i < n.length;i++){
			str += n[i];
		}
		int san = Integer.parseInt(str);
		if(san <= a){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
ll a,b,n;
int main(){
	ios::sync_with_stdio(0);
	cin>>a>>b>>n;
	ll mn=min(b-1,n);
	ll ans=a*mn;
	ans/=b;
	cout<<ans-a*(mn/b);
	re 0;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#include <sstream>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define pf push_front
#define LL long long
#define Pair pair<int,int>
#define LOWBIT(x) x & (-x)
using namespace std;
 
const int MOD=1e9+7;
const int INF=2e9;
const int magic=348;
const LL LINF=2e16;
const double eps=1e-10;
const int Ni=500000004;
 
inline int getint()
{
	char ch;
	while ((ch=getchar())<'0' || ch>'9') {}
	int res=ch-'0';
	while ((ch=getchar())>='0' && ch<='9') res=res*10+ch-'0';
	return res;
}
 
struct node
{
	LL x,y,z;
};
 
vector<int> v[200048];
vector<node> q[200048];
int deq_num[200048],tot=0;
int n;
 
bool cmp(int x,int y)
{
	return q[deq_num[x]].size()<q[deq_num[y]].size();
}
 
void dfs(int cur)
{
	node ins;int sz=v[cur].size();
	if (sz==0)
	{
		deq_num[cur]=++tot;
		ins.x=ins.y=Ni;ins.z=0;
		q[tot].pb(ins);
		return;
	}
	int i,j,j1,j2,num1,num2,xx,yy,zz;
	for (i=0;i<sz;i++) dfs(v[cur][i]);
	//sort(v[cur].begin(),v[cur].end(),cmp);
	for (i=1;i<sz;i++) if (!cmp(v[cur][i-1],v[cur][i])) swap(v[cur][i-1],v[cur][i]);
	int depth=0;
	for (i=0;i<=sz-2;i++)
	{
		num1=deq_num[v[cur][i]];num2=deq_num[v[cur][sz-1]];
		for (j=0;j<q[num1].size();j++)
		{
			j1=q[num1].size()-1-j;j2=q[num2].size()-1-j;
			depth=max(depth,min(int(q[num1].size()),int(q[num2].size())));
			xx=q[num2][j2].x;yy=q[num2][j2].y;zz=q[num2][j2].z;
			q[num2][j2].x=(xx*q[num1][j1].x)%MOD;
			q[num2][j2].y=((xx*q[num1][j1].y)%MOD+(yy*q[num1][j1].x)%MOD)%MOD;
			q[num2][j2].z=((xx*q[num1][j1].z)%MOD+(yy*q[num1][j1].y)%MOD+(yy*q[num1][j1].z)%MOD+(zz*q[num1][j1].x)%MOD+(zz*q[num1][j1].y)%MOD+(zz*q[num1][j1].z))%MOD;
		}
	}
	deq_num[cur]=deq_num[v[cur][sz-1]];int Num=deq_num[cur],SZ=q[Num].size()-1;
	for (i=0;i<depth;i++)
	{
		q[Num][SZ-i].x=(q[Num][SZ-i].x+q[Num][SZ-i].z)%MOD;
		q[Num][SZ-i].z=0;
	}
	ins.x=ins.y=Ni;ins.z=0;
	q[Num].pb(ins);
}
 
int mypow()
{
	LL res=1;int i;
	for (i=1;i<=n+1;i++) res=(res*2)%MOD;
	return int(res);
}
 
int main ()
{
	int i,x;
	n=getint();
	for (i=1;i<=n;i++)
	{
		x=getint();
		v[x].pb(i);
	}
	dfs(0);
	int Num=deq_num[0];LL ans=0;
	for (i=0;i<q[Num].size();i++) ans=(ans+q[Num][i].y)%MOD;
	ans=(ans*mypow())%MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 64624
/**
 *  author: Behradm
 *  Created: 2020.06.21 16:15:45
 *  In The Name Of God
**/
#include <bits/stdc++.h>

using namespace std;

int main() {   
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  int p;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0)
      p = a[i];
    else
      p ^= a[i];
  }

  for (int i = 0; i < n; i++)
    cout << (p ^ a[i]) << " ";

  cout << '\n';
  return 0;
}


Measured memory_bytes: 3968
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
a,b=map(int,input().split())
if a%2==0:
    if b%2!=0:
        if (b+1-a)//2%2==0:
            print(0)
        else:
            print(1)
    else:
        if (b-a)//2%2==0:
            print(b)
        else:
            print(b^1)
else:
    if b%2!=0:
        if (b-a)//2%2==0:
            print(a)
        else:
            print(a^1)
    else:
        if (b+1-a)//2%2==0:
            print(1^a^b)
        else:
            print(a^b)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int x = 0;
    int ans = 0;
    for(int i =0;i<n;i++){
        x+=s[i]=='I'?1:-1;
        ans = max(ans,x);
    }
    cout << ans;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;   }
ll lcm(ll a, ll b) { ll r=((a*b)/gcd(a,b)); return r;}
ll isOnBit(ll n, ll b) {return (n >> b) & 1;         }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll digsum(ll n)    { ll cnt=0; while(n){cnt+=(n%10); n/=10;} return cnt;}
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

ll fact[N];
ll inv[N];

void init(ll n)
{
    forn(i,0,n+1)
    {
        if(i==0)
            fact[i]=1;
        else
            fact[i]=mult(fact[i-1],i);
    }
    inv[n] = powm(fact[n],mod-2);
    for(ll i=n;i>=1;i--)
    {
        inv[i-1] = mult(inv[i],i);
    }
}

ll ncr(ll n,ll r)
{
    if(n<r || n<0 || r<0)
        return 0;

    ll ans = 1;
    ans = mult(ans,fact[n]);
    ans = mult(ans,inv[r]);
    ans = mult(ans,inv[n-r]);

    return ans;
}

int main()
{
    fast
    ll n,k;
    ll ans=0;
    cin>>n>>k;
    
    init(n);
    ll blue = k,red = n-k;
    forn(i,1,k+1)
    {
        ll x = red-(i-1);
        ll r = i+1;
        ans = 1;
        ans = ncr(blue-1,i-1);
        ans = mult(ans,ncr(x+r-1,x));
        cout<<ans<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

int N, M, P[202020], Q[202020], C[202020];
int main() {
	cin >> N >> M;
	typedef pair<int, int>Pair;
	vector<Pair>pairs;
	rep(i, 0, N)pairs.pb({ i,-1 });
	rep(i, 0, M) {
		cin >> P[i] >> Q[i] >> C[i];
		P[i]--, Q[i]--;
		pairs.pb({P[i],C[i]});
		pairs.pb({Q[i],C[i]});
	}
	sort(all(pairs));
	pairs.erase(unique(all(pairs)), pairs.end());
	int sz = pairs.size();

	map<Pair, int>pair2index;
	rep(i, 0, sz)pair2index[pairs[i]] = i;

	vector<vector<Pair>>edges(sz);
	rep(i, 0, sz) {
		if (pairs[i].second == -1)continue;
		int station = pairs[i].first;
		int out = pair2index[{station, -1}];
		edges[i].pb({ out,0 });
		edges[out].pb({i,1});
	}
	rep(i, 0, M) {
		int a = pair2index[{P[i],C[i]}];
		int b = pair2index[{Q[i],C[i]}];
		edges[a].pb({ b,0 });
		edges[b].pb({ a,0 });
	}

	//dijkstra
	vector<int>dist(sz, INF);
	int start = pair2index[{0,-1}];
	int end = pair2index[{N - 1, -1}];
	min_priority_queue<Pair>que;
	vector<int>vis(sz);
	dist[start] = 0;
	que.push({ 0,start });
	while (!que.empty()) {
		auto p = que.top();
		que.pop();
		int cur = p.second;
		int c = p.first;
		if (vis[cur])continue;
		vis[cur] = 1;
		fore(x, edges[cur]) {
			ll cc = c + x.second;
			if (cc < dist[x.first]) {
				dist[x.first] = cc;
				que.push({cc,x.first});
			}
		}
	}

	cout << (dist[end] == INF ? -1 : dist[end]) << endl;

	return 0;
}

Measured memory_bytes: 74092
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let _ = scan!(usize);
    let v = scan!(usize;;);

    let mut num = vec![0; 100_000 + 1];
    for &n in v.iter() {
        if n > 0 {
            num[n - 1] += 1;
        }
        num[n] += 1;
        num[n + 1] += 1;
    }
    println!("{}", num.iter().max().unwrap())
}


Measured memory_bytes: 6396
from collections import deque

n, m = map(int, input().split())
root = [[] for _ in range(n)]
adj = [-1 for _ in range(n)]
for _ in range(m):
  r,c = map(int, input().split())
  root[r-1].append(c-1)
  root[c-1].append(r-1)
  
explor = deque()
explor.append(0)

while explor:
  tmp = explor.popleft()
  for i in root[tmp]:
    if adj[i]==-1:
      adj[i] = tmp
      explor.append(i)

print('Yes')
for i in adj[1:]:
  print(i+1)

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		int[] A = new int[N];
		Arrays.setAll(A, i -> sc.nextInt());
		Set<Integer> used = new HashSet<>();
		used.add(1);
		int prev = 1;
		List<Integer> l = new ArrayList<>();
		l.add(1);
		while(true) {
			if(used.contains(A[prev-1]))
				break;
			used.add(A[prev-1]);
			l.add(A[prev-1]);
			prev = A[prev-1];
		}
		int index = l.indexOf(A[prev-1]);
		if(K <= index)
			System.out.println(l.get((int)K));
		else
			System.out.println(l.get((int)(index + (K-index) % (l.size()-index))));
	}

}


Measured memory_bytes: 66272
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=1e6+5;
int dp[mx];
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	/*freopen(".in", "r", stdin);
	freopen(".out", "w", stdout); 
    */	
	int h,n;cin >> h >> n;
	for(int i=0;i<1e6;++i){
		dp[i]=1e8;
	}

	dp[0]=0;
	for(int i=0;i<n;++i){
		int p,c;
		cin >> p >> c;
		for(int j=0;j<=h;++j){
			dp[min(j+p,h)]=min(dp[min(j+p,h)],(dp[j]+c));
		}
	}
	cout << dp[h] << endl;
}

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

namespace ConsoleApp15
{
    class Class179
    {
        static void Main()
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NM[0], M = NM[1];
            int Mod = 1000000007;
            long ans = 1;
            if (N == M || N == M + 1 || N + 1 == M)
            {
                if (N == M)
                {
                    ans = Bikkuri(ans,N, Mod);
                    ans = Bikkuri(ans, M, Mod);
                    ans = Bikkuri(ans, 2, Mod);
                }
                else
                {
                    ans = Bikkuri(ans, N, Mod);
                    ans = Bikkuri(ans, M, Mod);
                }
                Console.WriteLine(ans);
            }
            else
                Console.WriteLine(0);
        }
        static long Bikkuri(long ans,int a,int mod)
        {
            
            for(int i = 1; i <= a; i++)
            {
                ans *= i;
                ans %= mod;
            }
            return ans;
        }
    }
}


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


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

  ll ans=0;
  for(ll i=1;i*i<=n;i++) {
    if(n%i==0) {
      if(n/i!=1&&n/i!=2&&n/i-1>i) {
        ans+=(n/i-1);
      }
    }
  }
  cout << ans << endl;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    multiset<int> s;
    for(int i=0; i<n; i++){
        int c;
        cin >> c;
        s.insert(c);
    }
    int ans = 1e9;
    auto left = s.begin();
    auto right = s.begin();
    for(int i=0; i<k-1; i++) right++;
    while(right != s.end()){
        ans = min(ans, *right - *left);
        left++;
        right++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
int main(void){
    char s[10];
    scanf("%s",s);
    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
        printf("Yes\n");
        return 0;
    }
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int n, a, s, g;

typedef pair<string, int> Edge;
typedef vector< vector<Edge> > Graph;
int gg[41][41];
Graph G;

main(){
	while(cin >> n >> a >> s >> g, n){
		Graph G(n);
		memset(gg, 0, sizeof(gg));
		REP(i, a){
			int u, v;
			string sp;
			cin >> u >> v >> sp;
			gg[u][v] = 1;
			G[u].emplace_back(sp, v);
		}
		REP(i, n){
			sort(ALL(G[i]));
			gg[i][i] = 1;
		}
		REP(k, n)REP(i, n)REP(j, n) gg[i][j] |= gg[i][k] & gg[k][j];
		
		set<Edge> pq;
		pq.insert(Edge("", s));
		Edge S;
		while(!pq.empty()){
			S = *(pq.begin());pq.erase(pq.begin());
			if(S.second == g || S.first.size() > 6*n) break;
			FOR(e, G[S.second]){
				if(gg[e->second][g]) pq.insert(Edge(S.first + e->first, e->second));
			}
		}
		cout << (S.second == g ? S.first : "NO") << endl;
	}
	return 0;
}

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

void solve(std::string S)
{
    long long ans = 0;
    for (size_t i = 0; i < S.size() - 1; i++)
    {
        if (S[i] != S[i + 1])
        {
            ans++;
        }
    }
    cout << ans << endl;
}

int main()
{
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<iomanip>

using namespace std;

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

	vector<double> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];
	
	double X = 0;

	for (int i = 0; i < N; i++)
		X = X + (1 / A[i]);
	
	cout << setprecision(10) << 1 / X << endl;

	return 0;
}

Measured memory_bytes: 256