akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, k;
int main()
{
	FAST
	cin>>n>>k;
	if(n==1){
		if(k==0){
			cout<<"0 0 1 1\n";
		} else {
			cout<<"-1\n";
		}
	}else{
		if(k>(1<<n)-1){
			cout<<"-1\n";
			return 0;
		}
		FOR(i,0,(1<<n)){
			if(i==k)continue;
			cout<<i<<' ';
		}
		cout<<k<<' ';
		for(ll i=(1<<n)-1;i>=0;--i){
			if(i==k)continue;
			cout<<i<<' ';
		}
		cout<<k<<'\n';
	}
}


Measured memory_bytes: 1792
import sys


def solve(n, links, parents, costs):
    q = [n - 1]
    reachable = set()
    while q:
        v = q.pop()
        if v in reachable:
            continue
        reachable.add(v)
        q.extend(u for u in parents[v] if u not in reachable)

    INF = 10 ** 12
    dist = [INF] * n
    dist[0] = 0
    for _ in range(len(reachable)):
        updated = False
        for v in reachable:
            d = dist[v]
            if d == INF:
                continue
            cv = costs[v]
            for u in links[v]:
                if dist[u] == INF:
                    links[u] &= reachable
                if dist[u] > d + cv[u]:
                    dist[u] = d + cv[u]
                    updated = True
        if not updated:
            break
    else:
        return -1

    return max(0, -dist[n - 1])


n, m, p = list(map(int, input().split()))
INF = 10 ** 12
links = [set() for _ in range(n)]
parents = [set() for _ in range(n)]
costs = [[INF] * n for _ in range(n)]
for line in sys.stdin:
    a, b, c = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    parents[b].add(a)
    costs[a][b] = min(costs[a][b], p - c)

print(solve(n, links, parents, costs))


Measured memory_bytes: 99420
import java.util.BitSet;
import java.util.HashMap;
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        BitSet gdp = gdp(300000);
        while(true){
            int n = in.nextInt();
            if(n == 1) return;
            StringBuilder sb = new StringBuilder();
            sb.append(n+": ");
            for(int i=gdp.nextSetBit(0); i!=-1 && i<=n; i=gdp.nextSetBit(i+1)){
                if(n%i==0) sb.append(i+" ");
            }
            System.out.println(sb.toString().trim());
        }
    }
     
    public static BitSet gdp(int max){
        BitSet gdn = new BitSet(max+1);
        for(int i=1; i<=max; i++){
            int mod = i%7;
            if(mod == 6 || mod == 1) gdn.set(i);
        }
        BitSet gdp = (BitSet)gdn.clone();
        gdp.clear(1);
        for(int i=gdn.nextSetBit(2); i!=-1; i=gdn.nextSetBit(i+1)){
            for(long j=gdn.nextSetBit(2); j!=-1 && j*i<=max; j=gdn.nextSetBit((int)j+1)){
                gdp.clear((int)j*i);
            }
        }
        return gdp;
    }
}

Measured memory_bytes: 31572
import sys
# input = sys.stdin.buffer.readline
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

def main():
    N, M = map(int, input().split())
    nums = [-1] * N
    for i in range(M):
        s, c = map(int, input().split())
        s -= 1
        if s == 0 and c == 0 and N>1:
            print(-1)
            return
        elif nums[s] == -1:
            nums[s] = c
        elif nums[s] != c:
            print(-1)
            return
    if M == 0:
        if N==1:
            nums[0] = 0
        else:
            nums[0] = 1
    ans = ''
    for i in range(N):
        if nums[i] == -1:
            if i==0:
                ans += '1'
            else:
                ans += '0'
        else:
            ans += str(nums[i])
    print(ans)

main()

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


    
int main(int argc, const char * argv[]) {
    int N;
    cin >>N;
    vector<int> a(N);
    
    for(int i=0; i<N; ++i) cin >>a[i];
    
    int cou;
    
    cou=0;
    
    for (auto it = a.begin()+1; it != a.end(); ++it){
        if(*it==*(it-1)){
            ++cou;
            *it = 0;
        }
    }
    cout << cou <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	set<string> vis;
	int n;
	cin >> n;
	for (int i=0; i<n; i++) {
		string s;
		cin >> s;
		vis.insert(s);
	}
	cout << vis.size() << '\n';
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

i64 n, ans;
/*FUNCs=================================================*/
// enumerate divisor of N
std::vector<i64> divisor(i64 n){
    std::vector<i64> ret;
    for(i64 i = 1; i * i <= n; i++){
        if(n % i == 0){
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    cin >> n;
    /**
     * pm + p = N
     * なので
     * p(m+1) = N   (m>0, p < m+1
     * -> "Nの約数となる(m+1)の総和-約数の個数" を求める
     */

    vl divs = divisor(n);

    for(i32 i = 0; i < divs.size(); ++i) {
        i64 m = divs[i]-1;
        if(m==0) continue;
        if(n/m == n%m) ans += m;
    }

    cout << ans << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 384
import sys
raw_input = sys.stdin.readline
N,M = map(int,raw_input().split())
arr = []
for i in range(N):
    arr.append(list(raw_input()))
dp = [[0 for x in range(M)] for x in range(N)]
dp[0][0] = 1
mod = 1000000007
for i in range(N):
    for j in range(M):
        if arr[i][j]=='#':
            continue
        if i>0:
            dp[i][j] += dp[i-1][j]
        if j>0:
            dp[i][j] += dp[i][j-1]
        dp[i][j] %= mod
print dp[N-1][M-1]

Measured memory_bytes: 76700
n = int(input())
S = [input() for i in range(n)]
alp = [chr(i) for i in range(97, 97+26)]
cnt = [50] * 26
for s in S:
  for idx, a in enumerate(alp):
    tmp = s.count(a)
    cnt[idx] = min(cnt[idx], tmp)

ans = [si*cnt[ind] for ind, si in enumerate(alp)]
print(''.join(ans))

Measured memory_bytes: 3064
/*************************************************************************************
                         ---------------------------
                   ------Bismillahir-Rahmanir-Rahim------
                         ---------------------------
            //     //   Name: MD: NAZMUL HASAN              //     //
           //     //    Institute: HSTU                    //     //
          //     //     Dept.: CSE                        //     //
        //     //      Email: nazmulmoon123@gmail.com   //     //
    -----------------------------------------------------------------------
            ---------- I Love Programming as Gaming ----------
**************************************************************************************/
#include<bits/stdc++.h>
using namespace std;

#define loop(a,b,c)   for(int a=b;a<c;a++)
#define loopa(p,v)    for(auto p:(v))
#define lloop(a,b,c)  for(long long a=b;a<c;a++)
#define rloop(a,b,c)  for(int a=c-1;a>=b;a--)
#define rlloop(a,b,c) for(long long a=c-1;a>=b;a--)
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define EPS 1e-9
#define PI acos(-1)
#define rn PI/180
#define TC(t)         scanf("%d",&t);while(t--)
#define sf scanf
#define pf printf
#define SIZE 100001
#define sp ' '
#define nl printf("\n")
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define gcd(a,b) __gcd(a,b)

#define si(a) sf("%d",&a)
#define sl(a) sf("%I64d",&a)
#define sii(a,b) sf("%d%d",&a,&b)
#define Pi(a) pf("%d\n",a)
#define Pin(a) pf("%d ",a)
#define Pl(a) pf("%I64d\n",a)
#define pln(a) pf("%I64d ",a)
#define b_s(v,x) binary_search(v.begin(),v.end(),x)
#define l_b(v,x) lower_bound(v.begin(),v.end(),x)
#define u_b(v,x) upper_bound(v.begin(),v.end(),x)
#define e_r(v,x) equal_range(v.begin(),v.end(),x)
#define faster ios_base::sync_with_stdio(0);cin.tie(false);cout.tie(false);
#define case(x) cout<<"Case "<<x<<": "

/// ASCII Vlaue....
/// A=65,Z=90,a=97,z=122,0=48,9=57
///#define INT_MAX 2147483647
///#define INT_MIN -2147483647


const int MOD=1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef vector<ll>vl;
typedef vector<string> vs;
typedef stack<int> si;
typedef stack<string> ss;
typedef queue<int> qi;
typedef queue<string> qs;
typedef pair<int,int> pii;
typedef pair<string,int>psi;
typedef map<int,int>mii;
typedef map<string,int>msi;
int main()
{
    //faster
    int n,m,x;
    cin>>n>>m;
    x=m/n;
    for(int i=x;i>=1;i--)
    {
        if(m%i==0)
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int p;
string s;

bool is_digit(char ch){
    if ('0' <= ch && ch <= '9') {
        return true;
    }
    return false;
}

int dfs(){
    vector<int> v;
    while (p < s.size()) {
        if (is_digit(s[p])) {
            int res = 0;
            while (is_digit(s[p])) {
                res *= 10;
                res += s[p] - '0';
                p++;
            }
            v.push_back((res + 1) / 2);
        }else if (s[p] == '['){
            p++;
            v.push_back(dfs());
        }else if (s[p] == ']'){
            p++;
            int res = 0;
            int n = v.size();
            vector<int> a = v;
            sort(a.begin(), a.end());
            for (int i = 0; i <= n / 2; i++) {
                res += a[i];
            }
            return res;
        }
    }
    return 0;
}

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        p = 1;
        cout << dfs() << endl;
    }
    return 0;
}

Measured memory_bytes: 1288
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct {
  int num;
  int P;
  long long int Y;
  int y;
} bigint;

int cmp( const void *p, const void *q ) {
  return ((bigint*)p)->Y - ((bigint*)q)->Y;
}

int cmp2( const void *p, const void *q ) {
    return ((bigint*)p)->num - ((bigint*)q)->num;
}

void sixint(int N){
  int i;
  int k[6];
  for(i=5;i>=0;i--){
    k[i]=N%10;
    N=(int)N/10;
  }
  for(i=0;i<6;i++){
    printf("%d",k[i]);
  }
}

int main(){
  int N,M,i;
  scanf("%d%d",&N,&M);
  bigint X[M];
  int c_P[N+1];

  for(i=0;i<M;i++){
    scanf("%d%lld",&X[i].P,&X[i].Y);
    X[i].num=i;
  }
  
  qsort(X, M, sizeof(bigint), cmp);

  for(i=0;i<N+1;i++){
    c_P[i]=1;
  }

  for(i=0;i<M;i++){
    X[i].y = c_P[X[i].P];
    c_P[X[i].P]=c_P[X[i].P]+1;
  }
  
  qsort(X, M, sizeof(bigint), cmp2 );

  for(i=0;i<M;i++){
    sixint(X[i].P);
    sixint(X[i].y);
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 6492
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, A, B;
  string S;
  cin >> N >> A >> B >> S;
  int count = 0, coa = 0, cob = 0;
  for(char c: S){
    if(c == 'c'){
      cout << "No" << endl;
    } else {
      if(c == 'a'){
        if(coa + cob < A + B){
          coa++;
          cout << "Yes" << endl;
          continue;
        }
      } else {
        if(coa + cob < A + B && cob <= B - 1){
          cob++;
          cout << "Yes" << endl;
          continue;
        }
      }
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 896
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;
 
public class Main {
	public static void main(String[] args) throws IOException {
		MScanner sc = new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		char[]in=sc.nextLine().toCharArray();int c[]=new int[in.length];
		int i=0;
		while(i<in.length) {
			int k=0;int j=i-1;
			if(in[i]=='R') {
				while(in[i]=='R') {
					k++;i++;
				}
				c[i]+=k/2;
				c[i-1]+=(k-k/2);
			}
			else {
				while(i<in.length && in[i]=='L') {
					k++;i++;
				}
				c[j]+=k/2;
				c[j+1]+=(k-k/2);
			}
			
		}
		
		for(int j=0;j<in.length;j++)pw.print(c[j]+" ");
		pw.close();
		pw.flush();
 
	}
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 35796
#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;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 N;
  cin >> N;
  vector<int64> L(N);
  REP(i, N) cin >> L[i];
  int64 res = 0;
  sort(all(L));
  REP(i, N) {
    REP(j, N) {
      if (i == j) continue;
      int64 r = lower_bound(all(L), L[i]+L[j]) - L.begin(), l = upper_bound(all(L), abs(L[j]-L[i])) - L.begin();
      res += r-l - (l <= i && i < r) - (l <= j && j < r);
    }
  }
  cout << res/6 << endl;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int a[3];
	rep(i,3) scanf("%d",&a[i]);

	sort(a,a+3);

	puts(a[0]==5&&a[1]==5&&a[2]==7?"YES":"NO");

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  ll h, w;
  cin >> h >> w;
  if (h == 1 || w == 1) {
    cout << 1 << endl;
    return 0;
  }
  ll ans = (h * w) / 2;
  if ((h * w) % 2 == 1) {
    ans += 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define mod 1000000007
#define int long long int
int32_t main()
{
	int n,k;
	cin>>n>>k;
	int answer=0;
	int j;
	for(j=k;j<=n+1;j++)
	{
		int max=j*n-(j*(j-1))/2;
		int min=(j*(j-1))/2;
		answer=answer+(max-min+1);
		answer=answer%mod;
	}
	cout<<answer<<endl;
}


Measured memory_bytes: 3636
n = int(input())
v = list(map(int, input().split(" ")))

v1 = {}
v2 = {}
for i in range(n):
    if(i % 2 == 0):
        if((v[i] in v1) == True):
            v1[v[i]] += 1
        else:
            v1[v[i]] = 1
    else: 
        if((v[i] in v2) == True):
            v2[v[i]] += 1
        else:
            v2[v[i]] = 1

max_k1 = max(v1, key=v1.get)
max_k2 = max(v2, key=v2.get)

ans1 = 1e9
ans2 = 1e9
if(max_k1 == max_k2):
    tmp = v1[max_k1]
    v1[max_k1] = 0
    max_k1 = max(v1, key=v1.get)
    ans1 = n - v1[max_k1] - v2[max_k2]
    v1[max_k1] = tmp
    max_k1 = max(v1, key=v1.get)

    v2[max_k2] = 0
    max_k2 = max(v2, key=v2.get)
    ans2 = n - v1[max_k1] - v2[max_k2]
else: ans1 = n - v1[max_k1] - v2[max_k2]

print(min(ans1, ans2))

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

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var a = vals[0];
        var b = vals[1];

        for (int i = 1; i <= 1000; i++)
        {
            if ((int)(i * 0.08) == a && (int)(i * 0.1) == b)
            {
                Console.WriteLine(i);
                return;
            }
        }

        Console.WriteLine(-1);
    }
}

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

int main(){

    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    for(int i = 0; i < M; i++) cin >> B[i];
    vector<vector<int>> A(N, vector<int>(M));
    for(int i = 0; i < N; i++) for(int j = 0; j < M; j++) cin >> A[i][j];

    int ans = 0;
    for(int i = 0; i < N; i++){
        int sum = C;
        for(int j = 0; j < M; j++){
            sum += A[i][j] * B[j];
        }
        if(sum > 0) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
    int64_t n, b, as = 0, bs = 0, cnt = 0;
    cin >> n;
    vector<int64_t> a(n);
    for (auto i = 0; i < n; i++) {
        cin >> a[i];
        as += a[i];
    }
    for (auto i = 0; i < n; i++) {
        cin >> b;
        bs += b;
        if (a[i] >= b)
            cnt += a[i] - b;
        else
            cnt -= (b - a[i]) / 2;
    }
    if (cnt <= 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3692
n,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
a.sort()
a.append("9")
cnt=1
ans=[]
for i in range(0,n):
    if a[i]==a[i+1]:
        cnt+=1
    else:
        ans.append(cnt)
        cnt=1
ans.sort()
sum=0
for i in range(len(ans)-k):
    sum+=ans[i]
print(sum)

Measured memory_bytes: 89936
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;cin>>k;
    int c=0;
    for(int i=1;i<1000001;i++)
    {
        c=c*10+7;
        c%=k;
        if(c==0)
        {
            cout<<i<<endl;
            return 0;
        }

    }
    cout<<"-1"<<endl;
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AAccepted {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string s;
	    in >> s;
	    int res = 0;
	    for(int i=0; i<s.length(); i++){
	        if(s[i] == '1') res++;
	    }
	    out << res << endl;
	}
};


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


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

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

    vector<int> a(N);
    rep(i, N) cin >> a[i];

    int sum = 0;
    for (auto x : a)
        sum ^= x;

    for (auto x : a)
        cout << (x ^ sum) << endl;
}

Measured memory_bytes: 4032
def main():
    n, a, b, c, d = map(int, input().split())
    s = input()

    if solve(n, a, b, c, d, s):
        print('Yes')
    else:
        print('No')

def solve(n, a, b, c, d, s):
    if d > c:
        return all(s[i:i+2] != '##' for i in range(a - 1, d - 1))

    if not all(s[i:i+2] != '##' for i in range(a - 1, c - 1)):
        return False
    
    if not any(s[i:i+3] == '...' for i in range(b - 2, d - 1)):
        return False

    return True

main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    map<ll,ll> mp;
    rep1(x,100)rep1(y,100)rep1(z,100){
        ll buf=x*x+y*y+z*z+x*y+y*z+z*x;
        mp[buf]++;
    }
    rep1(i,n){
        cout<<mp[i]<<endl;
    }
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

ll N;
ll s[111];
bool dp[111][11111];
ll ans = 0;

int main() {
   ll sum = 0;
   cin >> N;
   rep (i, N) {
      cin >> s[i];
      sum += s[i];
   }

   dp[0][0] = true;
   rep (i, N) {
      for (int j = 0; j <= sum; j++) {
         dp[i+1][j] |= dp[i][j];
         if (j >= s[i]) {
            dp[i+1][j] |= dp[i][j-s[i]];
         }
      }
   }

   for (ll i = 0; i <= sum; i++) {
      // ans = max(ans, dp[N][i]);
      if (i % 10 == 0) continue;
      if (dp[N][i]) ans = max(ans, i);
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define int long long 
#define LL long long 
#define LD long double
#define PI 3.14159265358979323846
#define MOD ((LL)1e9+7)
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int32_t main()
{
	IOS
	string s;cin>>s;
	int c=0,mx=0;
	for(int i=0;i<(LL)s.length();i++)
	{
		if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T')
		{
			c++;mx=max(mx,c);
		}
		else c=0;
	}
	cout<<mx<<endl;
	
	

	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
#define pb push_back
typedef long long ll;
const ll INF = 1LL << 60;

int main()
{
    ll n,y;
    cin >> n >> y;
    rep(a,n+1){
        rep(b,n+1){
            int c = n-a-b;
            if(c<0){continue;}
            if(10000*a+5000*b+1000*c==y){
                cout << a << " " << b << " " << c;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1;
}

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

const ll mod = 1000000007;
int main() {
    int N;
    cin >> N;
    vector<P> D(N);
    rep(i,N){
        cin >> D[i].first >> D[i].second;
    }
    bool can = false;
    rep(i,N){
        if(D[i].first == D[i].second && D[i+1].first == D[i+1].second && D[i+2].first == D[i+2].second){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限
s = set(map(int,input().split()))
print(len(s))

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

int main()
{
	long long a,b,c,k;
	cin>>a>>b>>c>>k; //1 0 2 2
	
	if (a>=k)
	{
		cout<<k;
		return 0;
	}
	else if(a+b>=k)
	{
		cout<<a;
		return 0;
	}
	else if(a==0&&b>=k)
	{
		cout<<0;
		return 0;
	}
	else if(a==0&&b<k)
	{
		cout<<b-k;
		return 0;
	}
	else if(b==0&&a+c>=k)
	{
		cout<<2*a-k;
		return 0;
	}
	else cout<<2*a-k+b;
		
	return 0;
}

Measured memory_bytes: 3628
m, d = map(int, input().split())
ans = 0
for i in range(1, m + 1):
    for j in range(10, d + 1):  
        d1 = int(str(j)[1])
        d10 = int(str(j)[0])
        if d1 >= 2 and d10 >= 2 and d1 * d10 == i:
            ans += 1
print(ans)

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

Measured memory_bytes: 580
// AtCoder Beginner Contest 116 - Problem B: Collatz Problem (https://atcoder.jp/contests/abc116/tasks/abc116_b)
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2000010 };

bitset<MAX> found;

void solve(int S)
{
    found[S] = true;
    int m = 1;

    while (true)
    {
        S = S & 1 ? 3*S + 1 : S/2;
        ++m;

        if (found[S])
            break;

        found[S] = true; 
    }

    cout << m << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int S;
    cin >> S;

    solve(S);

    return 0;
}


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

int main()
{
	int R, G, B, N;
	scanf("%d%d%d%d", &R, &G, &B, &N);
	int count{};
	for (int i{}; i * R <= N; i++)
	{
		for (int j{}; i * R + j * G <= N; j++)
		{
			if ((N - i * R - j * G) % B == 0)
				count++;
		}
	}
	printf("%d\n", count);

	return 0;
}

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

int func(int n, int k){
    int y=0, i=0, z;
    while(n > 0){
        z = n%k;
        y += z*pow(10, i);
        n = n/k;
        i++;
    }
    return i;
}

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

    int n,k;
    cin >> n >> k;;
    int ans = func(n,k);
    
    cout << ans << "\n";


}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

void down_kaisou(int max_kaisou, queue<pair<int, char> > &que) {
    queue<pair<int, char> > temp;
    bool down;
    while (!que.empty()) {
        pair<int, char> inque = que.front();
        if (inque.first != -max_kaisou) {
            temp.push(inque);
            que.pop();
        } else {
            vector<int> v;
            int num = 0;
            down = false;
            while (!down) {
                pair<int, char> inque2 = que.front();
                if (inque2.first == -max_kaisou + 1) {
                    int p_que = 0;
                    sort(v.begin(), v.end());
                    for (int k = 0; k < num / 2 + 1; k++) {
                        p_que += v[k]; 
                    }
                    temp.push(make_pair(p_que, '0'));
                    temp.push(make_pair(-max_kaisou, ']'));
                    down = true;
                    break;
                }
                if (inque2.second == '0') {
                    v.push_back(inque2.first);
                    num++;
                }
                que.pop();
            }
        }
    }
    que = temp;
    return;
}

int main(void) {
    int n;
    int max_kaisou;
    cin >> n;
    for (int loop = 0; loop < n; loop++) {
        string s;
        cin >> s;
        max_kaisou = 0;
        queue<pair<int, char> > que;
        int kaisou = 0;
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] == '[') {
                kaisou++;
                if (max_kaisou < kaisou) {
                    max_kaisou = kaisou; 
                }
                que.push(make_pair(-kaisou, '[')); 
            } else if (s[i] == ']') {
                num /= 10;
                if (num != 0) {
                    num = num / 2 + 1;
                    que.push(make_pair(num, '0'));
                }
                num = 0;
                que.push(make_pair(-kaisou, ']')); 
                kaisou--;
            } else {
                num += s[i] - '0';    
                num *= 10;
            }
        }
        while (max_kaisou > 1) {
            down_kaisou(max_kaisou, que);
            max_kaisou--;
        }
        while (1) {
            pair<int, char> inque = que.front();
            if (inque.second == '0') {
                cout << que.front().first << endl;
                break;
            }
            que.pop();
        }
    }
    return 0;
}

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

int main() {
    string S;
    int K;
    int N = S.size();
    cin >> N >> K >> S;
    char t = S.at(K-1);
    if (t == 'A') {
       string D = S;
       D.at(K-1)='a';
        cout << D << endl;
    }
       if (t == 'B') {
       string D = S;
       D.at(K-1)='b';
        cout << D << endl;
    }
     if (t == 'C') {
       string D = S;
       D.at(K-1)='c';
        cout << D << endl;
    }
}

Measured memory_bytes: 256
#include<iostream> 
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=500010, inf=1e9;
int n;

template<typename T>
inline void read(T &k)
{
	int f=1; k=0; char c=getchar();
	while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar();
	while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
	k*=f;
}

inline int solve(int x)
{
	int ans=0;
	while(x) ans+=x%10, x/=10;
	return ans;
}

int main()
{
	read(n); int ans=inf;
	for(int i=1;i<n;i++) ans=min(ans, solve(i)+solve(n-i)); 
	printf("%d\n", ans);
}

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

int main(){
	while(1){
		int n, p;
		cin >> n >> p;
		if(n + p == 0) break;
		int d[51] = {};
		int now = p;
		int t = 0;
		int ans = -1;
		for(int i = 0;; i++){
			t = i % n;
			if(now >= 1){
				now--;
				d[t]++;
			}else if(now == 0){
				now = d[t];
				d[t] = 0;
			}
			if(d[t] == p){
				ans = t;
				break;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)a;i<=(sign)b;++i)
#define Fordown(i,a,b) for(register sign i=(sign)a;i>=(sign)b;--i)
bool cmax(sign &a,sign b){return (a<b)?a=b,1:0;}
bool cmin(sign &a,sign b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
  T ans=0,f=1;
  char ch=getchar();
  while(!isdigit(ch)&&ch!='-')ch=getchar();
  if(ch=='-')f=-1,ch=getchar();
  while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
  return ans*f;
}
template<typename T>void write(T x,char y)
{
  if(x==0)
  {
      putchar('0');putchar(y);
      return;
  }
  if(x<0)
  {
      putchar('-');
      x=-x;
  }
  static char wr[20];
  int top=0;
  for(;x;x/=10)wr[++top]=x%10+'0';
  while(top)putchar(wr[top--]);
  putchar(y);
}
void file()
{
  #ifndef ONLINE_JUDGE
      freopen("c.in","r",stdin);
      freopen("c.out","w",stdout);
  #endif
}
const int N=1e5+5;
int n,a[N];
ll sum[N];
void input()
{
	n=read<int>();
	For(i,1,n)a[i]=read<int>();
}
void work()
{
	ll ans,res=0;
	For(i,1,n+1)res+=abs(a[i]-a[i-1]);
	For(i,1,n)
	{
		ans=res-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]);
		write(ans,'\n');
	}
}
int main()
{

	input();
	work();
	return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
int main(void)
{
   int n, d, x, i, y=0, e, s=0;
   int a[101];

   scanf("%d%d%d",&n,&d,&x);

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

   for(i=0;i<n;i++){
        e=0;
        y=0;
      while(y<=d){
        e++;
        y=e*a[i]+1;
      }

      s=s+e;
    }

    printf("\n%d\n",x+s);

    return 0;
    }


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC098A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, c, d, f, g;
            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            c = A + B; d = A - B; f = A * B;
            if (c >= d)
            {
                if (c >= f) { g = c; }
                else { g = f; }
            }
            else if (d >= c)
            {
                if (d >= f) { g = d; }
                else { g = f; }
            }
            else { g = f; }
            Console.WriteLine(g);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1

bool Isprime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    for (int i = 3; i*i <= num; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int main() {
  int jd1=1;
  int jd2;
  int countjd=0;
  vector<lli> judge(100030);
  rep2(i,1, 50010){
    
  if(Isprime(i)&&Isprime(2*i-1)){
    jd2=2*i-1
      
    rep2(j, jd1, jd2){
    judge[j]=countjd;
    }
    jd1=jd2;
    countjd++;
  }
  }
  rep2(i, jd1, 100030)
    judge[i]=countjd;
  int Q;
  cin>>Q;
  rep(i, Q){
  int s, e;
    cin >> s>> e;
    cout<<judge[e]-judge[s-1] << endl;
  }
  
}


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

#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int  long long

int32_t main()
{
    IOS
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
    {
    	if(s[i] >= 'A' && s[i] <= 'Z') cout << "A";
    	else cout << "a";
    }
    return 0;
}

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

typedef long long LL;
const int MAXN = 8;
struct Node
{
    int x, y;
}a[MAXN];
bool cmp(Node A, Node B) {
    return A.y > B.y;
}
int main() {
    for(int i=0; i<5; i++) {
        cin>>a[i].x;
        a[i].y=a[i].x%10;
        if(a[i].y) a[i].y=10-a[i].y;
    }
    sort(a, a+5, cmp);
    int ans = a[0].x;
    for(int i=1; i<5; i++) {
        if(a[i].y) {
            ans+=(a[i].x/10+1)*10;
        }
        else ans+=a[i].x;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

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

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

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

signed main() {
    //宣言
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i < n + 1; ++i) {
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

int main()
{ 
    fast;

    ll n;
    cin>>n;

    ll a[n],b[n],c[n-1],sum=0;

    for(ll i=0;i<n;i++)
    	{cin>>a[i];
    		a[i]--;}

    for(ll i=0;i<n;i++)
    	{cin>>b[i];
    		sum+=b[i];
    	}
    	
    	for(ll i=0;i<n-1;i++) 
    		cin>>c[i];
    
    for(ll i=1;i<n;i++)
    {
    	if(a[i]-a[i-1]==1)
    		sum+=c[a[i-1]];
    }
    cout<<sum<<endl;
 
}


Measured memory_bytes: 256
S['= r'],m[4]['= r'],z,d[4]={0,-2},k,i;f(i){m[k][i]=S[i]+47?0:m[k][i]?:1+f(d[k]-~i);}main(t){for(scanf("%*d%d",d);S[++i-~*d]=~getchar();d[2]=-*d-2);for(;k--?:(z=fmax(z,-t),t=k=3,--i);)t-=f(i-~*d);printf("%d",z);}

Measured memory_bytes: 78464
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    ll x[1010]={};
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    rep2(i,a,b) x[i]++;
    rep2(i,c,d) x[i]++;
    ll ans=0;
    rep(i,100){
        if(x[i]>1) ans++;
    }
    cout<<ans<<endl;
    

    

}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){

        solve();

    }
   


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int dp[10010]={inf};
int main(){
    int h,n;
    cin>>h>>n;
    rep(i,10010) dp[i]=inf;
    dp[0]=0;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        rep(j,h+1){
            int nj = min(h,j+a);
            dp[nj]=min(dp[nj],dp[j]+b);
        }
    }
    cout<<dp[h]<<endl;
    return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int K, A, B;
	cin >> K >> A >> B;
	
	if ((A + K - 1) / K * K > B) cout << "NG\n";
	else cout << "OK\n";
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>

using namespace std;
int find(int n){
    int nine = 9;
    int six = 6;
    while(true){
        if(n>=nine){
            nine *= 9;
        }else{
            break;
        }
    }
    while(true){
        if(n>=six){
            six *= 6;
        }else{
            break;
        }
    }
    if(n==0)return 0;
    if(n<6)return n;
    return 1 + min(find(n - six/6),find(n - nine/9));
}
int main(){
    int n;
    cin >> n;
    cout << find(n) << endl;
    return 0;
}

Measured memory_bytes: 256
n, z, w = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    print(abs(a[-1] - w))
    exit()

# Xが最後の1枚をとるとき
ans = abs(a[-1] - w)

# Yが最後の1枚をとるとき
ans = max(ans, abs(a[-1] - a[-2]))

print(ans)

Measured memory_bytes: 3188