akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main extends Thread implements Runnable {
	public static void main(String[] args) {

		Main main = new Main();
		main.run();
	}

	@Override
	public void run() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (A == 0) {
			if (B == 100) {
				System.out.println(B + 1);
			} else {
				System.out.println(B);
			}
		} else {
			if (B == 100) {
				if (A == 1) {
					System.out.println(B * 100 + 100);
				} else if (A == 2) {
					System.out.println(B * 100 + 1000000);
				}
			} else {
				if (A == 2) {
					System.out.println(B * 10000);
				} else {
					System.out.println(B * 100);
				}
			}
		}

	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
}
int main() 
{  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--)
    {
      
      string s;
      cin>>s;
      sort(s.begin(),s.end());
      if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]&&s[0]!=s[3])
      cout<<"Yes";
      else
      cout<<"No";
      
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define eps 1e-9
#define oo 1e7+5

using namespace std;

typedef unsigned long long ull;
typedef vector<pair<int,pair<int,int>>> dirgraph;
typedef vector<vector<int>> graph;

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);

	int n;
	cin>>n;

	vector<int> ans(n);
	int temp=0;
	for(int i=0;i<n;i++){
		cin>>ans[i];
		temp=temp^ans[i];
	}
	for(int i=0;i<n;i++){
		cout<<(temp^ans[i])<<" ";
	}
	cout<<endl;
	
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll n;
  cin >> n;
  vll c(n);
  REP(i, n){
    cin >> c[i];
    c[i]--;
  }

  vll dp(n+1,0);
  dp[0] = 1;
  vll color(2*1e5+1,-1);
  REP(i, n){
    ll x = color[c[i]];
    if(x == -1){
      dp[i+1] = dp[i];
    }
    else{
      if(x==i-1)
        dp[i+1] = dp[i];
      else
        dp[i+1] = (dp[x+1]+dp[i])%MOD;
    }

    color[c[i]] = i;
  }

  cout << dp[n] << endl;

}


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

#define ll long long
#define ld long double
#define ull unsigned long long
#define endl "\n"
#define MohamedMotaz ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);

using namespace std;
ll mod = 1e9 + 7;
const ll N = 1e5 + 7;


ll arr[N];
ll fact[1000001]; ll inv[1000001];
ll primes[100007];
ll modPower(ll b, ll p) {
	if (p == 0)
		return 1;

	ll halfpow = modPower(b, p / 2);
	ll toReturn = (halfpow * halfpow) % mod;
	if (p % 2)
		toReturn = (toReturn * b) % mod;

	return toReturn;
}


void pre(ll n) {

	fact[0] = 1;
	inv[0] = 1;

	for (ll i = 1; i <= n; i++) {
		fact[i] = (i * fact[i - 1]) % mod;
		inv[i] = modPower(fact[i], mod - 2);
		arr[i] = modPower(i, mod - 2);
	}
}

ll ncr(ll n, ll r) {
    return ((((fact[n] * inv[n - r]) % mod) * inv[r]) % mod);
}


int main() {
    MohamedMotaz;
	pre(N);
    ll x, k; cin >> x >> k;
	 
    for (int i = 1; i <= x; i++) {
        cin >> arr[i];
    }
	sort(arr + 1, arr + x + 1);
	ll ans = 0;
	for (int i = 1; i <= x; i++) {
		
		if (i >= k) {
			//cout << "max: " << arr[i] << " " << ncr(x, k - 1) << endl;
			ans += ((arr[i] % mod) * (ncr(i - 1, k - 1) % mod) % mod);
		}
		if (i <= x - k + 1) {
			//cout << "min: " << arr[i] << " " << ncr(x, k - 1) << endl;
			ans -= ((arr[i] % mod) * (ncr(x - i, k - 1) % mod) % mod);
		}

	}
	cout << ans % mod;
}



















Measured memory_bytes: 3968
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W = map(int, readline().split())
    G = [readline().strip() for _ in range(H)]

    G = [row for row in G if row != '.' * W]
    G = list(''.join(row) for row in zip(*G))
    G = [row for row in G if row != '.' * len(row)]
    G = list(''.join(row) for row in zip(*G))

    print(*G, sep='\n')

    return


if __name__ == '__main__':
    main()


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	ll n,K;cin>>n>>K;
	cout<<min(n%K,K-n%K)<<endl;
}

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

int main(void)
{
  string s;
  cin >> s;
  int flag=0;
  for(int i=0; i<100; i++){
    //if(s[i]
    if(i==s.length()) break;
    if(flag==0 && s[i]=='C')++flag;
    if(flag==1 && s[i]=='F'){
	++flag;
	break;
    }
  }
  cout << (flag==2 ? "Yes" : "No") << endl;
  
  return 0;
}



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

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

using namespace std;

typedef pair<char, int> P;

string s;
vector<P> x;

int main(){
	cin >> s;
	rep(i, s.size()){
		if(x.empty() || x.back().first != s[i]){
			x.push_back(P(s[i], 1));
		}
		else{
			++x.back().second;
		}
	}
	int ans = 0;
	rep(i, (int)x.size() - 2){
		P& a = x[i];
		P& b = x[i + 1];
		P& c = x[i + 2];
		if(a.first == 'J' && b.first == 'O' && c.first == 'I'){
			if(a.second >= b.second && c.second >= b.second){
				ans = max(b.second, ans);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12432
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
#define next _next
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 100010
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}


int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

vi g[N];
int vis[N],sz=0,a[N],dfn[N],low[N],s[N],top,cnt;
void dfs(int u){
    vis[u]=1;
    a[sz++]=u;
    for(auto v:g[u]){
        if(!vis[v]){
            dfs(v);
            return;
        }
    }
}

int main(){
    //freopen("A.in","r",stdin);
    //freopen("B.out","w",stdout);
    //cout<<setprecision(9)<<fixed;
    int T,i,j,k,ca=0,m,K,n;
    scanf("%d%d",&n,&m);
    rep(i,0,m){
        scanf("%d%d",&j,&k),j--,k--;
        g[j].pb(k),g[k].pb(j);
    }
    rep(i,0,n)if(!vis[i]&&SZ(g[i])==1){
        sz=0;dfs(i);
        printf("%d\n",sz);
        rep(i,0,sz){
            printf("%d ",a[i]+1);
        }
        puts("");return 0;
    }
    rep(i,0,n)if(!vis[i]){
        sz=0;dfs(i);
        reverse(a,a+sz);
        sz--;
        dfs(i);
        printf("%d\n",sz);
        rep(i,0,sz){
            printf("%d ",a[i]+1);
        }
        puts("");return 0;
    }
    //cerr<<clock()*1./CLOCKS_PER_SEC<<"ms\n";
    return 0;
}

Measured memory_bytes: 7040
/*input
1 30
3 5 10 30
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int cnt[maxn];
int main()
{
	IOS;
	int n,m;
	cin>>n>>m;
	REP(i,n){
		int t;
		cin>>t;
		while(t--){
			int tmp;
			cin>>tmp;
			cnt[tmp-1]++;
		}
	}
	int ans=0;
	REP(i,m) if(cnt[i]==n) ans++;
	cout<<ans<<'\n';
	return 0;
}


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

using namespace std;

#define N 200

int n,m,ans,f[N][N][N],g[N][N][N];
char s[N][N];

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i){
		scanf("%s",s[i]+1);
	}
	for (int l=n;l;--l){
		for (int r=l;r<=n;++r){
			for (int h=m;h;--h){
				if (l==r||(s[l][h]==s[l+1][h]&&f[l+1][r][h]>h)){
					if (h+1<=m&&s[l][h]==s[l][h+1]){
						f[l][r][h]=f[l][r][h+1];
					}
					else{
						f[l][r][h]=h+1;
					}
				}
				else{
					f[l][r][h]=h;
				}
			}
		}
	}
	while (f[1][n][1]<m){
		for (int l=n;l;--l){
			for (int r=l;r<=n;++r){
				for (int h=m;h;--h){
					g[l][r][h]=f[l][r][h]<=m?f[l][r][f[l][r][h]]:m;
					if (l<r){
						int mn=l,mx=r-1;
						while (mn<=mx){
							int mid=(mn+mx)>>1;
							g[l][r][h]=max(g[l][r][h],min(f[l][mid][h],f[mid+1][r][h]));
							if (f[l][mid][h]>f[mid+1][r][h]) mn=mid+1;
							else mx=mid-1;
						}
					}
				}
			}
		}
		memcpy(f,g,sizeof f);
		++ans;
	}
	printf("%d\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 62464
# C - Coloring Colorfully

s = str(input())

odd0 = 0
odd1 = 0
even0 = 0
even1 = 0

for i in range(len(s)):
    if i%2==0:
        if int(s[i])%2==0:
            even0 += 1
        else:
            even1 += 1
    else:
        if int(s[i])%2==0:
            odd0 += 1
        else:
            odd1 += 1

print(min(even0+odd1, even1+odd0))



Measured memory_bytes: 3188
#include <stdio.h>
const int MAX_V = 1000000; // 100???????????????????f???????¢\????°???¬?????
int prime[MAX_V+1] ,cnt[MAX_V+1] = {0};
int main(){
		int k,i,n; // 1????????f???????C0????????f????????????????????¢
	for(i = 2; i <= MAX_V; i++) {
		prime[i] = 1; // 2???????£????f????????????°??????¨
	}
	for(i = 2; i <= MAX_V; i++) {
		cnt[i] = cnt[i-1];
		//printf("")
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0; // ???f??????2???{???????£????{?????????f????????????????????¢
			}
			cnt[i]++;
		}
	}
	while(scanf("%d",&n) != EOF){
		printf("%d\n",cnt[n]);
	}
	return 0;
}

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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

int N;

i64 res = 0;
i64 solve(i64 s, bool is7, bool is5, bool is3) {

  if (s > N) return 0;

  res += (is7 && is5 && is3);

  solve(s * 10 + 7, true, is5, is3);
  solve(s * 10 + 5, is7, true, is3);
  solve(s * 10 + 3, is7, is5, true);

  return res;
}

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

  input(N);

  outl(solve(0, false, false, false));

  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc061/tasks/abc061_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k, a, b, sum = 0, ans = 0;
    cin >> n >> k;
    vector<pii> v;
    REP(i, n) {
        cin >> a >> b;
        v.push_back({a, b});
    }
    sort(ALL(v));
    REP(i, n) {
        a = v[i].first;
        b = v[i].second;
        if (sum < k && k <= sum + b) {
            ans = a;
            break;
        }
        sum += b;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int x, y;
    cin >> x >> y;

    vector<int> A = {1, 3, 5, 7, 8, 10, 12};
    vector<int> B = {4, 6, 9, 11};

    int cntA = 0;
    for (int i = 0; i < A.size(); i++)
    {
        if (A[i] == x || A[i] == y)
        {
            cntA++;
        }
    }

    int cntB = 0;
    for (int i = 0; i < B.size(); i++)
    {
        if (B[i] == x || B[i] == y)
        {
            cntB++;
        }
    }

    if (cntA == 2 || cntB == 2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.io.*;
public class Main{
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] S = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String[] T = br.readLine().split(" ");
		int count = 0;
		for(int i = 0; i < q; i++) {
			for(int j = 0; j < n; j++) {
				if (Integer.parseInt(S[j]) == Integer.parseInt(T[i])) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 27068
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define int long long


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

    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i ++){
        cin >> a.at(i);
    }

    for(int i = 0;i < n;i ++){
        a.at(i) -= (i+1);
    }

    sort(a.begin(),a.end());

    int mid = a.at(n/2);

    for(int i = 0;i < n;i ++){
        a.at(i) -= mid;
    }

    int ans = 0;
    for(int i = 0;i < n;i ++){
        ans += abs(a.at(i));
    }

    cout << ans << endl;
}

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

int main() {
	string w;
	cin>>w;
	sort(w.begin(),w.end());
	bool yes=false;
	if(w.size()%2==0){
		for(int i=1;i<w.size();i+=2){
			yes=true;
			if(w.at(i-1)!=w.at(i)){
				yes=false;
				break;
			}
		}
	}
	if(yes)cout<<"Yes\n"s;
	else cout<<"No\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
typedef long long ll;

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define MAX_INT 100000
#define MOD 1000000007



void solve()
{
    ll n,m;cin>>n>>m;
    ll ans=n%m;
    cout<<min(ans,m-ans);
}
    
int main()
{
    IOS;
    
    //ll t;cin>>t;while(t--)
        solve();
 
    return 0;
}

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

int main()
{
    string X;
    cin >> X;
    
    if(X >= "SSS"){
        cout << "0" << endl;
    }else if(X >= "SSR"){
        cout << "1" << endl;
    }else if(X >= "SRS"){
        cout << "1" << endl;
    }else if(X >= "SRR"){
        cout << "2" << endl;
    }else if(X >= "RSS"){
        cout << "1" << endl;
    }else if(X >= "RSR"){
        cout << "1" << endl;
    }else if(X >= "RRS"){
        cout << "2" << endl;
    }else if(X >= "RRR"){
        cout << "3" << endl;
    }
    return 0;
}

Measured memory_bytes: 3548
S=str(input())

acgt=False
length=0
maxlen=0
for i in S:
  if acgt:
    if i=="A" or i=="G" or i=="C" or i=="T":
      length += 1
    else:
      maxlen = max(maxlen, length)
      acgt = False
  else:
    if i=="A" or i=="G" or i=="C" or i=="T":
      length = 1
      acgt = True
    else:
      continue
if acgt:
  maxlen = max(maxlen, length)

print(maxlen)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int k[m],a[m][20];
  for(int i=0;i<m;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
      cin>>a[i][j];
    }
  }
  int p[m],ans=0;
  for(int i=0;i<m;i++) cin>>p[i];

  for(int bit=0;bit<(1<<n);bit++){
    int light=0;
    for(int i=0;i<m;i++){
      int cnt=0;
      for(int j=0;j<k[i];j++){
        if(bit&(1<<a[i][j]-1)) cnt++;
      }
      if(p[i]==0&&cnt%2==0) light++;
      if(p[i]==1&&cnt%2==1) light++;
    }
    if(light==m) ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var aho = Console.ReadLine().Split();
    var a = long.Parse(aho[1]);
    var n = long.Parse(aho[0]);
    var b = long.Parse(aho[2]);
    long amari = n%(a+b);
    long set = (n-amari)/(a+b)*a;
    long nokori = 0;
    if(amari < a){
      nokori = amari;
    }
    else{
      nokori = a;
    }
    Console.WriteLine(set+nokori);
  }
}
 

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

using LL = long long;

LL S (int n) {
        return 1LL * n * (n+1) / 2;
}
int main () {
        int n, k; cin >> n >> k;
        vector <LL> a(n);
        vector <double> b(n);
        for (int i = 0; i < n; ++i) cin >> a[i];
        for (int i = 0; i < n; ++i) b[i] = 1.0 * S(a[i]) / a[i]; 
        for (int i = 1; i < n; ++i) b[i] += b[i-1];
        double Max = b[k-1]; int pos = 0;
        for (int i = k; i < n; ++i) if (b[i] - b[i-k] > Max) Max = b[i] - b[i-k], pos = i-k+1;
        printf ("%.10lf\n",Max);
        return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>
#define INF 10000
using namespace std;
int n;
int c[100][100],mi[100];
bool ud[100];
int pr(){
  int r=0;
  while(1){
    int v=-1;
    for(int u=0;u<n;++u){
      if(!ud[u]&&(v==-1||mi[u]<mi[v])) v=u;
    }
    if(v==-1)break;
    ud[v]=true;
    r+=mi[v];
    for(int u=0;u<n;++u) mi[u]=min(mi[u],c[v][u]);
  }
  return r;
}
int main(){
  int m,x,y,z;
  while(scanf("%d",&n)&&n){
    for(int i=0;i<n;++i){
      mi[i]=INF;ud[i]=false;
      for(int j=0;j<n;++j) c[i][j]=INF;
    }
    scanf("%d",&m);
    while(m--){
      scanf("%d,%d,%d",&x,&y,&z);
      c[y][x]=c[x][y]=z/100-1;
    }
    mi[0]=0;
    printf("%d\n",pr());
  }
  return 0;
}

Measured memory_bytes: 1068
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;
int main() {
  int n, x[100], ans = 1000000000, sum;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  for (int i = 0; i <= 100; i++) {
    sum = 0;
    for (int j = 0; j < n; j++) {
      sum += (i - x[j]) * (i - x[j]);
    }
    ans = min(ans, sum);
  }
  printf("%d\n", ans);
}

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

int main(int argc, char *argv[]) {
	std::string bigint1;
	std::string bigint2;

	std::cin >> bigint1;
	std::cin >> bigint2;

	bool greater(false);
	bool equal(false);

	if (bigint1.size() > bigint2.size()) {
		// 桁数が多ければ、GREATER
		greater = true;
	} else if (bigint1.size() < bigint2.size()) {
		// 桁数が少なければ、LESS
		greater = false;
	} else if (bigint1.size() == bigint2.size()) {
		// 桁数が同じなら、ひと桁ずつ比較
		for (int i = 0; i < bigint1.size(); i++) {
			if (bigint1[i] == bigint2[i]) {
				equal = true;
				continue;
			}
			if (bigint1[i] > bigint2[i]) {
				greater = true;
				equal = false;
				break;
			}
			if (bigint1[i] < bigint2[i]) {
				greater = false;
				equal = false;
				break;
			}
		}
	} else {
		std::abort();  // 上記以外の状態はありえない
	}

	if (equal) {
		std::cout << "EQUAL" << std::endl;
	} else if (greater) {
		std::cout << "GREATER" << std::endl;
	} else {
		std::cout << "LESS" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <vector>
#include <cmath>

typedef long long ll;

int N, Y;

int main() {
  cin >> N >> Y;
  Y /= 1000;
  
  for (int z = 0; z <= N; z++) {
    int all = N - z, max_y = 10 * all;
    if (max_y < Y - z) continue;
    if ((max_y - Y + z) % 5 != 0) continue;
    if ((max_y - Y + z) / 5 > all) continue;
    int x, y;
    x = all - (max_y - Y + z)/5;
    y = (max_y - Y + z)/5;
    cout << x << " " << y << " " << z << endl;
    return 0;
  }
  
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
  
  
}

Measured memory_bytes: 256
p=0
N,K=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
L=list()
L_append = L.append
for i in range(N):
  if i<K:
    if s[i]=="r":
      p+=c
      L_append(i)
    elif s[i]=="s":
      p+=a
      L_append(i)
    else:
      p+=b
      L_append(i)
  else:
    if s[i]=="r" and s[i-K]!="r":
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]!="s":
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]!="p":
      p+=b
      L_append(i)
    if s[i]=="r" and s[i-K]=="r" and i-K not in L:
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]=="s" and i-K not in L:
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]=="p" and i-K not in L:
      p+=b
      L_append(i)
print(p)

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

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

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

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


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
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];
    }
};

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

    int n; cin >> n;
    v<int> d(n); rep(i,n) cin >> d[i];
    int ans = 0;
    for (int i = 0; i < n; ++i){
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()
ans = 0
for i in range(1 << (len(s) - 1)):
    a = 0
    for j in range(len(s)):
        if (i >> j) & 1 == 1: 
            continue          
        ans += int(s[a:j + 1]) 
        a = j + 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
	string migi = "yuiophjklnm";
	string hidari = "qwertasdfgzxcvb";
	string s;
	int count;
	int i,j;
	int t; /* 0 右　１左 */

	
	while(1){

		cin >> s;
		if(s=="#") break;
		
		t = -1;
		count = 0;
		for(i=0;i<s.length();i++){
			
			
			for(j=0;j<migi.length();j++) {
				
				if (s[i]==migi[j]) {
					if (t==1) {
						
						count++;
						t=0;
						break;
					}
					else if( t==-1){
	//					cout << "a";
						t=0;
						break;
					}
					else break;
				}
			}
	//		cout << j  << endl;
			if (j==migi.length()){
				if (t==0) {
	//				cout << "b";
					count++;
					t=1;
				}
				else if(t==-1) {
					t=1;
				}
			}

		}
			

		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
std::vector<std::vector<long long>> comb(int n, int r) {
	std::vector<std::vector<long long>> v(n + 1, std::vector<long long>(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n,y;
	cin >> n>> y;
	for (ll i = 0; i <= n; i++) {
		for (ll k = 0; k <= n; k++) {
			if (n - (i + k) < 0)break;
			if (y == pow(10, 4) * i + 5 * pow(10, 3) * k + pow(10, 3) * (n - (i + k))) {
				return cout << i << " "<< k << " " << n - i - k << endl,0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	s := IOInitialize()
	N := Int(s)
	reds := scanStrings(s, N)
	M := Int(s)
	blues := scanStrings(s, M)
	m := map[string]int{}
	for _, red := range reds {
		if _, ok := m[red]; ok {
			m[red]++
		} else {
			m[red] = 1
		}
	}
	for _, blue := range blues {
		if _, ok := m[blue]; ok {
			m[blue]--
		}
	}
	maxNum := 0
	for _, v := range m {
		if v > maxNum {
			maxNum = v
		}
	}
	fmt.Println(maxNum)
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func String(s *bufio.Scanner) string {
	if !s.Scan() {
		panic("scan error")
	}

	return s.Text()
}

func scanStrings(s *bufio.Scanner, len int) (strs []string) {
	for i := 0; i < len; i++ {
		str := String(s)
		strs = append(strs, str)
	}
	return
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
	string S, T;
	cin >> S;
	cin >> T;
	int n = S.size();
	int m = T.size();
	vector<int> numSA(n + 1,0);
	vector<int> numSB(n + 1,0);
	vector<int> numTA(m + 1,0);
	vector<int> numTB(m + 1,0);
	int nA = 0;
	int nB = 0;
	for (int i = 0; i < n; i++) {
		if (S[i] == 'A') {
			nA++;
		}
		else {
			nB++;
		}
		numSA[i + 1] = nA;
		numSB[i + 1] = nB;

	}
	nA = 0;
	nB = 0;
	for (int i = 0; i < m; i++) {
		if (T[i] == 'A') {
			nA++;
		}
		else {
			nB++;
		}
		numTA[i + 1] = nA;
		numTB[i + 1] = nB;

	}
	int q;
	cin >> q;
	vector <string> res(q);
	int a, b, c, d;
	for (int i = 0; i < q; i++) {
		cin >> a >> b >> c >> d;
		if (abs(numSA[b] - numSA[a - 1] - (numSB[b] - numSB[a - 1])-(numTA[d] - numTA[c - 1] - (numTB[d] - numTB[c - 1])))%3==0){
			res[i] = "YES";
		}
		else {
			res[i] = "NO";
		}
	}
	for (int i = 0; i < q; i++) {
		cout << res[i] << endl;

	}
	
	return 0;
}

Measured memory_bytes: 9344
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

const int MX = 1301082;
bool sieve[MX];

void makeSieve() {
    memset(sieve, false, sizeof sieve);
    sieve[0] = sieve[1] = true;
    for (int i=2; i*i<MX; ++i) {
        if ( ! sieve[i]) {
            for (int j=i*i; j<MX; j+=i) {
                sieve[j] = true;
            }
        }
    }
}

int main() {
    makeSieve();
    int N, P;
    while (cin >> N >> P, N != -1) {
        vector<int> primes;
        for (int i=N+1; (int)primes.size()<P; ++i) {
            if ( ! sieve[i]) {
                primes.push_back(i);
            }
        }
        vector<int> sum;
        for (int i=0; i<(int)primes.size(); ++i) {
            for (int j=i; j<(int)primes.size(); ++j) {
                sum.push_back(primes[i] + primes[j]);
            }
        }
        sort(sum.begin(), sum.end());
        cout << sum[P-1] << endl;
    }
    return 0;
}

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

using namespace std;

#define ll long long
#define M 1005000
#define ii pair<ll, ll>
#define fi first
#define se second
#define pb push_back

ll n, a[M], b[M], c[M], sum;

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin >> n;
    for (int i = 1; i < n; i++) cin >> b[i];
    b[n] = b[n - 1], b[0] = b[1];
    for (int i = n; i > 0; i--) sum += min(b[i], b[i - 1]);
    cout << sum;
    
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,i,c=0,ans=0;string S;cin>>N>>S;
  REP(i,N)if(S[i]=='R')c++;
  REP(i,c)if(S[i]=='W')ans++;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3724
#include<cstdio>
const int P=200002,N=2003,M=1000000007;
typedef long long ll;
int n,i,j,a[P],b[P],f[N*2][N*2],fac[N*4],Ans;
void init(){
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",a+i,b+i);
		f[N-a[i]][N-b[i]]++;
	}
	fac[0]=1;
	for(i=1;i<N*4;i++)
		fac[i]=1ll*i*fac[i-1]%M;
}
ll ksm(ll x,int p){
	ll s=1;
	while(p){
		if(p&1)
			s=s*x%M;
		p>>=1;
		x=x*x%M;
	}
	return s;
}
ll inv(int x){
	return ksm(x,M-2);
}
void work(){
	for(i=1;i<N*2;i++)
		for(j=1;j<N*2;j++)
			f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%M;
	for(i=1;i<=n;i++){
		Ans=(Ans+f[N+a[i]][N+b[i]])%M;
		Ans=(Ans+M-fac[a[i]*2+b[i]*2]*inv(fac[a[i]*2])%M*inv(fac[b[i]*2])%M)%M;
	}
	printf("%d",Ans*inv(2)%M);
}
int main(){
	init();
	work();
	return 0;
}

Measured memory_bytes: 64384
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#include <queue>
#define LL long long
#define N 100005
#define maxn 10005
#define INFINITY 0x3f3f3f3f
#define mase(a,b) memset(a,b,sizeof(a))
#define MIN(a,b) (a<b?a:b)
#define MAX(a,b) (a>b?a:b)
#define DS DisputeSegement
using namespace std;
struct DisputeSegement
{
    int x,y;

}SENode[N];
bool Cmp(DS A,DS B)
{
    if(A.y!=B.y)
    {
        return A.y<B.y;
    }
    else
    {
        return A.x<B.x;
    }
}
int main()
{
    int n,m;
    int miny=INFINITY;
    int re;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d %d",&SENode[i].x,&SENode[i].y);
        miny=MIN(miny,SENode[i].y);
    }
    sort(SENode,SENode+m,Cmp);
    re=1;
    for(int i=0;i<m;i++)
    {
        if(SENode[i].x>=miny)
        {
            re++;
            miny=SENode[i].y;
        }

    }
    printf("%d\n",re);
    return 0;
}


Measured memory_bytes: 4576
#include<iostream> 
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main(){	
	int d,n;
	cin>>d>>n;
	int a=1;
	for(int i=0;i<d;i++){
		a=a*100;
	}
	cout<<(n+(n==100))*a;
    return 0;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <stack>
#include <set>
#include <vector>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INF = 987654321;
const double EPS = 1e-10;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
    return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
    os<<'[';
    rep(i,a.size()) os<<(i?" ":"")<<a[i];
    return os<<']';
}

int G[20][20];
int dp[20][20];
int V;

void warshall_floyd() {
    rep(k, V) rep(i, V) rep(j, V) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}


int main() {
    int n; cin >> n;
    int m; cin >> m;
    rep(i, 20) rep(j, 20) G[i][j] = INF;
    rep(i, m) {
        int a, b, c, d; scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        G[a - 1][b - 1] = c;
        G[b - 1][a - 1] = d;
    }
    int x1, x2, y1, y2; scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);

    V = n;
    rep(i, n) rep(j, n) dp[i][j] = G[i][j];
    //rep(i, n) dp[i][i] = 0;

    warshall_floyd();
    cout << y1 - dp[x1 - 1][x2 - 1] - dp[x2 - 1][x1 - 1] - y2 << endl;

    return 0;
}

Measured memory_bytes: 1244
def resolve():
    n = int(input())
    c = [int(input()) for i in range(n)]
    lac = [-1]* 200010
    dp = [0]*n

    dp[0] = 1
    lac[c[0]] = 0
    for i in range(1, n):
        if c[i] == c[i-1]:
            dp[i] = dp[i-1]
        elif lac[c[i]] == -1:
            dp[i] = dp[i-1]
        else:
            dp[i] = dp[i-1] + dp[lac[c[i]]]
        lac[c[i]] = i
    print(dp[n-1]%(10**9+7))
resolve()

Measured memory_bytes: 791904
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        //int n = int.Parse(Console.ReadLine());
        int[] nab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine((nab[2] - nab[1]) % 2 == 0 ? "Alice" : "Borys");
    }
}

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

#define ll long long int
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vl>
#define vvi vector<vi>
#define pb push_back
#define P pair<ll,ll>
#define mp make_pair
#define F first
#define S second
#define rep(i,n) for(ll i=0; i<n; i++)
#define Sort(v) sort(v.begin(), v.end())
#define all(v) v.begin(),v.end()

ll mo = 1000000007;
ll MO = 998244353;

ll modpower(ll a, ll b, ll mod){
	ll ans = 1;
	if(b == 0){
		return 1;
	}
	if(b%2 == 1){
		ans = a;
	}
	ll x = modpower(a,b/2,mod)%mod;
	ans *= (x*x)%mod;
	ans %= mod;
	return ans;
}

void pri(vl a){
	for(auto i:a)
		cout<<i<<" ";
	cout<<endl;
}

//-------------------------------------------------------------------------------

void solve(){
	ll n; cin>>n;
	string s; cin>>s;
	int i = 0, j = n-1;
	ll ans = 0;
	while(i<j){
		if(s[i]=='R'){
			i++; continue;
		}
		if(s[j]=='W'){
			j--; continue;
		}
		ans++;
		i++; j--;
	}
	cout<<ans<<endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	int nt = 1;
	// cin>>nt;
	while(nt--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,k;
	cin >> a >> b >> c >> k;
	int m[3]={a,b,c};
	sort(m,m+3);
	for(int i=0;i<k;i++)
		m[2] *= 2;
	cout << m[0]+m[1]+m[2];
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(int(i) for i in input().split())
count = 0
while not all(height==0 for height in h):
    index = [i for i,x in enumerate(h) if not x==0]
    for i in range(len(index)):
        h[index[i]] -= 1
        if not i==0:
            if index[i]-index[i-1]>1:
                count += 1
    count += 1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second
using namespace std;
int gcd(int a, int b);
  
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
  
    return (y%2 == 0)? p : (x * p) % m;
}
ll modInverse(int a, int m)
{
    int g = gcd(a, m);
   
    {
        // If a and m are relatively prime, then modulo inverse
        // is a^(m-2) mode m
      
             return power(a, m-2, m);
    }
}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
 /*  ll n,k;
    cin>>n>>k;
    ll a[100005]={0};
    fore(i,0,n)cin>>a[i];
    ll p[100005]={0};
    p[0]=a[0];
    for(ll i=1;i<n;i++)
    {
        p[i]=p[i-1]+a[i];
    }
    ll ans=0,m=0;
    for(ll i=1;i<n;i++)
    {
        ll l,r;
        l=1;ll mid;
        r=i;
        while(l<=r)
        {
             mid=(l+r)>>1;
            ll sum=p[i]-p[mid-1];
            ll d=i-mid+1;
            if(a[i]*d-sum<=k && d>ans)
            {
                r=mid-1;
                ans=d;
                m=a[mid];
                cout<<a[i]<<endl;
            }
            else
            {
                l=mid+1;
            }
        }
        
    }
    cout<<ans<<" "<<m<<endl;*/
 int32_t main()
{
    Need_for_speed(activated);
//    satisfy
//    {}
    string a,b;
    cin>>a>>b;
    ll aa,bb;
    cin>>aa>>bb;
    string c;cin>>c;
    if(a==c)aa--;
    else bb--;
    cout<<aa<<" "<<bb<<endl;
    
    return 0;
    }



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


// Modint
struct Mint {
	static const ll mod = (ll)(1e9 + 7);
	ll val;

	Mint() { val = 0; }
	Mint(ll a) { val = a; verify_value(); }

	void verify_value() {
		if (val >= mod) val %= mod;
		if (val < 0) val %= mod, val += mod;
	}

	Mint pow(ll p) const {
		Mint cur = Mint(val), ret = 1;
		while (p > 0) {
			if (p & 1) ret *= cur;
			cur *= cur;
			p >>= 1LL;
		}
		return ret;
	}
	Mint inv() const {
		if (val == 0) cerr << "WARNING: inv() is called with 0." << endl;
		return pow(mod - 2);
	}

	Mint operator+() const { return *this; }
	Mint operator-() const { return Mint(mod - val); }

	Mint operator+=(const Mint &a) {
		val += a.val;
		if (val >= mod) val -= mod;
		return Mint(val);
	}
	Mint operator*=(const Mint &a) {
		val *= a.val;
		if (val >= mod) val %= mod;
		return Mint(val);
	}
	Mint operator-=(const Mint &a) { return *this += -a; }
	Mint operator/=(const Mint &a) { return *this *= a.inv(); }

	Mint operator++() { return *this += Mint(1); }
	Mint operator--() { return *this -= Mint(1); }
	Mint operator++(int) {
		Mint ret = *this;
		++(*this);
		return ret;
	}
	Mint operator--(int) {
		Mint ret = *this;
		--(*this);
		return ret;
	}

	operator ll() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
	ll ret = a.val + b.val;
	if (ret >= Mint::mod) ret -= Mint::mod;
	return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
	ll ret = a.val * b.val;
	if (ret >= Mint::mod) ret %= Mint::mod;
	return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

ostream &operator<<(ostream &out, const Mint &a) { return out << a.val; }
istream &operator>>(istream &in, Mint &a) {
	in >> a.val;
	a.verify_value();
	return in;
}

Mint pow(Mint a, ll b) {
	return a.pow(b);
}


int main() {
	string s; cin >> s;
	int n = s.size();
	vector<vector<Mint>> dp(n + 2, vector<Mint>(2));
	dp[0][1] = 1;
	for (int i = 0; i < n; i++) {
		dp[i + 1][0] += Mint(3)*dp[i][0];
		if (s[i] == '0') {
			dp[i + 1][1] += dp[i][1];
		}
		else {
			dp[i + 1][0] += dp[i][1];
			dp[i + 1][1] += Mint(2)*dp[i][1];
		}
	}
	cout << dp[n][0] + dp[n][1] << endl;
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>

using namespace std;

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    while(1){
        c -= b;
        if(c<=0)break;
        a -= d;
        if(a<=0)break;
    }

    if(a <= 0)cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#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--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int A[N];
    REP(i, N){
        cin >> A[i];
    }

    REP(i, N-K){
        if(A[i] < A[K+i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 4412
import java.util.Scanner;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(); 
        int[] a = new int[x];
        for(int i = 0 ; i < x ; i++){
            a[i] = sc.nextInt();
        }
        System.out.print(a[x-1]);
        for(int i = 1 ; i < x ; i++){
            System.out.print(" "+a[x-i-1]);
        }
        System.out.println();
    }
}


Measured memory_bytes: 26280
import java.util.Scanner;

public class Main {
	static String s = "";

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int R = sc.nextInt();

		int ans = R;
		if(N < 10) {
			ans = R + 100 * (10 - N);
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void)
{
  int n, m, c;
  scanf("%d %d %d", &n, &m, &c);
  int b[101], a[101][101];
  rep(i, 0, m) scanf("%d", &b[i]);
  rep(ni, 0, n)
  {
    rep(mi, 0, m) scanf("%d", &a[ni][mi]);
  }

  int ans = 0;
  rep(ni, 0, n)
  {
    int sum = c;
    rep(mi, 0, m)
    {
      sum += a[ni][mi] * b[mi];
    }
    if (sum > 0)
      ans++;
  }

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
#define ll long long
const int Q=5005;
ll f[Q][Q];
int p[Q];
int main()
{
	int n;
	ll a,b;
	scanf("%d%lld%lld",&n,&a,&b);
	for(int i=1;i<=n;i++)
		scanf("%d",&p[i]);
	for(int i=1;i<=n;i++){
        f[i][p[i]]=998244353;
        for(int j=p[i];j;--j)
            f[i][j]=f[i-1][j]+a,f[i][p[i]]=min(f[i][p[i]],f[i-1][j]);
        for(int j=p[i]+1;j<=n;j++)
            f[i][j]=f[i-1][j]+b;
    }
    ll als=100000000000000000LL;
    for(int j=1;j<=n;j++)
        als=min(als,f[n][j]);
    printf("%lld\n",als);
	return 0;
}


Measured memory_bytes: 195712