akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
using P = pair<i64, i64>;
vector<P> ps;
int main() {
  cin >> n;
  ps.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> ps[i].first >> ps[i].second;
  }

  i64 ans = 0;
  auto cmp_l = [&](int i, int j) {
    return ps[i].first < ps[j].first;
  };
  auto cmp_r = [&](int i, int j) {
    return ps[i].second > ps[j].second;
  };
  for (int d = 0; d < 2; ++d) {
    priority_queue<int, vector<int>, decltype(cmp_l)> pq_l(cmp_l);
    priority_queue<int, vector<int>, decltype(cmp_r)> pq_r(cmp_r);
    vector<bool> used(n);
    for (int i = 0; i < n; ++i) {
      pq_l.push(i);
      pq_r.push(i);
    }

    i64 x = 0, res = 0;
    int t = d;
    while (!pq_l.empty() && !pq_r.empty()) {
      if (t) {
        while (!pq_l.empty()) {
          int i = pq_l.top();
          pq_l.pop();
          if (!used[i]) {
            // cerr << ps[i].first << ' ' << ps[i].second << endl;
            i64 y = ps[i].first;
            if (x < y) {
              res += y - x;
              x = y;
            }
            used[i] = true;
            break;
          }
        }
      } else {
        while (!pq_r.empty()) {
          int i = pq_r.top();
          pq_r.pop();
          if (!used[i]) {
            // cerr << ps[i].first << ' ' << ps[i].second << endl;
            i64 y = ps[i].second;
            if (x > y) {
              res += x - y;
              x = y;
            }
            used[i] = true;
            break;
          }
        }
      }
      // cerr << x << endl;
      t = !t;
    }
    cerr << endl;
    res += abs(x);
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k;
long long mod=1000000007;
long long a[300000];
int zerocnt,negcnt,poscnt;
long long ans=1;
bool cmp(long long A,long long B){
	return abs(A)>abs(B);
}
int main(){
	//freopen("Check.txt","r",stdin);
	//freopen("ans.txt","w",stdout);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		if(a[i]==0) zerocnt++;
		if(a[i]<0) negcnt++;
		if(a[i]>0) poscnt++;
		ans=ans*a[i];
		ans%=mod;
	}
	sort(a+1,a+1+n,cmp);
	if(n==k){
		while(ans<0) ans=ans+mod;
		ans%=mod;
		cout<<ans;
		return 0;
	}
	if(n-zerocnt<k){
		cout<<'0';
		return 0;
	}
	if(poscnt==0){
		if(k%2){
			if(zerocnt){
				cout<<'0';
				return 0;
			}
			ans=1;
			for(int i=n;n-i<k;i--){
				ans*=a[i];
				ans%=mod;
			}
			if(ans<0) ans+=mod;
			cout<<ans;
			return 0;
		}
		ans=1;
		for(int i=1;i<=k;i++){
			ans*=a[i];
			ans%=mod;
		}
		cout<<ans;
		return 0;
	}
	long long maxp=0,minn=-9999999999,maxn=0,minp=9999999999;
	//最大的没选的正数、最小的选了的负数
	//最大的没选的负数、最小的选了的正数
	for(int i=1;i<=k;i++){
		if(a[i]<0){
			minn=a[i];
		}
		if(a[i]>0){
			minp=a[i];
		}
	}
	for(int i=k+1;i<=n;i++){
		if(a[i]<0&&a[i]<maxn)
			maxn=a[i];
		if(a[i]>0&&a[i]>maxp)
			maxp=a[i];
	}
	long long ans1,ans2;
	bool flag1,flag2;
	flag1=flag2=true;
	ans=ans1=ans2=1;
	ans1*=maxp;
	ans2*=maxn;
	ans1%=mod;
	ans2%=mod;
	bool is_pos=true;
	for(int i=1;i<=k;i++){
		ans*=a[i];
		ans1*=a[i];
		ans2*=a[i];
		if(a[i]<0) is_pos=(!is_pos);
		if(a[i]==minn&&flag1){
			flag1=false;
			ans1=ans1/minn;
		}
		if(a[i]==minp&&flag2){
			flag2=false;
			ans2=ans2/minp;
		}
		ans%=mod;
		ans1%=mod;
		ans2%=mod;
	}
	if(is_pos){
		cout<<ans;
		return 0;
	}
	if(maxp==0||minn==-9999999999){
		cout<<ans2;
		return 0;
	}
	if(maxn==0||minp==9999999999){
		cout<<ans1;
		return 0;
	}
	minn=-minn;
	maxn=-maxn;
	long long tmp1,tmp2;
	tmp1=(long long)maxp*minp;
	tmp2=(long long)maxn*minn;
	if(tmp1>tmp2){
		cout<<ans1;
		return 0;
	}
	cout<<ans2;
	return 0;
}

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

const int N=309;
const int mod=1000000007;

int n,ans,i2;
int dp[N][N][N*2],d[N],fac[N*2],inv[N*2];

int quickpow(int x,int y){
	int s=1;
	for (;y;y>>=1,x=1ll*x*x%mod)
		if (y&1) s=1ll*s*x%mod;
	return s;
}

void init(){
	int i;
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for (i=2;i<=n+n;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n+n]=quickpow(fac[n+n],mod-2);
	for (i=n+n-1;i;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
}

void add(int &x,int y){
	x+=y;
	(x>=mod)?x-=mod:0;
}

int main(){
	int i,j,k;
	scanf("%d",&n);
	for (i=0;i<n;i++) scanf("%d",&d[i]);
	init();
	dp[0][0][0]=1;
	for (i=0;i<n;i++)
		for (j=0;j<=i;j++)
			for (k=0;k<=n+n;k++){
				if (!dp[i][j][k]) continue;
				add(dp[i+1][j][k],1ll*dp[i][j][k]*inv[d[i]-1]%mod);
				if (d[i]>=2&&k+d[i]-2<=n+n) add(dp[i+1][j+1][k+d[i]-2],1ll*dp[i][j][k]*inv[d[i]-2]%mod);
			}
	i2=quickpow(2,mod-2);
	for (j=3;j<=n;j++)
		for (k=0;k<=n+n;k++){
			if (!dp[n][j][k]) continue;
			if (j<n&&k==0) continue;
			if (j==n&&k==0){
				add(ans,1ll*dp[n][j][k]*i2%mod*fac[n-1]%mod);
				continue;
			}
			if (j<n) add(ans,1ll*dp[n][j][k]*k%mod*fac[j-1]%mod*fac[n-j-1]%mod*i2%mod);
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 223488
import java.util.*

fun main(args: Array<String>) = yorukatsu16d()

fun yorukatsu16d() {
    val k = readLine()!!.toInt()

    val queue = ArrayDeque((1..9L).toList())

    var curr = 1L

    repeat(k) {
        curr = queue.poll()
        val min = Math.max(curr % 10 - 1, 0)
        val max = Math.min(curr % 10 + 1, 9)
        (min..max).map { curr * 10 + it }.let { queue.addAll(it) }
    }

    val answer = curr

    println(answer)
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B;
string S[100];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	A--,B--;
	FOR(y,50) {
		S[y]=string(100,'#');
		FOR(x,100) if(y%2==0 && x%2==0 && A) S[y][x]='.', A--;
	}
	FOR(y,50) {
		S[y+50]=string(100,'.');
		FOR(x,100) if(y%2==1 && x%2==0 && B) S[y+50][x]='#', B--;
	}
	cout<<"100 100"<<endl;
	FOR(y,100) cout<<S[y]<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
N=int(input())
E=defaultdict(list)
for _ in range(N-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    E[u].append((v,w))
    E[v].append((u,w))
ans=[-1]*N

stack=[0]
ans[0]=0
while stack:
    node=stack.pop()
    for to,w in E[node]:
        if ans[to]!=-1: continue
        ans[to]=ans[node]^(w&1)
        stack.append(to)

for c in ans:
    print(c)

Measured memory_bytes: 79832
// BISMILLAHIR RAHMANIR RAHEEM
// ALLAH IS WATCHING ME
// ALLAH save us from COVID-19.Amin.

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp> //order_of_key return number of elements less than x, find_by_order return index (pointer use kora lgbe)

using namespace std;
using namespace __gnu_pbds;

#define ull    unsigned long long
#define ll     long long
#define ios    ios::sync_with_stdio(0);cin.tie(0);
#define ses    "\n"
#define all(x) (x).begin(), (x).end()
#define INF   ((int)2e18)
#define ii pair<ll, ll>

string digit="0123456789";
string small="abcdefghijklmnopqrstuvwxyz";
string capital="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

const int N=1e6+5;
const ll M=1e18;
const ll MOD = 1000000007;

template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)
        return 1;
    if(e%2==0)
    {
        ll t=bigmod(p,e/2,M);
        return (T)((t*t)%M);
    }
    return (T)((ll)bigmod(p,e-1,M)*(ll)p)%M;
}
template <class T> inline T modinverse(T a,T M)
{
    return bigmod(a,M-2,M);   // when M is prime;
}

typedef tree< ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

struct Edge
{
    int u, vv;
    bool operator<(Edge const& other)
    {
        return vv > other.vv;
    }
}; // eta joss jinis.krsukal er jnno and sort 1 out of 3 or more er jnno better


//***********************************************  The END **********************************************************************************************************************************


/////////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////
//main function is here.........
int main()
{
    ios
    ll n,k;
    cin>>n>>k;
    ll arr[n+1];
    for(ll i=1; i<=n; i++)
        cin >> arr[i];

    ll dp[n];
    for(ll i=0; i<=n; i++)
        dp[i]=0;
    for(ll i=2; i<=n; i++)
    {
        dp[i]=INF;
        for(ll j=i-1; j>=max(1LL,i-k); j--)
        {
            dp[i]=min(dp[j]+abs(arr[i]-arr[j]),dp[i]);
        }
        //cout<<dp[i]<<" ";
    }
    cout<<dp[n]<<ses;
}
/*

*/



Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>

#define MOD 1000000007LL

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    ll n, ans = 0;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) cin >> a.at(i);
    for (ll i = 0; i < 60; ++i) {
        vector<ll> cnt(2);
        for (ll j = 0; j < n; ++j) ++cnt.at((a.at(j) >> i) & 1);
        (ans += (1LL << i) % MOD * cnt.at(0) % MOD * cnt.at(1) % MOD) %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		int N=sc.nextInt();
		
		ArrayList<Integer> sei = new ArrayList<>(N);
		ArrayList<Integer> hu = new ArrayList<>(N);
		int x[]=new int[N+1];
		x[0]=0;
		int sum=0;
		
		for(int i=1;i<=N;i++) {
			x[i]=sc.nextInt();
			sum+=Math.abs(x[i-1]-x[i]);
		}
		sum+=Math.abs(x[N]);
		for(int i=1;i<=N;i++) {
				if(i==N) {
					int x1=Math.abs(x[N]-0)+Math.abs(x[N-1]-x[N]);
					int x2=Math.abs(x[N-1]-0);
					p(sum-x1+x2);
				}else if(x[i-1]<=x[i]&&x[i]<=x[i+1]) {
					p(sum);
				}
				else if(x[i-1]>=x[i]&&x[i]>=x[i+1]) {
					p(sum);
				}else {
					int x1=Math.abs(x[i-1]-x[i])+Math.abs(x[i]-x[i+1]);
					
					int x2=Math.abs(x[i-1]-x[i+1]);
					
					p(sum-x1+x2);
				}
			
		}
		
	}
	

	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 93868
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007
#define iP pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define inf 1e15
#define mod1 998244353
#define pi 3.141592653589793238
int power(int x,int y){
    int res=1;
    x=x%2019;
    while(y>0){
        if(y&1)res=(res*x)%2019;
        x=(x*x)%2019;
        y/=2;
    }
    return res;
}
void solve(int tc){
    // int m=2019;
    string str;
    cin>>str;
    int n=str.size();
    map<int,int> prev;
    prev[0]=1;
    vector<int> v(str.size()+1,0);
    // int k=0;
    for(int i=n-1;i>=0;i--){
        int z=str[i]-'0';
        v[i]=(v[i+1]+power(10,n-i-1)*z)%2019;
        // cout<<v[i]<<" ";
        prev[v[i]]++;
    }
    int ans=0;
    for(auto it: prev){
        int ctr=it.second;
        // cout<<ctr<<" ";
        ans+=(ctr*(ctr-1))/2;
    }
    cout<<ans;
}
int32_t main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(20);
    int t=1,ctr=0;
    // cin>>t;
    while(t--){
        solve(ctr+1);
        ctr++;
    }
}

Measured memory_bytes: 5044
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<long long> a(n);
  long long sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  vector<long long> ans;
  sum%=(long long)1e9+7;
  for(int i=0;i<n-1;i++){
    sum+=(long long)1e9+7-a[i];
    sum%=(long long)1e9+7;
    ans.push_back(a[i]*sum);
  }
  long long res=0;
  for(auto x:ans){
    x%=(long long)1e9+7;
    res+=x;
  }
  res%=(long long)1e9+7;
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 6908
#include <iostream>
using namespace std;
int main()
{
	long long n ,m ,k ,score[100005] ,t;	
	while(cin>>n>>m>>k)
	{
		for(int i=1 ;i<=n ;i++) score[i] = m;
		for(int i=1 ;i<=k ;i++) cin>>t ,score[t]++;
		for(int i=1 ;i<=n ;i++) 
		{
			score[i]-=k;
			if(score[i]>0)cout<<"Yes\n";
			else cout<<"No\n";
		}
	}
} 

Measured memory_bytes: 3836
#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 a,b;
  vll v(4);
  REP(i,3){
   cin>>a>>b;
    REP(i,4){
      if(a==i+1)
        v[i]++;
      if(b==i+1)
        v[i]++;
    }
  }
  
  ll cnt1,cnt2;
  cnt1=cnt2=0;
  REP(i,4){
    if(v[i]==1)
      cnt1++;
    if(v[i]==2)
      cnt2++;
  }
  
  if(cnt1==2 && cnt2==2)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
    

    
}

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

//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/

int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
          int n;
          cin>>n;
          string s;
          cin>>s;
          ll ans=0;
          vector<char>v;
          for(int i=0;i<s.size();i++){
            v.pb(s[i]);
          }
          int idx=n-1;
          for(int i=0;i<n;i++){
            if(v[i]=='W'){
               int flag=0;
               for(int j=idx;j>=i;j--){
                if(v[j]=='R'){
                  idx=j;
                  flag=1;
                  break;
                }
               }
               if(flag==0)break;
               else{
                ans++;
                v[i]='R';
                v[idx]='W';
               }
            }
          }
          cout<<ans<<endl;
          
   }
   }
















Measured memory_bytes: 3856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 62;

int main(){
  ll n,c,k;
  cin >> n >> c >> k;
  vector<int> t;
  for (int i = 0; i < n; i++){
    ll a;
    cin >> a;
    t.push_back(a);
  }
  sort(t.begin(),t.end());
  ll bus = 0;
  ll w = 0;
  ll lim = INF;
  for (int i = 0; i < n; i++){
    if (t[i] > lim && w > 0) {
      bus++; w = 0;
      lim = t[i] + k;
    }
    w++;
    if (w == 1) lim = t[i] + k;
    if (w == c) {
      bus++;
      w = 0;
    }
    if (i == n - 1 && w > 0) {
      bus++;
    }
  }
  cout << bus << endl;
  return 0;
}


Measured memory_bytes: 892
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int A = scanner.nextInt();
    int B = scanner.nextInt();
    int p = Math.max((25 * A - 1) / 2 + 1, 10 * B);
    if (p >= 10 * B + 10 || 2 * p >= 25 * A + 25) {
      System.out.println(-1);
    } else {
      System.out.println(p);
    }
  }
}


Measured memory_bytes: 23252
import sys
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()
sys.setrecursionlimit(10**6)
"""========main code==============="""


def check(lol,x):
    if(len(lol)==n):
        tp=0
        for j in v:
            a=j[0]
            b=j[1]
            c=j[2]
            d=j[3]
            if(lol[b-1]-lol[a-1]==c):
                tp+=d
            
        return tp
    k=0         
    for i in range(x,m+1):
        yo=lol[:]
        yo.append(i);
        k=max(k,check(yo,i))
    return k
    


n,m,q=ml()
lol=[]
for i in range(1,m+1):
    lol.append(i)


v=[]

for i in range(q):
   tmp=ll()
   v.append(tmp)



lol=[1]
print(check(lol,1))


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


int main() {
ll N;
cin >> N;
string s;
while(N != 0) {
    N--;
    s += 'a'+N%26;
    N /= 26;
}
reverse(s.begin(),s.end());
cout << s << endl;

return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int N,M;
  std::cin >> N >> M;
  vt<ll> H(N);
  rep(i,N)  std::cin >> H[i];
  vvi A(N);
  rep(i,M){
    int a,b;  std::cin >> a >> b;
    A[a-1].push_back(b-1);
    A[b-1].push_back(a-1);
  }

  int ans = 0; bool f = true;
  rep(i,N){
    f = true;
    for(int x : A[i]){
      if(H[i] <= H[x]){
        f = false;
        break;
      }
    }
    if(f) ans++;
  }

  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 8992
l,r=map(int,input().split())

sho_l = l // 2019
sho_r = r // 2019

if sho_r-sho_l >= 1:
  print(0)
else:
  ans = 2018
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans = min((i*j)%2019,ans)
  print(ans)


Measured memory_bytes: 9100
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define scn(n) scanf("%d",&n)
using namespace std;

int main() {
	
	ll n,d;
	cin>>n>>d;
	
	d=d*d;
	int pt=0;
	for(int i=0;i<n;i++)
	{
	    ll x,y;
	    cin>>x>>y;
	    
	    ll sum = x*x+y*y;
	    if(sum<=d)
	    pt++;
	}
	cout<<pt;
	return 0;
}

Measured memory_bytes: 3572
// finish date: 2019/2/23

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N, K;
    cin >> N >> K;
    vvi a(N, vi(2));
    rep(i, N) {
        cin >> a[i][0];
        a[i][1] = i + 1;
    }
    vi ans;
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    //1ターン目
    rep(i, N) {
        a[i][0]--;
        ans.push_back(a[i][1]);
    }
    int tag = ans[ans.size() - 1];
    //2ターン目以降
    FOR(i, 2, K + 2) {
        rep(j, N) {
            if (a[j][1] != tag) {
                a[j][0]--;
                ans.push_back(a[j][1]);
            }
        }
        tag = ans[ans.size() - 1];
        sort(a.begin(), a.end());
        reverse(a.begin(), a.end());
    }
//    rep(i, N) {
//
//    }
    if (a[N - 1][0] >= 0) {
        cout << ans.size() << endl;
        rep(i, ans.size()) {
            cout << ans[i] << " ";
        }
        cout << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int main(){
 for(int d;cin>>d,d;){
  vector<pair<int,int> > result;
  for(int i=0;i<d;i++){
   int name,score=0,a,b,k=0;
   cin>>name;
   for(int i=0;i<10;i++){
    cin>>a;score+=a;
    if(k&4)score+=a,k&=3;
    if(k&2)score+=a;
    if(k&1)score+=a,k&=6;
    if(a==10){
     if(k&2)k|=4;k|=2;}
    else{cin>>b;score+=b;
      if(k&2)score+=b,k&=5;
      if(a+b==10)k|=1;}
    }
    if(k&2){cin>>a>>b;score+=k&4?2*a+b:a+b;}
    if(k&1){cin>>a;score+=a;}
    result.push_back(make_pair(-score,name));
    }
    sort(result.begin(),result.end());
    for(int i=0;i<d;i++)cout<<result[i].second<<" "<<-result[i].first<<endl;
  }
}

Measured memory_bytes: 0
from collections import deque
n = int(input())
de = deque()
for i in range(n):
    o = list(map(int, input().split()))
    if (o[0] == 0):
        if (o[1] == 0):
            de.appendleft(o[2])
        else:
            de.append(o[2])
    elif (o[0] == 1):
        print(de[o[1]])
    else:
        if (o[1] == 0):
            de.popleft()
        else:
            de.pop()
    


Measured memory_bytes: 21980
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long
typedef pair<ll , ll > pii;
ll mod=998244353;
ll p=1e9+7;

 
int  main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k; cin>>n>>k;
    k++;
    ll a[n+1];
    for(ll i=1; i<=n; i++){
        cin>>a[i];
    }
    ll cycle_start=1;
    ll curr=1;
    vector<ll> v;
    bool vis[n+1]; memset(vis,false,sizeof(vis));
    
    while(true){
        if(vis[curr]){
            cycle_start=curr;
            break;
        }
        else {
            v.push_back(curr);
            vis[curr]=true;
            curr=a[curr];
        }
    }
    ll i=0;
    for( ; i<v.size() ; i++){
        if(v[i] == cycle_start){
            ll l=v.size()-i;
            k%=l;
            if(k==0){
                i=v.size()-1;
                break;
            }
        }
        k--;
        if(k<=0){
            break;
        }
    }
    cout<<v[i]<<endl;
    return 0;
}

Measured memory_bytes: 7088
#include<bits/stdc++.h>
#define mod 1000000007

using namespace std;

long long int mpow10(long long int n) {
    long long int x = 1;
    for(long long int i = 0; i < n; i++) {
        x *= 10;
        x %= mod;
    }
    return x%mod;
}

long long int mpow9(long long int n) {
    long long int x = 1;
    for(long long int i = 0; i < n; i++) {
        x *= 9;
        x %= mod;
    }
    return x%mod;
}

long long int mpow8(long long int n) {
    long long int x = 1;
    for(long long int i = 0; i < n; i++) {
        x *= 8;
        x %= mod;
    }
    return x%mod;
}

int main() {
    long long int n;
    cin>>n;
    cout<<((mpow10(n) - 2*mpow9(n) + mpow8(n))%mod + mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int64_t MOD = 1000000007;

// 繰り返し二乗法
int64_t power(int64_t a, int64_t n) {
    int64_t res = 1;
    while (n > 0) {
        if (n % 2 == 1) {
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n >>= 1;
    }

    return res;
}

int64_t dfs(string s) {
    if (s.length() == 1) {
        return stoi(s);
    }

    int64_t sum = 0;
    for (int i = 0; i < s.length(); ++i) {
        string y = s.substr(i + 1);
        sum += (stol(s.substr(0, i + 1)) * power(2, y.length() - 1) + dfs(y));
    }

    return sum;
}

int main() {
    string S;
    cin >> S;
    int64_t sum = dfs(S);
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();
		String ans = "";

		for (int i = 0; i < n; i++) {
			char c1 = s.charAt(i);
			char c2 = t.charAt(i);
			ans = ans + c1 + c2;
		}

		System.out.println(ans);

		sc.close();
	}

}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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 (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, k; cin >> n >> k;
    int r, s, p; cin >> r >> s >> p;
    string t; cin >> t;
    string taka = "";
    int ans = 0;

    map<char, char> m;
    m['r'] = 'p';
    m['s'] = 'r';
    m['p'] = 's';
    rep(i,n) {
        if (i-k >= 0 && taka[i-k] == m[t[i]]) {
            taka += 'a';
        } else {
            if (m[t[i]] == 'r') {
                taka += 'r';
                ans += r;
            } else if (m[t[i]] == 's') {
                taka += 's';
                ans += s;
            } else if (m[t[i]] == 'p') {
                taka += 'p';
                ans += p;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		String s=scanner.next();
		StringBuilder sb=new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i)=='C'||s.charAt(i)=='F') {
				sb.append(s.charAt(i));
			}
		}
		String re=sb.toString();
		if (re.contains("CF")) {
			System.out.print("Yes");
		}else {
			System.out.print("No");
		}
	}
}

Measured memory_bytes: 21844
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
A = np.array(read().split(), np.int64)
counter = np.bincount(A)

total = (counter * (counter - 1)).sum() // 2
answer = (total - (counter - 1))[A]

print('\n'.join(answer.astype(str)))


Measured memory_bytes: 61100
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
    int a=1;
    int b=1;
    
    double degree=90.0;
    
    double x=0.0;
    double y=0.0;

    while (a!=0&&b!=0){
        scanf("%d,%d",&a,&b);
        
        y+=(a*sin(degree* M_PI / 180));
        x+=(a*cos(degree* M_PI / 180));
        
        degree-=b;
    }
    
    cout<<(int)x<<endl<<(int)y<<endl;
    
    return 0;
}

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

using namespace std;

int main(void)
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int w[n][3];
	for(int i = 0; i < n; i++){
		w[i][0] = 0;
		w[i][1] = 0;
		w[i][2] = 0;
	}
	
	for(int i = 0; i < n; i++){
		if(s[i] == 'R'){
			for(int j = 0; j <= i;j++){
				w[j][0]++;
			}
		}
		else if(s[i] == 'G'){
			for(int j = 0; j<=i; j++){
				w[j][1]++;
			}
		}
		else if(s[i] == 'B'){
			for(int j = 0; j <= i; j++){
				w[j][2]++;
			}
		}
	}
	long long ans = 0;
	
	for(int i = 0; i < n-3; i++){
		if(s[i] == 'R'){
			for(int j = i+1; j < n; j++){
				if(s[j] == 'G'){
					ans+=w[j][2];
					if(j+j-i < n &&s[j+j-i] == 'B') ans--;
				}
				else if(s[j] == 'B'){
					ans+=w[j][1];
					if(j+j-i < n && s[j+j-i] == 'G')ans--;
				}
			}
		}
		else if(s[i] == 'G'){
			for(int j = i+1; j < n; j++){
				if(s[j] == 'R'){
					ans+=w[j][2];
					if(j+j-i < n &&s[j+j-i] == 'B') ans--;
				}
				else if(s[j] == 'B'){
					ans+=w[j][0];
					if(j+j-i < n &&s[j+j-i] == 'R')ans--;
				}
			}
		}
		else if(s[i] == 'B'){
			for(int j = i+1; j < n; j++){
				if(s[j] == 'G'){
					ans+=w[j][0];
					if(j+j-i < n &&s[j+j-i] == 'R') ans--;
				}
				else if(s[j] == 'R'){
					ans+=w[j][1];
					if(j+j-i < n &&s[j+j-i] == 'G')ans--;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3676
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    print((n*(n-1)>>1)+(m*(m-1)>>1))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>
#include <cmath>

using namespace std;

#define int long long
#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 rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back
#define UNIQ(a) a.erase(unique(all(a)), end(a))

using vi=vector<int>;
using pii=pair<int, int>;
using vpii=vector<pii>;
using ll=long long;

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
template<typename T>bool chmin(T&a,T b){return a>b?(a=b,1):0;}
template<typename T>bool chmax(T&a,T b){return a<b?(a=b,1):0;}
int read(){int a;scanf("%lld",&a);return a;}

const double pi = acos(-1);
constexpr int inf = 3*TEN(18) + 10;
constexpr int mod = TEN(9) + 7;

int N;
int mn[100010];
int counter[100010];

signed main()
{
	cin >> N;
	vi a(N);
	memset(mn, -1, sizeof mn);
	vi arr;
	rep(i, N) {
		cin >> a[i];
		arr.PB(a[i]);
	}
	arr.PB(0);
	sort(all(arr));
	UNIQ(arr);

	rep(i, N) {
		int idx = lower_bound(all(arr), a[i]) - begin(arr);
		counter[idx]++;
		if (mn[idx] == -1) mn[idx] = i;
	}

	vi ans(N);
	int minimum = inf;

	for (int i = (int)(arr.size()) - 1; i >= 1; --i) {
		chmin(minimum, mn[i]);
		ans[minimum] += counter[i] * (arr[i] - arr[i - 1]);
		counter[i - 1] += counter[i];
	}

	rep(i, N) printf("%lld\n", ans[i]);
}




Measured memory_bytes: 7148
s = str(input())
t = str(input())
n = len(s)
m = len(t)
ans = float("inf")
for i in range(n-m+1):
  si = s[i:i+m]
  c = 0
  for j in range(m):
    if si[j] != t[j]:
      c += 1
  if c < ans:
    ans = c
print(ans)
  

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

#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()

using namespace std;

using ll = long long;

ll ceil_div(ll a, ll b) {
    if (b > 0) {
        if (a >= 0) {
            return (a + b - 1) / b;
        } else {
            // ceil(a / b) == ceil(-((-a) / b)) == -floor((-a) / b)
            return -((-a) / b);
        }
    } else if (b < 0) {
        if (a >= 0) {
            // ceil(a / b) == ceil(-(a / (-b))) == -floor(a / (-b))
            return -(a / (-b));
        } else {
            // ceil(a / b) == ceil((-a) / (-b))
            return ((-a) + (-b) - 1) / (-b);
        }
    } else {
        throw runtime_error("division by zero");
    }
}

ll floor_div(ll a, ll b) {
    return -ceil_div(-a, b);
}

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

    constexpr ll A_MAX = 1000000000;
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    sort(all(A));

    // if the number of pairs whose multipilication is less than or equal to x is less than or equal to K, return true.
    function<bool(ll)> f = [&](ll x) {
        ll cnt = 0;
        REP(i, N) {
            // count j such that 0 <= j < i 
            // and A[i] * A[j] <= x
            if (A[i] > 0) {
                // | { j | 0 <= j < i, A[j] <= floor(x / A[i]) } |
                auto it = upper_bound(A.begin(), A.begin() + i, floor_div(x, A[i]));
                cnt += it - A.begin();
            } else if (A[i] < 0) {
                // | { j | 0 <= j < i, A[j] >= ceil(x / A[i]) } |
                // i - | { j | 0 <= j < i, A[j] < ceil(x / A[i]) } |
                auto it = lower_bound(A.begin(), A.begin() + i, ceil_div(x, A[i]));
                cnt += i - (it - A.begin());
            } else { // A[i] == 0
                if (x >= 0) cnt += i;
            }
            if (cnt >= K) {
                return false;
            }
        }
        return true;
    };

    ll first = -A_MAX * A_MAX;
    ll last = A_MAX * A_MAX;

    while (first < last) {
        ll mid = first + (last - first) / 2;
        if (f(mid)) {
            first = mid + 1;
        } else {
            last = mid;
        }
    }

    cout << first << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int n,k,q,x,ans[maxn];

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> k >> q;
	rep(n) ans[i]=k-q;
	rep(q){
		cin >> x;
		ans[x-1]++;
	}
	rep(n) print1(ans[i]>0?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e18;
const double PI=3.1415926535897932;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

ll dp[501][501];
bool used[501][501];

int main(){
    ll N; cin>>N;
    ll K=N*N;
    ll ans=0;
    rep(i,N) rep(j,N){
        ll a=min(i,j);
        a=min(a,N-1-i);
        a=min(a,N-1-j);
        dp[i][j]=a;
    }
    rep(i,K){
        ll t,x,y; cin>>t; t--;
        y=t%N; x=t/N;
        queue<P> Q;
        ans+=dp[x][y];
        dp[x][y]--;
        used[x][y]=true;
        Q.push(mp(x,y));
        while(!Q.empty()){
            ll X=Q.front().first, Y=Q.front().second;
            //cout<<X<<' '<<Y<<endl;
            Q.pop();
            rep(j,4){
                ll XX=X+dx[j], YY=Y+dy[j], p=0;
                if(0<=XX && XX<N && 0<=YY && YY<N){
                if(!used[XX][YY]) p++;
                if(dp[XX][YY]>dp[X][Y]+p){
                    dp[XX][YY]=dp[X][Y]+p;
                    Q.push(mp(XX,YY));
                }
            }
            }
        }
        /*rep(j,N) {
            rep(k,N) cout<<dp[j][k]<<' ';
            cout<<endl;
        }*/
        
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 5804
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int s,m;
int main()
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    s=min(A,B);
    m=min(C,D);
    cout<<s+m;
system("pause");
return 0;
}


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

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

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

    int n_max = max(a, max(b, c));
    int sum_diff = n_max-a + n_max-b + n_max-c;

    if(sum_diff%2 == 0) cout << sum_diff/2 << endl;
    else cout << (sum_diff+3)/2 << endl;
}

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

using namespace std;

int main() {
    double a, b, c, d, e, f;
    while (cin >> a >> b >> c >> d >> e >> f) {
        double det = a * e - b * d;
        double x = (e * c - b * f) / det;
        double y = (-d * c + a * f) / det;
        if (x == 0) x = 0;
        if (y == 0) y = 0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
    return 0;
}

Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long ll;
const int MAXN = 3e5 + 10;
const int Mod = 1e9 + 7;
int N;
char S[MAXN];
int To[8][2] = {{3, 1}, {5, 2}, {2, 2}, {4, 7}, {3, 3}, {6, 1}, {5, 5}, {3, 1}};
ll f[MAXN][8];

int main() {
	register int i, j;
	scanf("%s", S + 1); N = strlen(S + 1);
	f[1][0] = 1;
	for(i = 1; i <= N; ++i)
		for(j = 0; j < 8; ++j) {
			if(S[i] != '0') (f[i + 1][To[j][1]] += f[i][j]) %= Mod;
			if(S[i] != '1') (f[i + 1][To[j][0]] += f[i][j]) %= Mod;
		}
	printf("%lld\n", (f[N + 1][1] + f[N + 1][2]) % Mod);
	return 0;
}

Measured memory_bytes: 19200
#include<stdio.h>

int main(void){
    
    int A,B,tmp;
   
    do{
    scanf("%d%d",&A,&B);
    }while(A < 1 || B > 9);
    
    tmp = A + B;
    
    if(tmp >= 10){
        printf("error");
    }else{
        printf("%d",tmp);
    }
    
    return 0;
    
}

Measured memory_bytes: 128
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N = int(input())
    abc = [list(map(int, input().split())) for _ in range(N)]

    # dp[i]: i日目にa,b,cを選んだ場合のまでの最大幸福度
    dp = [[0, 0, 0] for _ in range(N)]
    dp[0] = [abc[0][0], abc[0][1], abc[0][2]]

    for i in range(1, N):
        prev = dp[i-1]
        preva = prev[0]
        prevb = prev[1]
        prevc = prev[2]
        abci = abc[i]
        a = abci[0]
        b = abci[1]
        c = abci[2]
        dp[i] = [max(prevb+a, prevc+a), max(prevc+b, preva+b), max(preva+c, prevb+c)]

    print(max(dp[N-1]))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 47344
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
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;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    ll n; cin >> n;
    string s; cin >> s;

    ll cnt = 0;
    FOR(i, 0, n-2) {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ++cnt, i+=2;
    }
    cout << cnt << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

const double PI=3.14159265358979323846;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    double a, b, x;
    cin >> a >> b >> x;

    double ans;
    if (x > a * a * b / 2.0) {
        double t = x / a / a * 2 - b;
        ans = atan((b - t) / a);
    }
    else {
        double t = x / a / b * 2;
        ans = atan(b / t);
    }

    cout << fixed << setprecision(10) << ans * 180.0 / PI << endl;
 
    return 0;
}

Measured memory_bytes: 512
import math
N= int(input())
nums = list(map(int,input().split()))
center = sum(nums) / N
center_down= math.floor(center)
center_up = math.ceil(center)

ans1  =sum([(center_down - i ) ** 2  for i in nums ])

ans2  =sum([(center_up- i ) ** 2  for i in nums ])

print(min(ans1,ans2))

Measured memory_bytes: 38512
n = int(input())
a = input()
b = input()
c = input()

num = 0
for i in range(n):
  if a[i] != b[i] != c[i] and a[i] != c[i]:
    num = num+2
  elif a[i] == b[i] and b[i] != c[i]:
    num = num+1
  elif b[i] == c[i] and b[i] != a[i]:
    num = num+1
  elif a[i] == c[i] and a[i] != b[i]:
    num = num + 1

print(num)

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
map<string,bool> f;
ll nr,n;
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    while(n--)
    {
        cin>>s;
        if(f[s]==0)
            nr++;
        f[s]=1;
    }
    cout<<nr;
    return 0;
}


Measured memory_bytes: 19136