akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define mod (ll)(1e9+7)
#define nax (ll)(1e5)
#define INFL LLONG_MAX
#define NINFL LLONG_MIN
#define INF INT_MAX
#define disp(a,n,arr) for(int i=a;i<(ll)n;i++) cout << arr[i] << " "; cout << "\n";
#define check cout << "Working\n";
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pl>
#define vpi vector<pi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
	FIO;
	int t = 1;
	//cin >> t;
	while (t--) {
		ll a,b;
		cin >> a >> b;
		if(a >= 13){
			cout << b << "\n";
		}else if(a >= 6 && a<=12) cout << b/2 << "\n";
		else cout << "0\n";
	}


	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
char s[100007];
int a[128];
int main() {
	a['b'] = 0, a['p'] = 1, a['d'] = 2, a['q'] = 3;
	scanf("%s", s + 1);
	for (int l = strlen(s + 1), i = 1; i <= (l >> 1) + 1; ++i)
		if (a[s[i]] ^ ((a[s[l - i + 1]] + 2) % 4))
			return printf("No\n"), 0;
	return printf("Yes\n"), 0;
}

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

int main() {
  
  int a, b;
  cin >> a >> b;
  
  if (a*b%2==0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }

return 0;
}

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

int main() {
	string s;
	cin>>s;
	int n=s.size(),sum=0,ma=0;
	for(int i=0; i<n; i++) {
		if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C') {
			sum++;
		} else {
			if(sum>ma) {
				ma=sum;
			}
			sum=0;
		}
	}
	if(sum>ma) {
		ma=sum;
	}
	cout<<ma<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>

struct TestData
{
  int testNum;
  std::string input;
  std::string expectedOutput;
};

struct TestResult
{
  std::string testOutput;
  bool testPassed;
};

void testSolution();
TestResult runTestCase(const TestData& testData);
std::string formatResult(const TestData& testData, const TestResult& testResult);
void solution(std::istream& is, std::ostream& os);

static const bool IS_TESTING = false;

// define test data
static const std::vector<TestData> testDatas = {
  {1, "3 7\n", "5 6 7 8 9\n"},
  {2, "4 0\n", "-3 -2 -1 0 1 2 3\n"},
  {3, "3 100\n", "98 99 100 101 102\n"},
  {4, "3 0\n", "-2 -1 0 1 2\n"},
};

int main()
{
  if (IS_TESTING)
    testSolution();
  else
    solution(std::cin, std::cout);

  return 0;
}

void testSolution()
{
  for (const auto& testData : testDatas) {
    auto testResult = runTestCase(testData);

    std::cout << formatResult(testData, testResult);
  }
}

TestResult runTestCase(const TestData& testData)
{
    std::istringstream iss {testData.input};
    std::ostringstream oss {};

    solution(iss, oss);

    auto testOutput = oss.str();
    auto testPassed = testData.expectedOutput.compare(testOutput) == 0;
    
    return {testOutput, testPassed};
}

std::string formatResult(const TestData& testData, const TestResult& testResult)
{
  std::ostringstream oss {};

  oss << "Test " << std::setw(2) << testData.testNum << ": "
    << (testResult.testPassed ? "Passed!" : "Failed!") << std::endl;
  
  oss << "\tExpected: " << testData.expectedOutput << "\tActual  : " << testResult.testOutput << std::endl;

  return oss.str();
}

// solution to the problem
void solution(std::istream& is, std::ostream& os)
{
  int numConsecutive, paintedBlackCoord; is >> numConsecutive >> paintedBlackCoord;

  auto lowerBound = paintedBlackCoord - (numConsecutive - 1);
  auto upperBound = paintedBlackCoord + (numConsecutive - 1);

  for (auto coord = lowerBound; coord <= upperBound; ++coord) {
    if (coord < upperBound)
      os << coord << " ";
    else
      os << coord << std::endl;
  }
}


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

int main()
{
    int N;
    std::vector<int> A;
    std::cin >> N;
    A.resize(N);

    for(int i=0; i<N; ++i)
        std::cin >> A[i];

    for(int i=0; i<N-1; ++i)
        std::cout << A[i] << ' ';
    std::cout << A[N-1];
    std::cout << std::endl;

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

        for(int a=0; a<N-1; ++a)
            std::cout << A[a] << ' ';
        std::cout << A[N-1];

        std::cout << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3096
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
const long double eps = 1e-12;
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define REP(a,b) for(long long a = 0;a < b;++a)
long long inputs[300000];
long long dp[300000];
int main() {
	long long n;
	cin >> n;
	REP(i, n) {
		cin >> inputs[i];
		if (i != 0) {
			dp[i] = dp[i - 1] + abs(inputs[i] - inputs[i - 1]);
			if (i >= 2) {
				dp[i] = min(dp[i], dp[i - 2] + abs(inputs[i] - inputs[i - 2]));
			}
		}
	}
	cout << dp[n - 1] << endl;
}

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

using namespace std;

#define Q int t, q; scanf("%d", &t); for(q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pli;

int fx[]={1, 0, -1, 0};
int fy[]={0, 1, 0, -1};
vector<string> v(50);
int vis[50][50], h, w;

void bfs(int x, int y)
{
    int i, gx, gy, xx, yy;
    queue<pli> qu;
    qu.push({x, y});
    vis[x][y] = 1;
    while(!qu.empty()){
        xx = qu.front().first;
        yy = qu.front().second;
        qu.pop();
        for(i=0; i<4; i++){
            gx = xx+fx[i];
            gy = yy+fy[i];
            if(gx>=0 && gx<h && gy>=0 && gy<w && vis[gx][gy] == 0 && v[gx][gy] == '.'){
                vis[gx][gy] = vis[xx][yy]+1;
                qu.push({gx, gy});
            }
        }
    }
}

int main()
{
    int i, j, gx, gy, x, y;
    cin >> h >> w;

    for(i=0; i<h; i++){
        cin >> v[i];
    }

    int mx = 0;
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            if(v[i][j] == '.'){
                for(int ii=0; ii<h; ii++){
                    for(int jj=0; jj<w; jj++){
                        vis[ii][jj] = 0;
                    }
                }
                //vis[i][j] = 1;
                bfs(i, j);

                for(int ii=0; ii<h; ii++){
                    for(int jj=0; jj<w; jj++){
                        if(mx < vis[ii][jj]){
                            mx = vis[ii][jj];
                        }
                    }
                }
            }
        }
    }
    cout << mx-1 << "\n";


    return 0;
}



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

#define ll long long
#define ar array
 
using namespace std;

int main() {
	
	int n, h[100000],aux=1;
	
	cin >> n;
	
	for(int i=0;i<n;i++){
		cin >> h[i];
	}
	int base=h[0];
	for(int i=1;i<n;i++){
		if(h[i]>=base){
			aux++;
			if(h[i]>base){
				base  = h[i];
			}
		}
	}
	cout << aux << endl;
	
   	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include <functional>

#define big ((long long)(1e9)+7)

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int num(int n)
{
	int ans = 1;
	int N = n;
	for(int i=1;i <= 2;i++)
	{
		ans *= N;
		ans /= i;
		N--;
	}
	return ans;
}


int main()
{
	string s;
	cin >> s;
	for(int i = 0;i < s.size();i++)
	{
		if(s.at(i) == '7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    for (int i=0; i<n; i++) {
        cin >> vec.at(i);
    }
    int ans = 0;
    int tmp = 1;

    for (int i=0; i<n; i++) {
        ans++;
        tmp = vec.at(tmp-1);
        if (tmp==2) {
            cout << ans << endl;
            break;
            }
    }
    if (ans==n) cout << -1 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,ans[N],a[N],b[N],t[N<<2],t1[N<<2],t2[N<<2];
void update(int l,int r,int k)
{
    t1[k]=t[k]+r-l;t2[k]=t[k];
    if(l!=r)
    {
        int m=l+r>>1;
        t[k<<1]=t[k];t[k<<1|1]=t[k]+m+1-l;
    }
    t[k]=0;
}
int query(int l,int r,int k,int x)
{
    if(t[k]) update(l,r,k);
    if(l>x) return m+1;
    if(r<=x) return t1[k];
    int m=l+r>>1;
    int a=query(l,m,k<<1,x),b=query(m+1,r,k<<1|1,x);
    if(x<=r) a+=x>=m?x-m:0;
    else a+=r-m;
    t2[k]=min(t2[k<<1],t2[k<<1|1]);
    t1[k]=min(t1[k<<1]+r-m,t1[k<<1|1]);
    return min(a,b);
}
void update(int l,int r,int k,int x,int y,int d)
{
    if(t[k]) update(l,r,k);
    if(r<x||l>y) return;
    if(l>=x&&r<=y)
    {
        t[k]=d+l-x;
        update(l,r,k);
        return;
    }
    int m=l+r>>1;
    update(l,m,k<<1,x,y,d);update(m+1,r,k<<1|1,x,y,d);
    t2[k]=min(t2[k<<1],t2[k<<1|1]);
    t1[k]=min(t1[k<<1]+r-m,t1[k<<1|1]);
}
int main()
{
    scanf("%d%d",&n,&m);
    for(register int i=1,a,b,d;i<=n;i++)
    {
        scanf("%d%d",&a,&b);
        d=min(m+1,query(1,m,1,a-1)+1);
        update(1,m,1,a,b,d);
        printf("%d\n",t2[1]>=m?-1:t2[1]+i);
    }
}


Measured memory_bytes: 9908
function Main(input){
	input = input.split(" ").map(a=>~~a);
  return input[0] * input[1] / 2;
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
3 4 5
`);

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

void showA(int A[], int n) {
    for (int i = 0; i < n; i++) {
        if (i != 0) cout << " ";
        cout << A[i];
    }
    cout << "\n";
}

/*
1 insertionSort(A, N) // N個の要素を含む0-オリジンの配列A
2   for i が 1 から N-1 まで
3     v = A[i]
4     j = i - 1
5     while j >= 0 かつ A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v
*/

int main() {
    int n, v, A[100];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    
    for (int i = 0; i < n; i++) {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        showA(A, n);
    }
    
    return 0;
}


Measured memory_bytes: 3060
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double L = sc.nextInt();
		BigDecimal ans = BigDecimal.valueOf(L*L*L);
		BigDecimal div = BigDecimal.valueOf(27);
		ans = ans.divide(div,7,RoundingMode.HALF_UP);
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cstdio>
#include <climits>
using namespace std;
#define rep(i,n) for(LL i=0;i<n;i++)
#define all(v)	(v).begin(),(v).end()
#define MOD  1000000007
const int INF = INT_MAX;
typedef long long LL;


int main(){
	string s;
	getline(cin, s);
	transform(s.begin(), s.end(), s.begin(), ::toupper);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 1176
import java.util.Scanner;

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

        Dice dice = new Dice();
        for(int i=0;i<dice.getLength();i++){
           dice.setNumber(i, sc.nextInt());
        }
        sc.nextLine();

        String direction = sc.next();
        sc.nextLine();

        for(int i=0;i<direction.length();i++){
            dice.roll(direction.charAt(i));
        }
        System.out.println(dice.getTop());
        sc.close();
    }
}
class Dice{
    int number[];

    Dice(){
        number = new int[6];
    }

    void setNumber(int x, int num){
        number[x] = num;
    }
    int getLength(){
        return number.length;
    }
    int getTop(){
        return number[0];
    }
    void printArray(int array[]){
        for(int i=0;i<array.length;i++)System.out.printf("%d ", array[i]);
        System.out.println();
    }
    void roll(char d){
        int array[] = new int[number.length];
        switch (d){
            case 'S':
                //roll
                array[0] = number[4];
                array[1] = number[0];
                array[5] = number[1];
                array[4] = number[5];
                //not roll
                array[2] = number[2];
                array[3] = number[3];
                break;
            case 'W':
                array[0] = number[2];
                array[3] = number[0];
                array[5] = number[3];
                array[2] = number[5];

                array[1] = number[1];
                array[4] = number[4];
                break;
            case 'N':
                array[0] = number[1];
                array[1] = number[5];
                array[5] = number[4];
                array[4] = number[0];

                array[2] = number[2];
                array[3] = number[3];
                break;
            case 'E':
                array[0] = number[3];
                array[3] = number[5];
                array[5] = number[2];
                array[2] = number[0];
                
                array[1] = number[1];
                array[4] = number[4];
                break;
        }
        for(int i=0;i<getLength();i++){
            setNumber(i, array[i]);
        }
    }
}


Measured memory_bytes: 26320
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

string S;

int main() {
    cin >> S;
    if (S == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (S == "Cloudy") {
        cout << "Rainy" << endl;
    } else if (S == "Rainy") {
        cout << "Sunny" << endl;
    }
}



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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int main() {
    int N;
    set<string> S;
    cin >> N;
    for_(i,0,N) {
        string x;
        cin >> x;
        S.insert(x);
    }

    cout << S.size() << endl;
}

Measured memory_bytes: 19180
#include <iostream>
#include <cstring>
#define For(i,x,y) for(int i=(x); i<=(y); i++)
using namespace std;
char g[10][10];
int h,w,k;
int ans=0,cnt=0;
int vis1[10][10],vis2[10][10];
void check(){
    int tot=0;
    For(i,1,h){
        For(j,1,w)if(g[i][j]=='#'&&!vis1[i][j]&&!vis2[i][j])tot++;
    }
    //cout<<tot<<endl;
    if(tot==k)ans++;
}
void dfs2(int x){
    if(x>w){check();return;}
    For(i,1,h)vis2[i][x]=1;
    dfs2(x+1);
    For(i,1,h)vis2[i][x]=0;
    dfs2(x+1);
}
void dfs1(int x){
    if(x>h){dfs2(1);return;}
    For(i,1,w)vis1[x][i]=1;
    dfs1(x+1);
    For(i,1,w)vis1[x][i]=0;
    dfs1(x+1);
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>h>>w>>k;
    For(i,1,h)cin>>g[i]+1;
    //For(i,1,h)cout<<g[i]+1<<endl;
    For(i,1,h)For(j,1,w)if(g[i][j]=='#')cnt++;
    dfs1(1);
   // int len1,len2;
   // len1=len2=0;
    cout<<ans<<endl;
    return 0;
}
/*
For(len1,0,h){
        For(i,1,h-len1){
            For(len2,0,w){
                if(len1==h&&len2==w)check(1,len1,1,len2);
                For(j,1,w-len2)check(i,len1,j,len2);
            }
        }
    }
*/


Measured memory_bytes: 3640
N, M = map(int, input().split())
C = [tuple(map(int, input().split())) for _ in range(N)]

res = 0

for i in range(8):
    #絶対値を足す、引くの2パターンで表現する
    
    #ケーキの値の合計を入れる配列
    D = [0 for _ in range(N)]

    #対応するbitが1なら足す、0なら引く
    for j in range(N):
        x, y, z = C[j]
        if (i >> 0) & 1:
            D[j] += x
        else:
            D[j] -= x
        if (i >> 1) & 1:
            D[j] += y
        else:
            D[j] -= y
        if (i >> 2) & 1:
            D[j] += z
        else:
            D[j] -= z

    #価値が高い順にM個選ぶ
    D.sort(reverse=True)
    res = max(res, sum(D[:M]))

print(res)


Measured memory_bytes: 9252
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define ld long double
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
 int a[100005];
int solve(){
        string s; cin>>s;
        int ans=0;
        if(s=="RRR"){
          ans=3;
        }
        if(s=="SRR"){
          ans=2;
        }
        if(s=="RSR"){
          ans=1;
        }
        if(s=="RRS"){
          ans=2;
        }
        if(s=="SSS"){
          ans=0;
        }
        if(s=="SSR"||s=="SRS"||s=="RSS"){
          ans=1;
        }
        cout<<ans<<"\n";
  return 0;
}
int main(){
fast
        int t=1;
        // cin>>t; 
        T(t){
          solve();
        }
        return 0;
}       

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] a = new int[N];

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}

		sc.close();

		int count = 0;

		for (int i = 0; i < N; i++) {
			while (a[i] % 2 == 0) {
				a[i] = a[i] / 2;
				count++;
			}
		}

		System.out.print(count);
	}
}

Measured memory_bytes: 36344
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
const int inf = 1e9+10;
const ll INF = 1e16+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int>v;
    int sum=0;
    rep(i,n){
        int in;
        cin>>in;
        sum=sum+in;
        v.pu(in);
    }
    sort(all(v),greater<int>());
    float bound= ((1/4.0)*sum)/(float)m; 
    // cout << bound<<endl;
    rep(i,m){
        if(v[i]<bound){
            cout << "No"<<endl;
            exit(0);
        }

    }
    cout <<"Yes"<<endl;
}


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

void solve(long long N) {
    vector<char> ans;
    ll subsum = 1;
    rep(i, 100) {
        // cout << "subsum: " << subsum << endl;
        ans.push_back('a' + ((ll)((N - subsum) / pow(26, i)) % 26));
        subsum += pow(26, i + 1);
        if (N - subsum < 0) break;
    }
    reverse(ans.begin(), ans.end());
    rep(i, ans.size()) { cout << ans[i]; }
    cout << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


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

class prime {
public:
        prime() {}
        prime(int maxn) : maxn(maxn), is_primes(maxn + 1, true) {
                is_primes[0] = is_primes[1] = false;
                for (int i = 2; i <= maxn; i ++) {
                        if (is_primes[i]) {
                                primes.push_back(i);
                                for (int j = i + i; j <= maxn; j += i) is_primes[j] = false;
                        }
                }
        }
        bool is_prime(int n) {
                cerr << "first" << endl;
                assert(n <= maxn);
                return is_primes[n];
        }
        bool is_prime(long long n) {
                cerr << "second" << endl;
                if (n < 2 || (n > 2 && (n % 2 == 0))) {
                        return false;
                }
                for (long long i = 3; i * i <= n; i += 2) {
                        if (n % i == 0) {
                                return false;
                        }
                }
                return true;
        }
        vector<int> get() {
                return primes;
        }
        template<class T> vector<pair<T, int>> factorize(T n) {
                assert(n > 1);
                vector<pair<T, int>> res;
                for (T i = 2; i * i <= n; i ++) {
                        if (n % i == 0) {
                                int c = 0;
                                while (n % i == 0) {
                                        n /= i;
                                        c ++;
                                }
                                res.emplace_back(i, c);
                        }
                }
                if (n > 1) {
                        res.emplace_back(n, 1);
                }
                return res;
        }
private:
        int maxn;
        vector<int> primes;
        vector<bool> is_primes;
};

int main() {
        prime pr;
        int n;
        cin >> n;
        auto f = pr.factorize(n);
        cout << n << ":";
        for (auto it : f) {
                int c = it.second;
                while (c --) {
                        cout << " " << it.first;
                }
        }
        cout << endl;
        return 0;
}



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

const int maxn = 200005, maxa = 1000001;

int n, ans;
int a[maxn], g[maxa];

signed main () {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        ++g[a[i]];
    }
    for (int i = 0; i < maxa; ++i) {
        if (g[i]) {
            if (g[i] > 1)
                g[i] = 0;
            for (int j = 2 * i; j < maxa; j += i)
                g[j] = 0;
        }
    }
    for (int i = 0; i < maxa; ++i)
        ans += g[i];
    printf("%d\n", ans);
}


Measured memory_bytes: 8472
#include<bits/stdc++.h>
using namespace std;
// #define ll long long int
// #define m 1000000007
// ll max(ll a,ll b)
// {
//     if(a>b) return a;
//     else return b;
// }
int main()
{
    int m,n,i,j,sum=0,flag=0,ctr=0;
    cin>>n>>m;
    vector<int>a(n);
    for(i=0;i<n;++i)
    {
        cin>>a[i];
        sum+=a[i];
    }
    float c=sum/(4.0*m);
    for(i=0;i<n;++i)
    {
        if(a[i]>=c) 
        {
            ctr++;
            if(ctr==m)  {flag=1;break;}
        }
    }
    if(flag)    cout<<"Yes\n";
    else    cout<<"No\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

int main()
{
  int x;
  scanf("%d",&x);
  if( x==3 || x==5 || x==7 ){
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return EXIT_SUCCESS;
}



Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#define N 5050
#define M 202
using namespace std;
typedef long long LL;
int n,m;
LL sum[N],a[N],b[N][M],sm[N][N],ans;
int st[N],tp,L[N],R[N];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=2;i<=n;i++)
	  scanf("%lld",&a[i]),sum[i]=sum[i-1]+a[i];
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)scanf("%lld",&b[i][j]);
	for(int j=1;j<=m;j++)
	{
		st[tp=1]=0,b[0][j]=1e9+1;
		for(int i=1;i<=n;i++)
		{
			while(b[st[tp]][j]<b[i][j])--tp;
			L[i]=st[tp]+1;
			st[++tp]=i;
		}
		st[tp=1]=n+1,b[n+1][j]=1e9+1;
		for(int i=n;i;i--)
		{
			while(b[st[tp]][j]<b[i][j])--tp;
			R[i]=st[tp]-1;
			st[++tp]=i;
		}
		for(int i=1;i<=n;i++)
		{
			if(L[i]<=i&&i<=R[i])sm[L[i]][i]+=b[i][j],sm[L[i]][R[i]+1]-=b[i][j],
			sm[i+1][i]-=b[i][j],sm[i+1][R[i]+1]+=b[i][j];
		}
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		sm[i][j]+=sm[i-1][j]+sm[i][j-1]-sm[i-1][j-1];
		if(i<=j)ans=max(ans,sm[i][j]-sum[j]+sum[i]);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<ll> sum;
  for (int i = 0; i < n; ++i) {
    ll res = 0;
    for (int j = i; j < n; ++j) {
      res += a[j];
      sum.push_back(res);
    }
  }
  ll ans = 0;
  for (int b = 40; b >= 0; --b) {
    int cnt = 0;
    for (int i = 0; i < sum.size(); ++i) {
      if ((sum[i] & (ans | 1ll << b)) == (ans | 1ll << b)) {
        cnt++;
      }
    }
    if (k <= cnt) {
      ans |= (1ll << b);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6132
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
AB=[]
for i in A:
    for j in B:
        AB.append(i+j)
AB.sort(reverse=True)
AB=AB[:K]
ABC=[]
for i in AB:
    for j in C:
        ABC.append(i+j)
ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])


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

int return_sum(int n){
    int sum = 0;

    while(n > 0){
        sum += n % 10;
        n = n / 10;

    }
    return sum;
}

int main(){
    int sum = 0;
    int total = 0;
    int N,A,B;

    cin >> N >> A >> B;

    for (int i = 0; i <= N; i ++){
        sum = return_sum(i);
        if (sum <= B && A <= sum){
            total += i;
        }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <limits>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define x first
#define y second
#define sf scanf
#define pf printf
#define vec vector
#define pb push_back
#define mp make_pair
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define clr(a,b) memset(a,b,sizeof(a))
#define bin_cnt(x) __builtin_popcount(x)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define srep(sub,s) for(int sub=s&(s-1);sub;sub=(sub-1)&s)
#define irep(i,a) for(__typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define irrep(i,a) for(__typeof(a.rbegin()) i=a.rbegin();i!=a.rend();i++)
#define inf numeric_limits<int>::max()
#define finf numeric_limits<double>::infinity()
#define eps 1e-8
#pragma GCC optimize ("O3")
#define o3 __attribute__((optimize("O3")))
#pragma comment(linker, "/STACK:32505856")

template<class T> inline T sqr(T a) {return a*a;}
template<class T> inline int gmin(T&a,T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> inline int gmax(T&a,T b) {if(a<b){a=b;return 1;}return 0;}
inline int dcmp(const double &a) {return a>eps?1:(a<-eps?-1:0);}
struct Initializer{Initializer(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}}initializer;

#define N 100010
int n;
int a[N];

int main() {
  while (~sf("%d",&n)) {
    rep(i,1,n) {
      sf("%d", a+i);
    }
    int cnt = 0;
    rep(i,1,n) {
      int j = a[i];
      if (j<i) if (a[j] == i) cnt++;
    }
    pf("%d\n", cnt);
  }
  return 0;
}


Measured memory_bytes: 640
package main

import (
  "fmt"
  "math"
)

var N, A, B, C int
var L []int

func main() {
  fmt.Scan(&N, &A, &B, &C)
  L = make([]int, N)
  for i := 0; i < N; i++ {
    fmt.Scan(&L[i])
  }
  fmt.Println(search(0, 0, 0, 0))
}

func search(cur, a, b, c int) int {
  if cur == N {
    if getMin(a, b, c) <= 0 {
      return math.MaxInt32
    }
    return int(math.Abs(float64(a-A)) + math.Abs(float64(b-B)) + math.Abs(float64(c-C)) - 30)
  }

  ret0 := search(cur+1, a, b, c)
  ret1 := search(cur+1, a+L[cur], b, c) + 10
  ret2 := search(cur+1, a, b+L[cur], c) + 10
  ret3 := search(cur+1, a, b, c+L[cur]) + 10
  return getMin(ret0, ret1, ret2, ret3)
}

func getMin(nums ...int) (min int) {
  min = nums[0]
  for i := 0; i < len(nums); i++ {
    min = int(math.Min(float64(min), float64(nums[i])))
  }
  return
}


Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, min, x int
	fmt.Scan(&n, &min)
	for i := 1; i < 5; i++ {
		fmt.Scan(&x)
		if x < min {
			min = x
		}
	}
	fmt.Println(int(math.Ceil(float64(n)/float64(min))) + 4)
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, Ma, Mb;
  cin >> N >> Ma >> Mb;
  int a[N], b[N], c[N];
  rep(i, N) cin >> a[i] >> b[i] >> c[i];
  int dp[401][401];
  fill(dp[0], dp[401], inf);
  dp[0][0] = 0;
  rep(i, N) {
    for(int j = 400; j >= a[i]; j--) {
      for(int k = 400; k >= b[i]; k--) {
    	dp[j][k] = min(dp[j][k], dp[j-a[i]][k-b[i]] + c[i]);
      }
    }
  }

  int ans = inf;
  reps(i, 1, 401) reps(j, 1, 401) {
    if(i*Mb == j*Ma) ans = min(ans, dp[i][j]);
  }

  cout << (ans == inf ? -1 : ans) << endl;

  return 0;
}

Measured memory_bytes: 1536
N = int(input())
K = int(input())

strN = str(N)
maxD = len(strN)

dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)]
dp[0][0][0] = 1
for d, Nd in enumerate(strN):
    Nd = int(Nd)
    for isLeN in range(2):
        for m in range(K+1):
            x = 0
            if not isLeN and x > Nd: continue
            isLeN2 = isLeN or x < Nd
            dp[d+1][isLeN2][m] += dp[d][isLeN][m]
            for x in range(1, 10):
                if not isLeN and x > Nd: continue
                isLeN2 = isLeN or x < Nd
                m2 = m+1
                if m2 > K: continue
                dp[d+1][isLeN2][m2] += dp[d][isLeN][m]
#    print(d+1, Nd, dp[d+1])

#print(dp[-1])
print(dp[-1][0][K]+dp[-1][1][K])


Measured memory_bytes: 41072
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = 0;

        if ((a + b) % 2 == 0) {
            c = (a + b) / 2;
        } else {
            c = ((a + b) / 2) + 1;
        }

        System.out.println(c);

		sc.close();
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n), b(n); rep(i, n)cin >> a[i] >> b[i];
	vector<P>tmp;
	rep(i, n) {
		tmp.push_back(make_pair(b[i],a[i]));
	}
	sort(ALL(tmp));
	int now = 0;
	rep(i, n) {
		now += tmp[i].second;
		if (now > tmp[i].first) {
			cout << "No" << endl; return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 9712
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

class Combination {
   public:
    Combination(int n) {
        fac = new ll[n];
        inv = new ll[n];
        finv = new ll[n];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        REP(i, 2, n) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    ll cnr(int n, int k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

   private:
    ll *fac, *inv, *finv;
};

vector<pair<int, int>> PrimeFactorization(int n) {
    vector<pair<int, int>> f;
    for (int i = 2; i * i <= n; i++) {
        int cnt = 0;
        while (n % i == 0) {
            n /= i;
            cnt++;
        }
        if (cnt > 0) f.push_back(make_pair(i, cnt));
    }
    if (n != 1) f.push_back(make_pair(n, 1));
    return f;
}

int main() {
    int N, M; cin >> N >> M;
    vector<pair<int, int>> f = PrimeFactorization(M);
    Combination comb(210000);

    ll ans = 1;
    for (auto fac : f) {
        if (fac.second == 0) continue;
        ans = (ans * comb.cnr(fac.second + N - 1, N - 1)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main(int argc, char const *argv[])
{
	int i,j,k;
	cin >> i >> j >> k;

	if(i+j+k == 17 )
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0; i<N; i++)

using namespace std;


bool checkTriangles(int a, int b, int c) {

    if( a < (b + c)){
      if( b < (c + a)){
        if( c < (a + b)){
          return true;
        }
      }
    }
    return false;
}

int main(){
  int n; cin >> n;
  vector<int> d(n);
  rep(i,n){
    cin >> d[i];
  }
  int ans = 0;

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

  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      for (int k = j + 1; k < n; k++) {
        if(d[i] + d[j] > d[k]){
          if(checkTriangles(d[i],d[j],d[k])){
            ans++;
          }
        }else{
          break;
        }
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.lang.*;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//
		byte states[] = new byte[10];
		int w, h;
		int x, y, xp, yp;
		byte map[][];
		int count;
		//
		for(;;){
			w = sc.nextInt();
			h = sc.nextInt();
			if(w == 0 && h == 0){
				break;
			}
			map = new byte[h][w];
			count = 0;
			for(y = 0; y < h; y++){
				for(x = 0; x < w; x++){
					map[y][x] = sc.nextByte();
				}
			}
			for(y = 0; y < h; y++){
				for(x = 0; x < w; x++){
					count += Main.checkAround(map, x, y, w, h);
				}
			}
			System.out.println(count);
		}
	}
	public static int checkAround(byte map[][], int px, int py, int w, int h){
		if(px < 0 || w <= px || py < 0 || h <= py || map[py][px] == 0){
			return 0;
		}
		map[py][px] = 0;
		Main.checkAround(map, px - 1, py - 1, w, h);
		Main.checkAround(map, px + 1, py + 1, w, h);
		Main.checkAround(map, px - 1, py + 1, w, h);
		Main.checkAround(map, px + 1, py - 1, w, h);
		//
		Main.checkAround(map, px    , py - 1, w, h);
		Main.checkAround(map, px    , py + 1, w, h);
		Main.checkAround(map, px - 1, py    , w, h);
		Main.checkAround(map, px + 1, py    , w, h);
		return 1;
	}
}

Measured memory_bytes: 45128
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <cassert>
using namespace std;
 
const int N = 4e5 + 5;
 
#define Pair pair<int,int>
 
int a[N] , ans[N] , n;
 
Pair res[N];
int cur , st[N][24] , id[N][24], wh[N][24];
 
struct NODE {
    int l , r , id;
    friend bool operator < (NODE xxx , NODE yyy) {
        return a[xxx.id] > a[yyy.id];
    }
}ind;
 
priority_queue<NODE>q;
 
#define m(l , r , id) (NODE){l , r , id}
 
int Log[N];
 
void make_dance(void) {
    for(int i = 1;i <= n;i ++) {
        st[i][1] = a[i]; id[i][1] = i;
        wh[i][1] = i + 2;
        st[i][0] = a[i]; id[i][0] = i;
    }
    for(int i = 2;i <= 20;++ i) {
        for(int j = 1;j <= n;j ++) {
            st[j][i] = min(st[j][i - 1] , st[wh[j][i - 1]][i - 1]);
            wh[j][i] = wh[wh[j][i - 1]][i - 1];
            if(st[j][i] == st[j][i - 1]) id[j][i] = id[j][i - 1];
            else id[j][i] = id[wh[j][i - 1]][i - 1];
        }
    }
    Log[1] = 0;
    int cur = 1;
    for(int i = 2;i <= n;i ++) {
        if((1 << (cur + 1)) > i) {
            Log[i] = cur;
        }
        else {
            cur ++; Log[i] = cur;
        }
    }
}
 
int Min(int l , int r) {
    if(l > r) return l;
    int LL = Log[r - l + 1];
    int id1 = id[l][LL] , id2 = id[r - (1 << LL) + 1][LL];
    if(a[id1] > a[id2]) return id2;
    return id1;
}
 
int main(void) {
//  freopen("data.txt" , "r" , stdin);
//  freopen("myout.txt" , "w" , stdout);
    scanf("%d" , &n);
    for(int i = 1;i <= n;i ++) scanf("%d" , &a[i]);
    make_dance();
    q.push(m(1 , n , Min(1 , n)));
    int tot = 0;
    while(!q.empty()) {
        ind = q.top(); q.pop();
        int i1 = ind.id , i2 = Min(i1 + 1 , ind.r + 1);
        res[++ tot] = make_pair(a[i1] , a[i2]);
        assert(ind.l <= i1 && i1 < i2);
        if(i1 != ind.l) q.push(m(ind.l , i1 - 1 , Min(ind.l , i1 - 1)));
        if(i2 - i1 != 1) q.push(m(i1 + 1 , i2 - 1 , Min(i1 + 1 , i2 - 1)));
        if(i2 != ind.r) q.push(m(i2 + 1 , ind.r , Min(i2 + 1 , ind.r)));
    }
    for(int i = 1;i <= n / 2;i ++) {
        printf("%d %d " , res[i].first , res[i].second);
    }
}

Measured memory_bytes: 69752
(declaim (inline sum-seq))
(defun sum-vec (vec)
  (loop for x across vec summing x))

(defparameter solve-times
  (concatenate 'vector (loop for i from 1 to (read)
                          collect (read))))

(defparameter total-time
  (sum-vec solve-times))

(defparameter drinks
  (loop for i from 1 to (read)
       collect (cons (read) (read))))

(loop for drink in drinks
   do (progn (prin1 (+ (cdr drink)
                       (- (aref solve-times (1- (car drink))))
                       total-time))
             (terpri)))


Measured memory_bytes: 4452
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        int N = RInt();
        var C = RString();
        int Wcount = C.Count(_ => _ == 'W');
        int Rcount = C.Count(_ => _ == 'R');

        int ans = 0;
        for (int i = 0; i < Rcount; i++)
        {
            if (C[i] != 'R') ans++;
        }
        WriteLine(ans);
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 28524
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 1000005;

bool ok[MAX_N], nok[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    vl a(n), sm(n+1);
    vl vec;
    rep(i,n){
        cin >> a[i];
        sm[i+1] = sm[i] + a[i];
    }
    rep(i,n){
        srep(j,i+1,n+1){
            vec.pb(sm[j]-sm[i]);
        }
    }
    rep(i,len(vec)){
        ok[i] = true;
    }
    ll ans = 0;
    rrep(i,60){
        rep(j,len(vec)){
            nok[j] = false;
        }
        int cnt = 0;
        rep(j,len(vec)){
            if(ok[j]){
                if((vec[j] >> i)&1LL){
                    cnt++;
                    nok[j] = true;
                }
            }
        }
        if(cnt >= K){
            // show(i);
            rep(j,len(vec)){
                ok[j] = nok[j];
            }
            ans += (1LL << i);
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6512
""" AtCoder """

N = int(input())
D, X = map(int, input().split())
A = [int(input()) for _ in range(N)]

ans = 0

for i in range(N):
    if D % A[i] > 0:
        ans += D // A[i] + 1
    else:
        ans += D // A[i]

print(ans + X)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long check(int x,int n,int ara[])
{
    long long ans=0;
    for(int i=0; i<n; i++)
    {
        ans+=((x-ara[i])*(x-ara[i]));
    }
    return ans;
}
int main()
{
    int n,i,sum=0,mini=INT_MAX,maxi=INT_MIN;
    cin>>n;
    int ara[n+5];
    for(i=0; i<n; i++)
    {
        cin>>ara[i];
        if(ara[i]<mini)
            mini=ara[i];
        if(ara[i]>maxi)
            maxi=ara[i];
    }
    long long ans1=INT_MAX;
    for(i=0; i<101; i++)
    {
        long long temp=check(i,n,ara);
        if(temp<ans1)
            ans1=temp;
    }
    cout<<ans1<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> vector<T> make_vec(size_t n) { return vector<T>(n); }
template<typename T, typename... Args> auto make_vec(size_t n, Args... args) {
    return vector<decltype(make_vec<T>(args...))>(n, make_vec<T>(args...));
}
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value>::type fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<!is_same<T, U>::value>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

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

    string s;
    cin >> s;
    int cnt = 0;
    int mx = 0;
    rep(i, 3) {
        if (s[i] == 'R') {
            cnt++;
            chmax(mx, cnt);
        }
        else cnt = 0;
    }
    cout << mx << '\n';

}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
using namespace std;
 
int main(){
    long long int N;
    cin >> N;
    long long int counter = 0;
    for(int i = 0;i<N+1; i++){
        if((i%3 != 0)&&(i%5 != 0)) counter += i;
    }
    cout << counter << endl;
}

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

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

  int fill = s == 1e9 ? 1 : 1e9;
  vector<int> v(n, fill);

  for (int i = 0; i < k; ++i)
    v[i] = s;

  for (int i = 0; i < n; ++i) {
    if (i != 0)
      cout << " ";
    cout << v[i];
  }
  cout << endl;
}

Measured memory_bytes: 1664