akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){

ll int N,D;
cin >> N >> D;
vector<ll int> X(N);
vector<ll int> Y(N);

rep(i,N){
	cin >> X[i] >> Y[i];
}

ll int counter = 0;
rep(i,N){
	if(sqrt(X[i]*X[i]+Y[i]*Y[i])<=D){
		counter+=1;
	}
	else{}

}

cout << counter;







	return 0;

}



Measured memory_bytes: 6484
N = int(input())
max_count = 0
for i in range(1,N+1):
    count = 0
    kari = i
    while True:
        if kari % 2 == 0:
            count += 1
            kari /= 2
        else:
            break
    if count > max_count:
        max_count = count
        ans = i
if N != 1:
 print(ans)
else:
    print(1)

Measured memory_bytes: 9148
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


int fac(int num) {
  if(num==1) return 1;
  else return num*fac(num-1);
}



int main() {
  double a,b,c,d;
  cin >> a >> b >> c >> d;
  int cntt = ceil(a/=d);
  int cnta = ceil(c/=b);

  if(cntt >= cnta) cout << "Yes" << endl;
  else cout << "No" << endl;

  
  return 0;
}


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

int main() {
    long n, ans = 0;
    bool was = false;
    cin >> n;
    for (long i=1; i<=n; i++) {
        long p;
        cin >> p;
        if (p == i && !was) {
            ans++;
            was = true;
        } else
            was = false;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int n;
	long long int x;
	x=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(i%3==0&&i%5==0||i%3==0||i%5==0){
			continue;
		}
		x+=i;
	}
	cout<<x<<endl;
}


Measured memory_bytes: 3636
var numbers = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(Number);
var n = numbers.shift();

function isPrime(num) {
  if (num < 2) return 0;
  if (num === 2) return 1;
  if (num % 2 === 0) return 0;
  for (var i = 3; i <= Math.sqrt(num); i += 2) {
    if (num % i === 0) return 0;
  }
  return 1;
}

console.log(numbers.reduce(function(acc, number) {
  return acc + isPrime(number);
}, 0));

Measured memory_bytes: 17156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  int count = 0;
  /*   for (int i = 1; i < n + 1; i++) {
      if (a[i] == a[a[i]]) {
        count++;
      }
    } */

  for (int i = 1; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if (a[i] == j && a[j] == i) count++;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
//  cin>>t;
  int tt=1;
  while(t--){
    ll l,r;
    cin>>l>>r;
    ll temp=r-l+1;
    if(temp>=2019)
    {
      cout<<0;
      return 0;
      
   // cout<<"Case #"<<tt<<": ";
   // tt++;
    }
    ll i ,j,ans=2018;
    fr(i,l,r+1)
    {
      fr(j,i+1,r+1)
      ans=min(ans,(i*j)%2019);
    }
    cout<<ans;

    }
  return 0;
}



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

if (A+B)%2==0:
  print(abs(A-B)//2)
else:
  left=min(A,B)+(abs(A-B)-1)//2
  right=N-max(A,B)+1+(abs(A-B)-1)//2
  print(min(left,right))
  

Measured memory_bytes: 3060
package main

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

func main() {
	sc := NewScanner(os.Stdin)
	n, maxWeight := sc.Int(), sc.Int()

	weights, values := make([]int, n+1), make([]int, n+1)
	for i := 1; i <= n; i++ {
		weights[i] = sc.Int()
		values[i] = sc.Int()
	}

	m := make([]int, maxWeight+1)

	for i := range weights {
		w, v := weights[i], values[i]

		for j := maxWeight; j >= w; j-- {
			m[j] = Max(m[j], m[j-w]+v)
		}
	}

	fmt.Println(m[maxWeight])
}

// generated by https://github.com/murosan/gollect

func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

type Scanner struct{ *bufio.Scanner }

func NewScanner(r io.Reader) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &Scanner{Scanner: s}
}

func (s *Scanner) Bytes() []byte { s.Scan(); return s.Scanner.Bytes() }

func (s *Scanner) Int() int { return BytesToInt(s.Bytes()) }

func BytesToInt(b []byte) (n int) {
	var i int
	negative := b[0] == 45
	if negative {
		i++
	}
	for ; i < len(b); i++ {
		n = n*10 + int(b[i]-'0')
	}
	if negative {
		return -n
	}
	return
}


Measured memory_bytes: 1408
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		int n,T,i,c,t,min,temp;
        i = 0;
        temp = 1001;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		T = sc.nextInt();

		while(i < n){
			c = sc.nextInt();
			t = sc.nextInt();
			if(t <= T && c < temp){
                temp = c;
			}
            i++;
		}
      if(temp != 1001){
      	min = temp;
        System.out.println(min);
      }else{
        System.out.println("TLE");
      }
      
      sc.close();
      return;
	  }
}

Measured memory_bytes: 23124
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
ll arr[200];
void Dufaux()
{
    ll n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    ll sum=0;
    sort(arr,arr+n);
    for(int i=0;i<n-1;i++){
        sum+=(arr[i+1]-arr[i]);
    }
    cout<<sum<<endl;
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






Measured memory_bytes: 3596
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
four = 0
two = 0
for i in range(n):
    if A[i]%4 == 0:
        four += 1
    elif A[i]%2 == 0:
        two += 1
print('Yes' if four + two//2 >= n//2 else 'No')


Measured memory_bytes: 21476
#include "bits/stdc++.h"
using namespace std;
#define MODULO 1000000007
#define PI 3.14159265359
typedef long long int ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll res=0;
	for(int c=1;c<n;++c)
	{
		res=res+(n-1)/c;
	}
	cout<<res<<endl;
    return 0;
}


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

using namespace std;

typedef long long int ll;
 
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; }
 
typedef pair<int,int> pair;

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

  ll sum=100;
  ll count=0;

  while(x>sum){
    sum*=1.01;
    count++;
  }

  cout << count << endl;


}

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

int main(){
  string S;
  cin >> S;
  
  string T="";
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='A'){
      T+='A';
      continue;
    }
    if(i+1<S.size()){
      if(S.at(i)=='B' && S.at(i+1)=='C'){
        T+='D';
        i++;
        continue;
      }
    }
    T+='E';
  }
  long long ans=0;
  long long cntA=0;
  for(int i=0;i<T.size();i++){
    if(T.at(i)=='A')  cntA++;
    else if(T.at(i)=='D') ans+=cntA;
    if(T.at(i)=='E')  cntA=0;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 776
let a: Int = Int(readLine()!)!
let b: Int = Int(readLine()!)!
let c: Int = Int(readLine()!)!
let x: Int = Int(readLine()!)!

var ans = 0

for i in 0...a{
    for j in 0...b{
        for k in 0...c{
            if(500 * i + 100 * j + 50 * k == x){
                ans += 1
            }
        }
    }
}

print(ans)

Measured memory_bytes: 3824
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0;i < n; i++){
		a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		int cnt = 1;
		int WaitTime = a[0];
		int ans = 1;
		for(int i = 1; i < n; i++){
			if(cnt == c||a[i] - WaitTime > k){
				ans++;
				cnt = 0;
				WaitTime = a[i];
			}
			cnt++;
		}
		System.out.println(ans);
 
	}
 
}

Measured memory_bytes: 50280
import java.util.*

fun BooleanArray.and() = this.reduce { a, b -> a && b }
fun BooleanArray.or() = this.reduce { a, b -> a || b }

data class Cell(val n: Int, var checked: Boolean)

fun main(args: Array<String>) {
  val a = Array(3) { readLine()!!.split(' ').map { Cell(it.toInt(), false) }}
  val n = readLine()!!.toInt()
  repeat(n) {
    val b = readLine()!!.toInt()
    checked@for (row in a) {
      for (col in row) {
        if (col.n == b) {
          col.checked = true
          break@checked
        }
      }
    }
  }
  val ans = BooleanArray(3) { i -> a[i][i].checked }.and()
    || BooleanArray(3) { i -> a[i][2 - i].checked }.and()
    || BooleanArray(3) { i -> BooleanArray(3) { j -> a[i][j].checked }.and() || BooleanArray(3) { j -> a[j][i].checked }.and() }.or()
  println(if (ans) "Yes" else "No")
}


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

int main() {
    int n;

    cin >> n;

    vector<ll> h(n);
    vector<ll> dp(n);

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

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);

    for ( int i = 1; i < n; i++ ) {
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }

    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long C[51][51], sum[51], max_sum = 0, cnt = 0, v[50];
	int n, a, b, m = 1;
	C[0][0] = 1;
	for(int k = 1; k <= 50; ++k) {
		C[k][0] = C[k][k] = 1;
		for(int i = 1; i < k; ++i)
			C[k][i] = C[k - 1][i] + C[k - 1][i - 1];
	}
	cin >> n >> a >> b;
	for(int i = 0; i < n; ++i)
		cin >> v[i];
	sort(v, v + n);
	sum[0] = 0;
	for(int i = 1; i <= b; ++i)
		sum[i] = sum[i - 1] + v[n - i];
	for(int i = a; i <= b; ++i) {
		if(max_sum * i < sum[i] * m) {
			max_sum = sum[i];
			m = i;
		}
	}
	cout << fixed << setprecision(15) << max_sum /(double)m << '\n';
	for(int k = a; k <= b; ++k) {
		if(sum[k] * m == max_sum * k) {
			int i = n - k, j = n - k;
			while(i > 0 && v[i - 1] == v[i]) --i;
			while(j < n - 1 && v[j + 1] == v[j]) ++j;
			cnt += C[j - i + 1][k - n + j + 1];
		}
	}
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long A = 0, B = 0;
        long sum = 0;
        for (int i = 0; i < N; i++) {
            if (i == 0) {
            A = Integer.parseInt(sc.next());
            } else {
                B = Integer.parseInt(sc.next());
                sum += Math.max(A - B, 0);
                A = B + Math.max(A - B, 0);
            }

        }
        System.out.println(sum);

    }
}

Measured memory_bytes: 58768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n, wl;
  cin >> n >> wl;

  vector<int> w(n), v(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> v[i];
  }

  vector<vector<ll>> dp(n + 1, vector<ll>(wl + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int sumW = 0; sumW <= wl; sumW++) {
      if (sumW - w[i] >= 0) {
        // iを選ぶ場合
        dp[i + 1][sumW] = max(dp[i + 1][sumW], dp[i][sumW - w[i]] + v[i]);
      }

      // iを選ばない場合
      dp[i + 1][sumW] = max(dp[i + 1][sumW], dp[i][sumW]);
    }
  }

  cout << dp[n][wl] << endl;

  return 0;
}

Measured memory_bytes: 80256
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  string s;
  cin >> s;

  map<string,int> mp;
  mp[s]++;

  char c = s.back();

  bool flag = true;
  REP(i,n-1){
    cin >> s;
    if(mp[s] || s[0] != c) flag = false;
    mp[s]++; c = s.back();
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define all(A) A.begin(), A.end()
#define sz(A) (int)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 2e5;

void solve () {
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	if (x / d >= k) {
		cout << x - k * d << "\n";
	}
	else {
		if ((k - x / d) % 2 == 0) {
			cout << x - (x / d) * d  << "\n";
		}
		else {
			cout << abs(x - (x / d) * d - d) << "\n";
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
  #endif
	int t = 1;
	while (t--) {
		solve();
	}
 	return 0;
}

Measured memory_bytes: 3644
n = int(input())
a = list(map(int,input().split()))

x = [0]*n
for i in range(n):
    x[0] += (-1)**(i) * a[i]
    
for i in range(1,n):
    x[i] = 2*a[i-1] - x[i-1]
    
for i in range(n):
    print(x[i],end="")
    print(" ",end="")

Measured memory_bytes: 20560
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int h = 0;cin >> h;
    int a;cin >> a;
    if(h % a == 0)
    cout << h / a  << endl;
    else
    {
        cout << h / a + 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
using namespace std;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define ipair pair<int,int>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int main() {
	bitset<30>b = {};
	TFOR(i, 28) {
		int n;
		cin >> n;
		b[n-1] = 1;
	}
	TFOR(i, 30) {
		if (!b[i])cout << i+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
H, W = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(H)]

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

##############################

cost = warshall_floyd(C)

num = [0] * 10
for i in range(H):
  for j in range(W):
    if A[i][j] != -1:
      kazu = A[i][j]
      num[kazu] += 1
#print(num)
ans = 0
for i in range(10):
  ans += num[i] * cost[i][1]

print(ans)

Measured memory_bytes: 3444
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    if n < 1200 {
        println!("ABC");
    } else {
        println!("ARC");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int a,b;
    cin>>a>>b;
    cout<<(a+b+1)/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,a[200005],ans;
map<ll,ll>mp;
int main(){
  cin >> n;
  for(int i=1; i<=n; i++){
   cin >> a[i];
   mp[a[i]]++;
  }
  
  sort(a+1,a+n+1);
  
  for(int i=n; i>=1; i--){
    if(mp[a[i]]){
    	mp[a[i]]--;
      ll p = 1;
      while(p <= a[i])p *= 2;
      if(mp[p - a[i]]){
        mp[p-a[i]]--;
        ans++;
      }
    }
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 26752
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<ll, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

struct UnionFind {
    vector<int> par; // 親を指すvector,-par[親]は木のサイズ
    UnionFind(int n):par(n, -1) {} // uniteで親を埋め込んでいく必要あり
    int root(int x) { // 親をたどる&データの整理
        if(par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    bool unite(int x, int y) { // データの結合
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    bool same(int x, int y) {return root(x) == root(y);} // 所属判定
    int size(int x) {return -par[root(x)];} // 木のサイズ
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    UnionFind uft(n);
    vector<ll> a(n);
    vector<multiset<ll> > se(n);
    rep(i, n) cin >> a[i];
    rep(i, n) se[i].insert(a[i]);
    rep(j, m) {
        int aa, b;
        cin >> aa >> b;
        aa = uft.root(aa);
        b = uft.root(b);
        if(se[aa].size() < se[b].size()) swap(aa, b);
        uft.unite(aa, b);
        for(ll x:se[b]) se[aa].insert(x);
    }
    if(n-m == 1) {
        cout << 0 << endl;
        return 0;
    }
    if(n < 2*(n-m-1)) {
        cout << "Impossible" << endl;
        return 0;
    }

    ll res = 0;
    int cnt = 0;
    PQG<ll> q;
    rep(i, n) {
        if(i == uft.root(i)) {
            cnt++;
            bool fi = true;
            for(ll x:se[i]) {
                if(fi) {
                    res += x;
                    fi = false;
                }
                else {
                    q.emplace(x);
                }
            }
        }
    }
    while(cnt++ < 2*(n-m-1)) {
        res += q.top();
        q.pop();
    }
    cout << res << endl;
}

Measured memory_bytes: 24648
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
const int Max = 1e5 + 5;
int lst[100][27];

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

	for (int i = 1;i <= n;i++)
	{
		string str;
		cin >> str;
		for (int j = 0;j < str.size();j++)
		{
			lst[i][str[j] - 'a']++;
		}
	}
	for (int i = 0;i <= 25;i++)
	{
		int g = 1e9 + 5;
		for (int j = 1;j <= n;j++)
		{
			g = min(lst[j][i], g);
		}
		for (int j = 1;j <= g;j++)cout << char(i + 'a');
	}
}

Measured memory_bytes: 3104
#include <stdio.h>
#include <math.h>

#define SQ(X) \
  ( (X) * (X) )
#define RAD(D) \
  ( (D) * M_PI / 180. )
#define degsin(D) \
  sin ( RAD( D ) )
#define degcos(D) \
  cos ( RAD( D ) )

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int a, b, c;

  scanf ( "%d%d%d", &a, &b, &c );
  printf ( "%.4f\n", a * b * degsin ( c ) / 2. );
  printf ( "%.4f\n", a + b + sqrt ( SQ( a ) + SQ( b ) - 2. * a * b * degcos ( c ) ) );
  printf ( "%.4f\n", b * degsin ( c ) );

  return ( 0 );
}

Measured memory_bytes: 0
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	ll n, k; cin >> n >> k;
	vector<ll> a(n), b(n); rep(i, n)cin >> a[i] >> b[i];
	ll res = 0;
	rep(i, n)
	{
		if ((k | a[i]) == k)res += b[i];
	}
	rep(i, 31)
	{
		ll bit = 1;
		rep(j, i)bit = bit << 1;
		if (!(k&bit))continue;
		ll maskbit = bit - 1;
		ll checker = ((k ^ bit) | maskbit);
		ll tmp = 0;
		rep(j, n)
		{
			if ((checker|a[j]) == checker)tmp += b[j];
		}
		chmax(res, tmp);
	}
	cout << res << endl;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define FOR(i,n) for(size_t i=0;i<(n);i++)
#define REP(n) FOR(i,n)
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const &auto s, const &auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(all(v),0l)

int main() {
  int n;
  cin>>n;
  for (int i = 9; i > 0; --i) {
    if(n%i==0&&n/i<10){
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No";
}

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  var k = parseInt(input[0].split(" ")[1]);
  var ans = 0;
  if(n%k!=0){
    ans=1;
  }

  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9932
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,n)  for(ll i=0;i<n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef pair<int,int> pii;
const int MAX=pow(10,7)+1;
long long is_composite[MAX]={0};
//vector<ll> prime;
void sieve (void)
{
	for (int i = 2; i < MAX; ++i)
	{
		//if (is_composite[i]==0) prime.push_back (i);
		for (int j = 2; i * j < MAX; ++j)
		{
			is_composite[i * j]++;
		}
	}
	for(int i=1;i<MAX;i++)
	{
		is_composite[i]+=2;
		is_composite[i]=is_composite[i-1]+(is_composite[i]*i);
	}
}
int main()
{
	IOS;
	//int t; cin>>t;
	//ll M=pow(10,9)+7;
	int t=1;
	while(t)
	{
		sieve ();
		ll n; cin>>n;
		ll ans=is_composite[n]-1;
		cout<<ans;
		t--;
	}
	return 0;
}


Measured memory_bytes: 81756
n, x, y = list(map(int, input().split()))
x = x-1
y = y-1
ans = [0] * (n-1)


for i in range(n):
    for j in range(i+1, n):
        shortest = min(abs(j-i), abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1)
        ans[shortest-1] += 1

for a in ans:
    print(a)



Measured memory_bytes: 9252
N = eval(input())
a = list(map(int,input().split()))
n = len(a)

# print(N,a,n)

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

if n==1:
    print(a[0])
else:
    element = gcd(a[0], a[1])
    if n==2:print(element)
    else:
        for i in range(2,n):
            element=gcd(element,a[i])
        print(element)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define int long long

struct point{
  int id,x,y;
  bool operator<(const point &u)const{
    return id < u.id;
  }
};

struct KDtree{
  struct node{
    int location;
    int p,l,r;
  };

  vector<point> P;
  vector<node> T;
  int n,np = 0;

  void init(int n){
    P.resize(n+1);
    T.resize(n+1);
  }

  static bool cmpX(const point &a,const point &b){ return a.x < b.x; }
  static bool cmpY(const point &a,const point &b){ return a.y < b.y; }

  int maketree(int l,int r,int depth){
    if(!(l < r)) return -1;
    int mid = (l+r) / 2;
    int t = np++;
    if(depth%2 == 0) sort(P.begin()+l,P.begin()+r,cmpX);
    else sort(P.begin()+l,P.begin()+r,cmpY);
    T[t].location = mid;
    T[t].l = maketree(l,mid,depth+1);
    T[t].r = maketree(mid+1,r,depth+1);
    return t;
  }

  void find(int v,int sx,int tx,int sy,int ty,int depth,vector<point> &ans){
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;
    if(sx <= x && x <= tx && sy <= y && y <= ty){
      ans.push_back(P[T[v].location]);
    }

    if(depth%2 == 0){
      if(T[v].l != -1){
        if(sx <= x) find(T[v].l,sx,tx,sy,ty,depth+1,ans);
      }
      if(T[v].r != -1){
        if(x <= tx) find(T[v].r,sx,tx,sy,ty,depth+1,ans);
      }
    }
    else {
      if(T[v].l != -1){
        if(sy <= y) find(T[v].l,sx,tx,sy,ty,depth+1,ans);
      }
      if(T[v].r != -1){
        if(y <= ty) find(T[v].r,sx,tx,sy,ty,depth+1,ans);
      }
    }
  }
}kd;

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

  int n; cin >> n;
  kd.init(n);
  for(int i = 0; i < n; i++){
    int x,y; cin >> x >> y;
    kd.P[i] = {i,x,y};
    kd.T[i].l = kd.T[i].r = kd.T[i].p = -1;
  }
  int root = kd.maketree(0,n,0);

  int q; cin >> q;
  vector<point> ans;
  for(int i = 0; i < q; i++){
    int sx,tx,sy,ty; cin >> sx >> tx >> sy >> ty;
    ans.clear();
    kd.find(root,sx,tx,sy,ty,0,ans);
    sort(ans.begin(),ans.end());
    for(auto p : ans){
      cout << p.id << '\n';
    }
    cout << '\n';
  }

  return 0;
}



Measured memory_bytes: 29504
#include<bits/stdc++.h>
#define f first
#define s second
#define pii pair<int, int>
using namespace std;
bool comp(pii a, pii b)
{
  return a.s<b.s;
}
int main()
{
  int n,x,l;
  cin>>n;pii p[n];
  for(int i=0;i<n;i++)
  {
    cin>>x>>l;
    p[i].f=x-l;p[i].s=x+l; 
  }
  sort(p,p+n, comp);
  int ans=0;
  int checker=p[0].s;
  for(int i=1;i<n;i++)
  { //cout<<"Iteration : "<<i<<"\n";
   //cout<<"checker = "<<checker<<" p[i].s = "<<p[i].s<<"\n";
    if(checker >p[i].f)
    {
      ans++;
     
    }
    else checker=p[i].s;
  }
  cout<<n-ans;
}

Measured memory_bytes: 1152
s = gets.chomp.split("")
arr = [0, 0, 0, 0]
s.each{|c|
    case c
    when "K" then arr[0] += 1
    when "U" then arr[1] += 1
    when "P" then arr[2] += 1
    when "C" then arr[3] += 1
    end
}
puts arr.min


Measured memory_bytes: 8908
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef long long ll;
typedef pair<int,int> P;
int dp[114514];
signed main(){
	int n;
	int a[111111];
	cin>>n;
	rep(i,n)cin>>a[i];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;
const double PI = acos(-1);

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
  vector<int> p;
  vector<int> s;
  void init(int n) {
    p.resize(n, -1);
    s.resize(n, 1);
  }
  int find(int n) {
    if(p[n] == -1) return n;
    else return find(p[n]);
  }
  int size(int n) {
    return s[find(n)];
  }
  void unite(int n, int m) {
    int pn = find(n);
    int pm = find(m);
    if(pn == pm) return;
    if(s[pn] > s[pm]) {
      s[pn] = s[pn] + s[pm];
      p[pm]= pn;
    } else {
      s[pm] = s[pm] + s[pn];
      p[pn] = pm;
    }
  }
};

long long gcd(long long a, long long b) {
  if(a % b == 0) return b;
  else return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int front = 0;
  int back = n-1;
  cout << front << endl;
  string str_front;
  cin >> str_front;
  if(str_front == "Vacant") return 0;
  cout << back << endl;
  string str_back;
  cin >> str_back;
  if(str_back == "Vacant") return 0;
  rep(i, 18) {
    int mid, dist;
    mid = (front + (back - front + 1) / 2) % n;
    dist = mid - front;
    cout << mid << endl;
    string s;
    cin >> s;
    if(s == "Vacant") break;
    else if(dist % 2 == 0) {
      if(s == str_front) front = mid;
      else back = mid;
    }
    else {
      if(s == str_front) back = mid;
      else {
        front = mid;
        str_front = s;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 852
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N, W;
	cin >> N >> W;
	VI A(N);
	VI V(N);
	VI a, b, c, d;
	a.push_back(0);
	b.push_back(0);
	c.push_back(0);
	d.push_back(0);
	int x = 0;
	REP(i, N) {
		cin >> A[i] >> V[i];
		if (i == 0)x = A[i];
		if (A[i] == x)
			a.push_back(V[i]);
		if (A[i] == x + 1)
			b.push_back(V[i]);
		if (A[i] == x + 2)
			c.push_back(V[i]);
		if (A[i] == x + 3)
			d.push_back(V[i]);
	}



	rSORT(a);
	rSORT(b);
	rSORT(c);
	rSORT(d);

	int ans = 0;
	REP(i, a.size()) {
		if (a[i] == 0)break;
		a[i + 1] += a[i];
	}
	REP(i, b.size()) {
		if (b[i] == 0)break;
		b[i + 1] += b[i];
	}
	REP(i, c.size()) {
		if (c[i] == 0)break;
		c[i + 1] += c[i];
	}
	REP(i, d.size()) {
		if (d[i] == 0)break;
		d[i + 1] += d[i];
	}




	FOR(i, 0, a.size() + 1) {
		int av, aw;
		if (i == 0) {
			av = 0;
			aw = 0;
		}
		else {
			av = a[i - 1];
			aw = i * A[0];
		}
		if (i == a.size()) aw -= A[0];

		//cout << "K" << endl;
		FOR(j, 0, b.size() + 1) {
			int bv, bw;
			if (j == 0) {
				bv = 0;
				bw = 0;
			}
			else {
				bv = b[j - 1];
				bw = j * (A[0] + 1);
			}
			if (j == b.size()) bw -= (A[0] + 1);


			FOR(k, 0, c.size() + 1) {
				int cv, cw;
				if (k == 0) {
					cv = 0;
					cw = 0;
				}
				else {
					cv = c[k - 1];
					cw = k * (A[0] + 2);
				}
				if (k == c.size()) cw -= (A[0] + 2);
				FOR(z, 0, d.size() + 1) {
					int dv, dw;
					if (z == 0) {
						dv = 0;
						dw = 0;
					}
					else {
						dv = d[z - 1];
						dw = z * (A[0] + 3);
					}
					if (z == d.size()) dw -= (A[0] + 3);
					//cout << av + bv + cv + dv << " " << aw << " " << bw << " " << cw << " " << dw << " " << i << " " << j << " " << k << " " << z << endl;
					if (aw + bw + cw + dw <= W) {
						ans = max(ans, av + bv + cv + dv);
					}

				}
			}
		}
	}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long int ll;
ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}
int main(){
  ll n,x,ans;cin>>n>>x;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ans=Svec(v);
  if(v[0]>x) v[0]=x;
  rep(i,n-1){
    if(v[i]+v[i+1]>x){
      v[i+1]=x-v[i];
    }
  }
  cout<<ans-Svec(v)<<endl;
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

int main(){
    int ans;

    string s;
    cin>>s;

    if(s=="RRR")ans=3;
    else if(s=="RRS"||s=="SRR")ans=2;
    else if(s=="SSS")ans=0;
    else ans=1;

    cout<<ans<<endl;
}


Measured memory_bytes: 3632
import numpy as np
H,N=map(int, input().split())
A = [None]*N
B = [None]*N
for i in range(N):
  A[i],B[i]=map(int,input().split())
dp=[10**8]*(H+1)
A = np.array(A)
B = np.array(B)
dp = np.array(dp)
dp[0]=0
for i in range(1,H+1):
  x=np.amin((dp[np.maximum(0,i-A)]+B))
  dp[i]=min(x,dp[i])
print(dp[-1])

Measured memory_bytes: 14556
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
K = int(input())
S = input()
#開業されたN個要素を受け付ける
#list = [input() for i in range(N)]
#input_list = [list(map(int, input().split())) for i in range(N)]
ans = ""
if len(S) <= K:
    ans = S
else:
    ans = S[:K] + "..."

print(ans)


Measured memory_bytes: 61608
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int x,y,tmp;
		
		do {
			x=sc.nextInt();
			y=sc.nextInt();
				
			if(x>y) {
				tmp=y;
				y=x;
				x=tmp;
			}
			
			if(x==0&&y==0) break;
			
			System.out.println(x+" "+y);
			       
		    
		 }while(true);
		
		
		
    }
}


Measured memory_bytes: 34696
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,from,to) for (int i=(from);i<=(to);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define MOD 1000000007

int main () {
  int a, b;
  while (cin >> a >> b) {
    if (a <= 0 && 0 <= b) puts("Zero");
    else if (a > 0) puts("Positive");
    else {
      int n = 0; // # of minus numbers
      if (b > 0) n = -a;
      else n = a - b - 1;
      if (n % 2 == 0) puts("Positive");
      else puts("Negative");
    }
  }
  return 0;
}


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


using namespace std;

int main(){
    string s,t;

    cin>>s>>t;

    int ans=0;



    for(int i=0;i<s.size()-t.size()+1;++i){
        int count=0;
        for(int j=i;j<i+t.size();++j){
            //cout<<s[j]<<":"<<t[j-i]<<endl;
            if(s[j]==t[j-i]){
                ++count;
            }
           
        }
         //cout<<count<<endl;

        ans=max(count,ans);


    }


    cout<<t.size()-ans<<endl;




}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(),v.end()
ll INF = 10010001010;

ll lcm(ll a,ll b)
{
    return a * b / __gcd(a, b);
}
typedef tuple<string, int, int> TUP;

bool tuplesort(const TUP &right, const TUP &left)
{
    if (get<0>(right) != get<0>(left))
    {
        return get<0>(left) < get<0>(right);
    }
    if (get<1>(left) != get<1>(right))
    {
        return get<1>(left) > get<1>(right);
    }
    return get<2>(left) < get<2>(right);
}

ll findSumOfDigits(ll n)
{
    ll digit = 0;
    while (n > 0)
    {
        digit++;
        n /= 10;
    }
    return digit;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    int N;
    string S;
    cin >> N >> S;
    int point = 0;
    int ans = 0;
    for (point = 0; point < N; point++)
    {
        string s, t;
        for (int i = 0; i < point;i++)
        {
            s.push_back(S[i]);
        }
        for (int i = point; i < N;i++)
        {
            t.push_back(S[i]);
        }
        sort(all(s));
        sort(all(t));
        s.erase(unique(all(s)), s.end());
        t.erase(unique(all(t)), t.end());
        int pre = 0;
        string r;
        for (int i = 0; i < s.size(); i++)
        {
            for (int j = 0; j < t.size();j++)
            {
                if(s[i] == t[j]){
                    pre++;
                    r.push_back(s[i]);
                }
            }
        }
        sort(all(r));
        r.erase(unique(all(r)), r.end());
        pre = r.size();
        ans = max(ans, pre);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
  int N;
  std::cin >> N;
  int limit_4 = N / 4 + 1;
  int limit_7 = N / 7 + 1;
  bool can = false;
  for (int i = 0; i <= limit_4; i++) {
    for ( int j = 0; j <= limit_7; j++ ) {
      int total = 4 * i + 7 * j;
      if ( total == N ) can = true;
    }
  }
  if (can) std::cout << "Yes\n";
  else std::cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val an = readLine()!!.split(" ").map(String::toInt).sorted()
    val bn = readLine()!!.split(" ").map(String::toInt).sorted()
    val cn = readLine()!!.split(" ").map(String::toInt).sorted()

//    an.joinToString(",").let(::println)
//    bn.joinToString(",").let(::println)
//    cn.joinToString(",").let(::println)

    fun lowerBound(list: List<Int>, key: Int): Int {
        var left = -1
        var right = list.size

        while (right - left > 1) {
            val mid = left + (right - left) / 2
            if (list[mid] >= key) {
                right = mid
            } else {
                left = mid
            }
        }
        return right

    }


    /**
     * key より大きい値の中から最小の index を返す
     * 該当するものがない場合、-1を返す
     */
    fun upperBound(list: List<Int>, key: Int): Int {

        var left = -1
        var right = list.size

        while (right - left > 1) {
            val mid = left + (right - left) / 2
            if (list[mid] > key) {
                right = mid
            } else {
                left = mid
            }
        }
        return right

    }


    var sum = 0L
    bn.forEach { b ->
        val a = lowerBound(an, b)
        val c = n - upperBound(cn, b)
//        println(b)
//        println(a)
//        println(c)
        sum += a.toLong() * c.toLong()
    }
    println(sum)
}



Measured memory_bytes: 112456