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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%llu",&n)
#define ull             unsigned long long
#define endll           pf("\n")
#define pf              printf
#define PI              acos(-1.0)
#define eps             1e-12
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define MOD  1000000007
#define mod1 1000000009
#define var    int i,j,c=0,t,l,r,mid,z=0,k,x,y

//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};
//int dx[4]={1,-1,0,0};  //4 direction
//int dy[4]={0,0,1,-1};
ll int n,m;

int main()
{
    ll var;
    sfl(n);
    z=0;
    for(i=3;i<=n;i+=3)
    {
        z+=i;
    }
    for(i=5;i<=n;i+=5)
    {
        z+=i;
    }
    for(i=15;i<=n;i+=15)
    {
        z-=i;
    }
    z=(n*(n+1))/2-z;
    cout<<z<<endl;
}


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

int main(){
  int N, M, C, a;
  int i,j,sum,count;
  cin >> N >> M >> C;
  vector<int> b(M);
  for(i=0;i<M;i++) cin >> b[i];
  for(i=0;i<N;i++){
    sum = C;
    for(j=0;j<M;j++){
      cin >> a;
      sum += b[j]*a;
    }
    if(sum > 0) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "Yes" : "No"));}
//----------------------------------------------------------------
#define bitrep(i, n)     for(ll i=0; i<(ll) (1<<n); i++)
#define bis(i, j)        i & (1<<j)

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

  ll ans=s.size()/2;
  rep(i,s.size()){
    if(s[i]=='p') ans--;
  }

  prt(ans);
}


Measured memory_bytes: 512
using System;

class Program
{
   static void Main(string[] args)
   {
      string[] input = Console.ReadLine().Split(' ');
      int r = int.Parse(input[0]) * 100;
      int g = int.Parse(input[1]) * 10;
      int b = int.Parse(input[2]);
      int num = r + g + b;

      Console.WriteLine((num % 4 == 0) ? "YES" : "NO");
   }
   
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int 

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, Y;
    cin >> X >> Y;
    int ans = 0;
    while(X <= Y) {
        X *= 2;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    int M, D;
    cin >> M >> D;
    int ans = 0;
    for (int i=1;i<=M;i++) for (int j=1;j<=D;j++) {
        int d1 = j % 10, d10 = j / 10;
        if (d1 > 1 && d10 > 1 && d1 * d10 == i) ans++;        
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

int main() {

	int N;
	cin >> N;

	vector<string> S(N, "");
	bool jdg = true;

	cin >> S[0];
	for (int i = 1; i < N; i++) {
		cin >> S[i];
		if (S[i - 1].substr(S[i - 1].length() - 1, 1) != S[i].substr(0, 1)) {
			jdg = false;
		}
	}

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

	for (int i = 0; i < N - 1; i++) {
		if (S[i] == S[i + 1]) {
			jdg = false;
		}
	}
	
	if (jdg == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}



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

int main() {
  int N; cin >> N;
  vector<string> s(N);
  vector<int> t(N);
  for (int i = 0; i < N; i++) cin >> s.at(i) >> t.at(i);
  string X; cin >> X;

  int ans = 0;
  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (flag) ans += t.at(i);
    if (s.at(i) == X) flag = true;
  }
  cout << ans << endl;
}

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

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return

#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define repd(i,a,b) for (ll i = (a); i >= b; i--)
#define repdz(i,a) for (ll i = a; i >=0; i--)
#define trav(a, x) for (auto& a : x)

#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define llin(a) ll a; cin>>a;
#define llin2(a,b) ll a,b; cin >>a>>b;
#define llin3(a,b,c) ll a,b,c; cin>>a>>b>>c;
#define full(v) v.begin(),v.end()

void solve()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(true)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes";
            return;
        }
        a -= d;
        if (a <= 0)
        {
            cout << "No";
            return;
        }

    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    //llin(t);
    //while (t--)
    //{
        solve();
    //}
}


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

#define ll long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define all(v) (v).begin(), (v).end()

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

    ll n, m;
    ll sum = 0, t;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        cin >> t;
        sum += t;
    }
    if (sum > n)
        cout << -1;
    else
        cout << n - sum;
}

Measured memory_bytes: 3652
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){
    
    int n,k;
    cin >> n>>k;
    cout << n-k+1<<endl;
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
import sys

num = 10**6
li = [0]*num
for k in a:
    li[k-1] += 1

i=2
while i<=num:
    if sum([li[k*i-1] for k in range(1,num//i+1)])>1:
        break
    i+=1
else:
    print("pairwise coprime")
    sys.exit()

import math
import functools
g = functools.reduce(math.gcd,a)
if g==1:
    print("setwise coprime")
    sys.exit()

print("not coprime")


Measured memory_bytes: 218980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;

// union_find
struct UnionFind {
    vector<ll> par; 
    vector<ll> rank;
    UnionFind(ll N) : par(N), rank(N, 1LL) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
    }

    void init(ll N){
        par.resize(N);
        rank.assign(N, 1LL);
        for(ll i = 0; i < N; i++) par[i] = i;
    }
    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); 
        ll ry = root(y); 
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (rank[rx] < rank[ry]){
            par[rx]=ry;
        }else{
            par[ry]=rx;
            if(rank[rx]==rank[ry])rank[rx]++;
        }
    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};




int main(){
    ll N, M;
    cin>>N>>M;
    vector<ll> P(N);
    rep(i, N){
    cin>>P[i];
    P[i]--;
}
vector<ll> X(M), Y(M);
rep(i, M){
    cin>>X[i]>>Y[i];
    X[i]--; Y[i]--;
}
    UnionFind uf(N);
    rep(i, M){
        uf.unite(X[i], Y[i]);
      	//if(uf.same(X[i], Y[i]))cout<<'!';
    }
    ll Ans=0;
    rep(i, N){
        if(uf.same(i, P[i]))Ans++;
      	//cout<<uf.root(i)/*<<" "<<uf.root(P[i])*/<<endl;
      	//cout<<uf.rank[i]<<endl;
    }
    cout<<Ans<<endl;
}

Measured memory_bytes: 4224
X = int(input())

items = [100 + i for i in range(6)]

def check(X):
	prices = [False for x in range(X)]
	prices[0] = True
	for item in items:
		while True:
			changed = False
			
			for i in range(X):
				if prices[i]:
					price = item + i
					if price == X:
						return True
					elif price < X and prices[price] == False:
						prices[price] = True
						changed = True
			
			if not changed:
				break
	return False

if check(X):
	print("1")
else:
	print("0")


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

using namespace std;

int dp[200010];
vector<int> v[26];

int main() {
  string s;
  cin >> s;
  int k = 1, m = 26;

  bool used[26] = {};
  dp[s.size() - 1] = 1;

  for(int i = s.size() - 1; i >= 0; --i) {
    used[s[i] - 'a'] = true;
    bool res = true;
    for(int j = 0; j < m; j++) res &= used[j];
    if(res) {
      k++;
      fill(used,used+26,false);
    }
    dp[i] = k;
    v[s[i] - 'a'].push_back(i);
  }
  for(int i = 0; i < m; i++) sort(v[i].begin(),v[i].end());

  int idx = 0;

  string ans = "";

  while(k > 0) {
    if(k == 1) {
      for(int i = 0; i < m; i++) {
	if(lower_bound(v[i].begin(),v[i].end(),idx) == v[i].end()) {
	  ans += (char)(i + 'a');
	  break;
	}
      }
      break;
    }

    for(int i = 0; i < m; i++) {
      int nxt = *lower_bound(v[i].begin(),v[i].end(),idx);

      if(lower_bound(v[i].begin(),v[i].end(),idx) != v[i].end() && dp[idx] == dp[nxt + 1] + 1) {
	ans += (char)(i + 'a');
	idx = nxt + 1;
	k--;
	break;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
char a[8005];
int dx[2][16005],dy[2][16005];
vector<int>vx,vy;
int main(){
	int x,y;
	scanf("%s%d%d",a,&x,&y);
	int n=strlen(a),f=0;
	int t=0;
	for(int i=0;i<n;i++){
		if(f){
			if(a[i]=='T'){
				if(f&1)vy.pb(t);
				else vx.pb(t);
				f++;
				t=0;
			}
			else t++;
		}
		else{
			if(a[i]=='F')x--;
			else f++;
		}
	}
	if(f&1)vy.pb(t);
	else vx.pb(t);
	dx[0][8000+x]=dy[0][8000+y]=1;
	for(int i=0;i<vx.size();i++){
		for(int j=0;j<=16000;j++)dx[(i+1)%2][j]=0;
		for(int j=0;j<=16000;j++){
			if(0<=j+vx[i]&&j+vx[i]<=16000)dx[(i+1)%2][j+vx[i]]|=dx[i%2][j];
			if(0<=j-vx[i]&&j-vx[i]<=16000)dx[(i+1)%2][j-vx[i]]|=dx[i%2][j];
		}
	}
	for(int i=0;i<vy.size();i++){
		for(int j=0;j<=16000;j++)dy[(i+1)%2][j]=0;
		for(int j=0;j<=16000;j++){
			if(0<=j+vy[i]&&j+vy[i]<=16000)dy[(i+1)%2][j+vy[i]]|=dy[i%2][j];
			if(0<=j-vy[i]&&j-vy[i]<=16000)dy[(i+1)%2][j-vy[i]]|=dy[i%2][j];
		}
	}
	printf("%s",dx[vx.size()%2][8000]&&dy[vy.size()%2][8000]?"Yes":"No");
}

Measured memory_bytes: 512
n,m=map(int,input().split())
if  n<=2 and m<=2:
    if n==m==1:
        print(1)
    else:
        print(0)
elif n==1 or m==1:
    print(max(n,m)-2)
elif n==2 or m==2:
    print(0)
else:
    print((n-2)*(m-2))

Measured memory_bytes: 9096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] c = new int[10][10];
		int[][] a = new int[h][w];
		for (int i=0; i<10 ;i++) {
			for (int j=0; j<10 ;j++) {
				c[i][j] = sc.nextInt();
			}
		}
		for (int i=0; i<h ;i++) {
			for (int j=0; j<w ;j++) {
				a[i][j] = sc.nextInt();
			}
		}
		sc.close();
		//入力終了

		//最短経路処理
		for(int k = 0; k < 10; k++) {
		    for(int i = 0; i < 10; i++) {
		    	    for (int j = 0; j < 10; j++) {
		    	    	    c[i][j] = Math.min(c[i][j], c[i][k] + c[k][j]);
		    	    }
		   }
		}

		//本処理
		int total =0;
		for (int i=0; i<h ;i++) {
			for (int j=0; j<w ;j++) {
				if (a[i][j] == -1) {
					continue;
				} else {
					total += c[a[i][j]][1];
				}
			}
		}
		System.out.println(total);
	}

}


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

int main()
{
    int h,w,n;
    std::cin >> h >> w >> n;

    int mx = std::max(h,w);

    int ans = 0;
    for (ans = 0; 0 < n; ans++) {
        n-=mx;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;


string S;
int judge, i;

int main() {
	cin >> S;
//	for (i = 0; i < N; i++)
	//	cin >> a[i];
	for (i = 0; i < 3; i++) {
		if (S[i] == S[i + 1])
			judge = 1;
	}


	if (judge == 1)
		cout << "Bad" << endl;
	else
		cout << "Good";
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
between = [x[i] - x[i-1] - 1 for i in range(1,m)]
between.sort(reverse=True)
print(max(0, (x[-1] - x[0] + 1) - sum(between[:n-1]) - n))

Measured memory_bytes: 13968
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
//    bool ans =
//    cout << (ans? "Yes" : "No") << endl;
}

Measured memory_bytes: 3196
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N;
    cin >> N;
    cout << N * 800 - N / 15 * 200 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,d,w,h,i,j,k,l,m,n,y,z;
	ll		ans = INFL;
	string	s;
	cin >> n >> k;

	vector<ll>	x(n+1),sum(n+1,0),sk(n+1);
	c = 0;
	for(i=1;i<=n;i++) cin >> x[i];
	if (x[1]<0) {
		c = -x[1];
		for(i=1;i<=n;i++) x[i] += c;
	}

	for(i=1;i<=n-k+1;i++) sk[i] = x[i+k-1]-x[i];
	//for(i=1;i<=n;i++) cout << sk[i] << ' ';cout << endl;
	for(i=1;i<=n-k+1;i++) sk[i] += min(abs(x[i]-c),abs(x[i+k-1]-c));
	//for(i=1;i<=n;i++) cout << sk[i] << ' ';cout << endl;
	for(i=1;i<=n-k+1;i++) ans = min(ans , sk[i]);
	cout << ans << endl;
	return 0;
}


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

int main(){
  string S;
  cin>>S;
  vector<bool> count(26,true);
  for (int i=0;i<S.size();i++){
    count.at(S.at(i)-'a')=false;
  }
  for (int i=0;i<26;i++){
    if (count.at(i)){
      cout<<(char)('a'+i)<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}

Measured memory_bytes: 512
using System;

class P
{
public static void Main()
{
int a;
            int b;
            int c = 0;

            for (a = 1; a <= 9; a++)
            {
                for (b = 1; b <= 9; b++)
                {
                    c = a * b;
                    Console.WriteLine(a + "x" + b + "=" + c);
                }
            }}
}

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

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define mp(a, b) make_pair(a, b)
#define __builtin_popcount __builtin_popcountll

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

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
    os << "[";
    for (const auto &it : t) {
        if (it != t.begin()) os << ",";
        os << it;
    }
    os << "]";
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const set<T> &t) {
    os << "{";
    for (const auto &it : t) {
        if (it != t.begin()) os << ",";
        os << it;
    }
    os << "}";
    return os;
}

template<class S, class T>
ostream &operator<<(ostream &os, const map<S, T> &t) {
    os << "{";
    for (const auto &it : t) {
        if (it != t.begin()) os << ",";
        os << it;
    }
    os << "}";
    return os;
}

template<class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) { return os << "(" << t.first << "," << t.second << ")"; }

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

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


int T, n, m;

int main(int argc, char *argv[]) {
    ios::sync_with_stdio(false);
    cin >> n;
    string s[2];
    cin >> s[0] >> s[1];
    ll ans = 1;
    for (int i = 0; i < n; ++i) {
        if (s[0][i] == s[1][i]) {
            if (i == 0) ans *= 3;
            else {
                if (s[0][i - 1] == s[1][i - 1]) {
                    ans = ans * 2 % MOD;
                }
            }
        } else {
            if (i == 0) ans *= 6;
            else {
                if (s[0][i - 1] == s[1][i - 1]) {
                    ans = ans * 2 % MOD;
                } else {
                    ans = ans * 3 % MOD;
                }
            }
            i ++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// age ye mosh dp ro baze dashti dp tedad baz shodeye baste nashode yadet nare !!
/// joooob zadam
const int N=2e5+100;
ll a[N];
int32_t main(){
    ll n;
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    ll ans=0;
    for (int i=0;i<n;i++){
        if (a[i]==i+1){
            swap(a[i],a[i+1]);
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include<iostream>
#include <malloc.h>
#include <vector>
#include<queue>
#include <algorithm>

using namespace std;


int main(){
  long b,a,n;
  cin >> n >> a >> b;
  long s = a+b;
  long k  = n/s;
  long _k = n%s;
  long sum = k*a ;
  if(_k>=a) sum += a;
  else sum+=_k;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
// initialize: UnionFind UF(N)

class UnionFind {                                              // OOP style
private:
	vector<int> p, rank, setSize;
	// p = path toward the root of disjoint set; p[i] = i means it is root
	// rank = upper bound of the actual height of the tree; not reliable as accurate measure
	// setSize = size of each disjoint set

	int numSets;
public:
	UnionFind(int N) {
		setSize.assign(N, 1);
		numSets = N;
		rank.assign(N, 0);
		p.assign(N, 0);
		for (int i = 0; i < N; i++) p[i] = i;	// each belongs to its own set
	}

	int findSet(int i) {
		return (p[i] == i) ? i : (p[i] = findSet(p[i]));		// path compression: cut short of the path if possible
	}

	bool isSameSet(int i, int j) {
		return findSet(i) == findSet(j);
	}

	void unionSet(int i, int j) {
		if (!isSameSet(i, j)) {
			numSets--;
			int x = findSet(i), y = findSet(j);
			// rank is used to keep the tree short
			if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
			else {
				p[x] = y; setSize[y] += setSize[x];
				if (rank[x] == rank[y]) rank[y]++;
			}
		}
	}

	int numDisjointSets() {		// # of disjoint sets
		return numSets;
	}

	int sizeOfSet(int i) {		// size of set
		return setSize[findSet(i)];
	}
};


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

	string s;
	int a;
	cin >> s;
	a = stoi(s.substr(5, 2));
	if (a <= 4) cout << "Heisei\n";
	else cout << "TBD\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
  int a,b;
  cin >> a >> b;
  cout << max(a+b,max(a*b,a-b)) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    ll N;
    cin >> N;
    ll AB[2*N], A[N], B[N], Asum=0, Bsum=0;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
        AB[i*2] = A[i];
        AB[i*2+1] = B[i];
        Asum += A[i];
        Bsum += B[i];
    }

    ll ans = min(Asum, Bsum);

    sort(AB, AB+2*N);

    bool opt = false;
    for (int i = 0; i < N; i++) {
        if (A[i] < AB[N] && B[i] < AB[N]) {
            opt = true;
            break;
        }
    }

    ll tmp = 0;
    for (int i = 0; i < N; i++) {
        tmp += AB[i];
    }

    if (!opt) {
        for (int i = 0; i < N; i++) {
            ll t = tmp;
            if (AB[N] == max(A[i], B[i])) {
                t = t - min(A[i], B[i]) + AB[N+1];
            } else {
                t = t - min(A[i], B[i]) + AB[N];
            }

            ans = min(ans, t);
        }
    } else {
        ans = min(ans, tmp);
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3328
#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);

  string s;
  cin >> s;
  REP(i, s.size()){
    if(s[i] == ',')
      cout << " ";
    else
      cout << s[i];
  }

  cout << endl;
}


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

VVL G(100010);
VL color(100010, 0);

int main(){
    ll n; cin >> n;
    vector<P> inputs;
    rep(i,n-1){
        ll a,b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
        inputs.push_back(P(a,b));
    }

    ll k = 0;
    map<P,ll> rec;
    
    queue<ll> q;
    VL done(n+1,0);
    q.push(1);
    done[1] = 1;

    while(!q.empty()){
        ll v = q.front();
        q.pop();
        chmax(k, G[v].size());
        ll cur = 1;
        for(auto w : G[v]){
            if(done[w]) continue;

            if(cur == color[v]) cur++;
            rec[P(v,w)] = cur;
            rec[P(w,v)] = cur;
            color[w] = cur;
            cur++;

            q.push(w);
            done[w] = 1;
        }
    }

    cout << k << endl;
    for(auto p : inputs){
        cout << rec[p] << endl;
    }

    return 0;
}

Measured memory_bytes: 22128
#include <iostream>
using namespace std;
int main()
{
  int A, B;
  int coin = 0;
  cin >> A >> B;
  for(int i=0; i<2; ++i)
  {
    if(A>B)
    {
      coin += A; A--;
    }
    else
    {
      coin += B; B--;
    }
  }
  cout << coin << endl;
  return 0;
}


Measured memory_bytes: 256
import scala.io.Source.stdin

object Main extends App {
  def fold(a:IndexedSeq[Int]):Int = {
    if(a.length==1) a(0)
    else fold( {for(i<- 1 until a.length) yield (a(i)+a(i-1))%10 } )
  }
  stdin.getLines.foreach { s=>
    println(fold(s.map(_.asDigit)))
  }
}

Measured memory_bytes: 44240
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int H,W,K;cin >> H >> W >> K;
    --K;    // 0-index 化
    LL dp[110][10] = {0};           // 横線h段、0がkにくるものの数 dp[H][k]
    dp[0][0] = 1;

    rep(h,H){                       // 各行をすすむ
        rep(b,(1 << (W-1))){        // 行ごとにbit全探索
            // 横線チェック
            bool judge = true;
            rep(i,W-2) if((b >> i) % 4 == 3)judge = false;

            if(!judge)continue;

            // 各始点がどこに行くか求める
            int perm[W];
            rep(i,W)perm[i] = i;
            rep(i,W-1) if((b >> i) & 1)swap(perm[i],perm[i+1]);

            // 配る
            rep(i,W){
                dp[h+1][perm[i]] += dp[h][i];
                dp[h+1][perm[i]] %= MOD;
            }
        }

    }

    cout << dp[H][K] << endl;
}



Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
#増えるとしたら1,2,3..のように増加分は1ずつ
#減るとしたらnumになるとして、一つ前をnum-1にする!
if l[0]!=0:
  print(-1)
  exit()
ans=0
now=0
for i in range(1,n):
  if l[i]==1+now:
    now+=1
    ans+=1
  elif l[i]>now:
    print(-1)
    exit()
  else:
    now=l[i]
    ans+=l[i]
print(ans)

Measured memory_bytes: 11048
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
int n,k;
int d[10];
cin>>n>>k;
for(int i=1;i<10;i++) d[i]=0;
for(int i=0;i<k;i++){
	int t;
	cin>>t;
	d[t]=1;
}
while(1){
	int ch=0;
	int p=n;
	while(p){
		int x=p%10;
		if(d[x]==1) { ch=1;break;}
		p/=10;
	}
	if(ch==0)break;
	n++;
}
cout<<n<<endl;
    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string a,b,c;
    cin>>a>>b>>c;
    cout <<"A"<<b[0]<<"C"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b,penj,peng,perkal;
	scanf("%d",&a);
	scanf("%d",&b);
	
	penj=a+b;
	peng=a-b;
	perkal=a*b;
	
	if (penj >= peng && penj >= perkal) 
	printf("%d", penj);
	else if (peng >= penj && peng >= perkal){
		printf("%d", peng);
	}
	else {
		printf("%d", perkal);
	}
	return 0;
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> v(N);

    // input
    for (size_t i = 0; i < N; i++)
    {
        int value;
        cin >> value;
        v[i] = value;
    }

    int result = 0;
    int min = 1000000000;

    for (size_t i = 0; i < N; i++)
    {
        if (min >= v[i])
        {
            min = v[i];
            result++;
        }
    }

    cout << result << endl;
}

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

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;

    int res = 0;
    for (int i = 0; i < static_cast<int>(s.size()); i++) {
        if (s[i] != t[i]) {
            res++;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (long long i = 0; i < (long long)(n); i++)

#define ALL(x) (x).begin(),(x).end()

void solve(long long N, std::vector<long long> P, std::vector<long long> Q){
  long long psize = 0;
  long long qsize = 0;

  std::vector<long long> v = vector<long long>(N,0);
  std::iota(ALL(v), 1);

  long long pcount = 0;
  long long qcount = 0;
  bool piscount = true;
  bool qiscount = true;

  do {
    bool pall = true;
    bool qall = true;
    REP(i, N) {
       pall = pall && v[i] == P[i];
       qall = qall && v[i] == Q[i];
    }
    if(pall) piscount = false;
    if(qall) qiscount = false;

    if(piscount) pcount++;
    if(qiscount) qcount++;
  } while (std::next_permutation(ALL(v)));

  cout << abs(pcount - qcount) << endl;

  return;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<long long> P(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&P[i]);
  }
  std::vector<long long> Q(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&Q[i]);
  }
    solve(N, std::move(P), std::move(Q));
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	int n, q;
	cin >> n >> q;

	vector<queue<int>> que( n );
	while( q-- > 0 ) {
		int cmd, t, x;
		cin >> cmd >> t;

		if( cmd == 0 ) {
			cin >> x;
			que[t].push( x );
		}
		else if( cmd == 1 && que[t].size() ) {
			cout << que[t].front() << '\n';
		}
		else if( cmd == 2 && que[t].size() ) {
			que[t].pop();
		}
	}

	return 0;
}



Measured memory_bytes: 4304
#!/usr/bin/env python3
n, m = map(int, input().split())
e = [[*map(int, input().split())][1:] for _ in range(m)]
p = [*map(int, input().split())]

c = 0

for i in range(2**n):
    count = [0] * m
    for j in range(n):
        if i >> j & 1:
            for k in range(m):
                if j + 1 in e[k]:
                    count[k] = (count[k] + 1) % 2
    if count == p:
        c += 1
print(c)


Measured memory_bytes: 74168
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iomanip>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1ll << 60;

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

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

    int A, B, T;
    cin >> A >> B >> T;

    int rsl = T / A * B;
    cout << rsl << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/

int main()
{
	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll a, b, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string c, t;
    cin>>n>>c;
    l = 0, r = n-1;
    while (true) {
        while (l < r && c[l] == 'R') l++;
        while (l < r && c[r] == 'W') r--;
        c[l] = 'W';
        c[r] = 'R';
        if (l < r) ans++;
        else break;
        l++;
        r--;
    }
    cout<<ans<<endl;
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
#define MAX_B 1001001
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL
int d(int n){
    int count=0;
    while(n){
        n/=10;
        count++;
    }
    return count;
}
int main(){
    ll n;
    cin>>n;
    int mini=INF;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            int w=max(d(i),d(n/i));
            if(w<mini)mini=w;
        }
    }
    cout<<mini<<endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val S = readInputLine().toCharArray()
    
    for ((i, c) in S.withIndex()) {
        S[i] = ((c.toInt() - 'A'.toInt() + N) % ('Z'.toInt() - 'A'.toInt() + 1) + 'A'.toInt()).toChar()
    }
    
    println(S.joinToString(""))
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 34032
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    REP(i,M)cin >> p[i] >> S[i];
    vector<bool> aced(N,false);
    int ac = 0;
    int wa = 0;
    vector<int> watmp(N,0);
    REP(i,M){
        if(!aced[p[i]-1]){
            if(S[i].compare("WA")==0){
                watmp[p[i]-1] ++;
            }
            else if(S[i].compare("AC")==0){
                ac ++;
                wa += watmp[p[i]-1];
                watmp[p[i]-1] = 0;
                aced[p[i]-1] = true;
            }
        }
    }
    cout << ac << " " << wa << endl;
    return 0;
}

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

using namespace std;

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];

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

    for (string s : v) {
        cout << s;
    }
}


Measured memory_bytes: 3648
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long max = 1;
        int cnt = 1;
        long bef = A;
        for(int i=0;i<18;i++) max *= 10;
          //System.out.println(A + "," + B + "," + max);
        for (long i = bef + 1; i <= max; i++) {
            if (B < i ) break;
            if ( i >= 2*bef ) {
          //System.out.println("i = " + i);
              cnt++;
              bef = i;
              i *= 2;
              i--;
            }
        }
          System.out.print(cnt);
		
	}
}

Measured memory_bytes: 21972
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  ll m = max(a,b);
  m = max(m,c);

  for(int i=0;i<k;i++){
    m *= 2;
  }

  if(a>=b && a>=c) cout << m+b+c << endl;
  else if(b>=a && b>=c) cout << m+a+c << endl;
  else if(c>=a && c>=b) cout << a+b+m << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
 
int main()
{
    string s,t;
    cin >> s >> t;
    t.erase(t.size()-1);
    if (s == t)
    {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
	while ( u != NIL && k != u->key ) {
		if ( k < u->key ) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if ( u == NIL ) return;
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if ( u == NIL ) return;
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
}

int main() {
	int n, i, x;
	string com;
	
	scanf("%d", &n);
	
	for ( i = 0; i < n; i++ ) {
		cin >> com;
		if ( com[0] == 'f' ) {
			scanf("%d", &x);
			Node *t = NIL;
			t = find(root, x);
			if ( t != NIL ) printf("yes\n");
			else printf("no\n");
		} else if ( com == "insert" ) {
			scanf("%d", &x);
			insert(x);
		} else if ( com == "print" ) {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
	
	return 0;
}



Measured memory_bytes: 22080
#include <stdio.h>

int main() {
    int a,b,i;
    int sum;

   while(scanf("%d %d\n", &a,&b)!=EOF) {
        sum=a+b;
        for(i=0;sum!=0;i++){
            sum=sum/10;
       }
       printf("%d\n",i);
   }
    return 0;
}


Measured memory_bytes: 1968
#include <stdio.h>

void trace(int*,int);
void insertionSort(int*,int);

int main(){
  int N,i,j;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  trace(A,N);
  insertionSort(A,N);
  return 0;
}

void trace(int A[],int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

void insertionSort(int A[],int N){
  int j,i,v;
  for(i=1;i<N;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    trace(A,N);
  }
}


Measured memory_bytes: 2068
package main

import (
	"fmt"
)

func main() {
	var A, B, C int
	fmt.Scan(&A)
	fmt.Scan(&B)
	fmt.Scan(&C)

	m := max(A, B, C)

	A = m - A
	B = m - B
	C = m - C

	res := 0
	if (A + B + C) % 2 == 0 {
		res = (A + B + C) / 2
	} else {
		res = (A + B + C) / 2 + 2
	}

	fmt.Println(res)
}

func max(a, b, c int) int {
	abmax  := a
	if abmax < b {
		abmax = b
	}

	if abmax < c {
		return c
	} else {
		return abmax
	}
}

Measured memory_bytes: 512