akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
	int n,i;
	unsigned long sum=0,price;

	scanf("%d",&n);

	for (i = 0; i < n; i++) {
		scanf("%lu",&price);
		sum += price;
	}
	printf("%lu\n",sum/n);
	return 0;
}

Measured memory_bytes: 604
package main

import (
	"fmt"
	"math"
)

func main() {
	n, ww := SingleInt(), SingleInt()
	vals, weis := make([]int, 0, n), make([]int, 0, n)

	for i := 0; i < n; i++ {
		vals = append(vals, SingleInt())
		weis = append(weis, SingleInt())
	}

	// dp[i+1][w] := i 番目までの品物の中から重さが w を超えないように選んだときの、価値の総和の最大値

	// index + 1 に対して、

	dp := make([][]int, n+1)
	dp[0] = make([]int, ww+1)
	for i := 0; i < n; i++ {
		dp[i+1] = make([]int, ww+1)
		for w := 0; w <= ww; w++ {
			if w >= weis[i] {
				dp[i+1][w] = Max(dp[i][w-weis[i]]+vals[i], dp[i][w])
			} else {
				dp[i+1][w] = dp[i][w]
			}
		}
		// fmt.Printf("%#v\n", dp[i+1])
	}

	fmt.Printf("%#v\n", dp[n][ww])

	// a := int64(math.Pow(3, float64(n)))
	// fmt.Printf("%#v\n", (a-(3*dp1[n-1])+(3*dp2[n-1]))%mod)
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func Max(nums ...int) int {
	if len(nums) == 0 {
		panic("function max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func Min64(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("function min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Min(float64(res), float64(nums[i])))
	}
	return res
}



Measured memory_bytes: 9620
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;
using P = pair<int, int>;

void fc(queue<pair<int, int>> &now, vector<queue<int>> &vq, int i, vector<bool> &cl){
  if(vq.at(i).size() == 0) return;
  int j = vq.at(i).front();
  if(cl.at(i) == true || cl.at(j) == true) return;
  if(vq.at(j).size() > 0 && vq.at(j).front() == i){
    cl.at(i) = true; cl.at(j) = true;
    now.push(make_pair(i, j));
  }
}

void qc(vector<queue<int>> &vq, vector<bool> &cl){
  rep(i, cl.size()){
    if(cl.at(i) == true){
      vq.at(i).pop();
      cl.at(i) = false;
    }
  }
}

int main(){
  int n;
  cin >> n;
  vector<queue<int>> vq(n);
  vector<bool> cl(n);
  rep(i, n){
    rep(j, n-1){
      int a;
      cin >> a;
      a--;
      vq.at(i).push(a);
    }
  }
  queue<pair<int, int>> now;
  int ans = 0;
  rep(i, n){
    if(vq.at(i).front() > i && vq.at(i).size() == n-1){
      fc(now, vq, i, cl);
    }
  }
  qc(vq, cl);
  while(!now.empty()){
    queue<pair<int, int>> nx;
    ans++;
    while(!now.empty()){
      auto p = now.front(); now.pop();
      // cerr << ans << " " << p.first << " " << p.second << endl;
      fc(nx, vq, p.first, cl);
      fc(nx, vq, p.second, cl);
    }
    qc(vq, cl);
    now = nx;
  }
  rep(i, n){
    if(vq.at(i).size() != 0){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4736
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int H; int W;
int yE, xE;
short memo[100][100][100][100];
int sumH[100][101], sumV[100][101];
int rec(int yA, int yB, int xA, int xB) {
	short &r = memo[yA][yB][xA][xB];
	if(r != -1) return r;
	r = 0;
	int yC = yB - yE, yD = H - 1 - (yE - yA);
	int xC = xB - xE, xD = W - 1 - (xE - xA);
	int xL = max(xA, xC), xR = min(xB, xD);
	if(xL <= xR) {
		if(yC <= yA - 1)
			amax(r, sumH[yA - 1][xR + 1] - sumH[yA - 1][xL] + rec(yA - 1, yB, xA, xB));
		if(yB + 1 <= yD)
			amax(r, sumH[yB + 1][xR + 1] - sumH[yB + 1][xL] + rec(yA, yB + 1, xA, xB));
	}
	int yL = max(yA, yC), yR = min(yB, yD);
	if(yL <= yR) {
		if(xC <= xA - 1)
			amax(r, sumV[xA - 1][yR + 1] - sumV[xA - 1][yL] + rec(yA, yB, xA - 1, xB));
		if(xB + 1 <= xD)
			amax(r, sumV[xB + 1][yR + 1] - sumV[xB + 1][yL] + rec(yA, yB, xA, xB + 1));
	}
	return r;
}

int main() {
	while(~scanf("%d%d", &H, &W)) {
		vector<string> a(H);
		rep(i, H) {
			char buf[101];
			scanf("%s", buf);
			a[i] = buf;
		}
		yE = -1, xE = -1;
		rep(i, H) rep(j, W) if(a[i][j] == 'E')
			yE = i, xE = j;
		rep(i, H) {
			sumH[i][0] = 0;
			rep(j, W)
				sumH[i][j + 1] = sumH[i][j] + (a[i][j] == 'o');
		}
		rep(j, W) {
			sumV[j][0] = 0;
			rep(i, H)
				sumV[j][i + 1] = sumV[j][i] + (a[i][j] == 'o');
		}
		memset(memo, -1, sizeof(memo));
		int ans = rec(yE, yE, xE, xE);
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 195712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
ll a[MAXN], n, k;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll g = -1;
	for (int i = 0; i <= n - k; i++)
	{
		ll ans = abs(a[i] - 0) + abs(a[i] - a[i + k - 1]);
		ll ans2 = abs(a[i + k - 1] - 0) + abs(a[i] - a[i + k - 1]);
		ans = min(ans, ans2);
		if(g == -1 || ans < g)
			g = ans;
	}
	cout << g;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,K;
	cin >> N >> K;
	ll ans = 0;
	if(K==0){
		cout << N*N << endl;
		return 0;
	}
	for(int b=K+1;b<=N;b++){
		ll l = K;
		ll r = b-1;
		ans += r-l+1;
		ll n = (N-r)/b;
		ans += n*(r-l+1);
		l = l +(n+1)*b;
		if(l<=N)ans += N-l+1;
	}
	cout << ans << endl;
}

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

int main() {
        int a, b;
        cin >> a >> b;
        if (a==1) a=14;
        if (b==1) b=14;
        if (a==b) cout << "Draw" << endl;
        else {
                cout << (a>b?"Alice":"Bob") << endl;
        }
        return 0;
}


Measured memory_bytes: 256
/*
created by Sanyam Singhal
/*/

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define w(t) int t;	cin>>t while(t--)
#define triplet pair<int,pair<int,int>>
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
#define loop(i, k, n) for(ll i=k; i<n; i+=1)
#define loop2(i, k, n) for(ll i=k; i>=n; i--)

const ll inf = 1e18;

void take_fileIO(){
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  return;
}

ll dfs(vector<vector<ll>> &adj, vector<ll>&dp, int src){
  if(dp[src]!=-1)
    return dp[src];

  ll ans=1;
  for(int neigh : adj[src]){
    ans = max(ans, dfs(adj, dp, neigh)+1);
  }
  dp[src] = ans;
  return ans;
}

void solve(){
  ll n,m; 
  cin>>n>>m;

  vector<vector<ll>>adj(n+1);
  vector<ll> dp(n+1, -1);

  for(int i=0; i<m; i++){
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
  }

  // for(int i=0; i<n; i++)
  //   cout<<dp[i]<<" ";
  // cout<<endl;

  ll ans=0;
  for(int i=0; i<=n; i++){
    ans = max(ans, dfs(adj, dp, i));
  }
  cout<<ans-1<<endl;

  // for(int i=0; i<=n; i++)
  //   cout<<dp[i]<<" ";
  // cout<<endl;

  return;
}

int main(){

  fastIO;
  //take_fileIO();
  solve();
  return 0;
}

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

int main() {
  double N,x;
  cin >> N;
  string u;
  double sum =0;
  for (int i=0;i<N; i++) {
    cin >> x >> u;
    if (u == "JPY") {
      sum += x;
    }
    else {
      sum += x*380000;
    }
  }
  cout << sum << endl;
}



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

using namespace std;

#define loop(n) for(int ii = 0; ii<n; ii++)

int main(){
    int n;
    long long int a[300000];
    
    cin >> n;
    loop(n){
        cin >> a[ii];
    }
    
    sort(a,a+n);

    loop(n-1){
        if(a[ii] == a[ii+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}

Measured memory_bytes: 1792
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func combi(n int, k int) int {
	a := 1
	b := 1
	for i := 0; i < k; i++ {
		a *= n - i
		b *= (k - i)
	}
	return a / b
}

func check(s string, k int) bool {
	l := len(s)
	var c int
	for i := 0; i < l; i++ {
		a, _ := strconv.Atoi(s[i : i+1])
		if a != 0 {
			c++
		}
		if c > k {
			return false
		}
	}
	if c == k {
		return true
	}
	return false
}

func run(s string, k int) int {
	l := len(s)
	dp := make([][]int, l)
	dpm := make([][]int, l)
	a := make([]int, l)
	for i := 0; i < l; i++ {
		a[i], _ = strconv.Atoi(s[i : i+1])
		dp[i] = make([]int, 3+1)
		dpm[i] = make([]int, 3+1)
	}
	// init
	dp[0][0] = 0
	dp[0][1] = a[0]
	dp[0][2] = 0
	dp[0][3] = 0

	for i := 1; i < l; i++ {
		for j := 1; j <= 3; j++ {
			if j == 1 {
				dp[i][j] = dp[i-1][j] + 9
			} else if j == 2 {
				if check(s[0:i], j-1) {
					dp[i][j] = dp[i-1][j] + dp[i-1][j-1]*9 - (9 - a[i])
				} else {
					dp[i][j] = dp[i-1][j] + dp[i-1][j-1]*9
				}
			} else {
				if i == 1 {
					dp[i][j] = 0
				} else if dp[i-1][j-1] == 0 {
					dp[i][j] = 0
				} else if check(s[0:i], j-1) {
					dp[i][j] = dp[i-1][j] + dp[i-1][j-1]*9 - (9 - a[i])
				} else {
					dp[i][j] = dp[i-1][j] + dp[i-1][j-1]*9
				}
			}
		}
	}
	return dp[l-1][k]
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	s := next()
	k := nextInt()
	fmt.Println(run(s, k))
}


Measured memory_bytes: 640
N,K=map(int,input().split())
x=[0 for i in range(N)]
y=[0 for i in range(N)]
for i in range(N):
    a,b,c=map(str,input().split())
    a,b=int(a),int(b)
    if c=="W":
        b+=K
    a%=(2*K)
    b%=(2*K)
    x[i]=a
    y[i]=b
board=[[0 for j in range(2*K+1)] for i in range(2*K+1)]
for i in range(N):
    if y[i]>=K:
        y[i]-=K
        x[i]=(x[i]+K)%(2*K)
    if x[i]>=K and y[i]<K:
        board[0][y[i]+1]+=1
        board[0][y[i]+K+1]-=1
        board[x[i]-K+1][y[i]+1]-=2
        board[x[i]-K+1][y[i]+K+1]+=2
        board[x[i]-K+1][0]+=1
        board[x[i]+1][0]-=1
        board[x[i]+1][y[i]+1]+=2
        board[x[i]+1][y[i]+K+1]-=2
    if x[i]<K and y[i]<K:
        board[0][y[i]+1]-=1
        board[0][y[i]+K+1]+=1
        board[x[i]+K+1][y[i]+1]-=2
        board[x[i]+K+1][y[i]+K+1]+=2
        board[x[i]+K+1][0]+=1
        board[x[i]+1][0]-=1
        board[x[i]+1][y[i]+1]+=2
        board[x[i]+1][y[i]+K+1]-=2
        board[0][0]+=1
coard=[[0 for j in range(2*K)] for i in range(2*K)]
doard=[[0 for j in range(2*K)] for i in range(2*K)]
for i in range(2*K):
    for j in range(2*K):
        if i==0:
            coard[i][j]=board[i][j]
        else:
            coard[i][j]=board[i][j]+coard[i-1][j]
for i in range(2*K):
    for j in range(2*K):
        if j==0:
            doard[i][j]=coard[i][j]
        else:
            doard[i][j]=coard[i][j]+doard[i][j-1]
ans=0
for i in range(2*K):
    for j in range(2*K):
        ans=max(ans,doard[i][j])
print(ans)



Measured memory_bytes: 141260
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main () {
  int REN[100] = {0, 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};
  int K, ans;
  cin >> K;
  ans = REN[K];
  // printf("%d\n", ansA);
  // printf("%d\n", ansB);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

inline void write_bool(bool b, const string &tval, const string &fval) {
  cout << (b ? tval : fval) << endl;
} 
inline void YESNO(bool b) { return write_bool(b, "YES", "NO"); }
inline void YesNo(bool b) { return write_bool(b, "Yes", "No"); }
inline void yesno(bool b) { return write_bool(b, "yes", "no"); }


int main() {
  int a, b, c;
  while (cin >> a >> b >> c) {
    cout << max(0, c - (a - b)) << endl;
  }
}


Measured memory_bytes: 888
#include <stdio.h>
#include <stdlib.h>


#define	ll_int	long long int
#define	INF	1000000001


int main()
{
	int n, m;
	ll_int *A, *B;
	int count;
	int i, j, k;

	scanf("%d", &n);
	A = (ll_int *)malloc(sizeof(ll_int) * (n + 1));
	for(i = 0; i < n; i++)
		scanf("%lld", &A[i]);
	A[n] = INF;

	scanf("%d", &m);
	B = (ll_int *)malloc(sizeof(ll_int) * (m + 1));
	for(i = 0; i < m; i++)
		scanf("%lld", &B[i]);
	B[m] = INF;


	// A, Bの要素を比較していく
	j = k = count = 0;
	for(i = 0; i < n + m - count; i++){
		if(A[j] == B[k]){
			j++;
			k++;
			count++;
		}else if(A[j] < B[k])
			printf("%lld\n", A[j++]);
		else if(B[k] < A[j])
			printf("%lld\n", B[k++]);
	}

	return 0;
}


Measured memory_bytes: 4916
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) xmax = x; return true;
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) xmin = x; return true;
    return false;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

ll n, m, q; 
vector<ll> a, b, c, d;

ll score(const vector<int>& A) {
    ll ret = 0;
    FOR(i, 0, q) {
        if (A[b[i]] - A[a[i]] == c[i]) {
            ret += d[i];
        }
    }
    return ret;
}

ll dfs(vector<int>& A) {
    if (A.size() == n) {
        return score(A);
    }
    ll res = 0;
    int prev = (A.empty() ? 0 : A.back());
    for (int i = prev; i < m; ++i) {
        A.push_back(i);
        res = max(res, dfs(A));
        A.pop_back();
    }
    return res;
}

void solve() {
    cin >> n >> m >> q;
    a.resize(q), b.resize(q), c.resize(q), d.resize(q);
    FOR(i, 0, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i];
        --b[i];
    }
    vector<int> A;
    cout << dfs(A) << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <map>

using namespace std;

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

int main(void) {
    int N, Q;
    cin >> N >> Q;
    vector<int> c(N+1);
    for(int i=1; i<=N; i++) {
        cin >> c[i];
    }
    vector< tuple<int,int,int> > v(Q);
    for(int j=0; j<Q; j++) {
        int l, r;
        cin >> l >> r;
        v[j] = make_tuple(r, l, j);
    }

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

    vector<int> ans(Q), last(N+1);
    BinaryIndexedTree<int> bit(N+1);

    int i = 1;
    for(auto [r, l, j]: v) {
        while(i <= r) {
            bit.add(last[c[i]], -1);
            last[c[i]] = i;
            bit.add(i, 1);
            ++i;
        }
        ans[j] = bit.sum(r) - bit.sum(l-1);
    }

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


Measured memory_bytes: 17376
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] array = new int[n];

        for (int i = 1; i < n; i++) {
            array[sc.nextInt() -  1]++;
        }
        for (int i = 0; i < n; i++) {
            System.out.println(array[i]);
        }
    }
}

Measured memory_bytes: 61832
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin >> n;
	int a[2][n];
	REP(i, n) cin >> a[0][i];
	REP(i, n) cin >> a[1][i];
	int m = 0;
	REP(i, n){
		int tmp = 0;
		REP(j, n){
			if(j <= i) tmp += a[0][j];
			if(j >= i) tmp += a[1][j];
		}
		m = max(m, tmp);
	}
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//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 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,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(a * b >= c * d) cout << a*b;
    else cout << c * d;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int n,want;
int a[MAXN];

void run() {
	scanf("%d%d",&n,&want); REP(i,n) scanf("%d",&a[i]);
	int g=a[0]; FOR(i,1,n) g=gcd(g,a[i]);
	int mx=a[0]; FOR(i,1,n) mx=max(mx,a[i]);
	printf("%s\n",want%g==0&&want<=mx?"POSSIBLE":"IMPOSSIBLE");
}

int main() {
	run();
	return 0;
}


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

#define rep0(i, n) for(int i=0; i<(int)(n);i++)
#define rep1(i, n) for(int i=1; i<=(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

using namespace std;

typedef uint64_t ulint;
typedef int64_t lint;

// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;

template<class T> lint sum(vector<T> a);
template<class T> double ave(vector<T> a);
template<typename T> ostream& operator << (ostream& s, const vector<T>& v);
ulint gcd(lint a, lint b);
ulint lcm(lint a, lint b);

bool flagdebug = false;





int main(){
//////////////////////////////////////////////////////

    flagdebug = true; ///本番時削除！！！！！

    //入力

    lint n, k;
    cin >> n >> k;

    // vector<lint> a(n);
    //2次元配列
    //vector<vector<lint>> mat(row, vector<lint>(column, 初期値));

    lint ans = 0;
    lint a = 1;
    while(1)
    {
        a *= k;
        ans ++;
        if(a > n)break;
    }
    //debug(ans);

    cout << ans << endl;

    //2次元配列
    //vector<vector<lint>> mat(row, vector<lint>(column, 初期値));
    //ペア
    //pair<lint,lint> p = make_pair(1,2);
    //vector<pair<lint,lint>> c(100010, pair<lint,lint>(0,0));
    //タプル
    //tuple<lint,lint,lint> t  = make_tuple(1,2,3);


    //昇順ソート
    //sort(all(a));
    //降順ソート
    //sort(all(a),greater<lint>());
    //特殊なソート（ラムダ式）
    //sort(all(mat), [&i](const vector<lint> &a, const vector<lint> &b){return a[i] < b[i];});
    // //[&i]は参照する変数，いらなければからの大括弧でよし．
    //ソート済集合（順序付き集合）
    //set<lint> st;
    //itr.insert(0);
    //auto itrmin = st.begin(); //最小値の次へアクセス
    //auto itrmax = st.end(); //最大値の次へアクセス（かならずデクリメントが必要）
    //itrmax --; //最大値はst.end()の1つ前
    //st.erase(0);
    //st.find;
    
    //////////////////////////////////////////////////////
    //キュー
    //queue<lint> que;
    //que.push(value);
    //que.front(); //トップを参照（消されないので消したい場合は直後にpop()を使う）
    //que.pop(); //追い出す
    //que.empty(); //空なら1，あれば0
    //優先度付きキュー
    //priority_queue<lint> que;
    //キューにque.push()で入れると最大値順に並べられる．que.pop()で取り出すときは常に最大値が前にくる．
    //最小値から取り出したい時はpriority_queue< lint, std::vector<lint>, std::greater<lint> >
    //////////////////////////////////////////////////////
    //スタック
    //stack<lint> stk;
    //stk.push(value);
    //stk.top(); //先頭を参照（消されないので消したい場合は直後にpop()を使う）
    //stk.pop(); //トップを削除
    //stk.empty(); //空なら1,あれば0
    //stk.size(); //数
    //
    // sort(input.begin() , input.end());
    // uint64_t max = numeric_limits<uint64_t>::max();

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}

//vectorprint用
template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
    s << "[\t";
    for (auto i = v.begin(); i < v.end() - 1; i++){s << *i << "\t";}
    s << *(v.end() - 1) << "\t]\n";
	return s;
}

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

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


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner (System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if((a<b) && (b<c)){
        System.out.println("Yes");    
        }
        else{
         System.out.println("No");    
        }

        }
}


Measured memory_bytes: 26316
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        final int k = scanner.nextInt();

        int count = 0;
        while (n > 0) {
            n /= k;
            count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23892
using System;
using System.Linq;

class P
{
    static void Main()
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToList();
        var N = input[0];
        var D = input[1];
        if (N % (D * 2 + 1) > 0)
            Console.WriteLine(N / (D * 2 + 1) + 1);
        else
        {
            Console.WriteLine(N / (D * 2 + 1));
        }



    }
}



Measured memory_bytes: 11220
nx = map(int, raw_input().split())
l = map(int, raw_input().split())
 
n = nx[0]
x = nx[1]
 
d = 0
i = 1
 
while True:
    if d <= x:
        d += l[i-1]
        i += 1
    if d > x:
        print(i-1)
        break
    if i == n + 1:
      print(i)
      break
  

Measured memory_bytes: 2568
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
const int mod = 1000000007;
#define ll long long

struct Dish {
	ll A, B, C;
	bool operator <(const Dish & b) {
		return C < b.C;
	}
};
Dish D[100010];
int main()
{
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> D[i].A >> D[i].B;
		D[i].C = -abs(D[i].A + D[i].B);
	}
	sort(D, D + N);
	for (int i = 0; i < N; i++) {
		D[i].C *= -1;
	}
	ll ans = 0;
	for (int i = 0; i < N; i += 2) {
		ans += D[i].A;
	}
	for (int i = 1; i < N; i += 2) {
		ans -= D[i].B;
	}
	cout << ans << endl;
}


Measured memory_bytes: 2560
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007




n = I()
print(n // 2 + n % 2)

Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
int stones[101];
int steps[101];

int main() {
	int N, K;
	scanf("%d %d", &N, &K);
	int pos = 0;
	for (int i = 0; i < N; ++i) {
		int stone;
		scanf("%d", &stone);
		if (i == 0) {
			steps[pos] = 0;
			stones[pos] = stone;
		}
		else {
			int m = 0x7FFFFFFF;
			for (int j = 1; j <= K && j<=i; j++) {
				int tmp = abs(stone - stones[(pos - j + K) % K]) + steps[(pos - j + K) % K];
				m = min(m, tmp);
			}
			steps[pos] = m;
			stones[pos] = stone;
		}
		pos = (pos + 1) % K;
	}

	printf("%d\n", steps[(pos - 1 + K) % K]);
	system("pause");
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<char> idx(N);
  vector<string> S;
  string P = "";
  string Q = "";
  rep(i,N){
    idx[i] = (i+1 + '0');
  }
  rep(i,N){
    char p;
    cin >> p;
    P = P + p;
  }
  rep(i,N){
    char q;
    cin >> q;
    Q = Q + q;
  }
  do{
    string s = "";
    rep(i,N){
      s = s + idx[i];
    }
    S.push_back(s);
  }while(next_permutation(idx.begin(),idx.end()));
  sort(S.begin(),S.end());
  int a = 0;
  int b = 0;
  rep(i,S.size()){
    if(S[i] == P) a = i;
    if(S[i] == Q) b = i;
  }
  cout << abs(a-b) << endl;
}

Measured memory_bytes: 2424
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 #define PI 3.141592653
using namespace std;



void solve(){
	int n; cin>>n;
	cout<<n*n*n;

}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout<<fixed<<setprecision(12);
	int t =1; //cin>>t;
	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,m,p,x,i;
	int a[110],sum=0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
	}
	cin >> m;
	for(i=0;i<m;i++){
		cin >> p >> x;
		cout << sum-a[p-1]+x << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import collections

N, M = list(map(int, input().split()))
likes = []
for i in range(N):
    x = list(map(int, input().split()))
    _ = x.pop(0)
    likes += x

col = collections.Counter(likes)
count = 0
for k, v in col.items():
    if v == N:
        count += 1

print(count)

Measured memory_bytes: 3316
/** 
 *  Author : Parth Prajapati aka (PARTH_4399, hungry_chef)
 *  Institute : Pandit Deendayal Petroleum University
 **/
#include<bits/stdc++.h>

using namespace std; 

#define start_cooking int main()
#define food_is_ready return 0;
#define main_ingredient_added ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void cook()
{
    // start with your recipe
    long long i, j, n, cnt = 0, ans = 0;
    cin>>n;
    while(n%2 == 0)
    {
        n /= 2;
        ++cnt;
    }
    for(i=1;;++i)
    {
        if(cnt >= i)
        {
            cnt -= i;
            ++ans;
        }
        else
            break;
    }
    for(j=3;j<=sqrt(n);j+=2)
    {
        cnt = 0;
        while(n%j == 0)
        {
            n /= j;
            ++cnt;
        }
        for(i=1;;++i)
        {
            if(cnt >= i)
            {
                cnt -= i;
                ++ans;
            }
            else
                break;
        }
    }
    if(n != 1)
        ++ans;
    cout<<ans;
}

start_cooking
{
    main_ingredient_added
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while(t--)
        cook();
    food_is_ready
}


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

using namespace std;

#define ll long long
#define ull unsigned long long

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

    int k;
    cin >> k;

    queue<ll> q;
    for (ll i = 1; i <= 9; i++) q.push(i);
    ll x;
    for (int i = 1; i <= k; i++) {
        x = q.front();
        q.pop();
        if (x % 10 != 0) q.push(10 * x + (x % 10) - 1);
        q.push(10 * x + x % 10);
        if (x % 10 != 9) q.push(10 * x + (x % 10) + 1);
    }

    cout << x << '\n';
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <unordered_map>
#include <cstdio>
#include <climits>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int par[100010], ran[100010];

void init(int n_) { for (int i = 1; i <= n_; i++)par[i] = i; };

int find(int x) {
	if (par[x] == x)return x;
	else return par[x] = find(par[x]);
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (ran[x] < ran[y])par[x] = y;
	else {
		if (ran[x] == ran[y])ran[x]++;
		par[y] = x;
	}
}

int n, m;

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> n >> m;
	init(n);
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		unite(a, b);
	}
	set<int> st;
	for (int i = 1; i <= n; i++)st.insert(find(i));
	cout << (int)st.size() - 1 << endl;
}

Measured memory_bytes: 8020
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < ll, ll > pl;
typedef vector < pi > vi;
typedef vector < pi > vl;

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-6;

const int MAX_N = (int)1e5 + 5;
const int mod = (int)1e9 + 7;

int n, k;
int a[MAX_N];

void out(bool tp) {
    if (!tp)
        puts("IMPOSSIBLE");
    else
        puts("POSSIBLE");
    exit(0);
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    cin >> n >> k;
    int x = 0, maxi = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        maxi = max(maxi, a[i]);
        x = __gcd(x, a[i]);
    }
    if (k % x == 0 && k <= maxi)
        out(1);
    else
        out(0);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
long long cm,ca,cr,cc,ch;

int main() {
  int N;
  scanf("%d", &N);
  string a[N];
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }

  string b[N];
  for (int i = 0; i < N; ++i){
    if(a[i][0]=='M') ++cm;
    if(a[i][0]=='A') ++ca;
    if(a[i][0]=='R') ++cr;
    if(a[i][0]=='C') ++cc;
    if(a[i][0]=='H') ++ch;
  }

  long long ans = 0;
  ans += cm*ca*cr;
  ans += cm*ca*cc;
  ans += cm*ca*ch;
  ans += cm*cr*cc;
  ans += cm*cr*ch;
  ans += ca*cr*cc;
  ans += ca*cr*ch;
  ans += ca*cc*ch;
  ans += cm*cc*ch;
  ans += cr*cc*ch;

  cout << ans << endl;




  

}



Measured memory_bytes: 6912
#include <iostream>
using namespace std;
int main()
{
	int a, b, k;
	cin >> k >> a >> b;
	for (int i = 1; i <= 1000; i++)
	{
		if (a <= i * k && i * k <= b)
		{
			cout << "OK" << endl;
			return 0;
		}
		if (i * k > b)
			break;
	}
	cout << "NG" << endl;
	return 0;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(M);
  cout << 24 + (24 - M) << endl;

  return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int ans[200000];

int main() {
    int n, i;
    vector <pair<int, int>> v;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        v.push_back(make_pair(x, i));
    }
    
    sort(v.begin(), v.end());
    
    for (i = 0; i < n; i++) {
        if (i < n / 2) {
            ans[v[i].second] = v[n / 2].first;
        } else {
            ans[v[i].second] = v[n / 2 - 1].first;
        }
    }
    
    for (i = 0; i < n; i++) printf("%d\n", ans[i]);
    
    return 0;
}


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

int main(){
	int N,W;
	cin >> N >> W;
	vector<ll> w(N);
	vector<ll> v(N);
	rep(i,N){
		cin >> w[i] >> v[i];
	}
	
	ll dp[105][100005];
	rep(i,N){
		rep(j,W){
			dp[i][j] = 0;
		}
	}
	
	rep(i,N){
		rep(j,W+1){
			if(j-w[i] >= 0){
				dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]);
			}
			dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
		}
	}
	
	cout << dp[N][W] << endl;
	
	
}

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


// Sieve of Eratosthenes
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  int m = 100000;
  Sieve sieve(m);
  vector<int> s;
  for(int x=1;x<=m;x+=2) {
    if(sieve.isPrime(x) && sieve.isPrime((x+1)/2)) s.push_back(x);
  }
  vector<ll> ans;
  int q;
  cin >> q;
  rep(i,q) {
    int l, r;
    cin >> l >> r;

    auto litr = lower_bound(s.begin(), s.end(), l);
    auto ritr = upper_bound(s.begin(), s.end(), r);
    auto index = distance(litr, ritr);
    ans.push_back(index);
  }

  rep(i, q) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4752
n = int(input())
p = input().split()
p = [int(x) for x in p]
c = 0
for i in range(1,n-1):
  if (p[i-1] <= p[i] and p[i] <= p[i+1]) or (p[i+1] <= p[i] and p[i] <= p[i-1]):
    c +=1
print(c)

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
    int n;
    int b, f, r, v;
    int i, j;
    int data[12][10];

    for (i = 0; i < 12; i++) {
        for (j = 0; j < 10; j++) {
            data[i][j] = 0;
        }
    }

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d %d %d %d", &b, &f, &r, &v);
        data[((b - 1) * 3) + (f - 1)][r - 1] += v;
        if (data[((b - 1) * 3) + (f - 1)][r - 1] < 0) {
            data[((b - 1) * 3) + (f - 1)][r - 1] = 0;
        }
        else if (data[((b - 1) * 3) + (f - 1)][r - 1] > 9) {
            data[((b - 1) * 3) + (f - 1)][r - 1] = 9;
        }
        else {

        }
    }

    for (i = 0; i < 12; i++) {
        for (j = 0; j < 10; j++) {
            printf(" %d", data[i][j]);
        }
        printf("\n");
        if (i % 3 == 2 && i != 11) {
            printf("####################\n");
        }
    }


    return 0;
}


Measured memory_bytes: 2044
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val A = sc.nextInt

    if (N % 500 <= A) "Yes" else "No"
  }
}



Measured memory_bytes: 27300
N = int(input())
H = list(map(int,input().split()))

DP = [1000000000 for _ in range(N+10)]
DP[0] = 0
for i in range(N):
    if i+1 < N:
        DP[i+1] = min(DP[i+1], DP[i] + abs(H[i] - H[i+1]))
    if i+2 < N:
        DP[i+2] = min(DP[i+2], DP[i] + abs(H[i] - H[i+2]))
print(DP[N-1])


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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  while(true){
    int h,w;
    cin >> h >>w;
    if(h==0) break;
    int len=h*h+w*w;
    bool flag=false;
    int resh=300,resw=300;
    for(int hei=1;hei<250;hei++){
      for(int wid=hei+1;wid<255;wid++){
        if(len<hei*hei+wid*wid && hei*hei+wid*wid<resh*resh+resw*resw){
          resh=hei;
          resw=wid;
        }
        else if(len==hei*hei+wid*wid && hei>h) {
          flag =true;
          resh=hei;resw=wid;
        }
        if(flag) break;
      }
      if(flag) break;
    }
    cout << resh << " " << resw << endl;
  }
}

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

int main()
{
	char hoshino[8] = "Hoshino";
	char buff[1002];
	char *index;
	int stringCount;
	int i;
	int j;
	int chain;

	scanf("%d",&stringCount);
	scanf("*%s",buff);
	for (i = 0; stringCount > i; ++i) {
		fgets(buff,sizeof(buff),stdin);
		while ('\n' == *buff) {
			fgets(buff,sizeof(buff),stdin);
		}
		chain = 0;
		for (index = buff; '\0' != *index; ++index) {
			if (hoshino[chain] != *index) {
				chain = 0;
			}
			if (hoshino[chain] == *index) {
				++chain;
			}
			if (7 == chain) {
				*index = 'a';
				chain = 0;
			}
		}
		printf("%s",buff);
	}
	return 0;
}

Measured memory_bytes: 600
class Dice < Array
	def roll!(drct)
		drct.split("").each{|s|
		case s
		when "E" then
			self.replace([at(3),at(1),at(0),at(5),at(4),at(2)])
		when "N" then
			self.replace([at(1),at(5),at(2),at(3),at(0),at(4)])
		when "S" then
			self.replace([at(4),at(0),at(2),at(3),at(5),at(1)])
		when "W" then
			self.replace([at(2),at(1),at(5),at(0),at(4),at(3)])
		when "R" then
			self.replace([at(0),at(3),at(1),at(4),at(2),at(5)])
		end
		}
	end
	def is_top
		at(0)
	end
	def getr!(face)
		while at(0) != face[0] do
			roll!(["E","N","S","W"].sample)
		end
		while at(1) != face[1] do
			roll!("R")
		end
		at(2)
	end
	def is_eq(dice)
		for i in 1..4 do
			for j in 1..4 do
				return "Yes" if self == dice
				roll!("R")
			end
			roll!("E")
		end
		for i in 1..3 do
			roll!("N")
			for j in 1..4 do
				return "Yes" if self == dice
				roll!("R")
			end
		end
		return "No"
	end
end

a = Dice.new(gets.split.map(&:to_i))
b = Dice.new(gets.split.map(&:to_i))
puts a.is_eq(b)

Measured memory_bytes: 8772