akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var n = cin.ReadLong;
            var m = cin.ReadLong;
            if (m > n * 2)
            {
                var s = m - n * 2;
                var ans = n + s / 4;
                WriteLine(ans);
            }
            else
            {
                var ans = m / 2;
                WriteLine(ans);
            }
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

// pairsをsecond優先キーとして昇順ソート
bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<P> plus;
    vector<P> minus;
    vector<P> zero;

    ll pcount = 0;
    ll mcount = 0;

    REP(i, N){
        P p;
        p.first = i;
        cin >> p.second;
        if(p.second >= 0){
            plus.push_back(p);
            pcount++;
        }
        if(p.second < 0){
            minus.push_back(p);
            mcount++;
        }
    }

    sort(plus.begin(), plus.end(), compare_by_b);
    sort(minus.begin(), minus.end(), compare_by_b);

    ll max = 0;
    ll min = 0;

    vector<P> ans;

    if(pcount>0 && mcount>0){
        max = plus[pcount-1].second;
        for(ll i=1; i<mcount; i++){
            // cout << max << " " << minus[i].second << endl;
            P temp;
            temp.first = max;
            temp.second = minus[i].second;
            ans.push_back(temp);
            max = max - minus[i].second;
        }

        min = minus[0].second;
        for(ll i=0; i<pcount-1; i++){
            // cout << min << " " << plus[i].second << endl;
            P temp;
            temp.first = min;
            temp.second = plus[i].second;
            ans.push_back(temp);
            min = min - plus[i].second;
        }

        P temp;
        temp.first = max;
        temp.second = min;
        ans.push_back(temp);
        max = max - min;
    }

    if(pcount == 0 && mcount>0){
        max = minus[mcount-1].second;
        for(ll i=0; i<mcount-1; i++){
            P temp;
            temp.first = max;
            temp.second = minus[i].second;
            ans.push_back(temp);
            max = max - minus[i].second;
        }
    }
if(pcount > 0 && mcount == 0){
        min = plus[0].second;
        max = plus[pcount-1].second;
        for(ll i=1; i<pcount-1; i++){
            P temp;
            temp.first = min;
            temp.second = plus[i].second;
            ans.push_back(temp);
            min = min - plus[i].second;
        }
        P temp;
        temp.first = max;
        temp.second = min;
        ans.push_back(temp);
        max = max - min;
    }

    cout << max << endl;
    for(auto v: ans){
        cout << v.first << " " << v.second << endl;
    }
    return 0;
}

Measured memory_bytes: 6896
using System;
using System.Collections.Generic;

namespace AtCoder_CSharp
{
    class AtCoder
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int P, Q, R;

            

            P = int.Parse(input[0]);
            Q = int.Parse(input[1]);
            R = int.Parse(input[2]);

            List<int> list = new List<int> { P, Q, R };
            list.Sort();

            Console.WriteLine(list[0] + list[1]);
        }

    }
}


Measured memory_bytes: 13268
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
struct point{
    int ck, a, b, c;
};
vector<point>V;

long long A[201000];

void Add(int c, int a, int b){ // c=a+b
A[c]=A[a]+A[b];
V.push_back({0,a,b,c});
}
void Comp(int c, int a, int b){ // c = a<b
A[c]=A[a]<A[b];
V.push_back({1,a,b,c});
}
void init(int a){
    Add(a,88,88);
}
void Copy(int a, int b){
    Add(a, 88, b);
}
void Mul2(int a){
    Add(a,a,a);
}
void Not(int a, int b){
    Comp(a,b,4);
}
int main(){
    Add(3,0,1);
    Comp(4,5,3);
    int i, j;
    for(i=0;i<=60;i++){
        Add(i+5,i+4,i+4);
    }
    Add(100,0,4);
    for(i=30;i>=0;i--){
        Add(102, 101, 4+i);
        Comp(150+i, 102, 100);
        Copy(103, 150+i);
        for(j=0;j<i;j++)Mul2(103);
        Add(101,101,103);
    }

    Add(200,1,4);
    for(i=30;i>=0;i--){
        Add(202, 201, 4+i);
        Comp(250+i, 202, 200);
        Copy(203, 250+i);
        for(j=0;j<i;j++)Mul2(203);
        Add(201,201,203);
    }

    for(i=0;i<=30;i++){
        Not(300, 150+i);
        for(j=0;j<=30;j++){
            Comp(399, 300, 250+j);
            Add(400+i+j,400+i+j, 399);
        }
    }


    for(i=0;i<=60;i++){
        for(j=0;j<i;j++){
            Mul2(400+i);
        }
        Add(2,2,400+i);
    }


    printf("%d\n",V.size());
    for(auto &t : V){
        if(t.ck==0)printf("+ %d %d %d\n",t.a,t.b,t.c);
        if(t.ck==1)printf("< %d %d %d\n",t.a,t.b,t.c);
    }
}

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

int main() {
    int n;
    cin >> n;
    int n3 = n*3;
    vector<int> a(n3);
    for (int i = 0; i < n3; i++) cin >> a[i];
    sort (a.begin(), a.end());
    long long ans = 0;
    for (int i = n; i < n3; i += 2) ans += a[i];
    cout << ans << endl;
}

Measured memory_bytes: 4576
h, w = gets.split.map(&:to_i)
bef = []
aft = []

h.times do
  bef.push(gets.split)
end

bef.each do |row|
  2.times do
    aft.push(row)
  end
end

aft.each do |row|
  puts "#{row.join}\n"
end

Measured memory_bytes: 1916
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    sort(l.begin(),l.end());
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int a=lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();
            int b=j+1;
            ans+=a-b;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define lnt long long int
int main()
{
    lnt n;
    cin>>n;
    lnt d[n];
    for(int i=0;i<n;i++)
    {

        cin>>d[i];
    }
    sort(d,d+n);
    lnt ans=0;
    for(int k=1;k<=d[n-1];k++)
    {
        int l = lower_bound(d,d+n,k)-d;
        //cout<<l;
        if(l==n-l)
        {

            ans++;
        }


    }
    cout<<ans;





}



Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>

//これは番兵を示している
struct Node{
	int key;
	Node *next, *prev;//ポインタ変数(参照型)
};

Node *nil;

void init(){
	nil = (Node *)malloc(sizeof(Node));//mallocは指定したサイズ分のメモリを確保する
	nil->next = nil;//->でポインタ変数にアクセスできる(C++だけで使う)
	nil->prev = nil;
}

void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	//番兵の直後に要素を追加
	x->next = nil->next;//next側に結合
	nil->next->prev =x;
	nil->next = x;
	x->prev = nil;//prev側に結合
}

Node* listSearch(int key){
	Node *cur = nil->next;//番兵の要素からたどる
	while(cur != nil && cur ->key != key){
		cur = cur ->next;
	}
	return cur;
}

//不要なメモリを削除することで効率化を謀る
//削除することでO(1)に近づける
void deleteNode(Node *t){
	if(t == nil) return;//tが番兵の場合は処理しない
	t->prev->next = t->next;//tのprevをtを飛ばしてnextに連結
	t->next->prev = t->prev;//tのnextをtを飛ばしてprevに連結
	free(t);
}

//残ったリストの先頭を削除
void deleteFirst(){
	deleteNode(nil->next);
}

//残ったリストの末尾を削除
void deleteLast(){
	deleteNode(nil->prev);
}

void printList(){
	Node *cur = nil->next;
	int isf = 0;
	while (1){
		if(cur == nil)break;//一致するまでwhilk文で回す
		if(isf++ >0)printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteKey(int key){
	//検索したノードを削除
	deleteNode(listSearch(key));
}

int main(){
	int key, n, i;
	int size = 0;
	char com[20];//delete xの命令の回数は20回まで
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for(i=0;i<n;i++){
		scanf("%s%d",com, &key);//%sがコマンド、%dが数字
		if(com[0] == 'i'){insert(key);np++;size++;}//メモリが増加
		else if(com[0] == 'd'){
			if(strlen(com)>6){
				if(com[6] == 'F')deleteFirst();
				else if(com[6] =='L')deleteLast();
			} else {
				deleteKey(key); nd++;
			}
			size--;//メモリが減少
		}
	}
	printList();
	
	return 0;
}



Measured memory_bytes: 33928
#include <map>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    long long d[n]; for (int i = 0; i < n; i++) cin >> d[i];
    int v[n];
    iota(v, v+n, 0);
    sort(v, v+n, [&d](int i, int j) { return d[i] > d[j]; });
    map<long long, int> vertex;
    for (int i = 0; i < n; i++) vertex[d[i]] = i;
    vector<pair<int, int> > ans;
    int sz[n];
    fill(sz, sz+n, 1);
    for (int p = 0; p < n-1; p++) {
        const int i = v[p];
        const long long dist = d[i] - n + 2 * sz[i];
        // cerr << i << " " << sz[i] << " " << d[i] << " " << dist << endl;
        if (d[i] == dist || vertex.find(dist) == vertex.end()) {
            cout << "-1\n";
            return 0;
        }
        int j = vertex[dist];
        sz[j] += sz[i];
        ans.push_back({j, i});
    }
    if (d[v[n-1]] == accumulate(sz, sz+n, 0LL) - sz[v[n-1]])
        for (auto [i, j] : ans) cout << i+1 << " " << j+1 << endl;
    else
        cout << "-1\n";
}


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

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	char a; cin >> a;
	if(a - 'A' <= 26) cout << "A" << endl;
	else cout << "a" << endl;
} 

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
  {int64_t N, p{1}; cin >> N;
  vector<int64_t> A(N); for (auto &a : A) {cin >> a; if (!a) {puts("0"); return 0;}}
  for (auto a : A)
    {if (p > int64_t(1e18) / a) {cout << -1 << endl; return 0;}
    p *= a;}
  cout << p << endl;}

Measured memory_bytes: 3892
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def par(a):
    if P[a] < 0: return a
    t = par(P[a])
    P[a] = t
    return t
def unite(a, b):
    if par(a) == par(b): return 0
    C[par(a)], C[par(b)] = C[par(a)] + C[par(b)], C[par(a)] + C[par(b)]
    if P[par(b)] == P[par(a)]:
        P[par(b)] = par(a)
        P[par(a)] -= 1
    elif P[par(b)] > P[par(a)]:
        P[par(b)] = par(a)
    else:
        P[par(a)] = par(b)
N, H, W = map(int, input().split())
P = [-1 for i in range(H+W)]
C = [1] * (H+W)
X = []
for _ in range(N):
    r, c, a = map(int, input().split())
    X.append((a, r-1, c+H-1))
X = sorted(X)
ans = 0
while X:
    a, r, c = X.pop()
    unite(r, c)
    if C[par(r)]:
        ans += a
        C[par(r)] -= 1
print(ans)

Measured memory_bytes: 25368
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7
 
int main(){
  int n, V;
  VE v;
  cin >> n;
  while(cin >> V){v.push_back(V);}
  ll ans = 0;
  ll sum = 0;
  ll r = 0;
  ll l = 0;
  while(r < n){
    if((sum ^ v[r]) == sum + v[r]){
      sum += v[r];
      r++;
    }else{
      ans += r - l;
      sum -= v[l];
      l++;
    }
  }
  ans += (r - l) * (r - l + 1) / 2;
  print(ans);
  return 0;
}

Measured memory_bytes: 1528
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string txt = Console.ReadLine();

            txt = txt.Replace(',', ' ');
            txt = txt.Replace('.', ' ');

            string[] words = txt.Split(' ');

            var ans = words.Where(w => w.Length >= 3 && w.Length <= 6).ToArray();

            Console.WriteLine(string.Join(" ", ans));
        }
    }
}

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

public class Hello
{
    public static void Main()
    {
        hoge();
        System.Console.ReadLine();
    }

    public static void hoge()
    {
        var s = System.Console.ReadLine();
        var s1 = s.Substring(0, (s.Length - 1) / 2);
        var s2 = s.Substring(((s.Length + 3) / 2) - 1);

        s2 = new string(s2.Reverse().ToArray());

        if (!isk(s1))
        {
            System.Console.WriteLine("No");
            return;
        }

        System.Console.WriteLine(s1 == s2 ? "Yes" : "No");
    }

    public static bool isk(string s)
    {
        for(int i = 0; i < s.Length; i++)
        {
            if (s[i] != s[s.Length - i - 1])
            {
                return false;
            }
        }
        return true;
    }

}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n;
signed main(){
	cin>>n;
	//1~n-1
	cout<<n*(n-1)/2<<endl;
	return 0;
}


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

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

typedef long long ll;

using namespace std;

const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6;

//-------------------------↓↓↓↓↓↓------------------------

ll par[ohara], ran[ohara], mi[ohara];

void init(int nn) {
	rep(i,nn){
		par[i] = i;
		ran[i] = 0;
    mi[i] = INF;
	}
}

ll root(ll xx){
    if(par[xx] == xx){
        return xx;
    }
    else{
        return par[xx] = root(par[xx]);
    }
}
 
void unite(ll xx,ll yy){
    xx = root(xx);
    yy = root(yy);
    if(xx == yy)return;
    
    if(ran[xx] < ran[yy]){
        par[xx] = yy;
    }
    else{
        par[yy] = xx;
        if(ran[xx] == ran[yy])ran[xx]++;
    }
}

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

   ll n, m, a[ohara], b, c, other[ohara], cnt = 0, group = 0, ans = 0;
   map<ll,ll> mp;
   map<ll,ll> mpp;
   map<ll,ll> help;

   cin >> n >> m;

   rep(i, n)cin >> a[i];

   init(n + 1);

   rep(i, m){
     cin >> b >> c;
     b++;c++;
     unite(b,c);
   }

   rrep(i, 1, n + 1){
     mi[root(i)] = min(a[i - 1], mi[root(i)]);
     help[root(i)]++;
   }

   rrep(i, 1, n + 1){
     if(help[root(i)] != 0){
       group++;
       help[root(i)] = 0;
     }
     if(mp[root(i)] == 0){
       ans += mi[root(i)];
       mp[root(i)]++;
     }
   }

   rrep(i, 1, n + 1){
     if(a[i - 1] == mi[root(i)]){
       if(mpp[root(i)] == 0)mpp[root(i)]++;
       else other[cnt++] = a[i - 1];
     }
     else{
       other[cnt++] = a[i - 1];
     }
   }

   if(cnt < group - 2)cout << "Impossible" << "\n";
   else{
     if(group == 1)cout << 0 << "\n";
     else{
       sort(other,other + cnt);
       rep(i,group - 2){
         ans += other[i];
       }
       cout << ans << "\n";
     }
   }

       
return 0;
}


Measured memory_bytes: 32640
#include<cctype>
#include<cstdio>
#include<algorithm>
#include<functional>
int a[100007];
int read(){int x;scanf("%d",&x);return x;}
int main()
{
    int n=read(),ans=0;
    for(int i=1;i<=n;++i) a[i]=read();
    std::sort(a+1,a+n+1,std::greater<int>());
    for(int i=1;i<=n;++i)
	if(i+1>a[i+1])
	{
	    for(int j=i+1;a[j]==i;++j) ans^=1;
	    return ans|=(a[i]-i)&1,puts(ans?"First":"Second"),0;
	}
}


Measured memory_bytes: 512
from collections import defaultdict
n,k = map(int,input().split())
s = [0] + list(map(int,input().split()))
for i in range(n):
    s[i+1] += s[i]
dic = defaultdict(int)
ans = 0
for i in range(n+1):
    x = (s[i]-i) % k
    ans += dic[x]
    dic[x] += 1
    if i >= k-1:
        y = (s[i-k+1]-(i-k+1)) % k
        dic[y] -= 1
print(ans)


Measured memory_bytes: 111692
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	int a,b;
	cin >> a >> b;

	int o = 0;
	o = max(a + b,a - b);

	cout << max(o,a * b) << endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
        #define ll long long
        #define rep(i,a,b) for(i=a;i<b;i++)
        #define pb push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define vi vector < ll  int >
        #define CLR(a) memset((a),0,sizeof(a))
        #define mp make_pair
        #define hell 1000000007
        using namespace std;

        void solve()
           {
               ll i,j=0,r=200,p,q,k=0,ans=0,d,y=0,x,h,flag=0,n,m=0,a=hell,b=hell,id,c,h1,h2,a1,b1,w;

               string s;
               cin>>s; n=s.size();
               vi v(n,0),cnt(n,0);
               rep(i,0,n)
                 {
                     if(s[i]=='R' and s[i+1]=='L') v[i]=1,v[i+1]=1;

                 }
                 rep(i,0,n)
                    {
                        if(v[i] and v[i+1] and s[i]=='R' and s[i+1]=='L') { ll lr=0;
                            for(j=i-1;j>=0;j--)
                            {
                                if(s[j]=='R') lr++;
                                else break;
                            }
                            k=lr;
                        }
                        if(v[i] and v[i-1] and s[i]=='L' and s[i-1]=='R')
                        {

                            ll lc=0;
                            for(j=i+1;j<n;j++)
                            {
                                if(s[j]=='L') lc++;
                                else break;
                            }
                            m=lc; //cout<<k<<" "<<m<<endl;
                            cnt[i-1]=k/2+(m/2+m%2);
                            cnt[i]=k/2+k%2+m/2;
                            cnt[i]++;
                            cnt[i-1]++;
                        }

                    }
                    rep(i,0,n) cout<<cnt[i]<<" ";




           }
        signed main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
            //cin>>t;
            while(t--)
            solve();
        }


Measured memory_bytes: 2256
/* Author : Prasuk Jain */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int              long long int
#define ull              unsigned long long
#define ld               long double
#define fo(i, n)         for(int i=0; i<n; i++)
#define Fo(i, a, b)      for(int i=a; i<b; i++)
#define rfo(i, n)        for(int i=n-1; i>=0; i--)
#define Rfo(i, a, b)     for(int i=b-1; i>=a; i--)
#define tr(it, v)        for(auto it=v.begin(); it!=v.end(); it++)
#define F                first
#define S                second
#define vi               vector<int>
#define vvi              vector<vector<int>>
#define pii              pair<int, int>
#define pqb              priority_queue<int>
#define pqs              priority_queue<int, vi, greater<int>>
#define mii              map<int, int>
#define uset             unordered_set<int>
#define umap             unordered_map<int, int>
#define mp               make_pair
#define pb(x)            push_back(x)
#define hcf(x, y)        __gcd(x, y)
#define lcm(x, y)        boost::math::lcm(x,y)
#define setpre(x, y)     fixed << setprecision(y) << x
#define setbits(x)       __builtin_popcountll(x)
#define zerolead(x)      __builtin_clzll(x)
#define zerotrail(x)     __builtin_ctzll(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define PI               3.1415926535897932384626
const int mod = 1e9+7;
const int inf = 1e18;
int mpow(int base, int exp);
bool isprime(int num);
void prifact(int num);

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

void coderprasukj(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    coderprasukj();
    int t, n, k, x, y;
    cin >> k;
    string s;
    cin >> s;
    if(k>=s.length()){
        cout << s << "\n";
    }
    else {
        s[k] = '.';
        s[k+1] = '.';
        s[k+2] = '.';
        for(int i=0; i<k+3; i++) cout << s[i];
        cout << "\n";
    }
    return 0;
}

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
  return result;
}

bool isprime(int num) {
    if(num <= 1) return false;
    for(int i=2; i*i <= num; i++)
        if(num%i == 0) return false;
    return true;
}

void prifact(int num){
    for(int i=2; i<=num; i++)
    if(num%i == 0){
        int cnt = 0;
        while(num%i == 0)
        cnt++ , num /= i;
        cout << i << "^" << cnt << " ";
    }
    if(num > 1)
    cout << num << "^" << "1" << " ";
}




Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
#define ll long long
ll powi(ll a,ll n)
{
  ll ans=1;
  while(n)
  {
    if(n%2)ans*=a, ans%=mod;
    a*=a;
    a%=mod;
    n=n/2;
  }
 
  return ans;
}

int main()
{
  ll n;
  cin>>n;
  ll ans=powi(10,n)-powi(9,n)-powi(9,n)+powi(8,n);
  ans%=mod;
  ans+=mod;
  ans%=mod;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3476
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, K := sc.nextInt(), sc.nextInt()
	_ = sc.nextIntSlice(N)
	ans := 1
	sum := K
	for sum < N {
		sum += K - 1
		ans++
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 2048
#include<stdio.h>

int main(){
    int A[3];
    int tmp = 0;
    int max=0, sum=0;
    int ans;
    int i, j, k;

    for(i=0; i<3; i++){
        scanf("%d", &A[i]);
        if(A[i]%2 == 1){
            tmp++;
        }
        if(max<A[i]){
            max = A[i];
        }
    }

    for(i=0; i<3; i++){
        sum += max-A[i];
    }

    if(tmp==0){
        ans = sum/2;
    }else if(tmp==1){
        if(max%2==0){
            ans = sum/2 +2;
        }else{
            ans = sum/2;
        }
    }else if(tmp==2){
        if(max%2==0){
            ans = sum/2;
        }else{
            ans = sum/2 +2;
        }
    }else if(tmp==3){
        ans = sum/2;
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
int main()
{
    int i, j, l;
    char s[120], t[120], c;
    gets(s);
    gets(t);
    l=strlen(s);
    for(i=0; i<l; i++)
    {
        if(strcmp(s, t)==0){
            printf("Yes\n");
            return 0;
        }
        c=t[l-1];
        for(j=l-1; j>=0; j--)
        {
            t[j]=t[j-1];
        }
        t[0]=c;
    }
    //printf("%s\n", t);
    printf("No\n");

    return 0;
}


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

using namespace std;
using ll = long long;

int main(){
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  
  double res = (double)(W)*H/2.0;
  cout << fixed << setprecision(10) << res << " ";
  
  if(2*x==W && 2*y==H) cout << 1 << endl;
  else cout << 0 << endl;
  
  
  return 0;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ll x;
	cin >> x;
	ll g = gcd(x, 360ll);
	ll xi = 0;
	ll yi = 0;
	for (ll i = 0; i < 360 / g; ++i) {
		xi += cos(x * i);
		yi += sin(x * i);
	}
	cerr << xi << " " << yi << endl;
	cout << 360 / g << endl;
}


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

using namespace std;

int val[501], X[501], Y[501], Z[501];

int main(void){
  int n;
  cin >> n;
  for(int i = 1; i < n; ++i){
    cin >> X[i] >> Y[i] >> Z[i];
  }
  for(int i = 1; i < n; ++i){
    long t = Y[i] + X[i];
    for(int j = i + 1; j < n; ++j){
      if(t > Y[j]){
        t -= Y[j];
        if(t % Z[j]){
          t /= Z[j];
          t++;
          t *= Z[j];
        }
        t += Y[j];
      }else{
        t = Y[j];
      }
      t += X[j];
    }
    cout << t << "\n";
  }
  cout << "0\n";
}


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



int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int r, d, x; cin >> r >> d >> x;
    for (int i = 1; i <= 10; i++) {
        x = r * x - d;
        cout << x << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0
A = []


def set_inputs():
    global N, A
    N = get_int()
    A = get_li()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    if 0 in A:
        print(sum(abs(a) for a in A))
    elif len(list(filter(lambda x: x < 0, A))) % 2 == 0:
        print(sum(abs(a) for a in A))
    else:
        m = min(abs(a) for a in A)
        print(sum(abs(a) for a in A) - 2 * m)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


Measured memory_bytes: 16432
#include<stdio.h>
int main(void)
{
	int a,b,c;
	while(1){
		scanf("%d%d",&a,&b);
		if(a>b){c=a; a=b; b=c;}
		if(a==0 && b==0)break;
		printf("%d %d\n",a,b);
	}
	return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
  int h,w;
  scanf("%d%d",&h,&w);
  char M[101][101];
  for(int i=0;i<h;i++){
    scanf("%s",M[i]);
  }
  int x,y;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(M[i][j]=='E'){
	x=j;
	y=i;
      }
    }
  }
  int x1=x+1,y1=y+1,x2=w-x,y2=h-y;
  static int R[100][101],C[100][101];
  for(int i=0;i<h;i++){
    R[i][0]=0;
    for(int j=0;j<w;j++){
      R[i][j+1]=R[i][j]+(M[i][j]=='o'?1:0);
    }
  }
  for(int j=0;j<w;j++){
    C[j][0]=0;
    for(int i=0;i<h;i++){
      C[j][i+1]=C[j][i]+(M[i][j]=='o'?1:0);
    }
  }
  static int dp[101][101][101][101];
  for(int H=0;H<=h;H++){
    for(int a=0;a+H<=h;a++){
      int b=a+H;
      for(int W=0;W<=w;W++){
	for(int c=0;c+W<=w;c++){
	  int d=c+W;
	  if(a==b||c==d){//||!(max(a,b-y2)<=y&&y<min(b,a+x1)&&max(c,d-x2)<=x&&x<min(d,c+x1))){
	    dp[a][b][c][d]=0;
	    continue;
	  }
	  dp[a][b][c][d]=max(max(dp[a+1][b][c][d]+(b-a>y2?0:-R[a][max(c,d-x2)]+R[a][min(d,c+x1)]),
				 dp[a][b-1][c][d]+(b-a>y1?0:-R[b-1][max(c,d-x2)]+R[b-1][min(d,c+x1)])),
			     max(dp[a][b][c+1][d]+(d-c>x2?0:-C[c][max(a,b-y2)]+C[c][min(b,a+y1)]),
				 dp[a][b][c][d-1]+(d-c>x1?0:-C[d-1][max(a,b-y2)]+C[d-1][min(b,a+y1)])));
	  //printf("%d %d %d %d %d  %d %d %d %d\n",a,b,c,d,dp[a][b][c][d],max(c,d-x2),min(d,c+x1),R[a][max(c,d-x2)],R[a][min(d,c+x1)]);
	}
      }
    }
  }
  printf("%d\n",dp[0][h][0][w]);
  return 0;
}


Measured memory_bytes: 205952
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    int N, K;
    cin >> N >> K;
    vector<int> v(N);
    for(auto& e : v)
        cin >> e;
    sort(v.begin(), v.end());
    int ans = 0;
    for(int i = 0; i < K; ++i)
    {
        ans += v[N - 1 - i];
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

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

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

    cout << 3 * r * r << '\n';

    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int BobSum = 0;
    int AliceSum = 0;
    for(int i = a.size()-1; i >= 0; i -= 2){
        AliceSum += a.at(i);
    }
    for(int i = a.size()-2; i >= 0; i -= 2){
        BobSum += a.at(i);
    }

    int res = AliceSum - BobSum;
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b;
    cin >> a >> b;
    if (a - b > 0)
        cout << "a > b" << endl;
    else if (a - b < 0)
        cout << "a < b" << endl;
    else 
        cout << "a == b" << endl;

 

}


Measured memory_bytes: 3096
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    if N==1:
        print(input())
        exit()
    h = list(map(int, input().split()))


    dflag = 0
    cmin = 0
    cmax = h[0]
    count = 0
    for i in range(1, N):
        if h[i - 1] < h[i] and dflag == 1:
            count += cmax - cmin
            cmax = h[i]
            dflag = 0
            cmin = h[i - 1]

        elif h[i - 1] > h[i]:
            dflag = 1

        elif h[i - 1] < h[i]:
            cmax = h[i]

    if dflag == 1:
        count += cmax - cmin
    else:
        count += max(cmax, h[i]) - cmin

    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9224
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 100000000
#define NUM 1000000007
#define all(x) begin(x), end(x)

int main() {
	int n, y;
	cin >> n >> y;
	int p1=-1, p2=-1, p3=-1;
	for (int i = 0; i <=n ; i++) {
		for (int j = 0; j <=n-i; j++) {
			for (int k = 0; k <= n - i - j; k++) {
				if (y == 10000 * i + 5000 * j + 1000 * k){
					if (i + j + k == n) {
						p1 = i, p2 = j, p3 = k;
						break;
					}
				}
			}
		}
	}

	cout << p1 << " " << p2 << " " << p3 << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

string str[5] = {"a", "e", "i", "o", "u"};
int main() {
  string c;
  cin >> c;
  string ans = "consonant";
  rep(i, 5) {
    if (str[i] == c) ans = "vowel";
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
  ll a[4], sup = 1000000000000000010;
  for(ll i = 0; i < 4; i++) cin >> a[i];
  cout << max(max(a[0]*a[2],a[0]*a[3]),max(a[1]*a[2],a[1]*a[3]));
  
}

Measured memory_bytes: 3636
// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
void build(){

}
#define N 101010
int h , w , n;
set< pair<int,int> > pt , cand;
void init(){
  h = getint();
  w = getint();
  n = getint();
  while( n -- ){
    int ai = getint();
    int bi = getint();
    pt.insert( { ai , bi } );
    for( int i = -2 ; i <= 0 ; i ++ )
      for( int j = -2 ; j <= 0 ; j ++ ){
        int xi = ai + i;
        int xj = bi + j;
        if( xi < 1 || xj < 1 ) continue;
        if( xi + 2 > h || xj + 2 > w ) continue;
        cand.insert( { xi , xj } );
      }
  }
}
LL ans[ 10 ];
void solve(){
  LL all = (LL)( h - 2 ) * (LL)( w - 2 );
  for( PII tp : cand ){
    int cnt = 0;
    for( int i = 0 ; i <= 2 ; i ++ )
      for( int j = 0 ; j <= 2 ; j ++ ){
        if( pt.count( { tp.first + i , tp.second + j } ) )
          cnt ++;
      }
    // printf( "%d %d : %d\n" , tp.first , tp.second , cnt );
    ans[ cnt ] ++;
    all --;
  }
  ans[ 0 ] = all;
  for( int i = 0 ; i < 10 ; i ++ )
    printf( "%lld\n" , ans[ i ] );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 47104
// Problem : A - Takoyaki
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define mk make_pair
#define fast                    \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define sz(x) (int)x.size()
#define mem(a, val) memset(a, val, sizeof(a))
#define deci(x) cout << fixed << setprecision(x);
#define bitcount(x) __builtin_popcountll(x)

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

const long long int mod = 1e9 + 7;
const long double EPS = 1e-12;
const int N = 1e5 + 20;

void solve() {
  ll n, x, t;
  cin >> n >> x >> t;
  cout << (((n + x - 1) / x) * t);
}
int main() {
  fast;
  ll t;
  t = 1;

  // cin>>t;

  while (t--) {
    solve();
  }

  return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>

#define N 100000

int partition(int[],int,int);

int main(){
  int i,n,q,A[N];

  scanf("%d",&n);

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

  q=partition(A,0,n-1);

  for(i=0;i<q;i++){
    if(i!=0) printf(" ");
    printf("%d",A[i]);
  }

  printf(" [%d]",A[q]);

  for(i=q+1;i<n;i++){
    printf(" %d",A[i]);
  }

  printf("\n");

  return 0;
}

int partition(int A[], int p, int r){
  int x,i,j,tmp;

  x=A[r];

  i = p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i = i+1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }

  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;

  return i+1;
}

  

Measured memory_bytes: 996
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::suspicious_arithmetic_impl)]

// using Rust(1.42.0)
// My Library Repo is at "https://github.com/Loptall/prcn_lib"
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"

/*
    AtCoder Language Update 2020204 お疲れ様でした! 有難いです
*/

// Dep crates are...
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::{i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_integer::{binomial, gcd, lcm, Integer};
use permutohedron::Heap;
use petgraph::unionfind::UnionFind;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;

// code...
fn main() {
    input! {
        a: isize, b: isize, c: isize, k: isize
    }

    let ans = min(k, a) - max(k - a - b, 0);
    println!("{}", ans);
}


Measured memory_bytes: 2028
#include <bits/stdc++.h>
#define ll long long
#define inf 100000000000000000
#define mod 1000000007
#define endl '\n'
#define omarshagar                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;


int main()
{
    omarshagar
    int n,m;
    cin>>n>>m;
    int k;
    cin>>k;
    int arr[k];
    for(int i=0;i<k;i++)
    {
        cin>>arr[i];
    }
    ll grid[n][m];
    int locr=0;
    int locc=0;
    for(int i=0;i<k;i++)
    {
        int num=arr[i];
        for(;locr<n&&num>0;)
        {
            if(locr%2==0)
            {
                for(;locc<m&&num>0;locc++)
                {
                    num--;
                    grid[locr][locc]=i+1;

                }
                if(locc==m){locc--;locr++;}
            }
            else
            {
                for(;locc>=0&&num>0;locc--)
                {
                    num--;
                    grid[locr][locc]=i+1;
                }
                if(locc==-1){locc++;locr++;}
            }
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int ii=0;ii<m;ii++)
        {
            cout<<grid[i][ii]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
# Aizu Problem 0040: Affine Cipher
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

A_INV = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]

def affine_decode(cipher, a_inv, b):
    message = ""
    for char in cipher:
        if 'a' <= char <= 'z':
            o = ord(char) - 97
            d = (a_inv * o - b) % 26
            message += chr(97 + d)
        else:
            message += char
    return message


N = int(input())
for n in range(N):
    cipher = input().strip()
    for b in range(26):
        for a_inv in A_INV:
            message = affine_decode(cipher, a_inv, b)
            if "this" in message or "that" in message:
                print(message)
                break

Measured memory_bytes: 7696
import fractions
n, m = map(int, input().split())
s = input()
t = input()
l = fractions.gcd(n, m)
a, b = n//l, m//l
for i in range(l):
    if t[b*i] != s[a*i]:
        print(-1)
        exit()
print(a*b*l)

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

void solve() {
    std::vector<int> sums(2, 0);
    for (auto& sum : sums) {
        for (int i = 0; i < 4; ++i) {
            int x;
            std::cin >> x;
            sum += x;
        }
    }

    std::cout << *std::max_element(sums.begin(), sums.end()) << "\n";
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,kk;
int main()
{
    cin>>a>>b>>c;
    if(b>=a)
    {
        cout<<1<<endl;
        exit(0);
    }
    if(c>=b)
    {
        cout<<-1<<endl;
        return 0;
    }
    if((a-b)%(b-c)>=1)kk=1;
    cout<<((a-b)/(b-c)+kk)*2+1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int x; 
  cin >> x;

  int ans = x/(6+5)*2;
  x %= (6+5);

  if(x > 6) ans++;
  if(x != 0) ans++;

  cout << ans << "\n";


  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		if((S.contains("A") == true) && (S.contains("B") == true))  {
			System.out.print("Yes");

		}else {
			System.out.print("No");

		}
	}

}


Measured memory_bytes: 21844