akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, x;
	cin >> n >> x;
	vi v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v));
	REP(i, n)x -= v[i];
	cout << n + x / v[0] << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import System.Exit (exitSuccess)
main = do
  nums <- map read <$> lines <$> getContents
  forM_ nums $ \i -> do
    if i == 0 then exitSuccess else do
      let t = sum [two | j <- [2..i], let two = div' j 2]
      let f = sum [five | j <- [2..i], let five = div' j 5]
      print $ min t f

div' 0 m = 0
div' n m
  | mod n m == 0 = 1 + div' (div n m) m
  | otherwise = 0


Measured memory_bytes: 7608
#include<iostream>
#include<string>
using namespace std;
int main(){
    string str;
    cin >> str;
    int n;
    n = str.size();
    int c0,c1;
    c0 = 0;
    c1 = 0;
    for(int i=0; i<n; i++){
        if(str[i]=='0'){
            c0++;
        }else{
            c1++;
        }
    }
    cout << 2*min(c0,c1) << endl;
}



Measured memory_bytes: 3756
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int UF[110000];
int UF2[110000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;UF[a]+=UF[b];UF[b]=a;
}
int FIND2(int a){
	if(UF2[a]<0)return a;
	return UF2[a]=FIND2(UF2[a]);
}
void UNION2(int a,int b){
	a=FIND2(a);b=FIND2(b);if(a==b)return;UF2[a]+=UF2[b];UF2[b]=a;
}
int p[110000];
vector<int>v[110000];
pair<int,int>z[110000];
int use[110000];
int mi[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	if(a==1){
		printf("0\n");return 0;
	}
	if(a>1&&b==0){
		printf("Impossible\n");return 0;
	}
	for(int i=0;i<a;i++)UF[i]=UF2[i]=-1;
	for(int i=0;i<a;i++)scanf("%d",p+i);
	if(a==2&&b==0){
		printf("%d\n",p[0]+p[1]);return 0;
	}
	for(int i=0;i<b;i++){
		int s,t;scanf("%d%d",&s,&t);
		UNION(s,t);
	}
	for(int i=0;i<a;i++){
		v[FIND(i)].push_back(p[i]);
	}
	for(int i=0;i<a;i++)std::sort(v[i].begin(),v[i].end());
	long long ret=0;
	int cn=0;
	int sz=0;
	int at;
	for(int i=0;i<a;i++){
		if(v[i].size()<2)continue;
		cn++;
		//ret+=v[i][0];
		for(int j=0;j<v[i].size();j++){
			z[sz++]=make_pair(v[i][j],i);
		}
	}
	std::sort(z,z+sz);
	if(cn==1){
	}else{
		for(int i=0;i<sz;i++){
			if(mi[z[i].second]);
			else{
				mi[z[i].second]=1;
				ret+=z[i].first;
				use[i]=1;
			}
		}
		int rem=cn-2;
		for(int i=0;rem;i++){
			if(!use[i]){
				rem--;
				ret+=z[i].first;
				use[i]=1;
			}
		}
	}
	at=0;
	for(int i=0;i<a;i++){
		if(v[i].size()==1){
			ret+=v[i][0];
			bool ok=false;
			while(at<sz){
				if(!use[at]){
					ok=true;
					use[at]=1;
					ret+=z[at].first;
					at++;
					break;
				}
				at++;
			}
			if(!ok){
				printf("Impossible\n");return 0;
			}
		}
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 7552
from math import factorial
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N , X] = [int(input_raw[0]), int(input_raw[1])]
    m_list = []
    for i in range(N):
        input_raw = read_func().strip().split()
        m_list.append(int(input_raw[0]))
    sub_X = X - sum(m_list)
    print len(m_list) + sub_X/min(m_list)



if __name__ == '__main__':
    main()

Measured memory_bytes: 2692
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	min := 1000
	max := 0
	for i := 0; i < n; i++ {
		var a int
		con.Scan(&a)
		if a > max {
			max = a
		}
		if a < min {
			min = a
		}
	}
	con.Println(max - min)
	return nil
}


Measured memory_bytes: 640
////#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include<functional>
//#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pI64d(x) printf("%I64d\n",x)
const int INF=1e9+10;
const int MOD=1e9+7;
const int N=1e5+10;
int a[N];
int main()
{
    int n,c,k;
    while(~scanf("%d%d%d",&n,&c,&k))
    {
        for(int i=1;i<=n;i++) scanf("%d",&a[i]);
        sort(a+1,a+n+1);
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            int num=0,j=i;
            while(j<=n&&num<c&&a[j]<=a[i]+k)  num++,j++;
            ans++;
            i=j-1;
        }
        printf("%d\n",ans);
    }
    return 0;
}






Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001
 
typedef struct Node {
    long key;
    struct Node *p, *l, *r;
} Node;
 
Node *root, *NIL;
 
 
void insert(long k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
     
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->l = z->r = NIL;
     
    while (x != NIL) {
    y = x;
    if (z->key < x->key) x = x->l;
    else x = x->r;
    }
    z->p = y;
     
    if (y == NIL) root = z;
    else if (z->key < y->key) y->l = z;
    else y->r = z;
}
 
Node * find(Node *x, long k) {
    while (x != NIL && k != x->key) {
    if (k < x->key) x = x->l;
    else x = x->r;
    }
    return x;
}
 
void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->l);
    printf(" %d", u->key);
    inorder(u->r);
}
 
void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->l);
    preorder(u->r);
}
 
void print() {
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
}
 
Node* getMinimum(Node *x) {
    while (x->l != NIL) x = x->l;
    return x;
}
 
Node* getSuccessor(Node *x) {
    if (x->r != NIL) return getMinimum(x->r);
     
    Node *y;
    y = x->p;
    while ( y!=NIL && x == y->r) {
    x = y;
    y = y->p;
    }
    return y;
}
void deleteNode(Node *z) {
    Node *y;
    Node *x;
    if (z->l == NIL || z->r == NIL) y = z;
    else y = getSuccessor(z);
 
    if (y->l != NIL) x = y->l;
    else x = y->r;
     
    if (x != NIL) x->p = y->p;
     
    if (y->p == NIL) root = x;
    else if (y == y->p->l) y->p->l = x;
    else y->p->r = x;
 
    if (y!= z) z->key = y->key;
}
 
 
int main() {
    long n, i, x;
    char st[20];
    scanf("%ld", &n);
    for (i = 0; i < n; i++) {
    scanf("%s", st);
    scanf("%ld", &x);
    Node *u = find(root, x);
    if (st[0] == 'f') {
        if (u != NIL) printf("yes\n");
        else printf("no\n");
    }
    else if (st[0] == 'i') insert(x);
    else if(st[0] == 'd') deleteNode(find(root, x));
    else if (st[0] == 'p') print();
    }
    return 0;
}



Measured memory_bytes: 20532
// Vicfred
// https://atcoder.jp/contests/abc165/tasks/abc165_a
// simulation
import std.conv;
import std.stdio;
import std.string;

void main() {
    int k = readln.chomp.to!int;
    int a, b;
    readf("%s %s\n", &a, &b);
    for(int i = a; i <= b; ++i) {
        if(i%k == 0) {
            "OK".writeln;
            return;
        }
    }
    "NG".writeln;
}



Measured memory_bytes: 2836
S = input()

A = ["R","U","D"]
B = ["L","U","D"]

flag = True
for i in range(len(S)):
    # 偶数
    if i % 2 == 0:
        if S[i] not in A:
            flag = False
    else:
        if S[i] not in B:
            flag = False

print("Yes") if flag else print("No")

Measured memory_bytes: 3060
#include <numeric>
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n;cin>>n;
    int a[214514];
    rep(i,0,n){
       cin>>a[i];
        a[i]-=i+1;
    }
    sort(a,a+n);
    int ans=0;
    if(n%2==1){
        int h=a[n/2];
        rep(i,0,n){
            ans+=abs(a[i]-h);
        }
        cout<<ans<<endl;
        return 0;
    }else {
        int h=a[n/2];
        int count=0;
        rep(i,0,n){
            count+=abs(a[i]-h);
        }
        int s=a[n/2-1];
        int sum=0;
        rep(i,0,n){
            sum+=abs(a[i]-s);
        }
        ans=min(sum,count);
        cout<<ans<<endl;
        return 0;
    }
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		if (x == 7 || x == 5 || x == 3) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 20692
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A * N, B) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)
#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl


int main(){
    int k;
    cin>>k;
    cout<<(k/2)*(k/2+k%2)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
#define yn {puts("Yes");}else{puts("No");}
struct edge{ ll to, cost; };
const ll INF = 1001001001001001001;
const int MAX_N = 500005;
const int MAX_V = 500005;
const int MAX_K = 6000;
vector<edge> G[MAX_V];
ll dd[MAX_V];

void dijkstra(int s){
    // greater<P>を指定することでfirstが小さい順に取り出せるようにする
    priority_queue<P, vector<P>, greater<P> > que;
    fill(dd, dd+MAX_V, INF);
    dd[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        for(int i=0; i<G[v].size(); i++){
            edge e = G[v][i];
            if(dd[e.to] > dd[v] + e.cost){
                dd[e.to] = dd[v] + e.cost;
                que.push(P(dd[e.to], e.to));
            }
        }
    }
}

int main() {
    ll n, m, s;
    cin >> n >> m >> s;
    ll u[m], v[m], a[m], b[m];
    rep(i,m){
        cin >> u[i] >> v[i] >> a[i] >> b[i];
        u[i]--; v[i]--;
    } 
    ll c[n], d[n];
    rep(i,n)cin >> c[i] >> d[i];

    rep(k,m){
        rep(i,6000){
            edge e1, e2;
            e1.cost = b[k]; e2.cost = b[k];
            if(i < a[k])continue;
            e1.to = v[k] * 6000 + (i - a[k]);
            G[u[k]*6000+i].push_back(e1);
            e2.to = u[k] * 6000 + (i - a[k]);
            G[v[k]*6000+i].push_back(e2);
        }
    }

    rep(k,n){
        rep(i,5999){
            ll nx = min((ll)5999, i+c[k]);
            edge e1;
            e1.cost = d[k];
            e1.to = k * 6000 + nx;
            G[k*6000 + i].push_back(e1);
        }
    }

    s = min(s, (ll)5999);
    dijkstra(s);

    ll ans[n];
    rep(i,n)ans[i] = INF;

    rep(i,n){
        rep(j,6000){
            ans[i] = min(ans[i], dd[i*6000+j]);
        }
    }

    srep(i,1,n)cout << ans[i] << endl;
    return 0;
}



Measured memory_bytes: 58156
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        int i=1;
        int x;
        Scanner sc = new Scanner(System.in);
        while(true){
            x =sc.nextInt();
            if(x == 0) break;
            System.out.println("Case "+i+": "+x);
            i++;
        }
    }
}


Measured memory_bytes: 45256
from collections import deque

n = int(input())
a = list(map(int, input().split()))
b = deque()
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

if n % 2 != 0:
    for i in reversed(b):
        print(i, end=" ")
else:
    for i in b:
        print(i, end=" ")


Measured memory_bytes: 25416
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'a')+1)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=10000005;
//const ll Mod=1000000007;
const ll Mod=998244353;
using namespace std;
 
ll p[maxn],inv[maxn];
//inv[0]=inv[1]=1;
//inv[i]=1LL*(Mod-Mod/i)*inv[Mod%i]%Mod;
//S(n,m)=S(n,m−1)+C(​​n m​​),S(n,m)=2S(n−1,m)−C(​​n−1 m​​)
ll ksm(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1)
        {
            res=res*x%Mod;
        }
        x=x*x%Mod;
        y/=2;
    }
    return res%Mod;
}
 
ll C(int n,int m)
{
    return p[n]*inv[m]%Mod*inv[n-m]%Mod;
}
int main()
{
    sync;
    int n;
    cin>>n;
    p[0]=inv[0]=1;
    for(int i=1;i<=maxn-2;i++)
    {
        p[i]=p[i-1]*i%Mod;
//        inv[i]=ksm(p[i],Mod-2);
    }
    inv[maxn-2]=ksm(p[maxn-2],Mod-2);     //阶乘的逆元
    for(int i=maxn-3;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%Mod;
    ll ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans=(ans+1ll*C(n,i)*ksm(2,n-i)%Mod)%Mod;
    ans=(ksm(3,n)-ans*2%Mod+Mod)%Mod;
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 156544
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var a = cin.ArrayLong(n);
            Array.Sort(a);
            Console.WriteLine(a.Take(n - 1).Sum() + a[n-1]/2);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

using ll=long long;

int round_down(double f){
    return int(f);
}

int main()
{
    
    int A,B;
    cin>>A>>B;
    bool f=false;
    for (int i=0;i<10000; i++) {
        if (round_down(i*0.08)==A&&round_down(i*0.1)==B) {
            f=true;
            cout<<i<<endl;
            break;
    
        }
    }
    if (!f) {
        cout<<-1<<endl;
    }
   
    return 0;
}


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

#define int long long
#define rep(i,a,n) for(int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(),(x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
#define INF (1e9)

typedef pair<int,int> P;
typedef vector<int> vi;

int N,K;
vi A;

signed main() {
    cin>>N>>K;
    rep(i,0,N) {
        int a; cin>>a;
        A.pb(a);
    }

    int res = 0;
    for(int d=60;d>=-1;d--) {
        if(d != -1 and !(K & (1LL<<d))) continue;

        int tmp = 0;
        for(int e = 60;e>=0;e--) {
            int mask = 1LL<<e;
            int ctn=0;
            rep(i,0,N) {
                if(A[i] & mask) ctn++;
            }

            if(e>d) {
                if(K & mask) {
                    tmp+=mask*(N-ctn);
                }else{
                    tmp+=mask*ctn;
                }
            }else if(e==d) {
                tmp+=mask*ctn;
            }else{
                tmp+=mask*max(ctn,N-ctn);
            }
        }
        res=max(res,tmp);
    }
    cout<<res<<endl;


    



}

Measured memory_bytes: 1400
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	digitMap := make(map[int]int)
	flag := true
	minDigit := 0
	for i := 0; i < m; i++ {
		digit := nextInt()
		num := nextInt()
		if n != 1 && digit == 1 && num == 0 {
			fmt.Println(-1)
			flag = false
			break
		}
		tmp, exist := digitMap[digit]
		if exist && tmp != num {
			fmt.Println(-1)
			flag = false
			break
		}
		if !exist {
			digitMap[digit] = num
			minDigit = digit
		}
	}
	if flag {
		if n != 1 && digitMap[1] == 0 {
			digitMap[1] = 1
		}
		_, exist := digitMap[minDigit-1]
		if digitMap[minDigit] == 0 && !exist {
			digitMap[minDigit-1] = 1
		}
		result := 0
		for i := 0; i < n; i++ {
			result = result*10 + digitMap[i+1]
		}
		fmt.Println(result)
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;

#define PI 3.1415926535897932;

int main() {
	double r;
	double ensyu, menseki;
	cin >> r;

	ensyu = 2.0 * r * PI;
	menseki = r * r * PI;

	printf("%.6f %.6f\n", menseki, ensyu);
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=3e5+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;
 
int n;
int main()
{
    	int m,d;

    	cin>>m>>d;

    	int ans = 0;
    	for(int i=1;i<=m;i++){
    		for(int j=20;j<=min(d,99);j++){
    			if(j%10 < 2)continue;
    			if((j/10) * (j%10)  == i){
    				ans++;
    			}
    		}
    	}
 	
 	cout<<ans<<endl;
 	
}

Measured memory_bytes: 256
import java.util.*;

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

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    }
}



Measured memory_bytes: 26420
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>

using namespace std;
typedef long long  ll;

ll dx[] = { 1, 0 };
ll dy[] = { 0, 1 };

int main()
{
	ll N;
	vector<ll> a(5);
	cin >> N >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	sort(a.begin(), a.end());
	cout << (ll)ceil((double)N / a[0]) + 4LL << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int X, t;
    cin >> X >> t;
    int ans = X-t;
    if(ans<0){
        ans=0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

const int N_BALL = 10;

int balls[N_BALL];

bool solve(int l[], int l_top, int r[], int r_top) {
  int bi = (l_top + 1) + (r_top + 1);

  if (bi == N_BALL) return true;

  l[l_top+1] = balls[bi];
  if (l_top >= 0 && l[l_top] > l[l_top+1]) return false;
  if (solve(l, l_top+1, r, r_top)) return true;

  r[r_top+1] = balls[bi];
  if (r_top >= 0 && r[r_top] > r[r_top+1]) return false;
  if (solve(l, l_top, r, r_top+1)) return true;

  return false;
}

int main() {
  int N;
  scanf("%d", &N);

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

    int left[N_BALL] = {}, right[N_BALL] = {};
    if (solve(left, -1, right, -1)) printf("YES\n");
    else printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 1008
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
s = input()
t = input()

if s == t:
	print(N)
	exit()

for i in range(1, N):
	if s[i:] == t[:-i]:
		print(2*N - len(s[i:]))
		break
else:
	print(2*N)

Measured memory_bytes: 5200
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
using p = pair<int, int>;

int main()
{
  int n, m;
  cin >> n >> m;
  std::vector<int> a(n);

  int sum = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    sum += a[i];
  }
  sort(a.rbegin(), a.rend());
  string ans = "Yes";
  if (a[m - 1] < (double)sum / (4 * m))
  {
    ans = "No";
  }
  cout << ans << endl;
  return 0;
}


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

#define int long long
#define ff first                
#define ss second               

int dp[6005][3005];

signed main(){
    int n, t, ans = 0; 
    cin >> n >> t;
    
    pair <int, int> data[n+5];
    
    for(int i = 1; i <= n; i++) cin >> data[i].ff >> data[i].ss;
    
    sort(data + 1, data + n + 1);
    
    for(int i = 1; i <= n; i++){
         for(int j = 0; j < t; j++){
            dp[j][i] = max(dp[j][i], dp[j][i-1]);
            dp[j+data[i].ff][i] = max(dp[j][i-1]+data[i].ss, dp[j+data[i].ff][i-1]);
            ans = max(ans, dp[j+data[i].ff][i]);
        }
    }
    
    cout << ans << '\n';
}

Measured memory_bytes: 141056
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean[] list = new boolean[82];
        for (int i = 1; i <10 ; i++) {
            for (int j = 1; j < 10 ; j++) {
                list[i*j] = true;
            }
        }
        int N = sc.nextInt();
        if(N > 81){
            System.out.println("No");
            return;
        }else{
            if(list[N]){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 23124
#include<stdio.h>
#define ll long long
int main(){
    ll x;
    scanf("%lld",&x);
    ll ans = 0;
    ll p = 100;
    while(x > p){
        ans ++;
        ll q = p / 100;
        p += q;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<algorithm>
using namespace std;
int n,k,a[51],sum;

int main(){
    ios::sync_with_stdio(false);
    cin>>n>>k;
    for (int i=1;i<=n;i++) {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for (int i=n;i>=n-k+1;i--) {
        sum+=a[i];
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize(-O3)
#pragma GCC optimize(0fast)
#pragma GCC optimize("unroll-loops")
 
#define fi first
#define se second
#define sqr(x) (x) * (x)
#define p_b push_back
#define m_p make_pair
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define pw(x) (1ll << x)
 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 1e6;
const ll MOD = 1e9 + 7;
 
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
template <typename T> void vout(T s){cout << s << endl; exit(0);}
 
 
int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
 
    ll n, k, t;
    cin >> n >> k;
    t = n;
 
    set <pll> res;
 
    res.insert({1ll, 2ll});
 
    for(int i = 3; i <= n; i++){
        res.insert({1ll, i});
 
        for(int j = 2; j < i; j++){
            if(!k){
                res.insert({j, i});
            }else k--;
        }
 
    }
 
 
    if(k)vout(-1);
  	cout << res.size() << "\n";
    for(auto i : res)cout << i.fi << " " << i.se << "\n";
 
 
    return 0;
}


Measured memory_bytes: 640
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define PI 3.14159265358979323846264338327950288
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
typedef long long ll;
using namespace std;
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	double x, y;
	cin >> x >> y;
	double a = (y / 2) -x;
	if (a >= 0 && (int)a == a && x - a >= 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3724
ATCG = ['A', 'T', 'C', 'G']
S = input()

counts = []
a = 0
i = 0
while i < len(S):
    if S[i] in ATCG:
        a += 1
    else:
        counts.append(a)
        a = 0
    
    i += 1
    if i == len(S):
        counts.append(a)

print(max(counts))

Measured memory_bytes: 61908
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int a, b;

        Scanner input = new Scanner(System.in);

        a = input.nextInt();
        b = input.nextInt();

        if ((a >= 0 && a <= 23) && (b >= 0 && b <= 23)) {

            int time = a + b;

            if (time >= 24) {

                int time1 = time - 24;

                System.out.println(time1);
                
            } else {

                System.out.println(time);
            }
        }
    }
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int board[100][100];
int main() {
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;
	int x = 0, y = 0, d = 1;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		while (a > 0) {
			board[y][x] = i + 1;
			int nx = x + d;
			if (0 > nx || nx >= W) {
				y++;
				d *= -1;
			}
			else {
				x = nx;
			}
			a--;
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << board[i][j] << " ";
		}
		cout << endl;
	}
 }

Measured memory_bytes: 384
fun main(args: Array<String>) {
    val (n,k) = readLine()!!.split(" ").map { it.toInt() }
    val v = readLine()!!.split(" ").map { it.toInt() }

    var ans = 0
    for(take in 0..Math.min(n,k)){
        for(takeL in 0..take) {
            val takeR = take-takeL
            var remove = k-take
            if(remove<0) remove = 0
            if(remove>take) remove = take
            var count = 0
            val vv = (v.take(takeL)+v.takeLast(takeR)).sorted().dropWhile { ++count<=remove && it<0 }
            ans = Math.max(ans, vv.sum())
        }
    }
    println(ans)
}


Measured memory_bytes: 42400
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	string s;
	cin >> s;
	if (s == "RRR")
		cout << 3 << endl;
	else if (s == "RRS" or s == "SRR")
		cout << 2 << endl;
	else if (s == "RSS" or s == "SRS" or s == "SSR" or s == "RSR")
		cout << 1 << endl;
	else
		cout << 0 << endl;
	return 0;
}

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

using namespace std;

int main() {
  int a, b, m;
  scanf("%d %d %d", &a, &b, &m);
  vector<int> va(a), vb(b);
  for (int i = 0; i < a; ++i) {
    scanf("%d", &va[i]);
  }
  for (int i = 0; i < b; ++i) {
    scanf("%d", &vb[i]);
  }
  int ans = *min_element(va.begin(), va.end()) + * min_element(vb.begin(), vb.end());
  for (int i = 0; i < m; ++i) {
    int x, y, c;
    scanf("%d %d %d", &x, &y, &c);
    --x, --y;
    ans = min(ans, va[x] + vb[y] - c);
  }
  ans = max(ans, 0);
  printf("%d\n", ans);
  return 0;
}


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

int main()
{
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='+')
        {
            cnt++;
        }
        else cnt--;
    }
    cout<<cnt<<endl;
}


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

using namespace std;

namespace {

#define VEVE(i, a, b) for (ll i = a, __##i = b; i < __##i; ++i)
#define DYDY(i, a, b) for (ll i = a, __##i = b; i > __##i; --i)
#define RARA(x, seq) for (auto &x : seq)
#define SIZE(x) ((ll)(x.size()))
#define ALL(x) x.begin(), x.end()

typedef int ll;
typedef double dd;

void Solve(ll) {
  ll n;
  cin >> n;
  if (n == 3) {
    cout << "2 5 63" << endl;
    return;
  }
  vector<ll> twos, threes;
  VEVE(i, 2, 30001) {
    if (i % 2 == 0)
      twos.push_back(i);
    else if (i % 3 == 0)
      threes.push_back(i);
  }
  // even number of odd numbers to be divisible by 2
  // number of evens % 3 != 1
  VEVE(o, 2, SIZE(threes) + 1) {
    if (o % 2 == 0) {
      VEVE(e, 1, SIZE(twos) + 1) {
        if (o + e == n and e % 3 != 1) {
          vector<ll> res(threes.begin(), threes.begin() + o);
          res.insert(res.end(), twos.begin(), twos.begin() + e);
          RARA(r, res) cout << r << ' ';
          cout << endl;
          return;
        }
      }
    }
  }
//  DEBUG(SIZE(poss), poss);
}

void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}

int32_t main() {
#ifdef AZN
  freopen("input.txt", "r", stdin);
#endif
  Init();
  ll tests = 1;
  VEVE(test, 1, tests + 1) Solve(test);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll n ; cin >> n;
    vector<pair<ll,ll>> hpns(n);
    rep(i,n){
        ll a,b ; cin >> a >> b;
        hpns.at(i).first = a;
        hpns.at(i).second = b;
    }
    std::sort(hpns.begin(), hpns.end(), [](const pair<ll,ll> a, const pair<ll,ll> b) {
        return a.first + a.second > b.first + b.second;
    });
    ll ans = 0;

    rep(i,n){
        if(!(i%2)) ans += hpns.at(i).first+hpns.at(i).second;
    }
    rep(i,n){
        ans -= hpns.at(i).second;
    }
    cout << ans << endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <math.h>

using namespace std;

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

  vector<string> str(N);

  int64_t M=0, A=0, R=0, C=0, H=0;

  for (int64_t i = 0; i < N; i++) {
    cin >> str.at(i);
  }

  for (int64_t i = 0; i < N; i++) {
    if (str.at(i).at(0) == 'M'){
      M++;
    }
    else if (str.at(i).at(0) == 'A')
    {
      A++;
    }
    else if (str.at(i).at(0) == 'R')
    {
      R++;
    }

    else if (str.at(i).at(0) == 'C')
    {
      C++;
    }
    else if (str.at(i).at(0) == 'H')
    {
      H++;
    }
  }

  int64_t count = M * A * R + M * A * C + M * A * H + M * R * C + M * R * H + M * C * H + A * R * C + A * R * H + A * C * H + R * C * H;
  

  cout << count << endl;
}

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

const int N = 2000;

int n, m;
std::vector<int> tree[N];

int dfs(int p, int u, int d)
{
    if (d == 0) {
        return 1;
    }
    int result = 1;
    for (auto v : tree[u]) {
        if (v != p) {
            result += dfs(u, v, d - 1);
        }
    }
    return result;
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n - 1; ++ i) {
        int a, b;
        scanf("%d%d", &a, &b);
        a --;
        b --;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    int result = 0;
    for (int u = 0; u < n; ++ u) {
        result = std::max(result, dfs(-1, u, m >> 1));
        for (auto v : tree[u]) {
            result = std::max(result, dfs(u, v, m - 1 >> 1) + dfs(v, u, m - 1 >> 1));
        }
    }
    printf("%d\n", n - result);
}

Measured memory_bytes: 888
n,p,q = map(int, input().split())
cn = []
for i in range(n):
    cn.append(int(input()))
difs = [p*(q-i) - cn[i] for i in range(n)] ##0번째 자취에서 1번 i번째날 자취할 때의 증가분
difs = sorted(difs, reverse = True) ##제일 증가분이 큰 순서대로 sort
ans = [sum(cn)] ##(ans[i] = i번 자취시 행복도의 최대값)  으로 만들것임
for i in range(n):
    ans.append(ans[-1] + 2*i*p + difs[i])
##i=0에서는 자취를 한번만 한 것으로 자취파워가 올라간 것을 반영한 2ip는 0이 된다.
##(자취파워 올라간게 반영되지 않으므로)
print(max(ans))  ##0~n번 자취할때 의 최대값들중 최대값을 출력.


Measured memory_bytes: 72540
# -*- coding: utf_8 -*-

from itertools import repeat
from itertools import combinations

def rec(s, i, total, m):
    if total == m:
        return 1

    if len(s) == i or total > m:
        return 0

    return rec(s, i + 1, total, m) + rec(s, i + 1, total + s[i], m)


def makeCache(s):
    cache = {}
    for i in range(len(s)):
        comb = list(combinations(s, i))
        for c in comb:
            cache[sum(c)] = 1

    return cache

def loop(s, m):
    for i in range(len(s)):
        comb = list(combinations(s, i))
        for c in comb:
            if sum(c) == m:
                return 1

    return 0

if __name__ == "__main__":
    n = int(input())
    a = [int (x) for x in input().split()]
    q = int(input())
    m = [int (x) for x in input().split()]
    s = makeCache(a)
    for i in m:
        #print("yes") if rec(a, 0, 0, i) > 0 else print("no")
        #print("yes") if loop(a, i) > 0 else print("no")
        print("yes") if i in s else print("no")

Measured memory_bytes: 58240
#include <stdio.h>

int main(){
	int i;
	int n,ans=0;
	int c[20],v[20];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",v+i);
	}
	for(i=0;i<n;i++){
		scanf("%d",c+i);
	}
	for(i=0;i<n;i++){
		if((v[i]-c[i])>0){
			ans+=v[i]-c[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    int n, t = 0;
    string S;
    cin >> n >> S;
    char p = S.at(0);
    rep(i, 1, n) {
        if(S.at(i) != p) {
            t++;
            if(i < S.size() - 1) p = S.at(++i);
        } else {
            p = S.at(i);
        };
    }
    cout << t << endl;
}


Measured memory_bytes: 3320
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var m int64
	fmt.Scan(&n, &m)
	ar := make(drinks, n)
	for i := 0; i < n; i++ {
		var a, b int64
		fmt.Scan(&a, &b)
		ar[i].cost = a
		ar[i].count = b
	}
	sort.Sort(ar)
	var ans int64
	for _, d := range ar {
		if d.count <= m {
			m -= d.count
			ans += d.cost * d.count
		} else {
			ans += d.cost * m
			break
		}
	}
	fmt.Println(ans)
}

type drink struct {
	cost  int64
	count int64
}
type drinks []drink

func (d drinks) Len() int {
	return len(d)
}

func (d drinks) Swap(i, j int) {
	d[i], d[j] = d[j], d[i]
}

func (d drinks) Less(i, j int) bool {
	return d[i].cost < d[j].cost
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if (A * B < C * D) {
    cout << C * D << endl;
  } else { 
    cout << A * B << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if (c == 'A') { cout << 'T' << endl; }
  else if (c == 'T') { cout << 'A' << endl; }
  else if (c == 'C') { cout << 'G' << endl; }
  else { cout << 'C' << endl; }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math

def solve(N: int, D: int, X: "List[int]", Y: "List[int]"):
    count = 0
    for n in range(N):
        dist = math.sqrt(X[n]**2 + Y[n]**2)
        if dist <= D:
            count += 1
    print(count)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = [int()] * (N)  # type: "List[int]"
    Y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, D, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24604
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;



int main(){
    long long c=0,i,n;

    cin >> n;
    long long p[n] ;
    for(i=0;i<n;i++){
        cin >> p[i];
    }

    for(i=1;i<n-1;i++){
        if((p[i] < p[i-1] && p[i]>p[i+1]) || (p[i] > p[i-1] && p[i]<p[i+1])){
            c++;
        }
    }

    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import Counter

n=int(input())
l=[int(i) for i in input().split()]
c=Counter(l).most_common()
s=sorted([key,val] for key,val in c if val>=2)

if len(s)<2:
    ans=0
elif s[-1][1]>=4:
    ans=s[-1][0]**2
else:
    ans=s[-1][0]*s[-2][0]

print(ans)


Measured memory_bytes: 21540
s = input()
mod = 2019
ls = [1]+[0]*2018
ans = 0
temp=0
m=1
for i in range(len(s)):
    temp= (temp + m*int(s[-i-1]))%mod
    m=(m*10)%mod

    ls[temp] += 1

for i in ls:
    ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 9244
#include<iostream>
using namespace std;
int main(){
	int A=0,B=0;
	int score;
	for(int i=0; i<4; i++){
		cin >> score;
		A+=score;
	}
	for(int i=0; i<4; i++){
		cin >> score;
		B+=score;
	}
	score = max(A,B);
	cout << score << endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<int> num(103, 0);
        for(;;){
            int a, b;
            if(!(cin >> a >> b))
                return 0;
            if(a == 0)
                break;
            ++ num[a];
            ++ num[b];
        }

        bool ok = true;
        for(int i=3; i<103; ++i){
            if(num[i] % 2 == 1)
                ok = false;
        }
        if(num[1] % 2 == 1 && num[2] % 2 == 1 && ok)
            cout << "OK" << endl;
        else
            cout << "NG" << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323846264338327950L


int main(){
   long double a,b,c,d,a1,a2,angle,ans;
   cout<<fixed<<setprecision(20);
   cin>>a>>b>>c>>d;
   a1=c*30+(float)d/2.0;
   a2=d*6;
   if(a1>a2) angle=(a1-a2);
   else angle=(a2-a1);
   if(angle>180.0) angle=360.0-angle;
   ans=sqrt(a*a+b*b-2*a*b*cos(PI*angle/180.0));
   cout<<ans;
   return 0;
}

Measured memory_bytes: 4076
#include <iostream>
using namespace std;
#define N 101
int main(){
	int n,x,l[N]={};
	cin >> n >> x;
	for(int i=0;i<n;i++){
		cin >> l[i];
	}
	int ct=1;
	long long int d=0;
	for(int i=1;i<n+1;i++){
		d=d+l[i-1];
		if(d<=x){
			ct++;
		}else{
			break;
		}
	}
	cout << ct << endl;
}



Measured memory_bytes: 256
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}

template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){
    vector<pair<T,T>> out(input.size()-1);
    rep(i,input.size()-1){
        out[i].first =input[i  ];
        out[i].second=input[i+1];
    }
    return(out);
}
vector<char> String_to_vector_char(const string& input){
    vector<char> out(input.size());
    rep(i,input.size()){
        out[i]=input[i];
    }
    return out;
}

vector<ll> q(3);
void input(){
    rep(i,3)
        cin>>q[i];
}
void src(){
    cout<<accumulate(q.begin(),q.end(),0) - *max_element(q.begin(),q.end());
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deque vector
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );
void Oli(){
    string a;
    cin>>a;
    int mx = 0,s = 0;
    for(int i=0;i<a.size();i++){
        if( a[i]=='R'){
            s++;
        }else {
            mx = max(mx,s);
            s = 0;
        }
    }
    mx = max(mx,s);
    cout<<mx<<endl;
}
int main(){
int times = 1;
//cin>>times;
while(times--)
Oli();
}


Measured memory_bytes: 3592