akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,n) for (int i = a; i < n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); \
    })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = long long;

int main() {
  int n, c, k; cin >> n >> c >> k;
  vector<int> t(n); REP(i,n) cin >> t[i];
  whole(sort, t);
  int max, cnt = c, ans = 0;
  for (int i = 0; i < n; ++i) {
    if (cnt == c || max < t[i]) ans++, cnt = 0, max = t[i] + k;
    cnt++;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,s;
  cin >> n >> s;
  int ans = 0;
  REP(i,n+1)REP(j,n+1){
      //cout << i << " " << j<<endl;
      if (i+j<=s)
          if (i+j+n+1>s)ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

Int Ceil(Int a, Int b) {
    if (a % b == 0) {
        return a / b;
    } else {
        return Floor(a, b) + 1;
    }
}

vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

Int digits(Int n) {
    return (Int)to_string(n).size();
}

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

    Int x;
    cin >> x;

    Int ans = 0, tem = 0;
    for (Int i = 1; i <= x; i++) {
        tem += i;
        if (x <= tem) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

int main() {
	int n = nxt(), m = nxt();
	vector<string> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	vector<vector<int>> dp(n, vector<int>(m, 1e9));
	dp[0][0] = a[0][0] == '#';
	deque<pair<int, int>> dq;
	dq.push_back({0, 0});
	while (!dq.empty()) {
		int x, y;
		tie(x, y) = dq.front();
		dq.pop_front();
		for (int i = 0; i <= 1; ++i) {
			for (int j = 0; j <= 1; ++j) {
				if (abs(i) + abs(j) != 1) {
					continue;
				}
				int nx = x + i, ny = y + j;
				if (nx < 0 || nx >= n || ny < 0 || ny >= m) {
					continue;
				}
				int nw = dp[x][y] + (a[x][y] != a[nx][ny]);
				if (nw < dp[nx][ny]) {
					dp[nx][ny] = nw;
					if (a[x][y] == a[nx][ny]) {
						dq.push_front({nx, ny});
					} else {
						dq.push_back({nx, ny});
					}
				}
			}
		}
	}

	cout << (dp.back().back() + 1) / 2 << "\n";

	return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n, k; cin >> n >> k;

    int ans = k;
    for (int i = 1; i < n; i++) ans *= k - 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
parseline(str) = parse.(Int, split(str))
function main()
    N = parse(Int, readline())
    D = parseline.(readlines())
    count = 0
    for d in D
        if d[1]==d[2]
            if count == 2
                return println("Yes")
            else
                count += 1
            end
        else
            count = 0
        end
    end
    return println("No")
end
main()

Measured memory_bytes: 193716
n = input()
n = int(n)
a = input().split()
b = 1
if '0' in a:
    print ("0")
else:
    for i in a:
        b *= int(i)
        if (b > 1000000000000000000):
            print ("-1")
            break
    if (b <= 1000000000000000000):
        print (b)


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    int cnt=0;
    cin >> s;
    rep(i,0,s.size()/2){
        if(s[i] != s[s.size()-1-i]) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.reflect.ClassTag

object Main {
  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()

    val notPrimes = Array.ofDim[Boolean](55555 + 1)
    (2 to 55555) foreach { i =>
      if (!notPrimes(i)) {
        (2 to 55555 / i) foreach (j => notPrimes(j * i) = true)
      }
    }

    val ans = ((2 to 55555) filter { i =>
      !notPrimes(i) && i % 5 == 1
    }).take(N)

    out.println(ans.mkString(" "))
  }


  def main(args: Array[String]): Unit = {
    solve()
    out.flush()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  def rep(n: Int)(f: Int => Unit): Unit = {
    var i = 0
    while(i < n) { f(i); i += 1 }
  }
  def rep_r(n: Int)(f: Int => Unit): Unit = {
    var i = n - 1
    while(i >= 0) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  implicit class ArrayOpts[A](val as: Array[A]) extends AnyVal {
    // todo Orderingだとboxing発生するので自作Orderを用意したい
    def maxByOpt[B: Ordering](f: A => B): Option[A] = {
      if (as.nonEmpty) Some(as.maxBy(f)) else None
    }

    def grpBy[K](f: A => K): mutable.Map[K, ArrayBuffer[A]] = {
      val map = mutable.Map.empty[K, ArrayBuffer[A]]
      rep(as.length)(i => map.getOrElseUpdate(f(as(i)), ArrayBuffer()) += as(i))
      map
    }

    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      var sum = num.zero
      rep(as.length)(i => sum = num.plus(sum, f(as(i))))
      sum
    }

    def minByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.lt)
    }

    def maxByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.gt)
    }

    private def limit[B](f: A => B, ixRange: Range)(cmp: (B, B) => Boolean): (A, B) = {
      var limA = as(ixRange.head)
      var limB = f(limA)

      for (i <- ixRange.tail) {
        val a = as(i)
        val b = f(a)
        if (cmp(b, limB)) {
          limA = a
          limB = b
        }
      }
      (limA, limB)
    }
  }

  implicit class IterableOpts[A](val as: Iterable[A]) extends AnyVal {
    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      as.foldLeft(num.zero)((acc, a) => num.plus(acc, f(a)))
    }
  }
}


Measured memory_bytes: 27956
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,m;
  while(cin>>n>>m,n||m){
    string pd[n],sa[n],da[n];
    for(int i=0;i<n;i++) cin>>pd[i]>>sa[i]>>da[i];
    string so[m],de[m],me[m];
    for(int i=0;i<m;i++) cin>>so[i]>>de[i]>>me[i];
    vector<int> ans;
    for(int i=0;i<m;i++){
      bool f=0;
      for(int j=n-1;j>=0;j--){
	bool ff=1;
	for(int k=0;k<8;k++){
	  ff&=sa[j][k]=='?'||sa[j][k]==so[i][k];
	  ff&=da[j][k]=='?'||da[j][k]==de[i][k];
	}
	if(ff){
	  f=pd[j]=="permit";
	  break;
	}
      }
      if(f) ans.push_back(i);
    }
    cout<<ans.size()<<endl;
    for(int i=0;i<(int)ans.size();i++)
      cout<<so[ans[i]]<<" "<<de[ans[i]]<<" "<<me[ans[i]]<<endl;
  }
  return 0;
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a==b && b!=c){
        std::cout << "Yes" << std::endl;
    }
    else if (a==c && b!=c){
        std::cout << "Yes" << std::endl;
    }
    else if (b==c && b!=a){
        std::cout << "Yes" << std::endl;
    }
    else{std::cout << "No" << std::endl;}
    
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,i,j,k,t=0,tt=0;

  string x;
  vector<char>  v;
  vector<char>  v1;
  cin>>x;
  a=x.length();
  b=x.length()-1;
  k=0;
  while(k<b){
    if(x[b]!=x[k]){
      tt++;
    }
   k++;
   b--;
  }
  for(i=0;i<((a-1)/2)-1;i++){
   v.push_back(x[i]);
  }
  for(i=((a+3)/2)-1;i<a;i++){
    v1.push_back(x[i]);
  }
  for(i=0;i<v.size();i++){
    if(v[i]!=v1[i]){
        t++;
    }
  }
if(t>0 || tt>0)
{
    cout<<"No"<<endl;
}
else{
    cout<<"Yes"<<endl;
}
   return 0;
}


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

int main() {
  int D;
  std::cin >> D;

  if (D == 25){
    std::cout << "Christmas" << '\n';
  }

  else if (D == 24){
    std::cout << "Christmas Eve" << '\n';
  }

  else if (D == 23){
    std::cout << "Christmas Eve Eve" << '\n';
  }

  else if (D == 22){
    std::cout << "Christmas Eve Eve Eve" << '\n';
  }

}


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

int main(){
    int n,x;
    int count;
    while(1){
        cin>>n>>x;
        if(n==0){
            break;
        }
        count=0;
        for(int i=1;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x){
                        count++;
                    }else if(i+j+k>x){
                        break;
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
}


Measured memory_bytes: 3088
class Node
	attr_accessor :key, :right, :left, :parent
	def initialize(key, right, left, parent)
		@key = key; @right = right; @left = left; @parent = parent
	end
end

$none = Node.new(0, nil, nil, nil)
#$root = Node.new(0, $none, $none, $none)
$root = $none

def find(u, k)
	while u != $none && k != u.key
		if k < u.key
			u = u.left
		else
			u = u.right
		end
	end
	return u
end

def insert(k)
	y = $none	
	x = $root
	z = Node.new(k, $none, $none, $none)

	#cnt = 0
	while x != $none
		#puts cnt
		#cnt += 1

		y = x
		if z.key < x.key
			x = x.left
		else
			x = x.right
		end
	end

	z.parent = y
	if y == $none
		$root = z
	else
		if z.key < y.key
			y.left = z
		else
			y.right = z
		end
	end
end

def inorder(u)
	return if u == $none
	inorder(u.left)
	printf(" %d", u.key)
	inorder(u.right)
end

def preorder(u)
	return if u == $none
	printf(" %d", u.key)
	preorder(u.left)
	preorder(u.right)
end

n = gets.to_i
0...n.times do |i|
	line = gets.split
	com = line[0]
	if com == "insert"
		insert(line[1].to_i)
	elsif com == "print"
		inorder($root)
		puts
		preorder($root)
		puts
	elsif com == "find"
		t = find($root, line[1].to_i)
		if t != $none
			puts "yes"
		else
			puts "no"
		end
	end
end

Measured memory_bytes: 66240
s=input();ans="AC"
for i in range(len(s)):
  if s[i]<="Z" and "A"!=s[i]!="C":ans="WA"
if s[0]!="A":ans="WA"
s=s[1:]
if "C"in s[0]+s[-1]:ans="WA"
s=s[1:-1]
if not"C"in s:ans="WA"
n=s.find("C");s=s[:n]+s[n+1:]
if "C"in s:ans="WA"
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int count = 0;
			for (int i = 1; i <= n; i++) {
				if (i % 2 == 1) {
					count++;
				}
			}
			System.out.println((double)count / n);
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int x[11][11];
int main() {
	// your code goes here
	int n,d; cin>>n>>d;
	
	for(int i=0;i<n;i++)
		for(int j=0;j<d;j++) cin>>x[i][j];
	
	int cnt = 0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int dist = 0;
			for(int k=0;k<d;k++){
				int dif = x[i][k]-x[j][k];
				dist+=(dif*dif);
			}
			double sqrt_dist = sqrt((double)dist);
			if(floor(sqrt_dist)==ceil(sqrt_dist)) cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 256
import numpy as np

grid = []
for i in range(3):
    array = list(map(int,input().strip().split()))
    grid.append(array)
    
grid = np.array(grid)

N = int(input())
s = [int(input()) for i in range(N)]

for i in s:
    grid = np.where(grid==i,0,grid)
    
#print(grid)
    
if grid[0][0]==0 and grid[0][1]==0 and grid[0][2]==0:
    han = "Yes"
elif grid[1][0]==0 and grid[1][1]==0 and grid[1][2]==0:
    han = "Yes"
elif grid[2][0]==0 and grid[2][1]==0 and grid[2][2]==0:
    han = "Yes"
elif grid[0][0]==0 and grid[1][0]==0 and grid[2][0]==0:
    han = "Yes"
elif grid[0][1]==0 and grid[1][1]==0 and grid[2][1]==0:
    han = "Yes"
elif grid[0][2]==0 and grid[1][2]==0 and grid[2][2]==0:
    han = "Yes"
elif grid[0][0]==0 and grid[1][1]==0 and grid[2][2]==0:
    han = "Yes"
elif grid[0][2]==0 and grid[1][1]==0 and grid[2][0]==0:
    han = "Yes"
else:
    han = "No"
print(han)


Measured memory_bytes: 12448
def solve(N, cnt):
    if len(str(N)) == 1:
        return cnt
    sN = str(N)
    maxNum = 0
    for i in range(1, len(sN)):
        left = int(sN[0:i])
        right = int(sN[i:])
        maxNum = max(left * right, maxNum)
    ret = solve(maxNum, cnt + 1)
    return ret


Q = int(input())
for i in range(Q):
    N = int(input())
    ans = solve(N, 0)
    print(ans)



Measured memory_bytes: 5600
#include<iostream>
#include<queue>
using namespace std;
#define MAX 1000
struct Point{int x,y,dist;};
int main()
{
  int H,W,N;
  int vital;
  int i,j;
  char field[MAX][MAX];
  int dx[4]={0,1,0,-1};
  int dy[4]={-1,0,1,0};
  int sx,sy,ans;

  cin>>H>>W>>N;
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      cin>>field[i][j];
      if(field[i][j]=='S'){
	sy=i;
	sx=j;
	ans=0;
      }
    }
  }

  for(vital=1;vital<=N;vital++){
    queue<Point>q;
    bool visited[MAX][MAX]={0};

    Point p={sx,sy,0},p2;
    q.push(p);
    while(1){
      p=q.front();
      q.pop();

      if(field[p.y][p.x]==(vital+'0')){
	sy=p.y;
	sx=p.x;
	ans+=p.dist;
	break;
      }

      for(i=0;i<4;i++){
	p2.y=p.y+dy[i];
	p2.x=p.x+dx[i];
	p2.dist=p.dist+1;
	if(p2.y<0||H<=p2.y)continue;
	if(p2.x<0||W<=p2.x)continue;
	if(field[p2.y][p2.x]=='X')continue;
	if(visited[p2.y][p2.x])continue;
	visited[p2.y][p2.x]=true;
	q.push(p2);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2824
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

ll f[2000010];

ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
ll binpow(ll a, ll b) {
     ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
 
ll find_ncr(ll n, ll r)
{
    ll m1=max(r,n-r);
    ll i,j,s,d=1,k;
    s=1;
 
    for(i=m1+1;i<=n;i++)
    {
        s=((s%m)*(i%m))%m;
    }
 
    m1=min(r,n-r);
 
    for(i=1;i<=m1;i++)
    {
        k=binpow(i,m-2);
        d=((d%m)*(k%m))%m;
    }
 
    k=(s%m*(d%m))%m;
 
    return k;
}

int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,m;
  cin >> n >> m;
  vector<int>a(n,-1);
  for (int i = 0; i < m; ++i)
  {
    int s,c;
    cin >> s >> c;
    if(s == 1 && c == 0 && n != 1)
    {
      cout << -1 << endl;
      return 0;
    }
    if (a[s-1] == -1)
    {
      a[s-1] = c;
    }
    else if (a[s-1] != c)
    {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; ++i)
  {
    if(i == 0 && a[i] == -1 && n != 1)
      cout << 1;
    else
    {
      if (a[i] != -1)
        cout << a[i];
      else
        cout << 0; 
    }
  }
  return 0;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

LL DP[100][2];

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

  DP[0][0] = 1;
  DP[0][1] = 0;
  FOR(i,1,N+1) {
    int A;
    scanf("%d", &A);
    REP(j,2) DP[i][j] = DP[i-1][j] + DP[i-1][j^(A&1)];
  }
  printf("%lld\n", DP[N][P]);
}


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

int main(){
    int X, a, b;
    cin >> X;
    a = X/500;
    b = (X - 500 * a)/5;
    cout << 1000 * a + 5 * b << endl;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N, M;
	cin >> N >> M;
	vector<double> a(N);
	vector<double> sum(N+1, 0);
	REP(i, N)
		cin >> a[i];
	REP(i, N){
		sum[i+1] = sum[i]+a[i];
	}
	vector<vector<vector<long double>>> dp(2, vector<vector<long double>>(510, vector<long double>(510, -INF_LL)));
	dp[0][0][0] = 0;
	REP(i, N){
		dp[1] = vector<vector<long double>>(510, vector<long double>(510, -INF_LL));
		REP(j, M+1){
			REP(k, i+1){
				chmax(dp[1][j][k], dp[0][j][k]);
				chmax(dp[1][j+1][i+1], dp[0][j][k]+(sum[i+1]-sum[k])/(i-k+1));
			}
		}
		swap(dp[0], dp[1]);
	}
	cout << fixed << setprecision(10) << dp[0][M][N] << endl;
}


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

int main(){
  int k, s;

  cin >> k >> s;

  int ans = 0;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      int sum = x + y + z;
      if (sum == s && z >= 0 && z <= k) {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1000

int main(void){
  int i,n;
  double w[N];

  for(i=0;scanf("%lf",&w[i])==1;i++){}
  n=i;
  for(i=0;i<n;i++){
    if(w[i]<=48.0)        printf("light fly\n");
    else if(w[i]<=51.0)   printf("fly\n");
    else if(w[i]<=54.0)   printf("bantam\n");
    else if(w[i]<=57.0)   printf("feather\n");
    else if(w[i]<=60.0)   printf("light\n");
    else if(w[i]<=64.0)   printf("light welter\n");
    else if(w[i]<=69.0)   printf("welter\n");
    else if(w[i]<=75.0)   printf("light middle\n");
    else if(w[i]<=81.0)   printf("middle\n");
    else if(w[i]<=91.0)   printf("light heavy\n");
    else                  printf("heavy\n");
  }
  return 0;
}

Measured memory_bytes: 0
import math
import calendar
import fractions
import itertools

n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in s:
    if i == "z":
        ans += "A"
    i_index = alpha.index(i)
    ans_char_index = 100
    if i_index + n <= len(alpha) - 1:
        ans_char_index = i_index + n
    else:
        ans_char_index = (n - (len(alpha) - 1 - i_index)) % 26 - 1
    ans += alpha[ans_char_index]
print(ans)


Measured memory_bytes: 5332
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException{
		String str[];
        int a,b,answer = 0;
        String operator;
        StringBuilder builder = new StringBuilder();


        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true){
	        str = br.readLine().split(" ");
	        a = Integer.parseInt(str[0]);
	        operator = str[1];
	        b = Integer.parseInt(str[2]);

	        if(operator.equals("?"))break;
	        else if(operator.equals("+")) answer = a + b;
	        else if(operator.equals("/")) answer = a / b;
	        else if(operator.equals("-")) answer = a - b;
	        else if(operator.equals("*")) answer = a * b;

	        builder.append(answer + "\n");
        }
        builder.delete(builder.length() - 1, builder.length());
        System.out.println(builder.toString());

        br.close();
	}
}

Measured memory_bytes: 24328
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <tuple>
#include <algorithm>

using namespace std;

template<typename T>
class PMA {
private:
    uint32_t id = 0;

public:
    struct Node {
        uint32_t id;
        bool accepted = false;
        unordered_map<T, Node*> children;
        Node *failure = nullptr;
    };

    Node *root;

    int32_t insert(const vector<T> &vec) {
        Node *node = root;
        for (T v : vec) {
            auto itr = node->children.find(v);
            if (itr != node->children.end()) {
                node = itr->second;
            } else {
                node->children[v] = new Node;
                node->children[v]->id = id++;
                node = node->children[v];
            }
        }

        node->accepted = true;

        return node->id;
    }

    Node *transition(Node *node, T v) {
        while (node != nullptr) {
            auto itr = node->children.find(v);
            if (itr != node->children.end()) {
                return itr->second;
            } else {
                node = node->failure;
            }
        }
        return root;
    }

    void link_failure() {
        queue<Node*> tovisit;
        tovisit.push(root);
        while (!tovisit.empty()) {
            Node *node = tovisit.front();
            tovisit.pop();

            for (auto p : node->children) {
                T v = p.first;
                Node *child = p.second;

                child->failure = transition(node->failure, v);

                tovisit.push(child);
            }
        }
        return;
    }

    PMA() {
        root = new Node;
        root->id = id++;
    }
};

int main() {
    int32_t H, W, R, C;
    cin >> H >> W;

    vector<vector<uint8_t>> T(H);
    for (int32_t i = 0; i < H; i++) {
        string temp;
        cin >> temp;
        T[i] = vector<uint8_t>(temp.begin(), temp.end());
    }

    cin >> R >> C;

    vector<vector<uint8_t>> P(R);
    for (int32_t i = 0; i < R; i++) {
        string temp;
        cin >> temp;
        P[i] = vector<uint8_t>(temp.begin(), temp.end());
    }

    PMA<uint8_t> pma_p;
    vector<uint32_t> M;
    for (vector<uint8_t> vec : P) M.push_back(pma_p.insert(vec));
    pma_p.link_failure();

    PMA<uint32_t> pma_m;
    pma_m.insert(M);
    pma_m.link_failure();

    vector<vector<uint32_t>> T2(W);

    for (vector<uint8_t> vec : T) {
        PMA<uint8_t>::Node *node = pma_p.root;
        for (uint32_t i = 0; i < vec.size(); i++) {
            node = pma_p.transition(node, vec[i]);
            T2[i].push_back(node->id);
        }
    }

    vector<pair<uint32_t, uint32_t>> res;
    for (int32_t c = 0; c < W; c++) {
        PMA<uint32_t>::Node *node = pma_m.root;
        for (int32_t r = 0; r < H; r++) {
            node = pma_m.transition(node, T2[c][r]);
            if (node->accepted) {
                res.push_back(make_pair(r - R + 1, c - C + 1));
            }
        }
    }

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

    for (auto p : res) {
        cout << p.first << " " << p.second << endl;
    }

    return 0;
}

Measured memory_bytes: 77252
#ifndef ___Geometry_Library
#define ___Geometry_Library

// ------ Includes ------ //
#include <cmath>
#include <vector>
#include <complex>
#include <utility>
#include <algorithm>

// ------ Defines ------ //
typedef long double GType;
typedef std::complex<GType> Point;
typedef std::pair<Point, Point> Segment;

// ------ Constants ------ //
const GType EPS = 1.0e-10L;

// ------ Functions Level 1 ------ //
GType dot(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).real();
}
GType cross(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).imag();
}
int ccw(const Point& p1, const Point& p2, const Point& p3) {
	Point v1 = p2 - p1, v2 = p3 - p1;
	if (cross(v1, v2) > EPS) return +1;
	if (cross(v1, v2) < -EPS) return -1;
	if (dot(v1, v2) < -EPS) return +2;
	if (std::norm(v1) < std::norm(v2)) return -2;
	return 0;
}

// ------ Functions Level 2 ------ //
bool intersect(const Segment& s1, const Point& p1, bool segflag) {
	if (!segflag) return std::abs(cross(s1.second - p1, s1.first - p1)) < EPS;
	return (std::abs(s1.first - p1) + std::abs(s1.second - p1) - std::abs(s1.second - s1.first)) < EPS;
}
bool intersect(const Segment& s1, const Segment& s2, bool segflag) {
	if (!segflag) return cross(s1.second - s1.first, s2.first - s1.first) * cross(s1.second - s1.first, s2.second - s1.first) < EPS;
	return (ccw(s1.first, s1.second, s2.first) * ccw(s1.first, s1.second, s2.second) <= 0 && ccw(s2.first, s2.second, s1.first) * ccw(s2.first, s2.second, s1.second) <= 0);
}

#endif

#include <queue>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
const double inf = 1000000000.0;
int N, M, x, y; vector<Point> v1, v2;
int main() {
	cin >> N >> M;
	v1.resize(N);
	v2.resize(M);
	for (int i = 0; i < N; i++) cin >> x >> y, v1[i] = Point(x, y);
	for (int i = 0; i < M; i++) cin >> x >> y, v2[i] = Point(x, y);
	vector<double> dist1(N, inf * 2); dist1[0] = 0;
	priority_queue<pair<double, int> > que1; que1.push(make_pair(0.0, 0));
	while (!que1.empty()) {
		int u = que1.top().second; que1.pop();
		for (int i = 0; i < N; i++) {
			if (u == i) continue;
			if (!intersect(Segment(make_pair(v2[0], v2[1])), Segment(make_pair(v1[u], v1[i])), true) && dist1[i] > dist1[u] + abs(v1[u] - v1[i])) {
				dist1[i] = dist1[u] + abs(v1[u] - v1[i]);
				que1.push(make_pair(-dist1[i], i));
			}
		}
	}
	vector<double> dist2(M, inf * 2); dist2[0] = 0;
	priority_queue<pair<double, int> > que2; que2.push(make_pair(0.0, 0));
	while (!que2.empty()) {
		int u = que2.top().second; que2.pop();
		for (int i = 0; i < M; i++) {
			if (u == i) continue;
			if (!intersect(Segment(make_pair(v1[0], v1[1])), Segment(make_pair(v2[u], v2[i])), true) && dist2[i] > dist2[u] + abs(v2[u] - v2[i])) {
				dist2[i] = dist2[u] + abs(v2[u] - v2[i]);
				que2.push(make_pair(-dist2[i], i));
			}
		}
	}
	if(dist1[1] < inf || dist2[1] < inf) cout << fixed << setprecision(12) << min(dist1[1] + abs(v2[0] - v2[1]), dist2[1] + abs(v1[0] - v1[1])) << endl;
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 3432
#include <iostream>
#include <map>

using namespace std;

int main()
{
        unsigned long long n;
        string s;
        cin >> n;

        unsigned long long m = 0;
        unsigned long long a = 0;
        unsigned long long r = 0;
        unsigned long long c = 0;
        unsigned long long h = 0;


        for (unsigned long long i=0; i<n; i++) {
                cin >> s;
                switch ((long long)s.c_str()[0]) {
                case 'M':
                        m++;
                        break;
                case 'A':
                        a++;
                        break;
                case 'R':
                        r++;
                        break;
                case 'C':
                        c++;
                        break;
                case 'H':
                        h++;
                        break;
                }
        }

        unsigned long long all = m + a + r + c + h;
        unsigned long long cond = all * (all-1) * (all-2)  / 6;

        unsigned long long hoge = 0;
        if (m > 1)
                hoge += (m*(m-1)/2)*(all-m) + m*(m-1)*(m-2)/6;
        if (a > 1)
                hoge += (a*(a-1)/2)*(all-a) + a*(a-1)*(a-2)/6;
        if (r > 1)
                hoge += (r*(r-1)/2)*(all-r) + r*(r-1)*(r-2)/6;
        if (c > 1)
                hoge += (c*(c-1)/2)*(all-c) + c*(c-1)*(c-2)/6;
        if (h > 1)
                hoge += (h*(h-1)/2)*(all-h) + h*(h-1)*(h-2)/6;

        if (all < 3) {
                cout << 0 << endl;
        } else {
                cout << cond - hoge<< endl;
        }
        return 0;
}

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

int main(){
    string S; cin >> S;
    if((S[0]==S[1] && S[1]==S[2]) || (S[1]==S[2] && S[2]==S[3])) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

int ans = 0;
int N, M, Q;
vector<int> a, b, c, d;

void dfs(vector<int> A)
{
    if (A.size() == N+1) {
        int tmp = 0;
        rep(q, Q) {
            if (A[b[q]]-A[a[q]] == c[q]) {
                tmp += d[q];
            }
            ans = max(ans, tmp);
        }
    } else {
        int b = A.back();
        for (int a = b; a <= M; ++a) {
            vector<int> B = A;
            B.push_back(a);
            dfs(B);
        }
    }
}

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

    cin >> N >> M >> Q;
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);
    rep(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    vector<int> A;
    A.push_back(1);
    dfs(A);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3660
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0])
    var H = Number(lines[0].split(" ")[1]);

    lines.shift();

    var AB = lines.map(i => i.split(" ").map(i => Number(i)));

    var x = AB.concat().sort((a, b) => b[0] - a[0]);
    var y = AB.concat().sort((a, b) => b[1] - a[1]);

    var max = x[0][0];
    var damage = 0; var ans = Math.ceil(H / max);

    // 切りつけ攻撃力最大の刀で切り続け，最後に任意の刀を投げる
    for (var i = 0; i < N; i++) {
        damage += y[i][1];
        
        // 切りつけ攻撃回数が負になる場合，0とする
        var m = Math.ceil((H - damage) / max)
        if (m < 0) { m = 0 }

        ans = Math.min(ans, m + i + 1)
    }
    console.log(ans);
});

Measured memory_bytes: 53068
#include <bits/stdc++.h>
#define int long
#define ll long long
#define MOD (1000000007)
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

const int MX = 777777 + 5;
int fac[MX+5],fac_inv[MX+5];
 
int power(int x,int y,int p){
	int res=1;
	x=x%p;
	while(y){
		if(y&1)res=(res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void init(){
  int n=MX+4;
	fac[0] = 1;
  for(int i=0;i<n;++i)fac[i+1]=fac[i]*(i+1)%MOD;
  fac_inv[n]=power(fac[n],MOD-2,MOD);
  for(int i=n-1;i>=0;--i)fac_inv[i]=fac_inv[i+1]*(i+1)%MOD;
}
int COM(int n,int r){return (fac[n]*fac_inv[r])%MOD*fac_inv[n-r]%MOD;}

main() {
    int N,K; cin >> N >> K;
    init();
    for(int i=1;i<=K;i++){
        if(N-K+1<i||K<i) cout << 0 << endl;
        else cout << (COM(N-K+1,i)*COM(K-1,i-1))%MOD << endl;
    }

    return 0;
}


Measured memory_bytes: 12416
n,m=[int(i) for i in input().split()]
arr=[0 for i in range(n+1)]
wa=[0 for i in range(n+1)]
ac=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if arr[p]==1:
        pass
    else:
        if s=='WA':
            wa[p]+=1
        else:
            ac+=1
            arr[p]=1
pen=0
for i in range(n+1):
    if arr[i]==1:
        pen+=wa[i]
print(ac,pen)


Measured memory_bytes: 4760
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define rer(i, a, b) for(ll i=a-1; i>=b; i--)
#define pb push_back
#define ALL(v) (v).begin(),(v).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n;

signed main(){
    cin >> n;
    ll v1[MAX_N], v2[MAX_N];
    rep(i, 0, MAX_N) v1[i] = v2[i] = 0;
    rep(i, 0, n){
        ll v; cin >> v;
        if(i%2==0) v1[v]++;
        else v2[v]++;
    }
    vector<P> pv1, pv2;
    rep(i, 1, MAX_N){
        pv1.pb(P(v1[i], i));
        pv2.pb(P(v2[i], i));
    }
    sort(ALL(pv1), greater<P>());
    sort(ALL(pv2), greater<P>());

    ll ans;
    if(pv1[0].second != pv2[0].second)
        ans = n - pv1[0].first - pv2[0].first;
    else
        ans = n - max(pv1[0].first + pv2[1].first, pv1[1].first + pv2[0].first);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5100
n,m = map(int, input().split())
d = {}
for _ in range(m):
    a,b = map(int, input().split())
    if a not in d:
        d[a] = {}
    if b not in d:
        d[b] = {}
    d[a][b] = d[b][a] = 1

for v in d.values():
    if 1 in v and n in v:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 96620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const int maxn = 1e6 + 7;
int n, m, k;

int main() 
{
    ios::sync_with_stdio(0); cin.tie(0); //C++关同步
    cin >> m >> n;
    int pre = 0, ans = 0, fir = 0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(i > 0)ans = max(ans, x - pre);
        else fir = x;
        pre = x;
    }
    ans = max(ans, m - pre + fir);
    cout << m - ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
double pi = 3.14159265358979;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

int main() {
  ll a;
  long double b;
  cin >> a >> b;
  ll p = b;
  b = b - p;
  long double f = b * a;
  ll h = f;
  ll g = p * a;
  g += f;
  printf("%lld\n", g);
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define ll long long
#define vec vector<ll> 
#define pb push_back

using namespace std;
ll dp[100001];
ll dfs( vec graph[] , ll curr ){
    if(dp[curr]!= -1){
        return dp[curr];
    }
    ll max=0;
    for(auto x: graph[curr]){
        ll temp =dfs(graph , x);
        if( temp > max){
            max =temp;
        }
    }
    return dp[curr] =1+ max;
}
int main() {
    ll n ,q , x,y;
    cin>>n>>q;
    vec indeg(n+1) , rank(n+1) , graph[n+1];
    for(int i=0 ;i<= n ; i++){
        dp[i] = -1;
    }
    for(int i=0;i<q;i++){
        cin>>x>>y;
        graph[x].pb(y);
        indeg[y]++;
    }
    ll max= 0;
    for(int i=1; i<=n ; i++){
        if(indeg[i]==0){
            ll temp = dfs(graph , i);
            max= max>temp ? max : temp;
        }
    }
    cout<<max-1<<endl;

    
    return 0;
}


Measured memory_bytes: 15528
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int H; cin >> H;
    int A; cin >> A;
    cout << (H+A-1) / A << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  ll long long
using namespace std;
ll n,m,p;
vector<pair<int,int>>v[25];
int vis[20];
int check(int temp)
{
	for(int k=1;k<=n;k++)
	{
		if(temp&(1<<(k-1)))//第k个人说真话 
		{
			for(int j=0;j<v[k].size();j++)
			{
				int x=v[k][j].first;
				int y=v[k][j].second;
				if(y&&!(temp&(1<<(x-1)))) return 0;//x说真话 看是否对应temp中的x位
				if(!y&&(temp&(1<<(x-1)))) return 0;
			}
		}
	}
	return 1;
}
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
    	scanf("%lld",&m);
    	for(int k=1;k<=m;k++)
    	{
    		int x,y;
    		scanf("%d%d",&x,&y);
    		v[i].push_back(make_pair(x,y));
		}
	}
	int res=0;
	for(int i=0;i<(1<<n);i++)
	{
		int f=check(i);
		if(f)
		{
			int cot=0;
			for(int k=1;k<=n;k++)   //状态压缩 位运算 
			   cot+=(i&(1<<(k-1)))?1:0;
			res=max(cot,res);		
		}
	}
	printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class DGatheringChildren {
public:
void solve(std::istream& cin, std::ostream& cout) {
    string S;
    cin >> S;

    int n = S.size();
    vector<int> A(n);
    int pos = 0;

    for (int i = 0; i < n; i++){
        if (S[i] == 'R')
            pos = 0;
        else
            A[i] = pos++;
    }

    for (int i = n - 1; i >= 0; i--){
        if (S[i] == 'L')
            pos = 0;
        else
            A[i] = pos++;
    }

    vector<int> B(n, 0);

    for (int i = 0; i < n; i++){
        if (S[i] == 'R')
            B[i + A[i] + (A[i] & 1)]++;
        else
            B[i - A[i] - (A[i] & 1)]++;
    }

    for (const auto &b: B)
        cout << b << " ";
    cout << endl;
}
};

int main() {
	DGatheringChildren solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1408
n = int(input())
act = [[0] * 3 for _ in range(n)]
for i in range(n):
    a, b, c = map(int, input().split())
    act[i][0], act[i][1], act[i][2] = a, b, c
dp = [[0] * 3 for _ in range(n+1)]
for i in range(n+1):
    if i+1 < n+1:
        dp[i+1][0] = max(dp[i][1] + act[i][0], dp[i][2] + act[i][0])
        dp[i+1][1] = max(dp[i][0] + act[i][1], dp[i][2] + act[i][1])
        dp[i+1][2] = max(dp[i][0] + act[i][2], dp[i][1] + act[i][2])
print(max(dp[n][0], max(dp[n][1], dp[n][2])))

Measured memory_bytes: 42572
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1000000007;
const long long INF = 1LL << 60;
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int k,x;
    cin >> k >> x;
    int n = k;
    rep(i,k){
        n--;
        cout << x - n << endl;
    }
    rep(i,k-1){
        n++;
        cout << x + n <<endl;
    }
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n, _ := iScan(), iScan()
	s := SScan(n)
	sort.Strings(s)
	for _, v := range s {
		fmt.Print(v)
	}
	fmt.Println("")
}


Measured memory_bytes: 1772
from collections import deque
N,C,K = map(int,input().split())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
T = deque(T)
bus = 0
while True:
    bus += 1
    Time = T[0]+K
    num = 0
    while num < C and T[0] <= Time:
        T.popleft()
        num += 1
        if not T:
            print(bus)
            exit()


Measured memory_bytes: 83144
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int A,B;

int main(int argc, char const *argv[])
{
    cin>>A>>B;
    if((A+B)>=10){
        cout<<"error"<<endl;
    }else{
        cout<<A+B<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

K, A, B = map(int, input().split())

bis = 1
if A - 1 <= K:
    K -= (A - 1)
    bis += A - 1

if B - A > 2:
    print(bis + (K // 2) * (B - A) + (K % 2))
else:
    print(bis + K)


Measured memory_bytes: 7880
class Edge:
    def __init__(self, dst, weight):
        self.dst, self.weight = dst, weight

    def __lt__(self, e):
        return self.weight > e.weight


class Graph:
    def __init__(self, V):
        self.V = V
        self.E = [[] for _ in range(V)]

    def add_edge(self, src, dst, weight):
        self.E[src].append(Edge(dst, weight))


class TreeDiameter:
    def __init__(self, graph: Graph) -> None:
        self.graph = graph
        self.diameter = None
        self.fathest_pair = None

    def run(self):
        _, v1 = self.calc_farthest(0, -1)
        diameter, v2 = self.calc_farthest(v1, -1)
        self.diameter = diameter
        self.fathest_pair = (v1, v2)
        return diameter

    def calc_farthest(self, target: int, par: int = -1):
        dists = [None] * self.graph.V
        stack = [(target, par)]

        while stack:
            v, par = stack[-1]
            if dists[v] is None:
                dists[v] = (0, v)
                for child in self.graph.E[v]:
                    if child.dst == par:
                        continue
                    stack.append((child.dst, v))
            else:
                stack.pop()
                ret_dist, ret_v = dists[v]
                for child in self.graph.E[v]:
                    if child.dst == par:
                        continue
                    cand_dist, cand_v = dists[child.dst]
                    if cand_dist + child.weight > ret_dist:
                        ret_dist = cand_dist + child.weight
                        ret_v = cand_v
                dists[v] = (ret_dist, ret_v)

        return dists[target]


def aoj():
    N = int(input())
    graph = Graph(N)
    for _ in range(N-1):
        s, t, w = map(int, input().split())
        graph.add_edge(s, t, w)
        graph.add_edge(t, s, w)
    diam = TreeDiameter(graph)
    print(diam.run())


if __name__ == "__main__":
    aoj()



Measured memory_bytes: 75316
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

int main() {
   Int m;
   std::cin >> m;
   printf("%ld\n", 48-m);
}


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

int gcd(int a, int b, int c) {
  int min = a;
  if (b < min) min = b;
  if (c < min) min = c;
  int greatest = 1;
  for (int i = 2; i <= min; i++) {
    if (a%i == 0 && b%i == 0 && c%i == 0) greatest = i;
  }
  return greatest;
}

int main() {
  int k;
  cin >> k;
  
  long ans = 0;
  for (int a = 1; a <= k; a++) {
    for (int b = 1; b <= k; b++) {
      for (int c = 1; c <= k; c++) {
        ans += gcd(a, b, c);
      }
    }
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 3644