akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    string s;cin >> s;
    int a=0;
    vl v(s.size(),0);
    rep(i,s.size()-1){
        if(s[i]=='L'&&s[i+1]=='R'||i==s.size()-2){
            int countr=0,countl=0;
            if(i==s.size()-2)countl++;
            for(int j=a;j<=i;j++){
                if(s[j]=='R')countr++;
                else countl++;
            }
            
            if((countr+countl)%2==0){
                v[countr+a-1]=(countr+countl)/2;
                v[countr+a]=(countr+countl)/2;
            }
            if((countr+countl)%2==1&&countr%2==1){
                v[countr+a-1]=(countr+countl)/2+1;
                v[countr+a]=(countr+countl)/2;
            }
            if((countr+countl)%2==1&&countl%2==1){
                v[countr+a-1]=(countr+countl)/2;
                v[countr+a]=(countr+countl)/2+1;
            }
            a=i+1;
        }
    }
    rep(i,s.size()){
        cout << v[i] << " ";
    }
}

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

int main() {
    int a, b;
    cin >> a >> b;
    int diff = b - a;
    int sum = 0;
    range (i, 1, diff) sum += i;
    cout << sum - a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define forinc(i,a,b) for(int i=a;i<=b;i++)
#define fordec(i,a,b) for(int i=a;i>=b;i--)
#define fi first
#define se second
const int maxn=2e5+5;
int n,a[maxn],s[maxn],sum;
int ret=LLONG_MAX;
main()
{
    cin>>n;
    forinc(i,1,n)
    {
        cin>>a[i];
        s[i]=s[i-1]+a[i];
        sum+=a[i];
    }
    forinc(i,1,n)
    {
        int A=s[i],B=s[n]-s[i];
        if(A>B) swap(A,B);
        if(A==B) return cout<<0,0;
        ret=min(ret,B-A);
    }
    cout<<ret;
}


Measured memory_bytes: 3328
s = int(input())
dic = {s:1}
count = 1
while True:
  if s % 2 == 0:
    s //= 2
  else:
    s = 3 * s + 1
  count += 1
  if s in dic.keys():
    dic[s] += 1
    print(count)
    break
  else:
    dic[s] = 1

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <vector>

using std::vector;

class Dice
{
public:
    Dice();
    void AssignPips();
    int  GetTopPip() { return pip[0]; };
    void Roll(char dir);
    void ShowAllPip();

private:
    int pip[6];
};

int main()
{
    Dice dice;
    dice.AssignPips();
    std::string dirs;
    std::cin>>dirs;
    for(int i = 0; i < dirs.length();i++)
    {
        dice.Roll(dirs[i]);
        //std::cout<<"Rolling"<<std::endl;
    }
    std::cout<<dice.GetTopPip()<<std::endl;
    //to check all roll 
    //dice.ShowAllPip();
    return 0;
}

Dice::Dice() : pip{}
{
}

void Dice::AssignPips()
{
    for(int i = 0; i < 6; i++)
    {
        std::cin>>pip[i];
    }
}

void Dice::Roll(char dir)
{
    int hoge;
    if(dir == 'N')
    {
        hoge   = pip[0];
        pip[0] = pip[1];
        pip[1] = pip[5];
        pip[5] = pip[4];
        pip[4] = hoge;
    }else if(dir == 'S')
    {
        hoge   = pip[1];
        pip[1] = pip[0];
        pip[0] = pip[4];
        pip[4] = pip[5];
        pip[5] = hoge;
    }else if(dir == 'W')
    {
        hoge = pip[0];
        pip[0] = pip[2];
        pip[2] = pip[5];
        pip[5] = pip[3];
        pip[3] = hoge;
    }else
    {
        hoge = pip[2];
        pip[2] = pip[0];
        pip[0] = pip[3];
        pip[3] = pip[5];
        pip[5] = hoge;
    }
}

void Dice::ShowAllPip()
{
    for(int i = 0; i < 6; i++)
    {
        std::cout<<i+1<<": "<<pip[i]<<std::endl;
    }
}



Measured memory_bytes: 3204
while 1:
    r, c = map(int, raw_input().split())
    if r == 0: break
    old = [raw_input().split() for i in range(r)]
    old = map(list, zip(*old))
    new = [int("".join(lst),2) for lst in old]
    ans = 0
    for i in range(1<<r):
        ret = 0
        for j in new:
            cnt = bin(i^j).count('1')
            ret += cnt if cnt > r/2 else r-cnt
        ans = max(ans, ret)
    print ans

Measured memory_bytes: 10804
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int a = sc1.nextInt();
		int b = sc1.nextInt();

		if ( a + b == 15) {
			System.out.println("+");
		}

		else if ( a * b == 15) {
			System.out.println("*");
		}
		else {
			System.out.println("x");
		}

		sc1.close();
	}

}

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

using namespace std;

int otsuri(int yen)
{
    int tmp = yen, res = 0, t;
    t = tmp / 500;
    tmp -= t * 500;
    res += t;
    t = tmp / 100;
    tmp -= t * 100;
    res += t;
    t = tmp / 50;
    tmp -= t * 50;
    res += t;
    res += tmp / 10;
    return res;
}

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

    int sum;
    bool flag = false;
    while (true)
    {
        cin >> sum;
        if (sum == 0)
            break;
        if (flag)
            cout << endl;
        flag = true;
        int coin[4] = {};
        for (int i = 0; i < 4; i++)
        {
            int k;
            cin >> k;
            coin[i] = k;
        }
        int mi = 1e8, name[4] = {10, 50, 100, 500}, ma[4] = {};
        for (int i = 0; i <= coin[0]; i++)
        {
            for (int j = 0; j <= coin[1]; j++)
            {
                for (int k = 0; k <= coin[2]; k++)
                {
                    for (int l = 0; l <= coin[3]; l++)
                    {
                        if (i * 10 + j * 50 + k * 100 + l * 500 >= sum)
                        {
                            if (otsuri(-sum + i * 10 + j * 50 + k * 100 + l * 500) + (coin[0] - i + coin[1] - j + coin[2] - k + coin[3] - l) < mi)
                            {
                                mi = otsuri(-sum + i * 10 + j * 50 + k * 100 + l * 500) + (coin[0] - i + coin[1] - j + coin[2] - k + coin[3] - l);
                                ma[0] = i;
                                ma[1] = j;
                                ma[2] = k;
                                ma[3] = l;
                            }
                        }
                    }
                }
            }
        }
        for (int i = 0; i < 4; i++)
        {
            if (ma[i])
            {
                cout << name[i] << " " << ma[i] << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3020
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
#define int long long

signed main(){
        //int a;
        //while( scanf("%lld", &a) != EOF ){}

        int n;
        scanf("%lld",&n);
        int m=100000;
        for(int i=0;i<n;i++){
                m=m*1.05;
                m=((m-1)/1000+1)*1000;
        }
        printf("%lld\n", m);

        return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c) {
        cout << 1 << endl;
    } else if (a != b && b != c && a != c) {
        cout << 3 << endl;
    } else {
        cout << 2 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7



char S[300000];
int A[300000], Z[300000];

int main() {


	scanf("%s", S);

	int inA = 0;
	int inZ = 0;


	for (int i = 0; i < strlen(S); i++) {
		if (S[i] == 'A') {
			A[inA] = i;
			inA++;
		}
		else if (S[i] == 'Z') {
			Z[inZ] = i;
			inZ++;
		}
	}

	int ans = 0;
	for (int i = 0; i < inA; i++) {
		ans = max(Z[inZ-1] - A[i] + 1, ans);
		


		
	}

	printf("%d", ans);




}


Measured memory_bytes: 1152
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//long.Parseはstringをlongに変換。
		string s = Console.ReadLine();
		string answer = "";
    int leftCount = 0;
    int rightCount = 0;

    for(int i = 0; i < n; i++)
    {
      if(s[i] == '(') leftCount++;
      else
      {
        if(leftCount == 0) rightCount++;
        else leftCount--;
      }
    }
    for(int i = 0; i < rightCount; i++) answer += "(";
    answer += s;
    for(int i = 0; i < leftCount; i++) answer += ")";
    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 11092
# -*- coding: utf-8 -*-

### TESTCASE
test = ""
#test = \
"""
1 1
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN

n, m = map(int, input2().split())

if n == m:
    print("Yes")
else:
    print("No")




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

int main()
{
    int d,n;
    cin>>d>>n;
   vector<int>v;
   for(int i=1;i<=1e7;i++)
   {
       int counter=0;
       int a=i;
       while(a%100==0)
       {
           a/=100;
           counter++;
       }
       if(counter==d)v.push_back(i);
   }
   sort(v.begin(),v.end());
   cout<<v[n-1]<<endl;
}


Measured memory_bytes: 67808
def solve(s,t):
	idx=0
	while idx<len(s):
		if s[idx].isdigit(): break
		idx+=1
	if t[:idx]<s[:idx]:
		return '-'
	elif t[:idx]>s[:idx] or s==t:
		return '+'
	elif len(t)==idx:
		return '-'
	elif len(s)==idx or not t[idx].isdigit():
		return '+'
	else:
		a=''
		idx2=idx
		while idx2<len(s) and s[idx2].isdigit():
			a+=s[idx2]
			idx2+=1
		a=int(a)
		b=''
		idx2=idx
		while idx2<len(t) and t[idx2].isdigit():
			b+=t[idx2]
			idx2+=1
		b=int(b)
		if a==b:
			return solve(s[idx2:],t[idx2:])
		else:
			return '-' if a>b else '+'

import sys
n=int(sys.stdin.readline())
s=sys.stdin.readline().strip()
for _ in range(n):
	t=sys.stdin.readline().strip()
	print(solve(s,t))


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

int main(){
    ios::sync_with_stdio(false);
	int n,m;
	ll ans=INT_MIN;
	vector<bool> a(3);
	cin>>n>>m;
	vector<vector<ll>> y(n,vector<ll>(3));
	for(int i=0;i<n;i++) for(int j=0;j<3;j++) cin>>y[i][j];
	vector<ll> sum(n);
	for(int i=0;i<(1<<3);i++){
		for(int j=0;j<3;j++){
			if(i&(1<<j)) a[j]=true;
			else a[j]=false;
		}
		fill(sum.begin(),sum.end(),0);
		for(int j=0;j<n;j++){
			if(a[0]) sum[j]+=y[j][0];
			else sum[j]-=y[j][0];
			if(a[1]) sum[j]+=y[j][1];
			else sum[j]-=y[j][1];
			if(a[2]) sum[j]+=y[j][2];
			else sum[j]-=y[j][2];
		}
		sort(sum.begin(),sum.end(),greater<ll>());
		ll tmp=0;
		for(int j=0;j<m;j++){
			tmp+=sum[j];
		}
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include<queue>
#include <cstdio>
using namespace std;

int main()
{
  string s;
  cin>>s;
  if(s[2]==s[3] && s[4]==s[5])
  {
    cout<<"Yes";
  }
  else
  {
    cout<<"No";
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<iomanip>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N;
string s;
map<char,int> mp,mpb;
int main(){
    cin >> N;
    cin >> s;
    int cnt = 0;
    int dot[200002],sharp[200002];
    if(s[0] == '.'){
        dot[0] = 1;
        sharp[0] = 0;
    } else {
        dot[0] = 0;
        sharp[0] = 1;
    }
    int ans = MM;
    for(int i = 1; i < N; i++){
        if(s[i] == '.'){
            dot[i] = dot[i-1]+1;
            sharp[i] = sharp[i-1];
        } else {
            dot[i] = dot[i-1];
            sharp[i] = sharp[i-1]+1;
        }
    }
    ans = min(dot[N-1],sharp[N-1]);
    for(int i = 0; i < N; i++){
        int tmp = sharp[i] + dot[N-1] - dot[i];
        ans = min(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans=0;
    for(int i=0;i<101;i++){
        if(a<=i&&i<=b&&c<=i&&i<=d){ans++;}
    }
    cout<<max(0,ans-1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
 
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=m/n;i>=1;i--){
    	if(m%i==0){
    		printf("%d\n",i);
    		break;
		}
	}
    return 0;
}


Measured memory_bytes: 128
n = int(input())
k = int(input())
x = list(map(int, input().split()))
sum = 0
for i in range(n):
    if x[i] <= abs(x[i] - k):
        sum += 2*x[i]
    else:
        sum += 2*abs(x[i] - k)
print(sum)

Measured memory_bytes: 3060
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}

	return B;
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

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

  int N;
  cin >> N;

  int tmp = N / 100;
  if(tmp * 111 == N) 
    cout << N << endl;
  else if(tmp * 111 < N) 
    cout << (tmp + 1) * 111 << endl;
  else if(tmp * 111 > N)
    cout << tmp * 111 << endl;




ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}
/*

*/




Measured memory_bytes: 504
import scala.math

object Main {
	def main(args: Array[String]) {
		val input = io.Source.stdin.getLines().mkString("\n")
		println(solve(input).trim)
	}

	def solve(input: String): String = {
		 val a = input.toInt
		 val ans = a * 2 * math.Pi
		 ans.toString
	}

}

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

const int MX = 10050;

int main() {
  int N;
  cin >> N;
  vector<int> a(MX);
  srep(x,1, 105) srep(y,1, 105) srep(z,1, 105) {
    int n = x * x + y * y + z * z + x * y + y * z + z * x;
    if (n < MX) a[n]++;
  }

  srep(i, 1, N + 1) cout << a[i] << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
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; }

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    printf("%d %d %d\n", a, b, c);
    return 0;
}

Measured memory_bytes: 3716
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
lr = [LI() for _ in range(n)]
cnt = 0
for i in lr:
    cnt += (i[1] - i[0] + 1)
print(cnt)



Measured memory_bytes: 71020
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i,q) for(int i = 0; (q) > i; i++)
int main(){
  int n;cin>>n;
  vector<int> a;
  rep(i,n){
    int tmp; cin>>tmp;
    a.push_back(tmp);
  }
  sort(a.begin(),a.end());
  int ketmp = a[0];
  while(true){
    if(a.size() == 1)break;
    for(int i = 1; a.size() > i; i++){
      a[i] = a[i]%a[i-1];
      if(a[i] == 0){
        swap(a[i],a[a.size()-1]);
        a.pop_back();
      }
    }
    sort(a.begin(),a.end());
  }
  

  cout << min(ketmp,a[0]) << endl;
}

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

int main () {
  int N;
  string S;
  cin >> N >> S;
  int count1 = 0;
  int count2 = 0;
  vector<int>A(N,0);
  vector<int>B(N,0);
  int a = 0;
  int b = 0;
  int c = 0;
            
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '('){
      count1++;
      a++;
    }
    else {
      count2++;
      b++;
    }
    A.at(i) = a;
    B.at(i) = b;
    if (B.at(i) - A.at(i) > c){
      c = B.at(i) - A.at(i);
    }
  }
  
  for (int i = 0; i < c; i++) {
    cout << '(';
  }  
  cout << S;
  for (int i = 0; i < a+c-b; i++) {
    cout << ')';
  } 
  cout << endl;
}
  

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

using namespace std;

using ll = long long;

int main() {
    std::string S;
    cin >> S;

    bool yes = true;
    for (std::size_t i = 0; i < S.size(); ++i) {
        if (i % 2 == 0) {
            if (S[i] == 'L') { yes = false; }
        } else {
            if (S[i] == 'R') { yes = false; }
        }
    }

    std::cout << (yes ? "Yes" : "No") << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

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

    string res = "No";

    if(a < b && b < c)res = "Yes";

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3208
#include "bits/stdc++.h"
using namespace std;

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

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

    if (N % sum == 0) puts("Yes");
    else puts("No");
}

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

struct Card {char suit, value;};

void bubble(struct Card A[], int N){
    for(int i=0;i<N;i++){
        for(int j=N-1;j>i;j--){
            if(A[j].value < A[j-1].value) swap(A[j],A[j-1]);
        }
    }
}

void selection(struct Card A[], int N){
    for(int i=0;i<N-1;i++){
        int minj = i;
        for(int j=i+1;j<N;j++){
            if(A[j].value < A[minj].value) minj = j;
        }
        swap(A[i],A[minj]);
    }
}

void print(struct Card A[], int N){
    for(int i=0;i<N;i++){
        if(i) cout << " " ;
        cout << A[i].suit << A[i].value ;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i=0;i<N;i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(){
    Card C1[36],C2[36];
    int N;
    char ch;
    
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> C1[i].suit >> C1[i].value;
        C2[i] = C1[i];
    }
    
    bubble(C1,N);
    selection(C2,N);
    
    print(C1,N);
    cout << "Stable" << endl;
    print(C2,N);
    if(isStable(C1,C2,N)) cout << "Stable" <<endl;
    else cout << "Not stable" << endl;
    
    return 0;
}


Measured memory_bytes: 3108
def f(x,r,p):
  ans=1
  for i in range(1,r+1):
    ans=(ans*(x-i+1))%p
  return ans
def comb(x,r,p):
  r=min(r,x-r)
  return (pow(f(r,r,p),p-2,p)*f(x,r,p))%p
n,a,b=map(int,input().split())
mod=10**9+7
print((pow(2,n,mod)-comb(n,a,mod)-comb(n,b,mod)-1)%mod)

Measured memory_bytes: 38512
INF=10**9

def dfs(cur, a, b, c, l,n):
    if cur==n:
        if not (a==0 or b==0 or c==0):
            return abs(A-a)+abs(B-b)+abs(C-c)-30
        else:
            return INF
    ret0=dfs(cur+1, a+l[cur], b, c, l, n)+10
    ret1=dfs(cur+1, a, b+l[cur], c, l, n)+10
    ret2=dfs(cur+1, a, b, c+l[cur], l, n)+10
    ret3=dfs(cur+1, a, b, c, l, n)
    #print(ret0,ret1,ret2,ret3)
    return min(ret0,ret1,ret2,ret3)

[n,A,B,C]=[int(i) for i in input().split()]
l=[]
for i in range(n):
    l.append(int(input()))

print(dfs(0,0,0,0,l,n))


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

int main(){
    bool cards[4][13];
    int n,rank;
    char mark;

    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            cards[i][j]=0;
        }
    }

    cin >> n;
    for(int s=0;s<n;s++){
        cin >> mark >> rank;
        if(mark =='S')cards[0][(rank-1)]=1;
        if(mark =='H')cards[1][(rank-1)]=1;
        if(mark =='C')cards[2][(rank-1)]=1;
        if(mark =='D')cards[3][(rank-1)]=1;
    }


    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(cards[i][j] == 0){
                if(i==0)mark='S';
                if(i==1)mark='H';
                if(i==2)mark='C';
                if(i==3)mark='D';

                cout << mark << " " << j+1 << endl;
            }
        }
    }
    
    return 0;
}



Measured memory_bytes: 3116
A,B = map(int,input().split())

def f(x):
    if x % 4 == 0:
        return x ^ 0
    elif x % 4 == 1:
        return 1
    elif x % 4 == 2:
        return 1 ^ x
    else:
        return 0


if A==0:
    print(f(B))
else:
    print(f(A-1) ^ f(B))

Measured memory_bytes: 3060
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem2409 : Power **/
int main()
{
	int N, M;
	cin>>N>>M;
	vector<int> a(M), b(M);
	vector<bool> use(M);
	
	rep(i, M) cin>>a[i]>>b[i];
	int min=0, tmp=0, idx=0;
	
	bool update=true;
	int ans=0;
	while (update) {
		update = false;
		rep(i, M) {
			if (a[i]<=min+1 && min+1<=b[i] && !use[i]) {
				if (!update) ans++;
				
				tmp = max(tmp, b[i]);
				update = true;
				idx = i;
			}
		}
		min = tmp;
		use[idx] = true;
		
		if (min==N)
			break;
	}
	
	if (min == N)
		cout << ans << endl;
	else
		cout << "Impossible" << endl;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;
using PII = pair<ll, ll>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())
#define MP make_pair

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    
    double d; cin >> d;
    double ans = max(sqrt(2)*d, floor(d)+1);
    cout << setprecision(20);
    p(ans);
    
    return 0;
}


Measured memory_bytes: 3308
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

long long GetAttackNum(long long n)
{
	if (n == 1)
	{
		return 1;
	}

	return 1 + 2 * GetAttackNum(n / 2);
}

int main()
{
	long long h;
	cin >> h;
	cout << GetAttackNum(h) << endl;
}

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

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

  ll ans = 1;
  for (ll i = 1; i <= N; i++) {
    ans = (ans * i) % MOD;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl
#define YORN(f) cout<<((f)?"YES":"NO")<<endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int n;
    cin >> n;
    cout << 800 * n - 200 * (n / 15) << endl;
    return 0;
}

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

int main()
{
    double n;
    while(cin>>n)
    {
        if(n==0)break;
        double sum=0,sum2=0;
        REP(i,n)
        {
            double x;
            cin>>x;
            sum+=x;
            sum2+=x*x;
        }
        sum/=n;
        sum*=sum;
        sum2/=n;
        cout<<sqrt(sum2-sum)<<endl;
    }
}





Measured memory_bytes: 3280
s=input()
ans=0
for i in range(1 << (len(s)-1)):
    tmp=""
    for j in range(len(s)-1):
        tmp+=s[j]
        if (i >> j ) & 1 == 1:
            tmp+="+"
    tmp+=s[-1]
    ans+=eval(tmp)
print(ans)

Measured memory_bytes: 40304
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N,a;cin >> N;
	vector<ll> A(N);
	for (int i = 0;i < N - 1;i++) {
		cin >> a; A[a-1]++;
	}
	for (int i = 0;i < N;i++)cout << A[i] << endl;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), s(n+1, 0);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) s[i+1] = s[i] + a[i]; 
    map<ll,ll> mp;
    ll ans = 0;
    rep(i, 0, n+1) {
        ans += mp[s[i]];
        mp[s[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 18652
fn solve() {
    let stdin = std::io::stdin();
    let mut scn = Scanner {
        stdin: stdin.lock(),
    };
    let n: usize = scn.read();
    let a: i64 = scn.read();
    let b: i64 = scn.read();
    let mut hs: Vec<i64> = (0..n).map(|_| scn.read()).collect();
    hs.sort();
    hs.reverse();
    let mut left = 0;
    let mut right = 1i64 << 34;
    while right - left > 1 {
        let med = (right + left) / 2;
        let hs: Vec<i64> = hs.iter().map(|h| *h - b * med).filter(|h| *h > 0).collect();
        let mut tmp = 0;
        let c = a - b;
        //eprintln!("{} {:?}", med, hs);
        for &x in hs.iter() {
            tmp += (x + (c - 1)) / c;
        }
        if tmp <= med {
            right = med;
        } else {
            left = med;
        }
    }
    println!("{}", right);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

dp = [1]*N
for i in range(M):
    dp[a[i]-1] = 0

for i in range(N):
    if dp[i] == 0:
        continue
    elif i == 0:
        dp[i] = 1
    elif i == 1:
        dp[i] = dp[i-1]+1
    else:
        dp[i] = dp[i-1] + dp[i-2]

ans = int(dp[N-1])%1000000007
print(ans)


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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y;
    cin>>x>>y;
    cout<<(x*500>=y?"Yes":"No")<<endl;
    return 0;
}


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

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}




int main(void){
    const ll INF = 1000000007;
    ll n;
    cin >> n;
    ll a[n],b[n];
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a, a+n);
    ll x,y;
    x = a[n-1];
    y = a[n-2];
    for(ll i = 0; i < n; i++){
        if(b[i] == x)cout << y << endl;
        else cout << x << endl;
    }
    
    return 0;
}


Measured memory_bytes: 4736
n=gets.to_i
count = 0
temp=0
flag=false

while n >= temp do
  while n>=count do
    if count == n
      flag =true
      break
    else
      count+=7
    end
  end
  break if flag ==true
  count =temp+4
  temp =count
end
puts flag==true ? "Yes" : "No"


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define input(array) repi(array##_itr, array) { cin >> *(array##_itr); }
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main() {
	Vi data(6);
	input(data);
	double up                   = 100.0 * data[4] / (100 + data[4]);
//	clog << up << endl;
	tuple<double, int, int> ans = mt(0.0, data[0]*100, 0),
	                        now = mt(0.0, 0, 0);  // per,water,suger
	for (int a = 0; a * data[0] * 100 <= data[5]; a++) {
		for (int b = 0; (data[0] * a + data[1] * b) * 100 <= data[5]; b++) {
			if ((data[0] * a + data[1] * b)==0){continue;}
			get<1>(now) = (data[0] * a + data[1] * b) * 100;
			for (int c = 0; get<1>(now) + c * data[2] <= data[5]; c++) {
				for (int d = 0;get<1>(now) + c * data[2] + d * data[3] <= data[5]; d++) {
					get<2>(now) = (data[2] * c + data[3] * d);
					if (get<2>(now) == 0) {
						continue;
					}
					get<0>(now) =(double) (100.0*get<2>(now)) / (get<1>(now) + get<2>(now));
					if (get<1>(now)/100 * data[4] < get<2>(now)) {
						continue;
					}
					chmax(ans, now);
				}
			}
		}
	}
		cout << get<1>(ans)+get<2>(ans) <<" "<<get<2>(ans)<< endl;
}

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

int main() {
	int a, b, c, cnt=0;
	cin >> a >> b >> c;
	for (int i=a; i<=b; i=i+1) {
		if (c % i == 0)
			cnt = cnt + 1;
	}
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>
int main(){
  int n,m;
  scanf("%d %d",&n,&m);
  int a[m];
  int i;
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
  }
  int sum=0;
  for(i=0;i<m;i++){
    sum+=a[i];
  }
  if(n-sum>=0){
    printf("%d\n",n-sum);
  }else{
    printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 1768
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
h,w = gets.chomp.split.map(&:to_i)
s = []
h.times do
  s.push gets.chomp.split(//)
end

dy = [-1, -1, -1, 0, 0, 1, 1, 1]
dx = [-1,  0,  1,-1, 1,-1, 0, 1]


h.times do |y|
  w.times do |x|
    next if s[y][x] == '#'
    count = 0
    8.times do |i|
      ny = y + dy[i]; nx = x + dx[i]
      if (0 <= ny && ny < h) && (0 <= nx && nx < w) && s[ny][nx] == '#'
        count += 1
      end
    end
    s[y][x] = count
  end
end

s.each do |line|
  puts line.join('')
end


Measured memory_bytes: 2428
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  char c;
  set<char> s;
  for(int i=0;i<n;i++){
    cin>>c;
    s.insert(c);
  }
  cout<<(s.size()==3?"Three":"Four");
}


Measured memory_bytes: 384
N = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(N):
    s = input()
    if s == "AC":
        c0 +=1
    elif s=="WA":
        c1 += 1
    elif s=="TLE":
        c2 += 1
    else:
        c3 += 1
print(f"AC x {c0}")
print(f"WA x {c1}")
print(f"TLE x {c2}")
print(f"RE x {c3}")

Measured memory_bytes: 69848
def A():
    temp = input().split()
    S = temp[0]
    T = temp[1]
    temp = [int(i) for i in input().split()]
    A = temp[0]
    B = temp[1]
    U = input()
    if U == S:
        print(A-1, B)
    else:
        print(A, B-1)

def B():
    print('x'*len(input()))

def C():
    N = int(input())
    A = [int(i) for i in input().split()]
    if N > len(set(A)):
        print('NO')
    else:
        print('YES')

def D():
    temp = [int(i) for i in input().split()]
    N = temp[0]
    K = temp[1]
    p = [int(i) for i in input().split()]
    expected_val = [(i+1)/2.0 for i in p]
    cur = sum(expected_val[:K])
    ans = cur
    for i in range(N-K):
        cur -= expected_val[i]
        cur += expected_val[i+K]
        ans = max(ans, cur)
    print(ans)

D()

Measured memory_bytes: 24548
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  map<ll,ll>mp;
  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
        int s = x*x + y*y + z*z + x*y + y*z + z*x;
        mp[s]++;
      }
    }
  }
  rep(i,n){
    cout << mp[i+1] << endl;
  }
  return 0;
}


Measured memory_bytes: 5968
import sys
input = sys.stdin.readline

import copy

N=int(input())
W = [input().split() for _ in range(N)]

for i in range(N):
    for j in range(i+1,N):
        if W[i] == W[j]:
            print("No")
            sys.exit()



for i in range(N):
    W[i] = list(W[i][0])

for i in range(1,N):
    if W[i-1][-1] != W[i][0]:
        print("No") 
        sys.exit()


print("Yes")


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
typedef complex<double> P;
double dot(P a, P b){ //内積
    return (a.real() * b.real() + a.imag() * b.imag());
}

double cross(P a, P b){ //外積
    return (a.real() * b.imag() - a.imag() * b.real());
}

bool is_orth(P a1, P a2, P b1, P b2){ //垂直か
    return EQ(dot(a1 - a2, b1 - b2), 0.0);
}

bool is_para(P a1, P a2, P b1, P b2){ //平行か
    return EQ(cross(a1 - a2, b1 - b2), 0.0);
}

bool is_online(P a, P b, P c){ //cが線分上か
    return (abs(a-c) + abs(c-b) < abs(a-b) + EPS);
}

bool distance_lp(P a, P b, P c){ //直線abと点cの距離
    return abs(cross(b-a, c-a)) / abs(b-a);
}

double norm(P a){
  return a.real() * a.real() +a.imag() *a.imag();
}

int ccw(P p0,P p1,P p2){
  P a = p1-p0;
  P b = p2-p0;
  if(cross(a,b) > EPS) return 1;
  if(cross(a,b) < -EPS) return -1;
  if(dot(a,b) < -EPS) return 2;
  if(abs(a) < abs(b)) return -2;
  return 0;
}

bool is_intersect(P p1, P p2, P p3, P p4){
  return (ccw(p1,p2,p3) * ccw(p1,p2,p4) <= 0 &&
      ccw(p3,p4,p1) * ccw(p3,p4,p2) <= 0 );
}

P intersect_pos(P a1, P a2, P b1, P b2){ //直線同士の交点
    P a = a2 - a1;
    P b = b2 - b1;
    return a1 + a * cross(b, b1 - a1) / cross(b, a);
}

#define printP(P) cout << "(" << P.real() << ", " << P.imag() << ")" << endl;




int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll q;
    cin >> q;
    while(q--){
        double x0, y0, x1, y1, x2, y2, x3, y3;
        cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        P p0(x0,y0), p1(x1, y1), p2(x2, y2), p3(x3, y3);
        if(is_intersect(p0,p1,p2,p3)){
            print("1");
        }else{
            print("0");
        }

    }
}


Measured memory_bytes: 3320
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<ll,ll>;
using vi=vector<ll>;
using vstr=vector<string>;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
void yes(bool c) { if (c)print("Yes"); else print("No"); };

map<ll,ll> counter(vi vec) {
    map<ll,ll> counter;
    for(auto v:vec) {
        counter[v]++;
    }
    return counter;
}

void solve() {
    ll n,k; cin >> n >> k;
    vi A(n);
    rep(i,n){
        cin >> A[i];
    }
    map<ll,ll> count = counter(A);
    ll siz = count.size();
    vi vec;
    for(auto c:count){
        vec.pb(c.sc);
    }
    sort(ALL(vec));
    ll ans = 0;
    rep(i,siz-k){
        ans += vec[i];
    }
    print(ans);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 17892