akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
q = gets.chomp.split.map(&:to_i)
r = gets.chomp.split.map(&:to_i)
a = 0
b = 0
f = (1..n).to_a.permutation(n).to_a
f.each_with_index do |v,i|
  if v == q
    a = i
  end
  if v == r
    b = i
  end

end
puts (a - b).abs

Measured memory_bytes: 6780
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <limits>
#include <iomanip>
using namespace std;

int main(){

    int a, b;
    double x;

    cin >> a >> b >> x;

    double S;
    double h0;

    double angle;

    S = (double) x/a; h0 = (double) x/(a*a);


    if( S <= (double) a*b/2 ){

        double h1 = 2*S/b;
        angle = acos( (double) h1 / sqrt(h1*h1+b*b) );

    }else if( S > (double) a*b/2 ){

        double h2 = b - S/a;
        angle = acos( (double) a / sqrt(a*a+2*h2*2*h2) );

    }

    double pi = 3.14159265359;
    angle = angle * 180 / pi;
    cout << fixed << setprecision(10) << angle << endl;

}

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

ll gcd(ll a, ll b)
{
    ll x = a * b;
    ll temp = 0;
    if(a<b)
    {
        temp = a;
        a = b;
        b = temp;
    }

    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }

    return x / b;
}

int main()
{
    ll a, b;
    cin >> a >> b;

    cout << gcd(a, b) << endl;

    return 0;
}


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

#define read(x) scanf("%d",&x)

int n,m,q;
int ans=0;
int a[55],b[55],c[55],d[55];
int rt[15];

void dfs(int th)
{
	if(th==n)
	{
		int now=0;
		for(int i=1;i<=q;i++)
		{
			if(rt[b[i]]-rt[a[i]]==c[i]) now+=d[i];
		}
		ans=max(ans,now);
		return;
	}
	for(int i=rt[th];i<=m;i++)
	{
		rt[th+1]=i;
		dfs(th+1);
	}
	return;
}

int main()
{
	read(n),read(m),read(q);
	for(int i=1;i<=q;i++) read(a[i]),read(b[i]),read(c[i]),read(d[i]);
	for(int i=1;i<=m;i++)
	{
		rt[1]=i;
		dfs(1);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3840
#include "bits/stdc++.h"
    using namespace std;
    #define sim template < class c
    #define ris return * this
    #define dor > debug & operator <<
    #define eni(x) sim > typename \
      enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
    sim > struct rge { c b, e; };
    sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
    sim > auto dud(c* x) -> decltype(cerr << *x, 0);
    sim > char dud(...);
    struct debug {
    #ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
      ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
      *this << "[";
      for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
      ris << "]";
    }
    #else
    sim dor(const c&) { ris; }
    #endif
    };
    #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
     
    using ll = long long;
     
    template <typename T> void max_self(T& a, T b) {
        a = max(a, b);
    }
     
    // dp[n][m]
     
    bool first_row_or_column(pair<int,int> p) {
        return p.first == 0 || p.second == 0;
    }
     
    const int INF = 1e9 + 5;
     
    int main() {
        string a, b;
        cin >> a >> b;
        vector<vector<pair<int,pair<int,int>>>> dp(a.length() + 1,
            vector<pair<int,pair<int,int>>>(b.length() + 1, {-INF,{0,0}}));
        dp[0][0] = {0, {0,0}};
        // dp[i][j] - the max total length so far
        for(int i = 0; i < (int) a.length(); ++i) {
            for(int j = 0; j < (int) b.length(); ++j) {
                if(a[i] == b[j]) {
                    max_self(dp[i+1][j+1], make_pair(dp[i][j].first + 1, make_pair(i,j)));
                }
                max_self(dp[i+1][j], make_pair(dp[i][j].first, make_pair(i,j)));
                max_self(dp[i][j+1], make_pair(dp[i][j].first, make_pair(i,j)));
            }
        }
        pair<int,pair<int,int>> answer = {0,{0,0}};
        for(int i = 0; i <= (int) a.length(); ++i) {
            for(int j = 0; j <= (int) b.length(); ++j) {
                max_self(answer, make_pair(dp[i][j].first, make_pair(i, j)));
            }
        }
        string s;
        pair<int,int> cur = answer.second;
        while(!first_row_or_column(cur)) {
            int i = cur.first;
            int j = cur.second;
            pair<int,int> previous = dp[i][j].second; // a cell from which we came to (i,j)
            debug() << imie(cur) imie(previous);
            if(previous == make_pair(i - 1, j - 1)) {
                assert(a[i-1] == b[j-1]);
                s += a[i-1];
            }
            cur = previous;
        }
        //~ debug() << answer;
        reverse(s.begin(), s.end());
        cout << s << endl;
    }

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

#define INF (INT64_MAX)
#define MOD (1000000000+7)
#define MAX 10000

string K;
int D;

long long dp[MAX + 1][2][100];

int main() {
	cin >> K >> D;

	int n = K.size();
	dp[0][0][0] = 1;
	for( int i = 0; i < n; i++ ) {
		for( int j = 0; j < 2; j++ ) {
			for( int k = 0; k < D; k++ ) {
				int d = K[i] - '0';
				if( j ) {
					d = 9;
				}
				for( int l = 0; l <= d; l++ ) {
					dp[i + 1][j || l < d][(k + l) % D] += dp[i][j][k];
					dp[i + 1][j || l < d][(k + l) % D] %= MOD;
				}
			}
		}
	}
	long long ans = (dp[n][0][0] + dp[n][1][0] - 1 + MOD) % MOD;

	cout << ans << endl;

	return 0;
}


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

int main() {
  string S; cin>>S;
  if ((S[0]==S[1])&&(S[1]==S[2])) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}


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

int main()
{
	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
	#endif*/
	
	int n, l;
	int min = 1000;
	int sum = 0;

	cin >> n >> l;

	if(l > 0)
	{
		for(int i = l+1;i < l+n;i++)
			sum += i;
	}
	else if(l+n-1 < 0)
	{
		for(int i = l;i < l+n-1;i++)
		{
			sum += i;
		}
	}
	else
	{
		for(int i = l;i < l+n;i++)
			sum += i;
	}

	cout << sum;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<string>
using namespace std;
int main() {
	int n; cin >> n;
	long long sum = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}
	cout << sum << endl;
}

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

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

  string temp = S;
  string ans = "No";
  for (int i=0; i<S.size(); i++) {
    temp = temp.substr(S.size()-1, 1) + temp.substr(0, S.size()-1);
    if (T == temp) {
      ans = "Yes";
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


int main() {
  int n;
  cin >> n;
  vi a(n), b(n), c(n - 1);
  rep (i, n) {
    cin >> a[i];
    a[i]--;
  }
  rep (i, n) cin >> b[i];
  rep (i, n - 1) cin >> c[i];

  int ans = 0;
  rep (i, n) ans += b[i];
  
  rep (i, n - 1) {
    if (a[i + 1] == a[i] + 1) {
      ans += c[a[i]];
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    a -= 2*b;
    chmax(a, 0);
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

for v in iter(sys.stdin.readline,""):
    a,op,b = v.split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a/b)
    elif op == '?':
        break

Measured memory_bytes: 6440
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 100005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair <int,int> P;

ll n,m;
ll x[SIZE],y[SIZE];

int main()
{
	cin >> n >> m;
	rep(i,0,n)cin >> x[i];
	rep(i,0,m)cin >> y[i];
	ll s = 0;
	rep(i,1,n) {
		ll u = (x[i]-x[i-1])*i%MOD;
		(u *= (n-i)) %= MOD;
		(s += u) %= MOD;
	}
	ll t = 0;
	rep(i,1,m) {
		ll u = i*(m-i)%MOD;
		(u *= (y[i]-y[i-1])) %= MOD;
		t += u;
		t %= MOD;
	}
	(s *= t) %= MOD;
	cout << s << endl;

	return 0;
}


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

int sum(int n, int array[n])
{
    int data_sum = 0;
    for( int i = 0; i < n; i++){
        data_sum = data_sum + array[i];
    }
    return data_sum ;
}

        
        
int main()
{
    int N;
    scanf("%d", &N);
    int W[N];
    int total_sum, now_sum;
    int min;
    
    now_sum = 0;

    for(int i = 0; i < N; i++){
        scanf("%d", &W[i]);
    }

    total_sum = sum(N, W);
    //minは最大値からスタート
    min       = total_sum;
    
    for(int i = 0; i < N; i++){
        now_sum = now_sum + W[i];
        if(min > abs(now_sum - (total_sum - now_sum))){
            min = abs(now_sum - (total_sum - now_sum));
        }
        
    }
    printf("%d", min);
    
    
    return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline

H,W = map(int,input().split())

A = [list(map(int,input().split())) for i in range(H)]
B = [list(map(int,input().split())) for i in range(H)]

C = [[0]*W for i in range(H)]
M = 0

for h in range(H):
    for w in range(W):
        C[h][w] = abs(A[h][w] - B[h][w])
        
#print(C)

c = 80*(H+W-1)+1

DP = [[0]*W for j in range(H)]

for h in range(H):
    for w in range(W):
        if h==0 and w==0:
            DP[h][w] = 1 << (C[h][w]+c)
        elif h==0:
            DP[h][w] = (DP[h][w-1] << C[h][w]) | (DP[h][w-1] >> C[h][w])
        elif w==0:
            DP[h][w] = (DP[h-1][w] << C[h][w]) | (DP[h-1][w] >> C[h][w])
        else:
            DP[h][w] = (DP[h][w-1] << C[h][w]) | (DP[h][w-1] >> C[h][w]) | (DP[h-1][w] << C[h][w]) | (DP[h-1][w] >> C[h][w])

ans = float('inf')
now = DP[H-1][W-1]
tmpans = -c
while now != 0:
    if now%2==1:
        ans = min(ans,abs(tmpans))
    tmpans += 1
    now = now >> 1

print(ans)

Measured memory_bytes: 59228
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int k;
string s;
#include <cassert>
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    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) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);

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

  cin >> k >> s;

  mint ans = 0;
  int n = s.size();
  combination c(n + k);
  REP(i, k + 1) {
    mint now = mint(26).pow(k - i);
    now *= mint(25).pow(i);
    now *= c(i + n - 1, n - 1);
    ans += now;
  }

  cout << ans << endl;
}


Measured memory_bytes: 38776
#include<iostream>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;

int main() {
	int n, k, q;
	cin >> n >> k >> q;

	vector<int> a(q);
	for (int i = 0; i < q; i++) {
		cin >> a[i];
	}

	vector<int> ans(n, k - q);

	for (int i = 0; i < q; i++) {
		ans[a[i] - 1] += 1;
	}

	for (int i = 0; i < n; i++) {
		if (ans[i] > 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

vector<pint> to[100005];
int pos[100005];
bool ok = true;
void dfs(int now) {
    rep(i,to[now].size()) {
        int s = to[now][i].first, dis = to[now][i].second;
        if(pos[s]==INF) {
            pos[s] = pos[now] + dis;
            dfs(s);
        }
        else if(pos[s] != pos[now]+dis) ok = false;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m; cin >> n >> m;
    rep(i,m) {
        int l, r, d; cin >> l >> r >> d;
        l--; r--;
        to[l].push_back({r,d});
        to[r].push_back({l,-d});
    }
    rep(i,100005) pos[i] = INF;
    rep(i,n) {
        if(pos[i]==INF) {
            pos[i] = 0;
            dfs(i);
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0; 
}

Measured memory_bytes: 12032
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;

void solve(){
	int n;
	cin>>n;
	int p[n];
	rep(i,0,n){
		cin>>p[i];
	}
	int cnt=0;
	rep(i,1,n-1){
		if((p[i]>p[i-1]&&p[i]<p[i+1])||(p[i]<p[i-1]&&p[i]>p[i+1]))cnt++;
	}
	cout<<cnt<<endl;
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


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

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define pb push_back
#define ff first
#define ss second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

using ll = long long int;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
using pii = pair<int, int>;

const int inf = 1e9;
const ll infL = (ll) 1e18;
const int N = 100005;
const ll mod = (ll) 1e9 + 7;
const ll mod2 = 998244353LL;

int32_t main(){
	fio;
	
	int n;
	cin >> n;
	pii arr[n];
	
	for(int i = 0; i < n; i++){
		int u, v;
		cin >> u >> v;
		arr[i].ff = u;
		arr[i].ss = v;
	}
	int ans = 0;
	
	for(int i = 0; i <= n - 3; i++){
		if(arr[i].ff == arr[i].ss){
			if(arr[i + 1].ff == arr[i + 1].ss){
				if(arr[i + 2].ff == arr[i + 2].ss)
					ans = 1;
			}
		}
	}
	
	if(ans)
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';
    return 0;
}

/*

 */



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

using cat = long long;

cat pw(cat a, cat e, cat mod) {
	if(e <= 0) return 1;
	cat x = pw(a, e/2, mod);
	x = x * x % mod;
	return e&1 ? x * a % mod : x;
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int N, M;
	cin >> N >> M;
	vector<cat> invf(3*N+1, 1), inv2(N+1, 1), inv3(N+1, 1);
	for(int i = 1; i <= 3*N; i++) invf[i] = invf[i-1] * pw(i, M-2, M) % M;
	for(int i = 1; i <= N; i++) inv2[i] = inv2[i-1] * pw(2, M-2, M) % M;
	for(int i = 1; i <= N; i++) inv3[i] = inv3[i-1] * pw(3, M-2, M) % M;
	cat ans = 0;
	for(int k3 = 0; k3 <= N; k3++) for(int k2 = 0; k2 <= N-k3; k2++) {
		int k1 = 3*N-2*k2-3*k3;
		ans += inv2[k2] * inv3[k3] % M * invf[k1] % M * invf[k2] % M * invf[k3] % M;
		if(ans >= M) ans -= M;
	}
	for(int i = 1; i <= 3*N; i++) ans = ans * i % M;
	cout << ans << "\n";
}


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

using namespace std;
#define REPI(x) for(int i=0;i<x;i++)

int main ()
{
  long long A,B,C,D,lcm,res;
  
  cin >> A >> B >> C >> D;
  lcm = C * D / __gcd<long long> (C,D);
  res = (B/C - (A-1)/C) + (B/D - (A-1)/D) - (B/lcm - (A-1)/lcm);
  cout << B - A - res + 1 << endl;
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 //動画解答例写し
const int M=1000005;
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  vector<int>cnt(M);
  for(int x:a){
    if(cnt[x]!=0){
      cnt[x]=2;
      continue;
    }
    for(int i=x;i<M;i+=x)cnt[i]++;
  }
  int ans=0;
  for(int x:a){
    if(cnt[x]==1)ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 7988
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <bitset>
#include <string>
#include <cmath>
#include <set>
#include <map>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
#define RepE(i, x) for (int i = pos[x]; i; i = g[i].nex)
#define ev g[i].y
#define eps 1e-10
#define fr first
#define sd second
#define pb push_back
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
const int N = 100005, mod = 1000000007;
int n, m, a[N], b[N], ans = 1 << 30, fl;
ll sum;
int main()
{
	scanf ("%d", &n);
	Rep(i, 1, n) {
		scanf ("%d%d", &a[i], &b[i]);
		sum += a[i];
		fl |= (a[i] != b[i]);
		if (a[i] > b[i]) ans = min(ans, b[i]);
	}
	if (!fl) {
		puts("0");
		return 0;
	}
	cout << sum - ans << endl;

	return 0;
}

Measured memory_bytes: 384
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

r=k()
print(3*r**2)


Measured memory_bytes: 10400
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static long B;
  static long C;
  static double min = 9999999;
  static long ans = 0;




  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] map = new int[10];
    int a = scanner.nextInt();
    map[a] = 1;

    int b = scanner.nextInt();
    map[b] = 1;

    a = scanner.nextInt();
    map[a] = 1;
    a = scanner.nextInt();
    map[a] = 1;


    if(map[1] == 1 && map[7] == 1 && map[9] == 1 && map[4] == 1){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }


  }

}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

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

    ll m = X / 11;

    ll ans = m * 2LL;
    X -= 11LL * m;
    if (X > 0)
        ans++;
    if (X > 6)
        ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
#define MOD 1000000007

ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}

int main(){
    ll n,x,ans=0;cin>>n>>x;
    vector<ll> vec(n);
    For(i,n){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    ll i=0;
    while(x>0&&i<n){
        x-=vec.at(i);
        ans++;
        i++;
    }
    if(x!=0){
        ans--;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,k;
   cin>>n>>k;
   int a[n+1];
   rep(i,1,n+1)
   cin>>a[i];
   bool vis[n+1];
   memset(vis,false,sizeof(vis));
   int cnt=0;
   deque<int>v;
   int x=1;
   while(!vis[x])
   {
       vis[x]=true;
       x=a[x];
       v.pb(x);
       cnt++;
   }
   //debug(x);
   vi v1;
   int cnt1=0;
   while(v.front()!=a[x])
   {
       v1.pb(v.front());
       v.pop_front();
       cnt1++;
   }
   if(k<v1.size())
   {
       cout<<v1[k-1];
       return 0;
   }
   k-=cnt1;
   cnt=v.size();
   //debug(v);
   int rem=(k%(cnt));
   //debug(rem);
   if(v.size()==0)
   {
       cout<<1<<endl;
   }
   else
   {   if(rem)rem--;
       else
        rem=cnt-1;
       //debug(v);
       cout<<v[rem]<<endl;
   }


}


Measured memory_bytes: 8604
n = int(input())
aclist = [0,0,0,0] #ac,wa,tle,re
for i in range(n):
    ans = input()
    if ans == 'AC':
        aclist[0] +=1
    if ans == 'WA':
        aclist[1] +=1
    if ans == 'TLE':
        aclist[2] +=1
    if ans == 'RE':
        aclist[3] +=1
print('AC x '+str(aclist[0]))
print('WA x '+str(aclist[1]))
print('TLE x '+str(aclist[2]))
print('RE x '+str(aclist[3]))


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

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long sol = a * c;
    sol = max(sol, a * d);
    sol = max(sol, b * c);
    sol = max(sol, b * d);
    cout << sol; 
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<char, int>P;

int d1[100][100];
int d2[100][100];

int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		memset(d1, 0x3f, sizeof(d1));
		memset(d2, 0x3f, sizeof(d2));
		rep(i, n) {
			int a, b, cost, time;
			scanf("%d%d%d%d", &a, &b, &cost, &time);
			a--; b--;
			d1[a][b] = d1[b][a] = cost;
			d2[a][b] = d2[b][a] = time;
		}
		rep(k, m)rep(i, m)rep(j, m) {
			d1[i][j] = min(d1[i][j], d1[i][k] + d1[k][j]);
			d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
		}
		int k; scanf("%d", &k);
		rep(i, k) {
			int p, q, r;
			scanf("%d%d%d", &p, &q, &r);
			p--; q--;
			if (r)printf("%d\n", d2[p][q]);
			else printf("%d\n", d1[p][q]);
		}
	}
	return 0;
}

Measured memory_bytes: 3256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

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

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	A := getInt()
	B := getInt()

	out(A * B)

}


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

using namespace std;

               
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef LOCAL
	assert(freopen("input.txt", "r", stdin));
	#endif

	char c;
	cin >> c;
	if (c == 'A') cout << 'T';
	if (c == 'T') cout << 'A';
	if (c == 'C') cout << 'G';
	if (c == 'G') cout << 'C';
}



Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <vector>

using namespace std;

int main() {
  int h, w;
  cin >> h >> w;

  char table[h][w];
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) { cin >> table[y][x]; }
  }

  long dp[h][w];
  dp[0][0] = 1;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (!(y == 0 && x == 0) && table[y][x] == '.') {
        dp[y][x] = 0;
        if (y > 0 && table[y - 1][x] == '.') { dp[y][x] += dp[y - 1][x]; }
        if (x > 0 && table[y][x - 1] == '.') { dp[y][x] += dp[y][x - 1]; }
        dp[y][x] %= (int)(1e9 + 7);
      }
    }
  }

  cout << dp[h - 1][w - 1] << endl;
}



Measured memory_bytes: 9088
#include <stdio.h>

#define MAX_NUM 200000

int main(void) {
    int n, i, j, f =0, min = MAX_NUM;

    scanf("%d", &n);

    int p[n];
    int ans = 0;

    for (i = 0; i < n; i++) {
        scanf("%d", &p[i]);
        if (min > p[i]) {
            min = p[i];
        }
        if (min == p[i]) {
            ans++;
        }
    }

    printf("%d\n", ans);

    return 0;

}

Measured memory_bytes: 896
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 2e5 + 10, INF = 1e9 + 100, lg = 19;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		int x;
		cin >> x;
		if(x % 2 == 0 && x % 3 && x % 5){
			cout << "DENIED\n";
			return 0;
		}
	}
	cout << "APPROVED\n";
}


Measured memory_bytes: 256
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x * f;
}
int n,a[101];
///------------------head------------------
signed main(signed argc, char *argv[]){
	n=read(); rep(i,1,n) a[i]=read();
	int cur=a[1],ret=1,ans=0;
	rep(i,2,n){
		if (cur!=a[i]){
			//cerr << a[i] << "  " << ret << endl;
			cur=a[i];
			ans+=(ret)/2;
			ret=1;
		}
		else ++ret;
	}
	ans += ret / 2;
	cout << ans << endl;
	return 0;
}

/* Examples: */
/*

*/

/*

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    ll N,T,wa=0;
    cin >> N >> T;
    vector<ll> t(N);
    bool shower = false;
    
    for(ll i = 0;i < N;i++)
        cin >> t.at(i);
    
    for(ll i = 0;i < N;i++){
        if(i == 0){
            wa += T;
        }else if(t.at(i) - t.at(i-1) <= T){
            wa += t.at(i) -t.at(i-1);
        }else if(t.at(i) - t.at(i-1) > T){
            wa += T;
        }
    }

    cout << wa << endl;

    

}

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

namespace AOJHelloWorld1
{
    class Program
    {
        static void Main(string[] args)
        {

            for (int i = 1; i>0 ; i++)
            {
                int x = int.Parse(Console.ReadLine());
                if (x == 0) break;
                else
                {
                    Console.WriteLine("Case {0}: {1}", i, x);
                }

            }
        }
    }
}


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

void bubble_sort(pair<char,int> A[],int n){
    for(int i=0;i<n;i++){
        for(int j=n-1;j>i;j--){
            if(A[j].second<A[j-1].second)swap(A[j],A[j-1]);
        }
    }
    return;
}

void select_sort(pair<char,int> A[],int n){
    int minj;
    for(int i=0;i<n;i++){
        minj=i;
        for(int j=i;j<n;j++){
            if(A[j].second<A[minj].second)minj=j;
        }
        swap(A[i],A[minj]);
    }
    return;
}

bool is_stable(pair<char,int> A[],pair<char,int> B[],int n){
    bool ans=true;
    for(int i=0;i<n;i++)if(A[i]!=B[i]){ans=false;break;}
    return ans;
}

int main(){
    int n;
    cin>>n;
    pair<char,int> A[n],B[n];
    for(int i=0;i<n;i++){
        scanf(" %c%d",&A[i].first,&A[i].second);
        B[i]=A[i];
    } 
    bubble_sort(A,n);
    select_sort(B,n);
    for(int i=0;i<n;i++){
        if(i!=0)printf(" ");
        printf("%c%d",A[i].first,A[i].second);
    }
    printf("\nStable\n");
    for(int i=0;i<n;i++){
        if(i!=0)printf(" ");
        printf("%c%d",B[i].first,B[i].second);
    }
    printf("\n");
    if(is_stable(A,B,n))printf("Stable\n");
    else printf("Not stable\n");
}


Measured memory_bytes: 3208
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

struct UnionFind {
    vector<int> par, rank;

    UnionFind(int n) : par(n , -1), rank(n, 1) { }
    void init(int n) { par.assign(n, -1), rank.assign(n, 1); }

    int find(int x) {
        if (par[x] == -1) return x;
        else return par[x] = find(par[x]);
    }

    bool is_same(int x, int y) {
        return find(x) == find(y);
    }

    bool merge(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        rank[x] += rank[y];
        par[y] = x;
        return true;
    }

    vector<int> roots(){
        vector<int> d;
        rep(i,par.size()){
            if(par[i]<0) d.emplace_back(i);
        }
        return d;
    }

    int size(int x){
        return rank[find(x)];
    }

    int count_group(){
        return roots().size();
    }
};

int main(){
    ll h,w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    UnionFind uf(w*h);
    rep(i,h) rep(j,w){
        rep(k,4){
            int ny = i+dy[k];
            int nx = j+dx[k];
            if(0<=ny && ny<h && 0<=nx && nx<w && s[i][j]!=s[ny][nx]){
                uf.merge(i*w+j,ny*w+nx);
            }
        }
    }
    ll ans = 0;
    vector<vector<ll>> black(h,vector<ll>(w,0));
    vector<vector<ll>> white(h,vector<ll>(w,0));
    rep(i,h) rep(j,w){
        int r = uf.find(i*w+j);
        int x = r%w;
        int y = (r-x)/w;
        if(s[i][j]=='#'){
            black[y][x]++;
        }
        else{
            white[y][x]++;
        }
    }
    vector<int> d = uf.roots();
    rep(i,d.size()){
        if(uf.size(d[i])==1){
            continue;
        }
        int r = d[i]%w;
        int l = (d[i]-r)/w;
        ans += black[l][r]*white[l][r];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4864
/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


int main() {
	int n;
	int a[100];
	int cnt = 0;
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	
	for(int i=0; i<n; i++) {
		int mini = i;
		for(int j=i+1; j<n; j++) {
			if(a[j] < a[mini]) {
				mini = j;
			}
		}
		if(i != mini) {
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			cnt++;
		}
	}
	
	cout << a[0];
	for(int i=1; i<n; i++) {
		cout << " " << a[i];
	}
	cout << endl;
	cout << cnt << endl;
}



Measured memory_bytes: 3080
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    stack<char> q;
    q.push(s[0]);
    repi(i,n,1){
        if(!q.empty() && q.top() != s.at(i))q.pop();
        else q.push(s[i]);
    }
    cout << n - q.size() << endl;
    return 0;
}

Measured memory_bytes: 512
n = input()
c = 0
f = False

if n[0] == "R" and n[1]=="R":
  c=2
  f = True
if n[1] == "R" and n[2] == "R":
  c=2
  f = True

if n[1] == "R" and n[0] == "R" and n[2] == "R":
  c= 3
if f == False:
  if n.count("R") == 0:
    c = 0
  else:
    c = 1

print(c)

Measured memory_bytes: 9096
import java.util.*;
public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double sec = sc.nextInt();
    int num = sc.nextInt();
    double maxSec = sc.nextInt();
    sc.close();
    maxSec += 0.5;
    double mult = maxSec / sec;
    System.out.println((int)mult * num);
    }
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second
#define lwb lower_bound
#define upb upper_bound
#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in", "r", stdin);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n, k;
  cin >> n >> k;
  int ans = k;
  for (int i = 2; i <= n; i++) {
    ans *= k - 1;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
 
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }

const int MOD = 1e9 + 7;
int add(int x, int y)
{
    x += y;
    if (x >= MOD) x -= MOD;
    return x;
}
int sub(int x, int y)
{
    x -= y;
    if (x < 0) x += MOD;
    return x;
}
int mult(int x, int y)
{
    return x * (ll)y % MOD;
}
int bpow(int x, ll y)
{
    int res = 1;
    for (; y; y >>= 1)
    {
        if (y & 1)
        {
            res = mult(res, x);
        }
        x = mult(x, x);
    }
    return res;
}
int rev(int x)
{
    return bpow(x, MOD - 2);
}

const int N = 300005;
int fact[N], rfact[N];

int cnk(int n, int k)
{
    if (k > n)
        return 0;
    return mult(fact[n], mult(rfact[k], rfact[n - k]));
}

int grid(int n, int m)
{
    return cnk(n - 1 + m - 1, n - 1);
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif

    fact[0] = rfact[0] = fact[1] = rfact[1] = 1;
    for (int i = 2; i < N; ++i)
    {
        fact[i] = mult(fact[i - 1], i);
        rfact[i] = rev(fact[i]);
    }
    
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    int sum = 0;
    for (int i = 0; i < H - A; ++i)
    {
        sum = add(sum, mult(grid(B, i + 1), grid(H - i, W - B)));
    }
    cout << sum << '\n';

    return 0;
}



Measured memory_bytes: 2560
s = input()
t = input()
a = len(s) + 1
b = len(t) + 1

X = [[0] * b for _ in range(a)]
for i in range(1, a):
    for j in range(1, b):
        X[i][j] = max(X[i-1][j], X[i][j-1])
        if s[i-1] == t[j-1]:
            X[i][j] = max(X[i-1][j-1]+1, X[i][j])
        
# print(X)
ans = ""
i = a-1
j = b-1
while i > 0 and j > 0:
    if X[i][j] == X[i-1][j]:
        i -= 1
    elif X[i][j] == X[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1
        
print(ans)

Measured memory_bytes: 112732
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}

int main()
{
    ll n;
    while(cin >> n)
    {
        if(n == 3 || n== 5 || n==7)
            cout << "YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,K;
ll A[200010];

int main(){
    cin>>N>>K;
    for(ll i=0;i<N;i++) cin>>A[i];

    for(ll counter=0;counter<K;counter++){
        vector<ll> sum(N+1);
        for(ll i=0;i<N;i++){
            sum[max(0ll,i-A[i])]++;
            sum[min(N,i+A[i]+1)]--;
        }
        bool f=true;
        for(ll i=1;i<N;i++){
            sum[i]+=sum[i-1];
            if(sum[i]<N)f=false;
        }
        for(ll i=0;i<N;i++)A[i]=sum[i];
        if(f)break;
    }
    for(ll i=0;i<N;i++){
        cout<<A[i]<<" ";
    }cout<<endl;

    return 0;
}

Measured memory_bytes: 6752
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ABC118D
{
    class Program
    {
        private static readonly int[] requiredMatch = { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
        private int[] availableNumbers;
        private int count = 0;
        private Dictionary<int, string> cache = new Dictionary<int, string>();

        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().calc();
        }

        void calc()
        {
            var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = temp[0]; // マッチ棒の本数
            var m = temp[1]; // 使用可能な数字の種類数(使わない)
            availableNumbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Console.WriteLine(match(n));
        }

        string match(int remainingMatch)
        {
            if (++count % 10000 == 0)
            {
                Console.Error.WriteLine("計算：" + count);
            }

            if (cache.ContainsKey(remainingMatch))
            {
                return cache[remainingMatch];
            }

            var max = "0";

            foreach (int number in availableNumbers)
            {
                var candidate = "0";

                if (requiredMatch[number - 1] == remainingMatch)
                {
                    candidate = number.ToString();
                }
                else if (requiredMatch[number - 1] < remainingMatch)
                {
                    var next = match(remainingMatch - requiredMatch[number - 1]);

                    if (next != null)
                    {
                        candidate = number.ToString() + next;
                    }
                }

                if (isBigger(candidate, max))
                {
                    max = candidate;
                }
            }

            if (max != "0")
            {
                Console.Error.WriteLine(remainingMatch + " : " + max);
                cache.Add(remainingMatch, max);
                return max;
            }
            else
            {
                return null;
            }
        }

        bool isBigger(string a, string b)
        {
            if (a.Length > b.Length)
            {
                return true;
            }
            else if (a.Length < b.Length)
            {
                return false;
            }
            else
            {
                return (a.CompareTo(b) > 0);
            }
        }
    }
}


Measured memory_bytes: 98696