akhauriyash/Code-Regression huggingface dataset:
K = int(input())
A = "0123456789"
S = []
def f(n):
    global A,S
    if len(n)>10:return
    if n[-1]=="0":
        D=(n+"0",n+"1")
    elif n[-1]=="9":
        D=(n+"9",n+"8")
    else:
        a = A.index(n[-1])
        D=(n+A[a],n+A[a-1],n+A[a+1])
    for d in D:
        S.append(int(d))
        f(d)

for i in range(1,10):
    S.append(i)
    f(str(i))
S.sort()
print(S[K-1])

Measured memory_bytes: 28184
toInt :: (String -> Int)
toInt x = read x ::Int

main :: IO ()
main = do
  n <- getLine
  s <- getLine
  k <- getLine
  let put_str = (s !! ((toInt k)-1))
      after = map (\x -> if x /= put_str then '*' else x) s
  putStrLn after


Measured memory_bytes: 508
/*****************
 *   I<3   C++   *
 *  IWANT ANYAC  *
 * ILOVEPROGRAM! *
 *IT'SINTERESTING*
 * ILOVEPROGRAM! *
 *  INCONTESTS   *
 *   GETSCORE    *
 *    ACCODE     *
 *     LETS      *
 *      GO       *
 *****************/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define LL long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define FILL(a,v) memset((void*)a,v,sizeof(a))
#define FILL0(a) FILL(a,0)
#define FILL1(a) FILL(a,-1)
#define ALL(a) (a).begin(),(a).end()
#define Inf 1e9
#define Mod 1000000007
#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define FOR(i,x) for(int i=0;i<x;i++)
#define RFOR(i,x) for(int i=x-1;i>=0;i--)
#define FFOR(i,a,b) for(int i=a;i<b;i++)
#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second
#define OVER(a) return puts(a),0
#define fastio ios::sync_with_stdio(0)
#define filei(f) freopen(f,"r",stdin)
#define fileo(f) freopen(f,"w",stdout)
#define MASK(a) (1<<(a))
#define MASKX(x,a) ((x)<<(a))
#define BIT(a,b) ((a>>b)&1)
using namespace std;
typedef pair<int,int> pii;
typedef unsigned long long UINT;
typedef unsigned int Uint;
typedef long long INT;
typedef pair<INT,INT> PII;
typedef stringstream sst;
typedef istringstream iss;
typedef vector<int> vint;
typedef vector<INT> VINT;
typedef vector<pii> vpii;
typedef vector<PII> VPII;
typedef priority_queue<int> pqi;
typedef priority_queue<INT> PQI;
typedef priority_queue<pii> pqp;
typedef priority_queue<PII> PQP;
typedef priority_queue<int,vint,greater<int> > xqi;
typedef priority_queue<INT,VINT,greater<INT> > XQI;
typedef priority_queue<pii,vpii,greater<pii> > xqp;
typedef priority_queue<PII,VPII,greater<PII> > XQP;

int n;
int d[100007];
vector<int> nei[100007];
int ceng[100007],shang[100007];

int cal_d(int la,int wh)
{
	int cnt=1;
	for(int i=0;i<SZ(nei[wh]);i++)
		if(nei[wh][i]!=la)
		{
			ceng[nei[wh][i]]=ceng[wh]+1;
			shang[nei[wh][i]]=wh;
			cnt+=cal_d(wh,nei[wh][i]);
		}
	d[wh]=cnt;
	return cnt;
}

int a,b;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n-1;i++)
	{
		scanf("%d%d",&a,&b);
		a--,b--;
		nei[a].push_back(b);
		nei[b].push_back(a);
	}
	cal_d(-1,0);
	int d4o=n-1;
	string mark;
	int guessed=(ceng[n-1]-1)/2;
	while(guessed--)d4o=shang[d4o];
	if(d[d4o]>=n-d[d4o])mark="Snuke";
	else mark="Fennec";
	cout<<mark<<endl;
	return 0;
}

Measured memory_bytes: 14720
#include<bits/stdc++.h>
using namespace std;
int d;
long long a;
char s[200010];
int main(){
	gets(s);
	bool flag=false;//标记 为false 
	for(int i=0;i<strlen(s);i++){
	 	if(flag) {//如果这个被处理过了，跳过循环 
	 		flag=false;
	 		continue;
	 	}
	 	if(s[i]=='A') d++;//标记A 
	 	if(s[i]=='B') {//标记B 
	 		if(i+1<strlen(s))//将下一个标记掉 
	 			flag=true;
	 		if(s[i+1]=='C'){
	 			a+=d;//相加 
	 			continue;//跳过循环 
	 		}
	 		else{
				if(s[i+1]=='A') d=1;
				else d=0;//清零 
			}
		}
		if(s[i]=='C') d=0;
	}
	printf("%lld",a);//输出 
	return 0;
}

Measured memory_bytes: 384
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
#show_flg=True

ans=0
an=[]
n=I()
st=-1
s=list(input())
can=[]
for d in range(1,n):
    cnt=0
    for i in range(n-d):
        if s[i]==s[i+d] and st+cnt+1<=st+d:
            if st==-1:
                st=i
            #show('d,i,s[i],st,cnt,an',d,i,s[i],st,cnt,an)
            cnt+=1
            #an+=s[i]
            ans=max(ans,cnt)
        else:
            #show('d,i,s[i],st,cnt,an',d,i,s[i],st,cnt,an,'els')
            cnt=0
            #can+=[an]
            #an=[]
            st=-1
    cnt=0
print(ans)
#show(can)

Measured memory_bytes: 44276
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll x; in(x);
  for (ll a=-1000; a<=1000; a++) {
    for (ll b=-1000; b<=1000; b++) {
      if (a*a*a*a*a - b*b*b*b*b == x) {
        print(a, " ");
        print(b, "");
        return 0;
      }
    }
  }
  assert(false);
  return 0;
}


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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
#define int long long
//#define double long double

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

    int a, b, n;
    cin >> a >> b >> n;
    cout << a * min(n, (b - 1)) / b - a * (min(n, (b - 1)) / b) << '\n';

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***

//      ***** ***** *   * *     ***** *   * ***** *****
//        *  *   * *   * *       *   **  *   *   *   *
//       *  *   * ***** *       *   * * *   *   *****
//   *  *  *   *   *   *       *   *  **   *   *
//  ****  *****   *   ***** ***** *   *   *   *


Measured memory_bytes: 3652
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll n, wx;
vector<ll> w, v;
vector<vector<ll>> dp;
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> wx;
    w.assign(n, 0);
    v.assign(n, 0);
    F0R(i, n)
    {
        cin >> w[i];
        cin >> v[i];
    }
    dp.assign(n + 1, vector<ll>(wx + 1, 0));
    dp[0][0] = 0;
    FOR(i, 1, n + 1)
    {
        F0R(j, wx + 1)
        {
            dp[i][j] = dp[i - 1][j];
            if(j - w[i - 1] >= 0) dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
        }
    }
    cout << dp[n][wx];
    return 0;
}

Measured memory_bytes: 80256
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections

N = int(sys.stdin.readline())
a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param

#print(a)
di = 10**9+7
cum = [0]*(N+1)
for i in range(N)[::-1]:
    cum[i] = (cum[i+1] + a[i])%di

s = 0
for i in range(N):
    s = (s + (a[i]*cum[i+1])%di)%di
    # for j in range(i+1,N):
    #     #print(a[i],a[j])
    #     s = (s + (a[i]*a[j])%di)%di
print(s)

# import sys,collections
# sys.setrecursionlimit(1000000)
# INF = float("inf")

# Q = int(sys.stdin.readline())
# ab = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(Q)) # multi line with multi param
# N = 1000001

# cum=[0]*(N+1)

# for l,r in ab:
#     cum[l] += 1
#     if r+1 < N+1: cum[r+1] -= 1

# ret = cum[0]
# for i in range(N):
#     cum[i+1] += cum[i]
#     ret = max(ret,cum[i+1])

# print(ret)


Measured memory_bytes: 33588
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

ll gauss(ll a, ll b) {
	ll r = abs(a) / abs(b);
	if (a%b == 0) { return r; }
	if (a > 0 && b > 0) { return r; }
	if (a > 0 & b < 0) { return -r - 1; }
	if (a < 0 && b>0) { return -r - 1; }
	if (a < 0 && b < 0) { return r; }
}

ll ceil(ll a, ll b) {
	if (a%b == 0) { return gauss(a, b); }
	else { return gauss(a, b) + 1; }
}



///////////////////////////

ll N, K;

vector<long double> A;

ll ch(ll x) {//x以下のものの個数

	ll ret = 0;

	auto st = ++A.begin();

	rep(i, N - 1) {
		if (A[i] > 0) {
			auto itr = upper_bound(st, A.end(), x / A[i]);
			ret += distance(st, itr);
		}

		if (A[i] < 0) {
			auto itr = lower_bound(st, A.end(), x / A[i]);
			ret += distance(itr, A.end());
		}

		if (A[i] == 0) {
			if (x >= 0) { ret += N - i - 1; }
		}

		++st;

		//cout << ret << " ";
	}

	return ret;
}


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

	repn(i, N) {
		ll a;
		cin >> a;
		A.push_back(a);
	}

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

	//rep(i, N) cout << A[i] << " ";
	//cout << endl;

	ll le = -1e18 - 1;
	ll ri = 1e18 + 1;

	while (ri - le > 1) {
		ll m = (le + ri) / 2;

		ll C = ch(m);

		//cout << m << " " << C << endl;

		if (C < K) { le = m; }
		else { ri = m; }

	}

	cout << ri;



	system("PAUSE");

}


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

int main() {
   int n;
   cin >> n;
   vector<int> ans(n);

   for (int i=1;i<=100;++i){
       for (int j=1;j<=100;++j){
           for (int k=1;k<=100;++k){
               int l=i*i+j*j+k*k+i*j+j*k+i*k;
               if (l<=n){
                ans[l-1]++;
               }
               }
           }
       }
   for(int i=0;i<n;++i){
       cout << ans[i] << endl;
   }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
//#include "local_debug.h"
using namespace std;
#define endl endl
#define debug(x) cout << #x << " = " << (x) << endl
typedef long long ll;
const int mod = (int)1e9 + 7;
const int maxn = (int)2e5 + 5;
ll n, m, t, a[maxn];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n)
		cout << n*n*n << endl;
}

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

int char_to_int(char c){
    int ret;
    switch (c){
        case 'a':
            ret = 0;
            break;
        case 'b':
            ret = 1;
            break;
        case 'c':
            ret = 2;
            break;
        case 'd':
            ret = 3;
            break;
        case 'e':
            ret = 4;
            break;
        case 'f':
            ret = 5;
            break;
        case 'g':
            ret = 6;
            break;
        case 'h':
            ret = 7;
            break;
        case 'i':
            ret = 8;
            break;
        case 'j':
            ret = 9;
            break;
        case 'k':
            ret = 10;
            break;
        case 'l':
            ret = 11;
            break;
        case 'm':
            ret = 12;
            break;
        case 'n':
            ret = 13;
            break;
        case 'o':
            ret = 14;
            break;
        case 'p':
            ret = 15;
            break;
        case 'q':
            ret = 16;
            break;
        case 'r':
            ret = 17;
            break;
        case 's':
            ret = 18;
            break;
        case 't':
            ret = 19;
            break;
        case 'u':
            ret = 20;
            break;
        case 'v':
            ret = 21;
            break;
        case 'w':
            ret = 22;
            break;
        case 'x':
            ret = 23;
            break;
        case 'y':
            ret = 24;
            break;
        case 'z':
            ret = 25;
            break;
        default:
            ret = -1;
            break;
        }
    return ret;
}

int main() {
    string S;
    string T;
    cin >> S >> T;


    int replace[26];
    for (int i = 0; i < 26; i++){
        replace[i] = -1;
    }

    int countS[26] = {};
    int countT[26] = {};

    for (int i = 0; i < S.size(); i++){
        countS[char_to_int(S[i])]++;
    }
    for (int i = 0; i < T.size(); i++){
        countT[char_to_int(T[i])]++;
    }
    sort(countS, countS + 26);
    sort(countT, countT + 26);
    for (int i = 0; i < 26; i++){
        if (countS[i] != countT[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

using namespace std;

int main(){
    int a,b;
    while(true){
        cin >> a >> b;
        if(a == 0 && b==0) break;
        if(a > b) swap(a,b);
        cout << a << " " << b << "\n";
        
    }
    
    return 0;
}


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

signed main(){

  int h,w;
  std::cin>>h>>w;
  std::vector<std::string> s(h);
  for(auto& si:s)std::cin>>si;

  auto grid_bfs = [&](int sy,int sx){
    using T3 = std::tuple<int,int,int>;
    auto chmin = [](auto& a,auto b){if(a>b){a=b;return true;}return false;};
    constexpr int inf = 1<<29;
    constexpr int dx[] = {0,0,1,-1,1,-1,1,-1};
    constexpr int dy[] = {1,-1,0,0,1,-1,-1,1};
    std::queue<T3> que;
    que.emplace(sy,sx,0);
    auto dist = std::vector<std::vector<int>>(h,std::vector<int>(w,inf));
    while(!que.empty()){
      int y,x,c;
      std::tie(y,x,c) = que.front();
      que.pop();
      if(chmin(dist[y][x],c)){
        for(int i=0;i<4;++i){
          int ny=y+dy[i];
          int nx=x+dx[i];
          if(ny==-1||nx==-1)continue;
          if(ny==h||nx==w)continue;     //
          if(s[ny][nx]!='.')continue;   //
          que.emplace(ny,nx,c+1);
        }
      }
    }
    return dist;
  };

  int ans = 0;
  auto chmax = [](auto& a,auto b){if(a<b)a=b;};
  for(int i=0;i<h;++i)for(int j=0;j<w;++j){
    if(s[i][j]=='#')continue;
    auto dist = grid_bfs(i,j);
    for(auto& di:dist)for(auto dij:di)if(dij<h*h*w*w)chmax(ans,dij);
  }
  std::cout<<(ans)<<std::endl;

}

Measured memory_bytes: 256
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

dis = abs(a-b)

if dis == 0:
    print('YES')
    exit()

if w > v:
    print('NO')
    exit()

if dis <= t*(v-w):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 61912
#!/usr/bin/env python3
import itertools

n, m, q = list(map(int, input().split()))

a = []
b = []
c = []
d = []
for i in range(q):
    a_, b_, c_, d_ = list(map(int, input().split()))
    a.append(a_)
    b.append(b_)
    c.append(c_)
    d.append(d_)

ans = 0
for seq in itertools.combinations_with_replacement(range(1, m+1), n):
    ans_tmp = 0
    for i in range(q):
        if seq[b[i]-1]-seq[a[i]-1] == c[i]:
            ans_tmp += d[i]
    ans = max(ans, ans_tmp)
print(ans)


Measured memory_bytes: 9148
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int M = scanner.nextInt();
        int[] a = new int[A];
        for(int x =0;x<A;x++){
            a[x] = scanner.nextInt();
        }
        int[] b = new int[B];
        for(int x =0;x<B;x++){
            b[x] = scanner.nextInt();
        }
        int x[] = new int[M];
        int y[] = new int[M];
        int c[] = new int[M];
        for(int X =0;X<M;X++){
            x[X] = scanner.nextInt();
            y[X] = scanner.nextInt();
            c[X] = scanner.nextInt();
        }

        int rawCostD = 999999999;

        for(int z =0; z<M; z++){
            rawCostD = Math.min(rawCostD,a[x[z]-1]+b[y[z]-1]-c[z]);
        }
            Arrays.sort(a);
        Arrays.sort(b);
        System.out.println(Math.min(a[0]+b[0], rawCostD));
    }

}


Measured memory_bytes: 136336
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>

constexpr int MAX = 220000;
constexpr int INF = 2000000000;    

struct SegTree {
    int N, dat[2*300000];
    SegTree() {}
    SegTree(int n) {
        N = 1;
        while(N < n) N *= 2;
        for(int i = 0; i < 2 * N - 1; ++i)
            dat[i] = INF;
    }
    SegTree(const SegTree&) = default;
    SegTree(SegTree&&) = default;
    SegTree& operator = (const SegTree&) = default;
    SegTree& operator = (SegTree&&) = default;
    
    void update(int k, int a) {
        k += N-1; // leaf
        dat[k] = a;
        while(k > 0) {
            k = (k - 1) / 2;
            dat[k] = std::min(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }

    int query(int a, int b) { return query(a, b, 0, 0, N); }
    int query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b) return dat[k];
        int m = (l + r) / 2;
        return std::min(query(a, b, 2 * k + 1, l, m), query(a, b, 2 * k + 2, m, r));
    }
};

int n;
int arr[MAX + 10];
int lidx[MAX + 10], ridx[MAX + 10];

int main() {
    SegTree tree1(MAX), tree2(MAX);
    std::cin >> n;
    
    for(int i = 0; i < n; ++i) {
        std::cin >> arr[i];
    }
    
    for(int i = 0; i < n; ++i) {
        auto it = tree1.query(0, arr[i]);
        
        int idx;
        if(it == INF) {
            idx = 0;
        }else {
            idx = -it + 1;
        }
        
        lidx[i] = idx;
        tree1.update(arr[i], -i);
    }
    
    for(int i = n - 1; i >= 0; --i) {
        auto it = tree2.query(0, arr[i]);
        
        int idx;
        if(it == INF) {
            idx = n - 1;
        }else {
            idx = it - 1;
        }
        
        ridx[i] = idx;
        tree2.update(arr[i], i);
    }
    
    long long sum = 0;
    for(int i = 0; i < n; ++i) {
        sum += arr[i] * 1ll  * (i - lidx[i] + 1) * (ridx[i] - i + 1);
    }
    
    std::cout << sum << std::endl;
}

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

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

void solve(long long N){
  ll res = 0;
  repr(i,1,N+1){
    if (i % 2 == 0) continue;
    ll c = 0;
    repr(j, 1, i + 1) if (i % j == 0)++ c;
    if (c == 8) ++res;
  }
  cout << res << endl;
}

int main() {
long long N;
    scanf("%lld",&N);
  solve(N);
}


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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

// template ends here

bool pos(ll t, vector<ll> &p, vector<ll> &q, ll K){
	for(ll i = 0; i <= t; i++){
		ll j = t-i;
		if(i >= (ll)p.size() || j >= (ll)q.size()) continue;
		if(p[i]+q[j] <= K) return true;
	}
	return false;
}

void solve(){
	// code starts from here
	ll N, M,K;
	cin >> N >> M >> K;
	vector<ll> a(N), b(M), c;
	input(a,N);
	input(b,M);
	
	vector<ll> p(N+1,0), q(M+1,0);
	
	for(int i = 0; i < N; i++){
		p[i+1] = a[i]+ p[i];
	}
	for(int i = 0; i < M; i++){
		q[i+1] = b[i] + q[i];
	}
	
	ll low = 0, high = N+M;
	ll mid;
	ll ans = 0;
	while(low <= high){
		mid = (low+high)/2;
		
		if(pos(mid,p,q,K)){
			ans = mid;
			low = mid+1;
		}
		else high = mid-1;
	}
	cout << ans << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


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

int main(){
  int N,max;
  int sum=0;
  cin >> N;
  vector<int> vec(N);
  for (int i=0;N>i;++i)
  {
    cin >> vec[i];
    sum += vec[i];
  }
  max = *max_element(vec.begin(),vec.end());
  string res =((sum-max) > max)? "Yes" : "No";
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000007
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n,q; string s;
vector<P>vec;
ll dp[3005][3005],C[3005][3005];
int main(){
    C[0][0]=1;
    for(int i=1;i<3005;i++)for(int j=0;j<=i;j++){
        if(j==0||j==i)C[i][j]=1LL;
        else C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
    }//cout<<C[3000][1500]<<endl;
	cin>>n>>q>>s;
	rep(i,q){
		int a,b;cin>>a>>b;a--;b--;
		if(vec.empty() || vec[vec.size()-1].sc<b){
			if(!vec.empty() && vec[vec.size()-1].fi == a){
				vec.pop_back();
			}
			vec.pb(mp(a,b));//cout<<vec[vec.size()-1].fi<<vec[vec.size()-1].sc<<endl;
		}
	}
	dp[0][0] =1LL;
	int sum = 0,nxt2 = 0;
	int S=0,T=0;
	rep(i,vec.size()){
		int nxt = (i==vec.size()-1?vec[i].sc+1:min(vec[i].sc+1,vec[i+1].fi));
		//[vec[i].fi,nxt) wo kettei
		for(int ii=max(nxt2,vec[i].fi);ii<vec[i].sc+1;ii++){
			if(s[ii]=='0')S++;else T++;
		}//cout<<S<<T;
		for(int ii=0;ii<=sum;ii++){
			if(dp[ii][sum-ii]==0LL)continue;//cout<<ii;
			int zan = S-ii,zan2 = T-(sum-ii); 
			for(int x=0;x<=nxt-vec[i].fi;x++){
				if(x>zan||(nxt-vec[i].fi-x)>zan2) continue;//cout<<x;
				dp[ii+x][sum-ii+(nxt-vec[i].fi-x)] += dp[ii][sum-ii]*C[nxt-vec[i].fi][x]%mod;
				while(dp[ii+x][sum-ii+(nxt-vec[i].fi-x)]>=mod) dp[ii+x][sum-ii+(nxt-vec[i].fi-x)]-=mod;
			}
		}
		sum += nxt-vec[i].fi; nxt2 = vec[i].sc+1;//cout<<S<<T<<dp[S][T];
	}
	ll ret = 0;
	rep(i,S+T+1) ret=(ret+dp[i][S+T-i])%mod; cout<<ret<<endl;
}

Measured memory_bytes: 107136
#include<iostream>
using namespace std;
  
int Merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  int L[n1+1],R[n2+1];
    
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=1000000000;
  R[n2]=1000000000;
    
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
    }
  }
  return right-left;
}
  
int Merge_Sort(int A[],int left,int right){
  int mid,res=0;
  if(left+1<right){
    mid=(left+right)/2;
  
    res+=Merge_Sort(A,left,mid);
    res+=Merge_Sort(A,mid,right);
    res+=Merge(A,left,mid,right);
      
  }
  return res;
}
  
int main(){
  int i,x,n,S[500000]; 
  cin>>n;
  for(i=0;i<n;i++)cin>>S[i];
  
  x=Merge_Sort(S,0,n);
    
  for(i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<S[i];
  }
  cout<<endl;
  cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 6992
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a[1010],b[1010];
int main()
{
   int n,h,w;
   int sum=0;
   cin>>n>>h>>w;
   for(int i=1;i<=n;i++)
   {
       scanf("%d%d",&a[i],&b[i]);
   }
   for(int i=1;i<=n;i++)
   {
       int k=min(a[i]/h,b[i]/w);
       sum+=k;
   }
   cout<<sum;
    return 0;
}


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

const int INF = 1e9 + 5;
int main() {
	int n, k; cin >> n >> k;
	vector < int > h(n);
	for(int i = 0; i < n; ++i) cin >> h[i];
	vector < int > dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i < n; ++i) {
		for(int j  = i + 1; j <= i + k; ++j) {
			if(j < n)
				dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
		}
	}

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

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

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)round(x))<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

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

  int n, m;

  while (cin >> n >> m) {
    int t[n];
    for (int i = 0; i < n; i++) {
      cin >> t[i];
    }
    sort(t, t + n);

    int ans = 0;
    
    for (int i = 0; m > 0 && i < n; i++) {
      if ((i == n - 1 && t[i] == m) || (i != n - 1 && m >= t[i])) {
        m -= t[i];
        ans++;
      } else {
        break;
      }
    }

    cout << ans << endl;
  }
}


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

int main(void){
  int N,T;
  std::cin >> N >> T;

  int max_cost = 100000000;
  for(int i=0;i<N;i++){
    int c,t;
    std::cin >> c >> t;
    if(t <= T){
      max_cost = std::min(max_cost,c);
    }
  }

  if(max_cost > 1001){
    std::cout << "TLE" << std::endl;
  }else{
    std::cout << max_cost << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    map< string, int > M;

    int max_val = 0;
    for(int i=0; i<N; i++) {
        string s; cin >> s;
        M[s]++;
        max_val = max(max_val, M[s]);
    }

    vector<string> ans;
    for(auto &e : M) {
        if(e.second != max_val) continue;
        ans.emplace_back(e.first);
    }

    for(auto &e : ans) cout << e << endl;
    return 0;
}


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

using namespace std;

int main(){
	int N, M; cin >> N >> M;
	int a, b;
	int ans[N] = {};
	for(int i = 0; i < M; ++i){
		cin >> a >> b;
		ans[a-1]++;
		ans[b-1]++;
	}
	for(int i = 0; i < N; ++i) cout << ans[i] << endl;
}

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

int main() {
    char a[1000];
    scanf("%s\n",&a);
    int f[512]; memset(f,0,sizeof(f));
    for(int i=0; i<strlen(a); ++i) f[a[i]]++;
    int d=1;
    for(int i=0; i<512; ++i) if(f[i]>1) d=0;
    if(d) printf("yes"); else printf("no");
    return 0;
}

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

using namespace std;
#define rep(n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end()
typedef long long ll;

int main () {
    vector<int> a(5);
    rep(5) {
        cin >> a[i];
    }

    int ans;
    for (int i = 0; i < 5; i++) {
        if(i+1 != a[i]) {
            ans = i + 1;
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n;
ll a[200005];
int main() {
  cin >> n;
  for(int i = 1; i <= n; i++) {
    ll A;
    cin >> A;
    a[i] = A - i;
    //cout << a[i] << endl;
  }
  sort(a+1,a+n+1);
  ll s[3] = {a[n / 2 - 1],a[n / 2],a[n / 2 + 1]};
  ll ans = 1e14;
 
  for(int i = 0; i < 3; i++) {
    ll cur = 0;
    for(int j = 1; j <= n; j++) {
      cur += abs(s[i] - a[j]);
    }
    //  cout << cur << endl;
    ans = min(ans,cur);
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
N = int(input())
rabbits_str = input()

rabbits_prefs = rabbits_str.split()

rabbits = {}
for i in range(1, N + 1):
    rabbits[i] = int(rabbits_prefs[i-1])

##print(rabbits)

num_pairs = 0
for r in rabbits:
    curr_pref = rabbits[r]
    other_pref = rabbits[curr_pref]

##    print('curr_pref: {}'.format(curr_pref))
##    print('other_pref: {}'.format(other_pref))
##    print()
    if other_pref == r:
        num_pairs += 1

print(num_pairs // 2)


Measured memory_bytes: 25600
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }

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

    vector<long long> cnt(1, 1);
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == s[i]) {
            cnt[cnt.size() - 1]++;
        } else {
            cnt.push_back(1);
        }
    }

    long long sum = 0;
    for (int i = 0; i < static_cast<int>(cnt.size()); i++) {
        sum += cnt[i] * (cnt[i] - 1) / 2;
    }

    cout << sum << endl;
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define MOD 1000000007
int c =1;
ll solve(ll h){
    if(h == 1){
        return 1;
    }
    return 2*solve(h/2) + 1;
    
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll h;
    cin>>h;
    
   ll ans =  solve(h);
    cout<<ans<<"\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(int a, int b) {
	return a > b;
}

int main() {
	llint k, a, b;
	llint ans = 1;
	cin >> k >> a >> b;
	if (b - a > 2) {
		if (k < a) {
			cout << k + 1 << endl;
			return 0;
		}
		k -= a - 1;
		ans += a - 1;
		if (k % 2 == 0) {
			ans += (k / 2)*(b - a);
		}
		else {
			ans += (k / 2)*(b - a);
			ans += 1;
		}
		cout << ans << endl;
	}
	else {
		cout << k + 1 << endl;
	}
	return 0;
}


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

int main() {
  int total, one;
  
  cin >> total >> one;
  if(total%500 <= one){ // 500円硬貨で払いきれない分を1円硬貨で払えるかを調べる
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }
}

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

namespace ABC126
{
    class Program
    {
        static double GetProbability(int n, int k)
        {
            double i = 1.0;
            while (true)
            {
                if (n >= k)
                    break;
                n *= 2;
                i *= 0.5;
            }
            return i;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int K = int.Parse(s[1]);
            double res = 0.0;
            double p = 1.0 / N;
            for (int i = 1; i <= N; i++)
                res += GetProbability(i, K);
            res *= p;
            Console.WriteLine(String.Format("{0:f10}", res));
        }
    }
}

Measured memory_bytes: 13140
N, A, B = map( int, input().split())
hmax = 0
H = [ int( input()) for _ in range(N)]
hmax = max(H)
L = 0
R = hmax//B + 1
add = A-B
while R-L != 1:#L != R:
    now = (L+R)//2
    need = 0
    for i in range(N):
        r = H[i] - now*B
        if r > 0:
            need += (r-1)//add+1
    if need <= now:#うまくいくとき
        R = now
    else:#うまくいかないとき
        L = now#+1#うまく行かないので+1している．これがないと無限ループが発生する。
print(R)

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

using namespace std;

int main()
{
    int n;
    long long int W;
    cin >> n >> W;
    vector<long long int>v(n+1);
    vector<long long int>w(n+1);
    for(int i=1;i<=n;++i){
        cin >> w[i] >> v[i];
    }
    vector<vector<long long int> >dp(W+1,vector<long long int>(n+1,0));
    for(int i=1;i<=W;++i){
        for(int j=1;j<=n;++j){
            if(w[j]<=i){
                dp[i][j]=max(v[j]+dp[i-w[j]][j-1],dp[i][j-1]);
            }else{
                dp[i][j]=dp[i][j-1];
            }
        }
    }
    cout << dp[W][n] <<endl;

    return 0;
}

Measured memory_bytes: 85200
N,M=map(int, input().split())
par=[i for i in range(N)]
rank=[0]*(N)
friend=[0]*N
block=[0]*N
size=[1]*N
def find(x):
  if par[x]==x:
    return x
  else:
    par[x]=find(par[x])
    return par[x]
 
#同じ集合か判定
def same(x,y):
  return find(x)==find(y)
 
def union(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return 
  if rank[x]>rank[y]:
    par[y]=x
    size[x]+=size[y]
  else:
    par[x]=y
    size[y]+=size[x]
    if rank[x]==rank[y]:
      rank[y]+=1
 
for i in range(M):
  a,b=map(int,input().split())
  a-=1
  b-=1
  union(a,b)
  friend[a]+=1
  friend[b]+=1

print(max(size))

Measured memory_bytes: 23164
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
long long k,a,b,c;
int main()
{
    cin>>k>>a>>b;
    if(a>=k)
    {
        cout<<1<<endl;
        return 0;
    }
    if(b>=a)
    {
        cout<<-1<<endl;
        return 0;
    }
    if((k-a)%(a-b)>=1)
	{
		c=1;
	}
    cout<<((k-a)/(a-b)+c)*2+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string S;
  cin >> S;
  string ans = S.substr(0, S.length() - 8);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<deque>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<map>
#include<stack>
#include<set>
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int maxn =1000100;
typedef pair<ll,ll>p1;
typedef pair<pair<ll,ll>,ll>p2;
map<pair<pair<ll,ll>,ll>,ll>m1;
map<pair<ll,ll>,ll>m2;
const int MOD = 1e9;
const int N=351;
const int inf = 0x3f3f3f3f;
typedef pair<char, int> PAIR;
map<string,int>mm;
ll w[maxn],v[maxn],c[maxn];
ll dp[maxn];
int main()
{
    mem(dp,0);
    int n,k;
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&w[i],&v[i]);
    }
    mem(dp,inf);
    dp[0] = 0;
    int res = 0;
    for(int i=1;i<=n;i++){
        for(int j=1e5;j>=v[i];j--){
            dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
            if(dp[j]<=k){
                res=max(res,j);
            }
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 11504
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+5;
char s[N];
int f[N][2];
int main() {
	scanf("%s",s+1);
	int n=strlen(s+1);
	f[0][1]=1e9;
	for(int i=1;i<=n;i++) {
		int t=s[i]-'0';
		f[i][0]=min(f[i-1][0],f[i-1][1])+t;
		f[i][1]=min(f[i-1][0]+11-t,f[i-1][1]+9-t);
	}
	printf("%d\n",min(f[n][0],f[n][1]));
	return 0;
}

Measured memory_bytes: 9088
#include<iostream>
#include<cstdio>
using namespace std;
int a[200010];
long long s[200010];
int mod=1e9+7;
int main()
{
	int n;
	long long ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		ans=((a[i]*s[i-1])%mod+ans)%mod;
		s[i]=(s[i-1]%mod+a[i]%mod)%mod;
	}
	printf("%lld\n",ans%mod);
}

Measured memory_bytes: 6120
import scala.io.StdIn._
import java.util._

object Main {
  def main(args: Array[String]) = {
    val data = Array(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
    val s = new Scanner(System.in)
    val n = s.nextInt
    println(data(n - 1))
  }
}

Measured memory_bytes: 25524
#include <stdio.h>
 
int main(void)
{
    int n;
    char c;
 
    scanf("%d", &n);
    int flg = 1;
    int i;
    for (i = 0; i < n; i++) {
        scanf("%c", &c);
        if (c == 'Y') {
            flg = 0;
        }
    }
    if (flg == 0) {
        puts("Four");
    } else {
        puts("Three");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int long long
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    rep (i, 0, n) {
        cin >> a[i];
        if (i % 2 == 0 && a[i] % 2 == 1) ans++;
    }
    cout << ans << "\n";
}

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << 6 - a - b;
  return 0;
}


Measured memory_bytes: 3608
from operator import itemgetter
import sys
input = sys.stdin.readline

n,m = map(int, input().split())
xs = []
for _ in range(n):
  x,y,z = map(int, input().split())
  xs.append([x, y, z, x+y+z, x+y-z, x-y+z, x-y-z, -x+y+z, -x+y-z, -x-y+z, -x-y-z])

ans = 0
xs.sort(key=itemgetter(3))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(4))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(5))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(6))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(7))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(8))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(9))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

xs.sort(key=itemgetter(10))
tot = abs(sum(xs[i][0] for i in range(m))) + abs(sum(xs[i][1] for i in range(m))) + abs(sum(xs[i][2] for i in range(m)))
ans = max(ans, tot)

print(ans)

Measured memory_bytes: 3660
/*****************************************************
 				*	Logged in : HABIBUR RAHMAN						 *
				*	Dept	  : COMPUTER SCIENCE AND ENGINEERING	 *
				*													 *
				*	KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY  *
				******************************************************/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;
typedef pair<ll,ll> pll;
#define fast_io 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) 				v.begin(),v.end()
#define allr(v) 			v.rbegin(),v.rend()
#define rep(i,a,b) 			for(ll i=a;i<=b;i++)
#define rep0(i,n)			for(ll i=0;i<n;i++)
#define rrep0(i, n) 		for(ll i=(ll)(n);i>0;--i)
#define rrep(i, a, b) 		for(ll i=(ll)(a);i>=(ll)(b);--i)
#define pb(z) 				emplace_back(z)
#define ff					first
#define ss 					second
#define caset 				int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define sz(X) 				((ll)(X).size())
#define scan(X) 			scanf("%s", (X))
#define ms(v,val)			memset((v),(val),sizeof((v)))
#define ms0(X) 				memset((X), 0, sizeof((X)))
#define ms1(X) 				memset((X), -1, sizeof((X)))
#define m_p(a,b)            make_pair(a,b)
#define get_pos(c,x) 		(lower_bound(c.begin(),c.end(),x)-c.begin())
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define INF9                1000000010
#define INF18               4000000000000000010
#define bpll(a)             __builtin_popcountll(a)
#define sqr(a)              ((a)*(a))
#define nl					"\n"
//#define mod					1e9+7;
#define mx_el(v)			*max_element(all(v));
#define mn_el(v)			*min_element(all(v));
#define pcase(z,x)    		cout<<"Case "<<z<<": "<<x<<"\n"
const double pi = 2*acos(0) ;
#define display(v)			vi :: iterator it;for(it=(v).begin();it!=(v).end();it++){cout << *it << " " ;}cout << endl;
#define taking(n,v) 		for(ll i=0;i<(n);i++){ll inp;cin>>inp;(v).push_back(inp);}
/*-------------------------some important functions--------------------------------------------------------------------*/
ull binpow(ull b,ull n){if(n==0)return 1;if(n==1)return b;if(n&1) return binpow(b,n-1)*b;else return binpow(b*b,n/2);}
ll bigmod(ll a,ll n,ll mod){if(n==0)return 1;ll res=bigmod(a,n/2,mod);if(n&1){return ((res%mod)*(res%mod)*a)%mod;}else return ((res%mod)*(res%mod))%mod;}
/*--------------------------------------------x----------------------------------------------x--------------------------*/
void start(){
      #ifndef ONLINE_JUDGE 
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
}
void solve(){
	ll n;cin>>n;
	ll a[n+1];
	rep0(i,n){
		cin>>a[i];
	}
	ll cnt=a[0];
	rep(i,1,n-1){
		if(a[i]>=a[i-1]){
			cnt+=(a[i]-a[i-1]);
		}
	}
	cout << cnt << nl;
}
 	 
int main() {
	fast_io
	//start();
    //caset{
    	//cout << "Case " << tt << ": ";
		  solve();
	//}
	
	return 0;
}

Measured memory_bytes: 3652
W, H = gets.split.map(&:to_i)
P = W.times.map { gets.to_i }.sort.reverse
Q = H.times.map { gets.to_i }.sort.reverse

ans = 0
p_size = P.size
q_size = Q.size

while p_size + q_size > 0
  if p_size == 0
    ans += (p_size + 1) * Q.pop
    q_size -= 1
  elsif q_size == 0
    ans += (q_size + 1) * P.pop
    p_size -= 1
  else
    if P.last < Q.last
      ans += (q_size + 1) * P.pop
      p_size -= 1
    else
      ans += (p_size + 1) * Q.pop
      q_size -= 1
    end
  end
end

puts ans


Measured memory_bytes: 6160
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if((a==5&&b==5&&c==7)||(b==5&&c==5&&a==7)||(c==5&&a==5&&b==7)){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int>p(n);
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
  int ret=0;
  for(int i=1; i<n-1; i++){
    if((p[i-1]-p[i])*(p[i+1]-p[i])<=0)ret++;
  }
  cout << ret;
  return 0;
}


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

def main():
    N = int(input())
    A = [int(input()) for i in range(N)]
    if A[0] != 0:
        print(-1)
        return
    dp = [0] * N
    for i in range(1, N):
        if A[i] > A[i-1] + 1:
            print(-1)
            return
        elif A[i] == A[i-1] + 1:
            dp[i] = dp[i-1] + 1
        else:
            dp[i] = dp[i-1] + A[i]
    
    print(dp[-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 19880
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-10;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集
 
ll modPow(ll x, ll n, ll mod = MOD){
    ll res = 1;
    while(n){
        if(n&1) res = (res * x)%mod;
 
        res %= mod;
        x = x * x %mod;
        n >>= 1;
    }
    return res;
}
const int MAX = 2000010;
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;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int l, r, d; cin >> l >> r >> d;
  int ans = 0;
  for(int i=l; i<=r; i++){
    if(i%d == 0)ans++;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3608