akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main( void ){
  int a,b,k,s;
  scanf("%d %d", &a, &b);
  s = (a+b) % 2;
  k = (a+b) / 2;

  if( s ){
    printf("IMPOSSIBLE\n");
  }else{
    printf("%d\n",k);
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main()
{
	ll w, h, A, B;
  	cin>>h>>w>>A>>B;
  
	if(B> h - B || A > w - A)
    {
      cout<<-1<<endl;
      return 0;
    }
  	
  	for(int i = 0; i < h; i++)
    {
      for(int j = 0; j < w; j++)
      {
        if((j<A && i < B) || (j >=A && i >=B))
          cout<<0;
        else
           cout<<1;
      }
           cout<<endl;
           }
      return 0;
           }          

Measured memory_bytes: 1280
n = int(input())
listP = list(map(int, input().split()))
index=1
counter=0
while index < len(listP)-1:
    if listP[index-1] < listP[index] < listP[index+1]:
        counter+=1
    elif listP[index-1] > listP[index] > listP[index+1]:
        counter += 1
    index+=1
print(counter)

Measured memory_bytes: 3060
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for B - Good Distance
	var N, D int
	fmt.Scanf("%d %d", &N, &D)

	A := make([][]int, N)
	for i := 0; i < N; i++ {
		A[i] = make([]int, D)
		for j := 0; j < D; j++ {
			fmt.Scanf("%d", &A[i][j])
		}
	}

	var count int = 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			B := 0
			for k := 0; k < D; k++ {
				B += (A[j][k] - A[i][k]) * (A[j][k] - A[i][k])
			}

			if math.Round(math.Sqrt(float64(B))) == math.Sqrt(float64(B)) {
				count++
			}
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 1848
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
using namespace std;
int s;
map<int,int>mmp;
int f(int x)
{
    if(x%2==1)
    {
        return 3*x+1;
    }
    else
    {
        return x/2;
    }
}
int main()
{
    scanf("%d",&s);
    mmp[s]=1;
    int ans=2;
    while(1)
    {
        if(mmp[f(s)])
        {
            printf("%d\n",ans);
            break;
        }
        else
        {
            mmp[f(s)]=1;
        }
        s=f(s);
        ans++;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// ????????????????????????
		String[] size = new String[2];
		size = br.readLine().split(" ");

		int gyoR = Integer.parseInt(size[0]);
		int retsuC = Integer.parseInt(size[1]);

		int[][] spreadSheet = new int[gyoR + 1][retsuC + 1];


			// ?¶????????????±??\???
			
			for (int i = 0; i < gyoR; i++) {
				String tempInfo = br.readLine();
				String[] info = tempInfo.split(" ");

				for (int j = 0; j < retsuC; j++) {
					spreadSheet[i][j] = Integer.parseInt(info[j]);
					spreadSheet[i][retsuC] += Integer.parseInt(info[j]);
					spreadSheet[gyoR][j] += Integer.parseInt(info[j]);
					spreadSheet[gyoR][retsuC] += Integer.parseInt(info[j]);
				}
			}
			for (int i = 0; i < gyoR + 1; i++) {
				for (int j = 0; j < retsuC; j++) {
					System.out.print(spreadSheet[i][j] + " ");
				}
				System.out.println(spreadSheet[i][retsuC]);
			}
		}
	}

Measured memory_bytes: 30728
S1 = input()
S = S1[0:3]
if(S.count('S')==3):
    D = 0
elif(S.count('S')==2):
    D = 1
elif(S.count('S')==1):
    if(S[1]=='S'):
        D = 1
    else:
        D = 2
elif(S.count('S')==0):
    D = 3
print(D)

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    vector<int> b;
    // rep(i, n)
    // {
    //     b.push_back(a.at(i));
    //     reverse(b.begin(), b.end());
    // }

    if (n % 2 == 1)
    {
        for (int i = 0; i < int(n / 2) + 1; i++)
        {
            b.push_back(a.at(n - i * 2 - 1));
        }
        for (int i = int(n / 2) + 1; i < n; i++)
        {
            b.push_back(a.at(2 * (i - int(n / 2) - 1) + 1));
        }
    }
    if (n % 2 == 0)
    {
        for (int i = 0; i < int(n / 2); i++)
        {
            b.push_back(a.at(n - 1 - 2 * i));
        }
        for (int i = int(n / 2); i < n; i++)
        {
            b.push_back(a.at(2 * (i - int(n / 2))));
        }
    }

    rep(i, n)
    {
        cout << b.at(i);
        if (i != int(b.size() - 1))
        {
            cout << " ";
        }
    }
}

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

int main() {
    double a,b,c,d;
    double x,y;

    cin >> a >> b >> c >> d;

    x = ceil(c/b);
    y = ceil(a/d);

    if(x <= y){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using iii = pair<ii, ll>;
#define vt vector
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a * b / gcd(a, b)
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;
const ll N = 1e5 + 5;

ll n, ans;
ll a[N], ps[N];

void solve() {
    cin >> n;
    for(ll i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    for(ll i = 1; i <= n; i++) {
        ps[i] = ps[i - 1] + a[i];
    }
    for(ll i = 1; i < n; i++) {
        if(ps[i] * 2 < a[i + 1]) {
            ans = 0;
        } else ans++;
    }
    cout << ans + 1 << "\n";
}

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

Measured memory_bytes: 5212
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug(x) cerr<<#x<<" -> "<<x<<'\n'
#define debug2(x,y) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<'\n'
#define debug3(x,y,z) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<" "<<#z<<" -> "<<z<<'\n'

 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

using ordered_set = tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T>
struct CMP {
	bool operator() (const T& lhs, const T& rhs) const{
		return lhs < rhs;
	}
};

template <typename T>
T power(T a, T n){
	T res = 1;
	while(n > 0){
		if(n & 1) res = (res * a);
		a = (a * a);
		n >>= 1;
	}
	
	return res;
}

template <typename T>
T power(T a, T n, long long mm){
	T res = 1;
	while(n > 0){
		if(n & 1) res = (res * a) % mm;
		a = (a * a) % mm;
		n >>= 1;
	}
	
	return res;
}

const ll N = 405;
const ll MOD = 1e9+7;
const ll INF = 2e14+7;

ll arr[N], presum[N];
ll dp[N][N];

ll solve(int l, int r){
	if(l == r) return 0;
	
	if(dp[l][r] != -1) return dp[l][r];
	
	ll ans = INF;
	
	for(int i = l; i < r; i++){
		ans = min(ans, solve(l, i) + solve(i + 1, r) - presum[l - 1] + presum[r]);
	}
	
	return dp[l][r] = ans;
}

void testcase(){
	int n;
	cin>>n;
	presum[0] = 0;
	for(int i = 1; i <= n; i++){
		cin>>arr[i];
		presum[i] = presum[i - 1] + arr[i];
	}
	
	memset(dp, -1, sizeof(dp));
	
	ll ans = solve(1, n);
	
	cout<<ans<<'\n';
}

signed main(){
	fast;
	
	int t = 1;
	//cin>>t;
	while(t--){
		testcase();
	}
	
	return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

constexpr int d = 365;
constexpr int n = 26;

vector<int> c(n);
vector<vector<int>> s(d,vector<int>(n));

double Score(const vector<int>&v){
  double score = 0;
  vector<int> last(n,-1);
  for(int i = 0; i < d; ++i){
    for(int j = 0; j < n; ++j){
      if(v[i] == j){
	score += s[i][j];
	last[j] = i;
      } else {
	score -= c[j]*(i-last[j]);
      }
    }
  }
  return score;
}

int main(){
  cin.ignore(3);
  cin >> c;
  for(auto&e:s)cin >> e;
  vector<int> ans(d);
  vector<int> last(n,-1);
  for(int i = 0; i < d; ++i){
    int maxp = -1001001001;
    int argi = 0;
    for(int j = 0; j < n; ++j){
      if(ChangeMax(maxp,s[i][j] + c[j]*(i-last[j])))argi = j;
    }
    ans[i] = argi;
    last[argi] = i;
  }

  random_device seed_gen;
  default_random_engine engine(seed_gen());
  uniform_int_distribution<> dist1(0, d-1);
  uniform_int_distribution<> dist2(0, n-1);

  double pre = Score(ans);

  for(int i = 0; i < 1000; ++i){
    int x = dist1(engine);
    int y = dist2(engine);
    int z = ans[x];
    ans[x] = y;    
    if(!ChangeMax(pre,Score(ans)))ans[x] = z;
  }
  
  for(auto e:ans)cout << e+1 << endl;
  return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main(void){
string S;
int K;

cin >> K >> S;

if(S.size()<=K){
    cout << S << endl;
}else {
    S.substr(0, K);
    string result = S.substr(0, K);
    cout << result  <<"..."<<endl;
}
}


Measured memory_bytes: 3628
def main():
    INF = float("inf")

    N, M, P, *ABC = map(int, open(0).read().split())

    F = [[] for _ in range(N)]
    B = [[] for _ in range(N)]
    E = [(a - 1, b - 1, P - c) for a, b, c in zip(*[iter(ABC)] * 3)]

    for a, b, c in E:
        F[a].append(b)
        B[b].append(a)

    S = {0}
    stack = [0]
    while stack:
        s = stack.pop()
        for v in F[s]:
            if v not in S:
                stack.append(v)
                S.add(v)

    T = {N - 1}
    stack = [N - 1]
    while stack:
        s = stack.pop()
        for v in B[s]:
            if v not in T:
                stack.append(v)
                T.add(v)

    ok = S & T

    E = [(a, b, c) for a, b, c in E if a in ok and b in ok]

    D = [INF] * N
    D[0] = 0

    def bellman_ford(N):
        for _ in range(N):
            update = False
            for a, b, c in E:
                if D[b] > D[a] + c:
                    D[b] = D[a] + c
                    update = True
            if not update:
                return False
        return True

    bellman_ford(N)

    print(-1 if bellman_ford(1) else max(-D[-1], 0))



if __name__ == '__main__':
    main()


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


int main() {
  ll n; cin >> n;
  ll greatest = 0;
  ll aikata = n;
  for (ll i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (greatest < i) {
        greatest = i;
        aikata = n / i;
      }
    }
  }
  cout << greatest+aikata-2 << endl;
}

Measured memory_bytes: 256
n = int(input())
primes = dict()
p = 2

while p * p < n:
  if n % p == 0:
    primes[p] = 0
    while n % p == 0:
      n //= p
      primes[p] += 1
  p += 1
if p * p == n:
  primes[p] = 2
elif n >= p:
  primes[n] = 1

count = 0
for e in primes.values():
  c = 1
  while c * (c + 1) // 2 <= e:
    c += 1
  count += c - 1
  
print(count)

Measured memory_bytes: 9148
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		INT32_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//ll dp[500000 * 2000 + 10];	// dp[i日目]までの勝ち数

// main function
int main()
{
	ll ans = 0;
	ll N = 0;
	ll tmp = 0;

	cin >> N;
	vector<ll> P(N);

	Rep(i, N) {
		cin >> tmp;
		P[i] = tmp - 1;
	}

	// solve
	// Fist, P[i] == i && P[i+1] == i+1を交換
	Rep(i, N - 1) {
		if (P[i] == i && P[i + 1] == i + 1) {
			ans++;
			tmp = P[i];
			P[i] = P[i + 1];
			P[i + 1] = tmp;
		}
	}

	// Next, P[i] == iを交換
	Rep(i, N) {
		if (P[i] == i) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n,count,maxh;
    int h[100];
    cin>>n;
    count=0;
    for (int i=0;i<n;i++) cin>>h[i];
    maxh=h[0];
    for (int i=0;i<n;i++){
        if(maxh<=h[i]){
            maxh=h[i];
            count++;
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = gets.split.map(&:to_i)
r = 0
 
n.times do |n|
  r += b[n]
  if (a[n + 1] != nil) && (a[n + 1] - a[n]) == 1
    r += c[a[n] - 1]
  end
end
p r

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EMP emplace
#define EMPB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
#define Bit(n) (1LL << (n))
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

int H, W, D, Q;
int A[310][310];
int posx[90010], posy[90010];
int cost[90010];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> H >> W >> D;
  REP(i, H) REP(j, W) {
    cin >> A[i][j];
    A[i][j]--;
    posx[A[i][j]] = i;
    posy[A[i][j]] = j;
  }
  REP(i, D) cost[i] = 0;
  FOR(i, D, H*W) {
    cost[i] = cost[i-D] + abs(posx[i]-posx[i-D]) + abs(posy[i]-posy[i-D]);
  }
  cin >> Q;
  REP(i, Q) {
    int L, R;
    cin >> L >> R;
    R--; L--;
    cout << cost[R] - cost[L] << endl;
  }

  return 0;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

#define MAX_N 1000000

signed main() {
	vector<vector<bool>> v(4, vector<bool>(14, true));
	v[0][0] = v[1][0] = v[2][0] = v[3][0] = false;
	ll n; cin >> n;
	rep(i, n) {
		char mark;
		ll num;
		cin >> mark >> num;
		switch (mark) {
		case 'S':
			v[0][num] = false;
			break;
		case 'H':
			v[1][num] = false;
			break;
		case 'C':
			v[2][num] = false;
			break;
		case 'D':
			v[3][num] = false;
			break;
		default:
			break;
		}
	}
	rep(i,4)
		rep(j, 14) {
		if (v[i][j]) {
			switch (i){
			case 0:
				cout << "S " ;
				break;
			case 1:
				cout << "H ";
				break;
			case 2:
				cout << "C ";
				break;
			case 3:
				cout << "D ";
				break;
			default:
				break;
			}
			cout << j << endl;
		}

	}

}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(LL i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define drep(i, a, b) for(LL i = (a), i##_end_ = (b); i >= i##_end_; --i)
#define clar(a, b) memset((a), (b), sizeof(a))
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long LL;
typedef long double LD;
const int BUF_SIZE = (int)1e6 + 10;
struct fastIO {
	char buf[BUF_SIZE], buf1[BUF_SIZE];
	int cur, cur1; FILE *in, *out;
	fastIO() { cur = BUF_SIZE, in = stdin, out = stdout; cur1 = 0; }
	inline char getchar() { if(cur == BUF_SIZE) fread(buf, BUF_SIZE, 1, in), cur = 0; return *(buf + (cur++)); }
	inline void putchar(char ch) { *(buf1 + (cur1++)) = ch; if (cur1 == BUF_SIZE) fwrite(buf1, BUF_SIZE, 1, out), cur1 = 0; }
	inline int flush() { if (cur1 > 0) fwrite(buf1, cur1, 1, out); return cur1 = 0; }
}IO;
#define getchar IO.getchar
#define putchar IO.putchar
LL read() {
	char ch = getchar();
	LL x = 0, flag = 1;
	for (;!isdigit(ch); ch = getchar()) if (ch == '-') flag *= -1;
	for (;isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
	return x * flag;
}
void write(LL x) {
	if (x < 0) putchar('-'), x = -x;
	if (x >= 10) write(x / 10);
	putchar(x % 10 + 48);
}

const int Maxn = 2009, Mod = 924844033;
int n, k, fac[Maxn];

void init() {
	n = read(), k = read();
	fac[0] = 1;
	rep (i, 1, n) fac[i] = fac[i - 1] * 1ll * i % Mod;
}

int dp[Maxn * 2][Maxn][2], tot, g[Maxn];
bool flag[Maxn];

void solve() {
	rep (i, 1, k) {
		for (int j = i; j <= n; j += k) flag[++tot] = (j == i);
		for (int j = i; j <= n; j += k) flag[++tot] = (j == i);
	}

	dp[0][0][0] = 1;
	rep (i, 0, tot - 1)
		rep (j, 0, n - 1) {
			dp[i + 1][j][0] = (dp[i][j][0] + dp[i][j][1]) % Mod;
			if (!flag[i + 1]) dp[i + 1][j + 1][1] = dp[i][j][0];
		}

	rep (i, 0, n) g[i] = (dp[2 * n][i][0] + dp[2 * n][i][1]) % Mod;
	LL ans = 0;
	rep (i, 0, n) (ans += (Mod + ((i & 1) ? (-1ll) : 1ll) * g[i] * fac[n - i] % Mod) % Mod) %= Mod;
	cout << ans << endl;
}

int main() {
//	freopen("bosky.in", "r", stdin);
//	freopen("bosky.out", "w", stdout);

	init();
	solve();

#ifdef Qrsikno
	debug("\nRunning time: %.3lf(s)\n", clock() * 1.0 / CLOCKS_PER_SEC);
#endif
	return IO.flush();
}



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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N; cin >> N;
  cout << N*N*N << endl;

  return 0;
}



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

int main()
{
	int q;
	scanf("%d", &q);
	while (q--){
		int c, a, n;
		scanf("%d %d %d", &c, &a, &n);
		int res = 0;
		while (c && a && n){
			c--; a--; n--;
			res++;
		}
		while (c >= 2 && a){
			c -= 2; a--;
			res++;
		}
		while (c >= 3){
			c -= 3;
			res++;
		}
		printf("%d\n", res);
	}
}

Measured memory_bytes: 1188
import itertools
from collections import defaultdict
n = int(input())
d = defaultdict(lambda: 0)
for i in range(n):
    s = input()
    d[s[0]] += 1
ans = 0

for x, y, z in list(itertools.combinations(['M', 'A', 'R', 'C', 'H'], 3)):
    ans += d[x]*d[y]*d[z]
print(ans)


Measured memory_bytes: 43224
import math
import itertools
import statistics
#import numpy as np
import collections

#n = int(input())
h, w = list(map(int, input().split()))
#a = list(map(int, input().split()))
c = []
for i in range(h):
    c.append(input())

for i in range(h):
        print(c[i])
        print(c[i])
    


Measured memory_bytes: 5148
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
  int n, ans=0;
  cin >> n;
  vector<int> p(n), cnt(n);
  rep(i, n) {
    cin >> p.at(i);
    if(i+1 == p.at(i))cnt.at(i) = 1;
    else cnt.at(i) = 0;
  }
  rep(i, n-1){
    if(cnt.at(i) == 1 && cnt.at(i+1) == 1){
      ans++;
      cnt.at(i)=0;cnt.at(i+1)=0;
    }
    else if(cnt.at(i)==1) {ans++; cnt.at(i)=0;}
  }
  if(cnt.at(n-1) == 1)ans++;
  cout << ans;
}

Measured memory_bytes: 1024
fun main() {
    readLine()
    val a = readLine()!!.split(' ').map { it .toInt() }
    var mapL: MutableMap<Int, Long> = mutableMapOf()
    var mapR: MutableMap<Int, Long> = mutableMapOf()
    a.forEachIndexed { idx, value ->
        val l = idx-value
        val r = idx+value
        if (!mapL.containsKey(l)) mapL[l] = 0L
        if (!mapR.containsKey(r)) mapR[r] = 0L
        mapL[l] = mapL[l]!!+1
        mapR[r] = mapR[r]!!+1
    }
    var cnt = 0L
    for (x in mapL.keys) {
        if (mapR.containsKey(x)) cnt += mapL[x]!!*mapR[x]!!
    }
    println(cnt)
}


Measured memory_bytes: 90244
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    cout << __gcd(n, m) << endl;
}




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


int32_t main(){
    int n;cin>>n;
    int a[n];
    multiset<int> s;
    for(int i=0;i<n;i++){
    	cin>>a[i];
    	s.insert(a[i]);
    }
    for(int i=0;i<n;i++){
    	s.erase(s.find(a[i]));
    	cout<<*s.rbegin()<<endl;
    	s.insert(a[i]);
    }
    
    return 0;
}

Measured memory_bytes: 12544
import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(10000)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))
    S = input()
    d = {'SUN': 7, 'MON': 6, 'TUE': 5, 'WED': 4, 'THU': 3, 'FRI': 2, 'SAT': 1}
    print(d[S])


if __name__ == "__main__":
    main()


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

int a, b, c, x;

int main() {
	int ans = 0;

	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			int tmp = (x - (i * 500) - (j * 100));
			if (tmp % 50 == 0 && tmp>=0 && tmp<=c*50) {
				ans++;
			}
		}
	}


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const double pi = 3.141592653589;
int mod = 1000000007;
/* global variables */
/* function */
/* main */
int main(){
    ll n, x, m;
    cin >> n >> x >> m;

    ll before_loop = 0, loop_size = 0, loop_sum = 0;
    vector<ll> sum(m + 1, 0);  // i回目の操作後のsumを格納 (a[i] = sum[i+1] - sum[i])
    map<ll, int> corresp; // keyが最初に出てくる場所
    int cnt = 0;
    ll ai = x;
    for (int i = 0; i <= m; i++) {
        cnt++;
        sum[i + 1] = sum[i] + ai;
        // ループに入る
        if (corresp.count(ai)) {
            before_loop = corresp[ai];
            loop_size = cnt - before_loop;
            loop_sum = sum[i + 1] - sum[before_loop];
            break;
        }
        corresp[ai] = cnt;
        ai = (ai * ai) % m;  // a[i + 1] = (a[i] * a[i]) % m
    }

    ll loop_times = (n - before_loop) / loop_size;
    ll after_loop = (n - before_loop) % loop_size;
    // A = {A1, A2, ..., An}
    // ループ前 + (ループ) + ループ後の残り
    // (ループ前 + ループ後の残り) + (ループ)
    ll ans = sum[before_loop + after_loop] + loop_sum * loop_times;
    cout << ans << '\n';
}


Measured memory_bytes: 7076
#include<bits/stdc++.h>
using namespace std;
int main(){

int n,cnt=0;
cin>>n;
string s;
cin>>s;
for(int i=0; i<s.length()-2;i++){

    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
        cnt++;
}

cout<<cnt<<endl;



return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    string s,t;cin >> s >> t;
    vector<int> start(26,-1);
    vector<int> end(26,-1);

    for(int i=0;i<s.size();i++){
        int a = s[i] - 'a';
        int b = t[i] - 'a';
        if(start[a] != -1 || end[b] != -1){
            if(start[a] != b || end[b] != a){
                cout << "No" << endl;
                return 0;
            }
        }else{
            start[a] = b;
            end[b] = a;
        }
    }
    cout  << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 776
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

vector<vector<long>> bd(90001, vector<long>(3,0));
int main(){
    long h,w,d;
    long tmp;
    cin >> h >> w >> d;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> tmp;
            bd[tmp][0] = j;
            bd[tmp][1] = i; 
        }
    }
    for(int i=1; i<h*w+1; i++){
        if( i-d <= 0) bd[i][2] = 0;
        else{
            long dist=abs(bd[i-d][0]-bd[i][0])+abs(bd[i-d][1]-bd[i][1]);
            bd[i][2] = bd[i-d][2]+dist;
        }
    }
    long q,x1,x2;
    cin >> q;

    for(int i=0; i<q; i++){
        cin >> x1 >> x2;
        cout << bd[x2][2] - bd[x1][2] << endl;
    }
    return 0;
}


Measured memory_bytes: 6016
#include <stdio.h>
#include <string.h>

int main(){
	long int i,j,N,M,ans=0;
	char s[10];
	scanf("%s",s);
	
	if(s[2]==s[3] && s[4]==s[5])
	printf("Yes\n");
	else printf("No\n");

 return 0;
 }

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

#define REP(i,n) for (int i=0;i<(n);i++)
#define PII pair<int,int>
#define LL long long
#define vi vector<int>

int main(){
	int n;
	int in[4];
	int i[3];
	int goal;
	int sum=0,dif;
	char op[3];
	
	cin >> n;

	REP(j, 4) {
		in[3-j] = n % 10;
		n /= 10;
	}

	goal = 7 - in[0];

	for (i[0] = 0; i[0] < 2; i[0] ++){
		for (i[1] = 0; i[1] < 2; i[1] ++) {
			for (i[2] = 0; i[2] < 2; i[2] ++) {
				sum = 0;
				REP(j, 3) {
					sum += pow(-1, i[j]) * in[j + 1];
				}
				if (sum == goal) {
					REP(j, 3) {
						if (i[j]) op[j] = '-';
						else op[j] = '+';
					}
					cout << in[0] << op[0] << in[1] << op[1] << in[2] << op[2] << in[3] << "=7"<<endl;
					return 0;
				}
			}
		}
	}	
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int ans;
bool flag;
int main(){
    cin>>s;
    int l=s.size();
    for(int i=1;i<l;i++) ans+=9;
    for(int i=1;i<l;i++) if(s[i]!='9') flag=1;
    if(!flag) cout<<ans+s[0]-'0'<<endl;
    else  cout<<ans+s[0]-'1'<<endl;
    return 0;

}

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

int main()
{
  int n;
  cin >> n;
  vector<int> _p(n);
  auto * const p = &_p[0];
  for (int i = 0; i < n; ++i)
    cin >> p[i];
  int count = 0;
  for (int i = 1, _i = n - 1; i < _i; ++i)
    if (0 < (p[i] - p[i - 1])*(p[i + 1] - p[i]))
      ++count;
  cout << count;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }

typedef long long ll;
using namespace std;

int main() {
    
    ll n;
    cin >> n;
    vector<ll> a(n, 0), b(n, 0), c(n, 0);
    vector<ll> v(n, 0); // a_i - b_i

    ll asum = 0, bsum = 0;
    REP(i, n) {
        cin >> a[i];
        c[i] = a[i];
        asum += a[i];
    }
    REP(i, n) {
        cin >> b[i];
        v[i] = a[i] - b[i];
        bsum += b[i];
    }

    if (bsum > asum) {
        cout << -1 << endl;
        return 0;
    }
    
    sort(ALL_OF(v));

    vector<ll> imos(n+1, 0);
    REP(i, n) imos[i+1] = imos[i] + v[i];
    
    // REP(i, n) cerr << v[i] << (i == n-1 ? "\n" : " ");
    // REP(i, n) cerr << imos[i+1] << (i == n-1 ? "\n" : " ");
    int l = lower_bound(ALL_OF(v), 0) - v.begin(); // [0, l) is negative (in need)
    for (int r = n; l <= r; r--) {
        ll s = imos[n] - imos[r];
        // cerr << "l: " << l << ", r: " << r << " -> s: " << s << ", in need: " << -imos[l] << endl;
        if (s >= -imos[l]) {
            cout << l + n - r << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    
}

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

 int N, K;
 vector<int> d;
 vector<vector<int>> A;

 void input() {
 cin >> N >> K;
 d.resize(K);
 A.resize(K, vector<int>());
 for(int i = 0; i < K; i++) {
 cin >> d[i];
 A[i].resize(d[i]);
 for(int j = 0; j < d[i]; j++) {
 cin >> A[i][j];
 }
 }
 }

 void solve() {
 int ans = 0;
 for(int i = 1; i <= N; i++) {
 bool have = false;
 for(auto v : A) {
 for(auto p : v) {
 if(p == i) have = true;
 }
 }
 if(!have) ans++;
 }
 cout << ans << endl;
 }

 int main() {
 input();
 solve();
 return 0;
 }

Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
using namespace std;

int main() {
	int cha, chb = -1, ch, ans = 1000, ansk = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 26; ++i) {
		for (int j = 0; j < s.size(); ++j) {
			if (s[j] == (char)(97 + i)) {
				cha = j;
				ch = cha - chb - 1;
				chb = cha;
				ansk = max(ansk, ch);
			}
		}
		ch = s.size() - chb - 1;
		ansk = max(ansk, ch);
		ans = min(ans, ansk);
		chb = -1;
		ansk = 0;
	}
	cout << ans << endl;
}

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	string kata1,kata2;
	int i,j;
	cin>>kata1>>kata2;
	i=0;
	for(i=0;i<3;i++){
		j=2-i;
		if(kata1[i]!=kata2[j]){break;}
	}
	if(i==3){printf("YES\n");}
	else{printf("NO\n");}
	return 0;
};

Measured memory_bytes: 256
from collections import namedtuple
from operator import attrgetter


Restaurant = namedtuple("Restaurant", ("id", "city", "score"))
restaurants = []
N = int(input())
for i in range(N):
    s, p = input().split()
    restaurant = Restaurant(i+1, s, int(p))
    restaurants.append(restaurant)
for restaurant in sorted(sorted(restaurants, key=attrgetter("score"), reverse=True), key=attrgetter("city")):
    print(restaurant.id)


Measured memory_bytes: 38384
STR = input()
if len(STR) < len("keyence"):
	print("NO")
	exit()

word = "keyence"
word_index = STR.find(word)

if word_index >= 0:
	if STR[:word_index] == "" or STR[word_index + len(word):] == "":
		print("YES")
		exit()

word = "keyenc"
word_index = STR.find(word)

if word_index >= 0:
	if STR[:word_index] == "":
		if STR[-1] == "e":
			print("YES")
			exit()

word = "keyen"
word_index = STR.find(word)

if word_index >= 0:
	if STR[:word_index] == "":
		if STR[-2] + STR[-1] == "ce":
			print("YES")
			exit()

word = "keye"
word_index = STR.find(word)

if word_index >= 0:
	if STR[:word_index] == "":
		if STR[-3] + STR[-2] + STR[-1] == "nce":
			print("YES")
			exit()

word = "key"
word_index = STR.find(word)

if word_index >= 0:
	if STR[:word_index] == "":
		if STR[-4] + STR[-3] + STR[-2] + STR[-1] == "ence":
			print("YES")
			exit()

word = "ke"
word_index = STR.find(word)

if word_index >= 0:
	if STR[:word_index] == "":
		if STR[-5] + STR[-4] + STR[-3] + STR[-2] + STR[-1] == "yence":
			print("YES")
			exit()

word_index = STR.find("k")

if word_index >= 0:
	if STR[:word_index] == "":
		if STR[-6] + STR[-5] + STR[-4] + STR[-3] + STR[-2] + STR[-1] == "eyence":
			print("YES")
			exit()

print("NO")


Measured memory_bytes: 3188
from math import floor, ceil

a, b = map(int, input().split())
for i in range(ceil(a / 0.08), ceil(b/0.1)+10):
    if floor(i*0.08) == a and floor(i*0.10) == b and i >= 1:
        print(i)
        break
else:
    print('-1')

Measured memory_bytes: 38384
N = int(input())
def prime_factorize(n):
    ans = 0
    while n % 2 == 0:
        i = 1
        j = 0
        while n % 2 == 0:
            n = n//2
            j += 1
            if i <= j:
                ans += 1
                i += 1
                j = 0
    f = 3
    while f * f <= n:
        i = 1
        j = 0
        while n % f == 0:
            n //= f
            j += 1
            if i <= j:
                ans += 1
                i += 1
                j = 0
        f += 2
    if n != 1:
        ans += 1
    return ans
print(prime_factorize(N))

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

int main(){
  string s;cin >> s;
  int ans = 0;
  for(int i=0;i<4;++i){
    if(s[i] == '+')ans += 1;
    else if(s[i] == '-')ans -= 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

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

	long long sum = 0;
	int j = 0;

	for (int i = 0; i < S.length(); i++) {
		j = S.at(i) - '0';
		sum +=j;
	}

	if (sum % 9 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3716
node_num, l_connected_node, g_connected_node = [int(n) for n in input().rstrip().split()]

l_connected_node-=1
g_connected_node-=1

count=[0]*node_num

for i in range(node_num-1):
    for j in range(i+1, node_num):
        count[min(j-i, abs(i-l_connected_node)+abs(j-g_connected_node)+1)]+=1

for x in range(1, node_num):
    print(count[x])

Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int h1,h2,m1,m2,k;

cin >>h1>>m1 >> h2 >> m2 >> k;
  h1 = h1*60+m1;
  h2 = h2*60+m2;
  cout<< h2-h1-k<<endl;
}

Measured memory_bytes: 3636
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 998244353;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res="";
		//int res = 0; ;
		//int t = int.Parse(Console.ReadLine());
		//string str = Console.ReadLine();
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//int n = int.Parse(Console.ReadLine());
		//string res="";

		int res = 0;
		int n = int.Parse(Console.ReadLine());

		int[] vals = parseAry(Console.ReadLine().Split(cs));
		int[] cost = parseAry(Console.ReadLine().Split(cs));
		for ( int i = 0; i < n; i++ ) {
			int t = vals[i] - cost[i];
			if ( t > 0 ) { res += t; }
		}

			Console.WriteLine(res);


		return;
	
	}
	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}

}

Measured memory_bytes: 11092
#include <iostream>
#include <queue>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> q;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    q.push(a);
  }
  for (int i = 0; i < m; i++) {
    a = q.top();
    q.pop();
    q.push(a / 2);
  }
  long long result = 0;
  for (int i = 0; i < n; i++) {
    result += q.top();
    q.pop();
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#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 <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  for (int i = 1; i < 10000; i++) {
    if (n <= i * 1000) {
      cout << i * 1000 - n << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3616
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        int sum = sc.nextInt();
        double r = sum;
        r /=3;
        double v = r*r*r;
        DecimalFormat df = new DecimalFormat("0.000000000000");
        System.out.println(df.format(v));
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 22484
nyu = input()
nyu = nyu.split()

k = int(nyu[0])
s = int(nyu[1])

n = 0
for x in range(k+1):
  for y in range(k+1):
    if x+y > s:
      break
    elif s - (x+y) > k:
      #print(str(x) + " " + str(y))
      continue;
    else:
      n +=1;

print(n)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
int X,A,B;
  cin>>X>>A>>B;
  if(A>=B){
    cout<<"delicious"<<endl;
  }
  else if(A<B && X+A>=B){
    cout<<"safe"<<endl;
  }
  else{
    cout<<"dangerous"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100005];

    ll jump(ll i,ll n,ll a[],ll k)
    {
        if(i==n-1)
            return 0;
            
        if(dp[i]!=-1)
            return dp[i];
        ll p=1e9;    
        for(ll j=i+1;j<=min(i+k,n-1);j++)
            p=min(abs(a[j]-a[i])+jump(j,n,a,k),p);
        
        return dp[i]=p;    
            
    }
    int main()
    {
        ll i,n,test=1,k;
        cin>>n>>k;
        ll a[n];
        
        for(i=0;i<n;i++)
            cin>>a[i];
            
        memset(dp,-1,sizeof dp);
        
        cout<<jump(0,n,a,k)<<"\n";    
        
        return 0;
    }

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

import sys
import os
from collections import deque


N = int(input())
q = deque()

for i in range(N):
    lst = input().split()
    command = lst[0]
    if command == 'insert':
        v = int(lst[1])
        q.appendleft(v)
    elif command == 'delete':
        v = int(lst[1])
        if v in q:
            q.remove(v)
    elif command == 'deleteFirst':
        q.popleft()
    elif command == 'deleteLast':
        q.pop()
print(*list(q))

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string N)
{
    string ans;
    ll sum = 0;
    for (auto &&e : N)
    {
        sum += e - '0';
    }
    if (sum % 9 == 0)
        ans = "Yes";
    else
    {
        ans = "No";
    }
    cout << ans << endl;
}

signed main()
{
    std::string N;
    std::cin >> N;
    solve(N);
    return 0;
}


Measured memory_bytes: 3860
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
#define MOD 1000000007ll
ll modpow(ll a,ll x){
	ll ret = 1ll;
	while(x){
		if(x&1)ret=ret*a%MOD;
		a = a*a%MOD;
		x >>= 1;
	}
	return ret;
}
int main(){
	ll m,n;
	cin >> m >> n;
	cout << modpow(m,n) << endl;
	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint n,k;
	cin>>n>>k;
	lint a[n];
	rep(i,n)cin>>a[i];
	rep(i,n)a[i]--;
	//添字合わせ
	map<lint,lint>alr;
	//通過済みか，そこまでいくつかかったか
	lint pos=0,step=0;
	//posループ開始step累計テレポート
	rep(i,n){
		alr.emplace(pos,step);
		//通ったよ
		pos=a[pos];
		//テレポート
		step++;
		if(k==step)break;
		if(alr.count(pos))break;
		//ループしてたらbreak
	}
	lint ansStep=(k-alr[pos])%(step-alr[pos]);
	//kからループ開始までの回数を引いて，ループのテレポート回数の剰余をとる
	lint ans=pos;
	rep(i,ansStep){
		ans=a[ans];
	}
	cout<<ans+1<<endl;
}

Measured memory_bytes: 15200
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	LL a,b,c;
	LL p,q;
	cin>>n;
	p=0,q=1;
	for(i=0;i<n;i++){
		cin>>a>>b;
		if(a==1)p*=b,q*=b;
		if(a==2)p-=b;
		if(a==3)p+=b;
	}
	cout<<p<<" "<<q<<endl;
}


Measured memory_bytes: 3100
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int K;
  cin >> K;
  string S;
  cin >> S;

  if ((int)S.size() <= K)
    cout << S << endl;
  else
    cout << S.substr(0, K) << "..." << endl;
  return 0;
}


Measured memory_bytes: 3656