akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 2e3;
int a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  cout << max(0, a-b*2) << endl;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
from math import floor, log

def main():
    N = int(readline())
    dp = [i for i in range(N+1)]

    for i in range(N):
        dp[i+1] = min(dp[i+1], dp[i]+1)
        for e in range(1, 7):
            if i + 9**e <= N:
                dp[i+9**e] = min(dp[i+9**e], dp[i]+1)
        for e in range(1, 7):
            if i + 6**e <= N:
                dp[i+6**e] = min(dp[i+6**e], dp[i]+1)
    
    print(dp[N])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7064
<?php
while (true) {
  $answer = 0;
  $memo = [];
  $nums = explode(' ', trim(fgets(STDIN)));
  $max = $nums[0];
  $target = $nums[1];
  if (!$max && !$target) {
    break;
  }
  for ($i=1; $i <= $max; $i++) {
    for ($j=1; $j <= $max; $j++) {
      for ($k=1; $k <= $max; $k++) {
        if ($i + $j + $k == $target && !($i == $j || $i == $k || $j == $k)) {
          $tmp = [$i, $j, $k];
          sort($tmp);
          if(in_array($tmp, $memo) === false) {
            $memo[] = $tmp;
            $answer++;
          }
        }
      }
    }
  }
  echo $answer."\n";
}



Measured memory_bytes: 10176
#include <iostream>

using namespace std;

int MOD = 1e9 + 7;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long frac(int n) {
    long long ret = 1;
    for (int i = 1; i <= n; i++) ret = ret * i % MOD;
    return ret;
}

long long C(int a, int b) {
    return frac(a + b) * modinv(frac(a), MOD) % MOD * modinv(frac(b), MOD) % MOD;
}

int main() {
    int x, y;
    cin >> x >> y;
    int a = (x * 2 - y) / 3;
    int b = (y * 2 - x) / 3;
    if ((x + y) % 3 != 0 || a < 0 || b < 0) {
        cout << 0 << endl;
        return 0;
    }
    cout << C(a, b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	int m;
	cin >> m;
	cout << 48 - m << endl;
	
	return 0;
}

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

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

    int cnt = 0;
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] != s[i + 1]) cnt++;
    }

    cout << cnt << endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pii;
typedef pair<ll , ll> pll;
typedef vector <pair <int, int>> vpii;
typedef vector <vvi> _3dveci;

int main()
{
    int n; cin >> n;
    vector <int> a(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    
    vector <int> state(n, INT_MAX);

    state[0] = 0;

    //forward
    for(int i = 0; i < n; i++)
    {
        state[i + 1] = min(state[i+1], state[i] + abs(a[i] - a[i+1]));
        state[i + 2] = min(state[i+2], state[i] + abs(a[i] - a[i+2]));       
    }
    cout << state[n-1] << endl;
}

Measured memory_bytes: 1024
// Problem : A - Coffee
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << " | ";
	err(++it, args...);
}

const ll inf = 1e18;
const int nax = 1e5 + 5;

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		string s;
		cin>>s;
		
		if(s[2] == s[3] && s[4] == s[5])
		{
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
 
using namespace std;
 
int main() {
  int N, Q,i,t;
  int a[100000] = {0};
  long K;
  
  cin >> N >> K >> Q;
  for ( i= 0; i<Q; i++){
    cin >> t;
    a[t-1] += 1;
  }
  
  for(i=0;i<N;i++){
    if((long)a[i] >(long) (Q-K) ){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  
  return 0;
}

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

int main() {

	int ans = 0;

	string str;

	cin >> str;
	int wk = 0;
	for (int i = 0; i < str.length(); i++) {
		if (str[i] == 'A' || str[i] == 'C' || str[i] == 'G' || str[i] == 'T') {
			wk++;
		}
		else {
			wk = 0;
		}

		if (wk > ans)ans = wk;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N,X = map(int,input().split())
# a:バンの数  b:パティの数
a,b = [1],[1]
for i in range(N):
    a.append(2*a[i] + 3)
    b.append(2*b[i] + 1)
def f(N,X):
    if N == 0:
        return 1
    if X == 1:
        return 0
    elif 1 < X <= a[N-1] + 1:
        return f(N-1,X-1)
    elif X == a[N-1] + 2:
        return b[N-1] + 1
    elif a[N-1] + 2 < X <= 2*a[N-1] + 2:
        return b[N-1] + 1 + f(N-1,X-(a[N-1]+2))
    elif X == 2*a[N-1] + 3:
        return 2*b[N-1] + 1
ans = f(N,X)
print(ans)

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

int main() {
    string s;
    cin>>s;
    int r=1410065407;
    for (int i=0;i<s.size()-2; i++) {
        string t={s[i],s[i+1],s[i+2]};
        int n=atoi(t.c_str());
        if (abs(n-753)<r) {
            r=abs(n-753);
        }
    }
    cout<<r<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
typedef long long int ll;
using namespace std;

int main() {
  int N, M, WA[100001] = {}, AC[100001] = {};
  int cor = 0, pena = 0;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int p;
    string S;
    cin >> p >> S;
    if (S == "AC") {
      if (AC[p] == 0) {
        AC[p] = 1;
        pena += WA[p];
        cor++;
      }
    }
    if (S == "WA") {
      WA[p]++;
    }
  }
  cout << cor << ' ' << pena << endl;
  return 0;
}


Measured memory_bytes: 1656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

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

  vector<ll> w(n), v(n);
  rep(i, n) cin >> w[i] >> v[i];

  vector<vector<ll> > dp(110, vector<ll>(100100));
  for (int i = 0 ; i < n; ++i) {
    for (int j = 0; j <= W; ++j) {
      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][j], dp[i + 1][j]);
    }
  }
  cout << dp[n][W] << endl;
}

Measured memory_bytes: 88560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
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; }
signed main(void){
    int h,w,k; cin>>h>>w>>k;
    vector <vector<char>> cake(h,vector <char>(w));
    vector <int> itigo(h);
    rep(i,h){
        rep(j,w){
            cin>>cake[i][j];
            if(cake[i][j] == '#') itigo[i]++;
        }
    }
    vector <vector<int>> ans(h,vector <int>(w));
    int now = 0;
    bool stop = false;
    
    rep(i,h){
        if(itigo[i]){
            now++;
            rep(j, w){
                ans[i][j] = now;
                if(cake[i][j] == '#'){
                    itigo[i]--;
                    if(itigo[i]) now++;
                }
            }
        }
        else {
            if(i == 0) continue;
            rep(j,h){
                if(!ans[i][j]){
                    ans[i][j] = ans[i-1][j];
                }
            }
        }
    }
    rep(i,h){
        if(i == 0) continue;
        rep(j,w){
            if(!ans[i][j]){
                ans[i][j] = ans[i-1][j];
            }
        }
    }
    rrep(i,h){
        if(i == h-1) continue;
        rep(j,w){
            if(ans[i][j] == 0){
                ans[i][j] = ans[i+1][j];
            }
        }
    }
    rep(i,h){
        rep(j,w){
            cout<<ans[i][j]<<' ';
        }
        cout<<endl;
    }
}


Measured memory_bytes: 1536
use std::env;
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let N = read::<i32>();
    let A = read::<i32>();

    println!("{}", N*N-A);
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	int a,b;
	char op;
	int ans;
	while(true){
	    a = in.nextInt();
	    op = in.next().charAt(0);
	    b = in.nextInt();

	    if(op == '+'){
		ans = a+b;
		System.out.println(ans);
	    }
	    else if(op == '-'){
		ans = a-b;
		System.out.println(ans);
	    }
	    else if(op == '/'){
		ans = a/b;
		System.out.println(ans);
	    }
	    else if(op == '*'){
		ans = a*b;
		System.out.println(ans);
	    }
	    else if(op == '?')break;
	}
    }
}



Measured memory_bytes: 26264
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;
using ll = long long int;


int main(void){
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++)
        cin >> a[i];
    for(ll i = 0; i < n; i++){
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0){
                cout << "DENIED" << endl;
                break;
            }
        }
        if(i==n-1)
            cout << "APPROVED" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll v;
vector<ll> *g;
bool *vis;
ll *dp;

void addEdge(ll x,ll y)
{
    g[x].push_back(y);
}


/*ll bfs(ll rt, bool vis[])
{
    vis[rt]=true;
    dp[rt]=0;
    queue<ll> q;
    q.push(rt);
    while(!q.empty())
    {
        rt = q.front();
        q.pop();
        for(auto it = g[rt].begin(); it!=g[rt].end(); it++)
        {
            dp[*it] = max(dp[*it] , dp[rt] + 1);
            q.push(*it);
            vis[*it] = true;
        }
    }
        
    return mx;
}*/


void dfs(ll rt)
{
    vis[rt]=true;
    for(auto it = g[rt].begin(); it!=g[rt].end(); it++)
    {
        if(!vis[*it])
            dfs(*it);
            
        dp[rt] = max(dp[rt] , dp[*it]+1);
    }
}


int main()
{
    ll e;
    ll i;
    cin>>v>>e;
    
    g=new vector<ll>[v+1];
    vis = new bool[v+1];
    dp = new ll[v+1];
    
    while(e--)
    {
        ll x,y;
        cin>>x>>y;
        addEdge(x,y);
    }
    
    memset(vis,false,sizeof(vis));
    memset(dp,0,sizeof(dp));
    
    for(i=1;i<=v;i++)
    {
        if(!vis[i])
            dfs(i);
    }
    
    ll mx = INT_MIN;
    for(i=1;i<=v;i++)
        mx = max(mx , dp[i]);
    
    cout<<mx;
    
    return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
   
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define deb(x) cout << #x << "=" << x << endl
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define int long long

   
 


void solve()
{
    int n;
    cin>>n;
    int a[n];
    for(auto &x:a)cin>>x;
    int ans=0,ma=0;
    for(int i=0;i<n;i++)
    {
        ma=max(ma,a[i]);
        ans+=abs(ma-a[i]);
    }
    cout<<ans;
    
}

int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    
	int t=1;
//	cin>>t;
	while(t--)solve();
	    
   
}


Measured memory_bytes: 5180
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
struct UnionFind{
	vector<int> par,rank,sz;
	UnionFind(int N){
		par.assign(N,0);
		rank.assign(N,0);
		sz.assign(N,1);
		rep(i,N) par[i]=i;
	}
	int find(int x){
		if(par[x]==x) return x;
		return par[x]=find(par[x]);
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	void unite(int x,int y){
		x=find(x),y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]) swap(x,y);

		//x becomes root
		par[y]=x;
		sz[x] += sz[y];
		if(rank[x]==rank[y]) rank[x]++;
	}
};
int main(){
	int N,M;
	cin>>N>>M;
	UnionFind UF(N);
	rep(i,M){
		int a,b;
		cin>>a>>b;
		a--,b--;
		UF.unite(a,b);
	}
	int x = min(UF.sz[UF.find(0)],UF.sz[UF.find(1)]);
	cout << (ll)N*(N-1)/2 - M - (ll)x*(N-x) << endl;
}


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

int main() {
   int N;
   cin >> N;
   vector<int> a(N), ans(N);
   for(int i = 0; i < N; i++) {
       cin >> a[i];
   }
int sum = 0;
   for(int i = N; i >= 1; i--) {
       sum = 0;
       for(int j = i; j <= N; j += i) {
        sum += ans[j - 1];
       }
       if(sum % 2 == a[i - 1]) { ans[i - 1] = 0; }
       else ans[i - 1] = 1;
   }
    int m = 0;
    for(int i = 0; i < N; i++) {
        if(ans[i] == 1) m++; 
    }
    cout << m << endl;
    for(int i = 0; i < N; i++) {
        if(ans[i] == 1) cout << i + 1 << " ";
    }
    return 0;
}

Measured memory_bytes: 4800
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    if(h1 > h2) h2 += 24;
    cout << (h2-h1)*60 + (m2-m1)-k << endl;
}

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

using namespace std;

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

	long long l;
	cin >> l;

	cout << fixed << setprecision(12) << (l*l*l)/27.0 << '\n';

	return 0;
}


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

int main(){
    int K,X;
    cin >> K >> X;
    for (int i = 0;i < (K * 2) - 2;i++){
        cout << X - K + 1 + i << " ";
    }
    cout << X + K - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int l = s.size();
  string ans = "AC";
  if(s[0] != 'A') ans = "WA";
  int cnt = 0;
  FOR(i, 1, l) {
    if(isupper(s[i])) {
      if(i == 1 || i == l - 1 || s[i] != 'C') ans = "WA";
      cnt++;
    }
  }
  if(cnt != 1) ans = "WA";
  cout << ans << endl;
  return 0;
}


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

void swap(int *x, int *y){
	int tmp = *x;
	*x = *y;
	*y = tmp;
}

int main(void){
	while(1){
		int num, i, j, max, min, count=0;
		int n[5], a[5], b[5];
		int flag=00;
		
		scanf("%d", &num);
		if(num==0) break;
			
		while(num!=6174){
			flag=1;
			max=0;
			min=0;
			
			for(i=0; i<4; i++){
				n[3-i] = (num % (int)pow(10,i+1) ) / (int)pow(10,i);	
				a[3-i]=n[3-i];
				b[3-i]=n[3-i];	
			}
			
			
			for(i=0; i<3; i++){
				if(n[i]!=n[i+1]){
					flag=0;
				}
			}
			
			if(flag==1){
				break;
			}
					
			for(i=0; i<4; i++){	
				for(j=0; j<4; j++){
					if(a[i] < a[j]) swap(&a[i], &a[j]);
					if(b[i] > b[j]) swap(&b[i], &b[j]);
				}
			}
			
			//for(i=0; i<4; i++)
				//printf("a[%d] = %d, b[%d] = %d\n", i, a[i], i, b[i]);
			
			for(i=0; i<4; i++){
				max += b[i] * (int)pow(10, 3-i);
				min += a[i] * (int)pow(10, 3-i);
			}
		 
			num = max-min;
			//printf("now: %d\n", num);
			
			count++;
		}
		
		if(flag!=0) printf("NA\n");
		else printf("%d\n", count);
	}
		
	return 0;
}

Measured memory_bytes: 652
N, M = map(int, input().split())
land = [[] for i in range(N)]
for _ in range(M):
    i, j = map(int, input().split())
    land[i - 1].append(j)
def landNumber(i,path):
    for j in range(len(land[i])):
        number=land[i][j]
        if path == 2:
            if number==N:
                print('POSSIBLE')
                exit()
            else:
                continue
        else:
            if len(land[number-1]) == 0:
                continue
            else:
                landNumber(number - 1, path + 1)
    return True

if M == 1:
    print('IMPOSSIBLE')
    exit()
if landNumber(0, 1):
    print('IMPOSSIBLE')
    exit()

Measured memory_bytes: 29080
// C - Slimes
#include <stdio.h>

int main(void){
    int i, j, n, cnt=1;
    char s[100010]={'\0'}, c;
    scanf("%d%s", &n, s);
    for(i=1; i<n; i++){
        if(s[i]!=s[i-1]){cnt++;}
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 256
import java.io._
import scala.io.StdIn.{readInt, readLine}

object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512)
  var count = 0
  class Node(var key:Int, var left:Node = null, var right:Node = null) { }

  def getNodeToInsert(node:Node,keyNode:Node):Node =
    if(node.key > keyNode.key) {
      if(node.left == null) node
      else getNodeToInsert(node.left,keyNode)
    } else {
      if(node.right == null) node
      else getNodeToInsert(node.right,keyNode)
    }

  def insert(tree:Node, keyNode:Node) = {
    val target = getNodeToInsert(tree,keyNode)
    if(keyNode.key < target.key) target.left = keyNode
    else target.right = keyNode
  }

  def inOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      inOrder(tree.left)
      out.write(" ")
      out.write(tree.key.toString)
      if(count<500) count += 1
      else { out.flush; count = 0 }
      inOrder(tree.right)
    }

  def preOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      out.write(" ")
      out.write(tree.key.toString)
      if(count<500) count += 1
      else {
        out.flush
        count = 0
      }
      preOrder(tree.left)
      preOrder(tree.right)
    }

  def main(args:Array[String]) = {
    val n = readInt
    val tree = new Node(-1)

    for(i<-0 until n) {
      val s = readLine.split(" ")
      s(0) match {
        case "insert" =>
          if(tree.key == -1) tree.key = s(1).toInt
          else insert(tree, new Node(s(1).toInt))
        case _ => {
          inOrder(tree)
          out.write("\n")
          out.flush()
          preOrder(tree)
          out.write("\n")
          out.flush()
        }
      }
    }
  }
}

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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int main(void){
  lli x; cin >> x;
  // find minimam positive integer n such that n(n + 1) / 2 ≥ x
  // n^2 + n - 2x ≥ 0 , (n + 1/2)^2 ≥ 2x - 1/4
  // n ≥ -1/2 + √(8x - 1) / 2, n ≤ -1/2 - √(8x - 1) / 2 < 0
  int res = ceil((sqrt(8 * x - 1) - 1) / 2);
  cout << res << "\n";
  return 0;
}

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

using namespace std;

const int MOD = 1000000000 + 7;

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

  char a, b;
  cin >> a >> b;
  if(a == b){
    cout << "H" << endl;
  }else{
    cout << "D" << endl;
  }
}

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

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

 int a = N%10;//一桁目
 int b = N-a;
  int c = b/100000000;//九桁目
  int f = (N-c*100000000)/10000000;//八桁目
  int g = (N-c*100000000-f*10000000)/1000000;//七桁目
  int h = (N-c*100000000-f*10000000-g*1000000)/100000;//六桁目
  int i = (N-c*100000000-f*10000000-g*1000000-h*100000)/10000;//五桁目
  int j = (N-c*100000000-f*10000000-g*1000000-h*100000-i*10000)/1000;//四桁目
  int l = (N-c*100000000-f*10000000-g*1000000-h*100000-i*10000-j*1000)/100;//三桁目
  int k =  b%100/10;//二桁目
  
  int X = a+c+f+g+h+i+j+k+l;//十進法で表したときの各桁の数字の和
  /*
  //各桁出力
  cout<<c<<endl;
  cout<<f<<endl;
  cout<<g<<endl;
  cout<<h<<endl;
  cout<<i<<endl;
  cout<<j<<endl;
  cout<<l<<endl;
  cout<<k<<endl;
  cout<<a<<endl;
  
  cout<<X<<endl;//十進法で表したときの各桁の数字の和を出力
  */

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

Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().split()))
odd = [0] * (10 ** 5 + 1)
even = [0] * (10 ** 5 + 1)
odd_cnt = []
even_cnt = []
ans = 0
for i in range(n):
    if i % 2 == 0:
        even[v[i]] += 1
    else:
        odd[v[i]] += 1
for i in range(10 ** 5 + 1):
    odd_cnt.append((odd[i], i))
    even_cnt.append((even[i], i))
even_cnt.sort(reverse=True)
odd_cnt.sort(reverse=True)
if even_cnt[0][1] == odd_cnt[0][1]:
    ans = n - max(even_cnt[0][0] + odd_cnt[1][0],
                  even_cnt[1][0] + odd_cnt[0][0])
else:
    ans = n - (even_cnt[0][0] + odd_cnt[0][0])
print(ans)

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

int main() {
    string S, s;
    int w;
    cin >> S >> w;
    for (int i = 0; i < S.length(); i += w) {
        s.push_back(S[i]);
    }
    cout << s << endl;
    return 0;
}

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

typedef long long ll;

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

    string s; cin >> s;
    if(s=="ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
	string s[3];
	rep(i,3)cin>>s[i];
	
	int t = 0;
	while(1){
		if(s[t].size()==0){
			cout<<(char)('A'+t)<<endl;
			break;
		}
		int tmp = s[t][0]-'a';
		s[t] = s[t].substr(1);
		t=tmp;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string concanate(string s,int k)
{
	string s1=s;
	for(int i=1;i<k;i++)
	{
		s+=s1;
	}
	return s;
}
int main()
{
	int k;
	cin>>k;
	string s="ACL";
	cout<<concanate(s,k)<<endl;
	return 0;
}

Measured memory_bytes: 3628
package main

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

//var warped [250000]int
//var cyc [250000]int

func main() {
	scanInit()

	n := nextInt()

	if n == 1 {
		fmt.Println(1)
		return
	}
	k := nextInt()
	al := make([]int, n+1)
	warped := make([]int, n+1)
	cyc := make([]int, n+1)

	for i := 1; i <= n; i++ {
		al[i] = nextInt()
	}

	now := 1
	warped[1] = 1
	cyc[1] = 1
	cycstartIdx := -1
	cycstartOffset := 1
	clen := 0
	for {

		if warped[al[now]] == 0 {
			cycstartOffset++
			warped[al[now]] = 1
			cyc[cycstartOffset] = al[now]
			now = al[now]
		} else {
			cycstartNum := al[now]
			//fmt.Println("DBG cyc detected cycstartNum=", cycstartNum, " warp=", warped) //! DBG

			for j := 1; j <= cycstartOffset; j++ {
				if cyc[j] == cycstartNum {
					cycstartIdx = j
				}
			}
			clen = cycstartOffset - cycstartIdx + 1
			cycstartOffset -= clen
			//fmt.Println("DBG cyc detected cycstartNum=", cycstartNum, " Idx=", cycstartIdx) //! DBG
			//fmt.Println("DBG cyc detected Offset=", cycstartOffset)//! DBG
			break
		}

	}
	//fmt.Println(cycstartIdx, cycstartOffset, " clen=", clen) //! DBG
	//fmt.Println("DBG: ", warped, cyc)                        //! DBG

	ans := 0
	if k < cycstartOffset {
		ans = cyc[1+k]
	} else {
		ans = cyc[1+cycstartOffset+(k-cycstartOffset)%clen]
	}

	fmt.Println(ans)
}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std;

int main(){

	int arr[3]; cin >> arr[0] >> arr[1] >> arr[2];
  
  	sort(arr,arr+3);
  
  	if(arr[0] == 5 && arr[1] == 5 && arr[2] == 7) cout << "YES\n";
 	else cout << "NO\n";

}


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

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

    if(S=="ABC"){
        ans="ARC";
    }else{
        ans="ABC";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n, k;
  cin >> n >> k;
  vi p(n);
  vector<double> pa(n);
  rep(i, n){
    cin >> p[i];
  }

  rep(i, n){
    pa[i] = (double)(p[i] + 1) / 2;
  }

  double x = 0;
  rep(i, k) x += pa[i];
  double ans = x;
  rep(i, n-k){
    x = x - pa[i] + pa[i+k];
    ans = max(ans, x);
  }
  printf("%.10lf\n", ans);
  return 0;
}

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

int main(){
    ll n;
    cin>>n;
    vector<ll> h(n);
    rep(i,n)cin>>h[i];
    ll cnt=0;
    ll ans=0;
    for(ll i=1;i<n;i++){
        if(h[i-1]>=h[i]){
            cnt++;
        }else{
            ans=max(ans,cnt);
            cnt=0;
        }
    }
    ans=max(ans,cnt);
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
// Problem : B - Mix Juice
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
} 
ll factorial[1000007];
ll fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ll i;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}
void bfs(vector<int> v[],int o,int n,int dp[]){
	queue<int> q;
	q.push(o);
	dp[o]=0;
	bool visited[n+1]={0};
	visited[o]=true;
	while(q.empty()==false){
		int a=q.front();
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(visited[v[a][i]]==false){
				visited[v[a][i]]=true;
				q.push(v[a][i]);
				dp[v[a][i]]=dp[a]+1;
			}
		}
	}
}
int nov[1000001];
bool visited[1000001];
int dp[1000001];
int dfs(vector<int> v[],int o)
{
    if(visited[o]==0)
    {
        visited[o]=1;
        for(int i=0;i<v[o].size();i++)
        {
            if(visited[v[o][i]]==0)
            {
            dp[v[o][i]]=dp[o]+1;
            nov[o]+=dfs(v,v[o][i]);
            }
        }
        return nov[o]+1;
    }
    else
    return 0;
}
// string s=bitset<64>(n).to_string();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ll sum=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>

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

using namespace std;

const int MAX_N = 100;

int N;
char S[MAX_N];
map<char, bool> included;

int main() {
    cin >> N;
    rep(i, N) cin >> S[i];

    for (int i = 0; i < N; i++) {
        included[S[i]] = true;
    }

    int cnt = 0;
    for (map<char, bool>::iterator i = included.begin(); i != included.end(); ++i) {
        cnt++;
    }

    if (cnt == 4) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }
}


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

using namespace std;

int n,ans,i;

bool pd(int x);

int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		if(pd(i))
			ans++;
	printf("%d",ans);
	return 0;
}

bool pd(int x)
{
	int len=0;
	while(x!=0)
	{
		len++;
		x/=10;
	}
	if(len%2==1)return 1;
	else return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

#define ll long long

using namespace std;


int main() {
  int K, N; cin >> K >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++) cin >> a[i];

  int ans = a[N-1] - a[0];

  for(int i=1;i<N;i++) {
    int st = a[i];
    int ed = a[i-1];
    ans = min(ans, K-st+ed);
  }
  cout << ans << endl;


  return 0;
}


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

int main() {
  string s;
  cin >> s;
  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  }
  if(s == "Cloudy"){
    cout << "Rainy" << endl;
  }
  if(s == "Rainy") {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]

a2 = [a[i] - i - 1 for i in range(n)]
mean = sum(a2) / len(a2)
median = np.median(np.array(a2))
b = np.floor(median)
a3 = sum([abs(a2[i] - b) for i in range(n)])
b = np.ceil(median)
a4 = sum([abs(a2[i] - b) for i in range(n)])
print(int(min(a3, a4)))


Measured memory_bytes: 35792
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
#include<bitset>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

int main(){
  int x, y, z;
  cin >> x >> y >> z;
  int res = (x-z)/(y+z);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;
 
 
const int MAX_N = int(1e6) + 10;
long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()
 
 
 
 
//s.reserve(32768); //updated !
//s.max_load_factor(0.25);

const int N=1e5+5;




bool ok(ll x,vector<ll> &a,int n,ll K){
    ll cnt=0;
    for(int i=0;i<n;i++){
        if(a[i]<=x)continue;
        else if(a[i]%x==0)cnt+=a[i]/x-1;
        else cnt+=a[i]/x;
    }

    if(cnt<=K)return true;
    else return false;
}

int last[500005];
int tree[500005];
int a[500005];
int ans[500005];

void update(int x,int v){
    while(x<500005){
        tree[x]+=v;
        x+=x&(-x);
    }
}

int query(int x){
    int ans=0;
    while(x>0){
        ans+=tree[x];
        x-=x&(-x);
    }
    return ans;
}


vector<pair<int,pair<int,int> > >queries;
int main(){

    int n,q;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }


    for(int i=1;i<=q;i++){
        int l,r;
        scanf("%d%d",&l,&r);
        queries.push_back({r,{i,l}});
    }

    sort(queries.begin(),queries.end());
    
    int query_counter=0;

    

    memset(last,-1,sizeof(last));

    for(int i=1;i<=n;i++){
        if(last[a[i]]!=-1){
            update(last[a[i]],-1);
        }

        update(i,1);
        last[a[i]]=i;
        

        while(query_counter<q && queries[query_counter].first==i){
            int L=queries[query_counter].second.second;
            int R=queries[query_counter].first;
            int indx=queries[query_counter].second.first;
            ans[indx]=query(R)-query(L-1);
           // cout<<query_counter<<" "<<R<<" "<<L<<" "<<query(R)-query(L-1)<<endl;
            query_counter++;
        }
    }

    for(int i=1;i<=q;i++){
        printf("%d\n",ans[i]);
    }




}
 
    
 
 
 
    
 
 
 
    
    
    
 
 
 
 
    
 
 
    
 
    
 
 
 
 
 
 
    
    
 
    
 
    
 
 
 
 
    
 


Measured memory_bytes: 17536
// Practice AtCoder
// author: Leonardone @ NEETSDKASU

// PDF解説読後

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let h = get!(usize);
    let w = get!(usize);
    let mut ab = vec![vec![0; w]; h];
    for i in 0..2 {
        for y in 0..h {
            for x in 0..w {
                ab[y][x] += get!();
                ab[y][x] = -ab[y][x];
            }
        }
    }
    let size = 160 * (w + h) + 1;
    let mut dp = vec![vec![vec![false; size]; w]; 2];
    dp[0][0][ab[0][0].abs() as usize] = true;
    for i in 1..w {
        for j in 0..size {
            if dp[0][i - 1][j] {
                let k = j as i64 + ab[0][i];
                dp[0][i][k.abs() as usize] = true;
                let k = j as i64 - ab[0][i];
                dp[0][i][k.abs() as usize] = true;
            }
        }
    }
    for y in 1..h {
        let p = y & 1;
        for i in 0..w {
            for e in dp[p][i].iter_mut() {
                *e = false;
            }
        }
        for j in 0..size {
            if dp[1 - p][0][j] {
                let k = j as i64 + ab[y][0];
                dp[p][0][k.abs() as usize] = true;
                let k = j as i64 - ab[y][0];
                dp[p][0][k.abs() as usize] = true;
            }
        }
        for i in 1..w {
            for j in 0..size {
                if dp[p][i - 1][j] || dp[1 - p][i][j] {
                    let k = j as i64 + ab[y][i];
                    dp[p][i][k.abs() as usize] = true;
                    let k = j as i64 - ab[y][i];
                    dp[p][i][k.abs() as usize] = true;
                }
            }
        }
    }
    let p = (h - 1) & 1;
    for j in 0..size {
        if dp[p][w - 1][j] {
            println!("{}", j);
            break;
        }
    }
}


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

int main()
{
    int N;
    cin >> N;
    int sum = 0;
    int num = N;

    while(num>0){
        sum += num % 10;
        num /= 10;
    }
    if(N % sum == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define mod 1000000007
#define INF 1e18+5
#define ll long long
#define maxn 16
using namespace std;

int ar[maxn+2][maxn+2],n;
ll dp[(1<<maxn)+2],pre[(1<<maxn)+2];

void recur(int i,vector<int>&not_taken,ll score_so_far,int mask,int group)
{
    if(i == not_taken.size()) {
        dp[mask] = max(dp[mask],score_so_far+pre[group]);
        return;
    }
    recur(i+1,not_taken,score_so_far,mask,group);
    recur(i+1,not_taken,score_so_far,mask|(1<<not_taken[i]),group|(1<<not_taken[i]));
}

int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>ar[i][j];
        }
    }

    for(int mask =0;mask<(1<<n);mask++)
    {
        for(int i=0;i<n;i++)
        {
            if(mask&(1<<i)) {
                for(int j=i+1;j<n;j++)
                {
                    if(mask&(1<<j))
                    {
                        pre[mask]+=ar[i][j];
                    }
                }
            }
        }
    }
    for(int i=0;i<(1<<n);i++) dp[i] = -INF;
    dp[0] = 0;
    for(int mask = 0;mask<(1<<n);mask++)
    {
        vector<int>not_taken;
        for(int i=0;i<n;i++)
        {
            if(!(mask&(1<<i))) {
                not_taken.push_back(i);
            }
        }
        recur(0,not_taken,dp[mask],mask,0);
    }
    cout<<dp[(1<<n)-1]<<endl;

}


Measured memory_bytes: 1280
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int m = int.Parse(In[1]);
            int Rmin = 100001;
            int Lmax = 0;
            for (int i = 0; i < m; i++)
            {
                string[] In2 = Console.ReadLine().Split(' ');
                int l = int.Parse(In2[0]);
                int r = int.Parse(In2[1]);
                Lmax = (int)Math.Max(Lmax, l);
                Rmin = (int)Math.Min(Rmin, r);
            }
            if (Lmax <= Rmin) Console.WriteLine(Rmin - Lmax + 1);
            else Console.WriteLine(0);
        }
    }
}

//TLE
//namespace C
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            string[] In = Console.ReadLine().Split(' ');
//            int n = int.Parse(In[0]);
//            int m = int.Parse(In[1]);
//            int[] Pass = new int[n+1];
//            for(int i=0; i < m; i++)
//            {
//                string[] In2 = Console.ReadLine().Split(' ');
//                int l = int.Parse(In2[0]);
//                int r = int.Parse(In2[1]);
//                for(int j = l; j <= r; j++)
//                {
//                    Pass[j]++;
//                }
//            }
//            int cnt = 0;
//            for (int i = 0; i <= n; i++)
//            {
//                if (Pass[i] == m) cnt++;
//            }
//            Console.WriteLine(cnt);
//        }
//    }
//}


Measured memory_bytes: 42440
#include <bits/stdc++.h>
#define int int64_t
#define pb push_back
#define pii pair<int, int>
#define F first
#define S second
#define vecsort(x) sort(x.begin(), x.end())
#define vecrsort(x) sort(x.rbegin(), x.rend())
#define massort(x, n) sort(x, x + n)
#define FOR(i, n) for(int i = 0; i < n; i ++)
using namespace std;
int max(int32_t a, int b){
   return max((int)a, b);
}

const int INF = 1e9 + 7;
const int N = 1e5 + 2000;

int dp[N];
int  h[N];

int32_t main(){
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   int n;
   cin >> n;
   FOR(i, n)
      cin >> h[i], dp[i] = INF;
   dp[0] = 0;
   for(int i = 0; i < n-1; i ++){
      dp[i+1] = min(dp[i+1], abs(h[i] - h[i+1]) + dp[i]);
      if(i + 2 < n){
         dp[i+2] = min(dp[i+2], abs(h[i] - h[i+2]) + dp[i]);
      }
   }
   cout << dp[n-1];
}



Measured memory_bytes: 1792
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort()
h=[]
ans=0
import heapq
j=0
for i in range(1,m+1):
    while j<n and ab[j][0]==i:
        heapq.heappush(h,-1*ab[j][1])
        j+=1
    if h:
        ans+=(-1*heapq.heappop(h))
print(ans)


Measured memory_bytes: 72792
#include<bits/stdc++.h>
#define man 10000
#define gosen 5000
#define sen 1000
#define rep(i,n) for(int (i)=0;(i)<=(n);(i)++)

using namespace std;

int N,Y;

int x,y,z;

int main()
{
	cin >> N >> Y;
	
	rep(i,N)
	{
		rep(j,N-i)
		{
			if(N-i-j>=0)
			{
				if((i*man+j*gosen+(N-i-j)*sen)==Y)
				{
					cout << i << " " << j << " " << N-i-j << endl;
					return 0;
				}
			}
		}
	}
	
	cout << -1 << " " << -1 << " " << -1 << endl;
	
	return 0;
}

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

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    long long int  n, m, ans = 1;
    cin >> n  >> m;
    for (int i = 1; i*i <= m; i++) {
        if (m % i == 0) {
            long long int  first = i, second = m / i;
            if (first * n <= m)
                ans = max(ans, first);
            if (second * n <= m)
                ans = max(ans, second);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256