akhauriyash/Code-Regression huggingface dataset:
//Optimise
#include <bits/stdc++.h>
using namespace std;

// #define multitest 1
#define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

int n, m;
vector<bool> v(2e5);
vector<ll> dp(2e5, -1);

ll ways(int level)
{
	if (level == n)
		return 1;
	if (v[level])
		return 0;
	if (level > n)
		return 0;
	if (dp[level] >= 0)
		return dp[level];
	ll ans = (ways(level + 1) + ways(level + 2)) % mod;
	return dp[level] = ans;
}

void solve()
{
	cin >> n >> m;
	// v.resize(n);
	int x;
	for (int i = 0; i < m; ++i)
	{
		cin >> x;
		v[x] = true;
	}
	cout << ways(0) << '\n';
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  if(n==1){
    cout << "Hello World" << endl;
    return 0;
  }
  else{
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
    return 0;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
    int n,a;
    double b=0;
    scanf("%d",&n);
    for(a=1; a<=n; a++)
    {
        if(a%2!=0)
            b++;
    }
    printf("%.10lf\n",b/n);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;
const double PI=3.14159265358979323846;

int main()
{

    double A ,B , H ,M;


    cin >> A >> B >> H >> M;


    double B_pose_x =  B*cos(-2.*PI*M/60.);
    double B_pose_y = B*sin(-2.*PI*M/60.);

    double A_pose_x = A *cos(-(2.*PI)/12.*H-(PI/6.)*M/60.);
    double A_pose_y  = A *sin(-(2.*PI)/12.*H-(PI/6.)*M/60.);



    double dist = sqrt(pow(B_pose_x-A_pose_x,2.) +  pow(B_pose_y-A_pose_y,2.));


    cout << fixed << setprecision(15) <<  dist << endl;



    return 0;
}

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

int main() {
  int N; cin>>N;
  long x=1, y=1;
  for (int i = 0; i < N; i++){
    long t,a;cin>>t>>a;
    long x_fac = (x+t-1)/t, y_fac = (y+a-1)/a;
    long fac = max(x_fac, y_fac);
    x = t * fac;
    y = a * fac;
  }
  cout<<x+y<<endl;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define slowanddetermined ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;


int main()
{
    slowanddetermined

    string st;
    cin>>st;
    int q;
    cin>>q;
    deque<char>s;
    for(auto i:st)s.push_back(i);

    int cnt=0;
    int pos;
    char ch;
    while(q--){

        int  n;
        cin>>n;

        if(n==1){
            cnt++;
        }
        else{
                cin>>pos;
                cin>>ch;
            //cin>>pos>>ch1>>ch;
            if(pos==1 && cnt%2==0){
                s.push_front(ch);
            }
            else if(pos==1 && cnt%2!=0){
                s.push_back(ch);
            }
            if(pos==2 && cnt%2!=0){
                s.push_front(ch);
            }
            else if(pos==2 && cnt%2==0){
                s.push_back(ch);
            }


        }


    }
    st="";
    for(auto i:s)st+=i;
    if(cnt%2==0){
        cout<<st;
    }
    else{
        reverse(st.begin(),st.end());
        cout<<st;
    }




    return 0;

}


Measured memory_bytes: 1296
#include <iostream>

using namespace std;

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

    if (N % 10 == 3) {
        cout << "bon" << endl;
    } else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

// Most important thing in CP - Have Fun :)

const int N = 2e5 + 5;

struct Point{
    int x, y;
    bool operator < (const Point &b )const{
        return (x<b.x) || (x==b.x && y<b.y);
    }
};

Point d[N], p0;

ll dist(Point p1,Point p2){
    return (abs(p1.x - p2.x) + abs(p1.y - p2.y));
}
ll crossProduct(Point a, Point b, Point c){
    Point ab, bc;
    ab.x=b.x-a.x; ab.y=b.y-a.y;
    bc.x=c.x-b.x; bc.y=c.y-b.y;
    ll s = 1ll*(ab.x)*bc.y - 1ll*(bc.x)*ab.y;
    return s;
}
void findP0(int n, Point d[]){
    p0 = d[1];
    for(int i=2; i<=n; ++i)
        if (p0<d[i]) p0 = d[i];
}

bool compare(Point p1, Point p2){
    ll o = crossProduct(p0, p1, p2);
    if (o == 0)
    return (dist(p0, p1)) < dist(p0, p2);
    return o>0;
}
Point q[N];
int t;
void convex(int n, Point d[]){
    findP0(n,d);
    sort(d+1,d+1+n,compare);
    t=1;
    q[1] = d[1];
    for(int i=2; i<=n; ++i) {
        while (t>1 && ( crossProduct(q[t-1],q[t],d[i])<=0) ) t--;
        q[++t] = d[i];
    }
}
ll kc(int i, int j){
    Point a = q[i];
    Point b = q[j];
    return abs(a.x-b.x)+abs(a.y-b.y);
}
int nextVertex(int i) {return i%t+1; }

void solve(){
	//write here
    cin.tie(NULL);
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1; i<=n; ++i) cin>>d[i].x>>d[i].y;

    convex(n,d);

    int j = 1;
    ll maxdist = 0;
    for(int i=1; i<t; ++i){
        while (kc(i,j) < kc(i,nextVertex(j)))
            j = nextVertex(j);
            maxdist = max(maxdist, kc(i,j));
        }
        cout<<maxdist<<"\n";
	return;
}

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	
		solve();
	return 0;
}

Measured memory_bytes: 5124
N = int(input())
l = list(map(int,input().split()))

for i in range(N):
  S1 = 0
  S2 = 0
  for j in range(i+1):
    S1 += l[j]
  for k in range(i+1,N):
    S2 += l[k]

  temp_min = S1 - S2
  if i==0:
    ans = abs(temp_min)
  elif ans > abs(temp_min):
    ans = abs(temp_min)

print(ans)


Measured memory_bytes: 3060
open Printf
open Scanf

let id x = x

let max_heapify h ar i =
  let swap i j =
    let t = ar.(i) in
    ar.(i) <- ar.(j);
    ar.(j) <- t in
  let rec iter i =
    let l = 2 * i in
    let r = 2 * i + 1 in
    let mi =
      let ti = if l <= h && ar.(l) > ar.(i) then l else i in
      if r <= h && ar.(r) > ar.(ti) then r else ti in
    if mi <> i then
      begin
        swap mi i;
        iter mi
      end
  in
  iter i
       
let build_max_heap h ar =
  let rec iter i =
    if i = 0 then ()
    else (max_heapify h ar i;
          iter (i-1))
  in iter (h / 2)
                          
let () =
  let h = scanf "%d\n" id in
  let hp = Array.init (h+1) (fun i -> if i = 0 then 0 
                                      else if i = h then let v = scanf "%d\n" id in v
                                      else let v = scanf "%d " id in v) in
  build_max_heap h hp;
  Array.iteri (fun i v -> if i <> 0 then printf " %d" v) hp;
  printf "\n"

Measured memory_bytes: 8588
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (unfoldr)

main :: IO ()
main = do
  (n : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  mapM_ putStrLn . concatMap (map (map (toEnum . (fromEnum 'a' +))) . fromTree n) . toTrees $ 0

data Tree = Node Int [Tree]

toTrees :: Int -> [Tree]
toTrees m = map (Node <$> id <*> (toTrees . max m . succ)) [0..m]

fromTree :: Int -> Tree -> [[Int]]
fromTree 1 (Node k _) = [[k]]
fromTree n (Node k ts) = map (k :) (concatMap (fromTree (pred n)) ts)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 4732
#include <stdio.h>

int main(void){
    int input[3];
    int i;
    scanf("%d",&input[0]);
    scanf("%d",&input[1]);
    scanf("%d",&input[2]);
    if(input[1]-input[0]+1<=2*input[2]){
        for(i=input[0];i<=input[1];i++){
            printf("%d\n",i);
        }
    }
    else{
        for(i=input[0];i<=input[0]+input[2]-1;i++){
            printf("%d\n",i);
        }
        for(i=input[1]-input[2]+1;i<=input[1];i++){
            printf("%d\n",i);
        }
    }

    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<vector<int>> sc(M, vector<int>(2));
  for (int i = 0; i < M; i++) {
    cin >> sc.at(i).at(0) >> sc.at(i).at(1);
  }
  
  bool can = true;
  
  if (M == 0) {
    if (N == 1) {
      cout << 0 << endl;
    }
    else if (N == 2) {
      cout << 10 << endl;
    }
    else if (N == 3) {
      cout << 100 << endl;
    }
  }
  else {
  
    for (int i = 0; i < M; i++) {
      if (sc.at(i).at(0) == 1 && sc.at(i).at(1) == 0 && N != 1) {
        can = false;
      }
    }
  
    vector<vector<int>> backet(N, vector<int>(0));
  
    for (int i = 0; i < M; i++) {
      for (int j = 0; j < N; j++) {
        if (j+1 == sc.at(i).at(0)) {
          backet.at(j).push_back(sc.at(i).at(1));
        }
      }
    }
  
    for (int i = 0; i < N; i++) {
      if (i == 0 && backet.at(i).size() == 0) {
        backet.at(i).push_back(1);
      }
      else if (backet.at(i).size() == 0) {
        backet.at(i).push_back(0);
      }
    }
  
    for (int i = 0; i < N; i++) {
      for (int j : backet.at(i)) {
        if (j != backet.at(i).at(0)) {
          can = false;
        }
      }  
    }
  
    if (can) {
      for (int i = 0; i < N; i++) {
        cout << backet.at(i).at(0);
      }
      cout << endl;
    }
    else {
      cout << -1 << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
h = gets.split.map(&:to_i)
cnt = []
c = 0
i = 0
while i+1 < h.size
  if h[i] >= h[i+1]
    c += 1
  else
    cnt.push c
    c = 0
  end
  i += 1
end
cnt.push c
p cnt.max


Measured memory_bytes: 8964
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9223372036854775807 //  巨大数INF
using namespace std;

signed main() {
  int k, x;
  cin >> k >> x;
  rep(i, 2*k-1) cout << x - k + 1 + i << ' ';
  cout << endl;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
c=[list(map(int,input().split())) for _ in range(10)]
a=[list(map(int,input().split())) for _ in range(h)]
for k in range(10):
  for i in range(10):
    for j in range(10):
      c[i][j]=min(c[i][j],c[i][k]+c[k][j])
s=0
for i in range(h):
  for j in range(w):
    if a[i][j]!=-1:
      s+=c[a[i][j]][1]
print(s)

Measured memory_bytes: 40284
#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

int N, M;
int A[301][301];
int current[301];
int selected[301];
int cnt[301];

int solve() {
    int ans = N;
    for(int k = 0; k < M - 1; k++) {
        for(int i = 0; i < M; i++) cnt[i] = 0;
        for(int i = 0; i < N; i++) {
            while(selected[A[i][current[i]]] == 0) current[i]++;
            cnt[A[i][current[i]]]++;
        }
        int tmp = 0, max_id;
        for(int i = 0; i < M; i++) {
            if(tmp < cnt[i]) {
                tmp = cnt[i];
                max_id = i;
            }
        }
        ans = min(ans, tmp);
        selected[max_id] = 0;
    }
    return ans;
}

int main() {
    fastio();
    cin >> N >> M;
    REP(i, N) REP(j, M) {
        cin >> A[i][j];
        A[i][j]--;
    }
    REP(i, M) selected[i] = 1;
    cout << solve() << "\n";
	return 0;
}

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

inline ll gcd(ll a,ll b){
	return b ?gcd(b,a%b) :a;
}

int main()
{
	ll a,b;
	scanf("%lld%lld",&a,&b);
	printf("%lld",a*b/gcd(a,b));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ll b=0,c=0,d=0,e,l,m,n,k,o=0,p,q,x,y,z,max1=0,s=0,ans,r,i1=-1;
    string t,u;

    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        o+=max(a[i],-a[i]);
    }
    sort(a,a+n);
    for(ll i=0;i<n;i++){
        if(a[i]>=0){
            i1=i;
            break;
        }
    }
    if(i1>0){
    cout<<o<<endl;
    ans=a[n-1];
    for(ll i=1;i<i1;i++){
        cout<<ans<<" "<<a[i]<<endl;;
        ans-=a[i];
    }
    b=a[0];
    for(ll i=n-2;i>=i1;i--){
        cout<<b<<" "<<a[i]<<endl;
        b-=a[i];
    }
    cout<<ans<<" "<<b<<endl;
    }
    
    if(i1==0){
    cout<<o-a[0]*2<<endl;
    ans=a[0]-a[1];
    cout<<a[0]<<" "<<a[1]<<endl;
    for(ll i=2;i<n-1;i++){
        cout<<ans<<" "<<a[i]<<endl;;
        ans-=a[i];
    }
    if(n!=2)cout<<a[n-1]<<" "<<ans<<endl;
    }
    
    if(i1==-1){
    cout<<o+a[n-1]*2<<endl;
    ans=a[n-1]-a[n-2];
    cout<<a[n-1]<<" "<<a[n-2]<<endl;
    for(ll i=n-3;i>=0;i--){
        cout<<ans<<" "<<a[i]<<endl;;
        ans-=a[i];
    }
    }
}




Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, m, s[400], l[400], p[400], w[400], dp[400][400];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    rep(i, 0, n) cin >> s[i] >> l[i] >> p[i];
    cin >> m;
    rep(i, 0, m) cin >> w[i];
    vector<int> ans;
    rep(f, 0, m) {
        rep(i, 0, n) erep(j, 0, w[f]) {
            if (j < s[i]) 
                dp[i+1][j] = dp[i][j];
            else 
                dp[i+1][j] = max(dp[i][j], dp[i+1][j-s[i]] + p[i]);
        }
        if (dp[n][w[f]] == 0) {
            cout << -1 << endl;
            return 0;
        } else {
            ans.pb(dp[n][w[f]]);
            memset(dp, 0, sizeof(dp));
        }
    }
    rep(i, 0, ans.size()) cout << ans[i] << endl;
    return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a[150][150],b,c,cmp,cmpp,data,m,h,w,x,y,xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

        cin >> x >> y;
        if(Abs(x,y)<=1){
            Cout("Brown");
        }
        else{
            Cout("Alice");
        }
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set

    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }

    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }

    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }

    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main(){
    int n,q; cin >> n >> q;
    vector<int> c(n);
    rep(i,n){
        cin >> c[i];
        c[i]--;
    }
    vector<pair<P, int>> query(q);
    rep(i,q){
        int l,r; cin >> l >> r;
        query[i].first.second = l; query[i].first.first = r;
        query[i].second = i;
    }
    sort(ALL(query));
    vector<int> ans(q);

    vector<int> pos(n, -1);
    BIT<int> bit(n+5);
    int now = 0;

    rep(j,q){
        int l = query[j].first.second, r = query[j].first.first, k = query[j].second;
        FOR(i,now, r) {
            int col = c[i];
            if(pos[col] != -1) bit.add(pos[col]+1, pos[col]+2, -1);
            pos[col] = i;
            bit.add(pos[col]+1, pos[col]+2, 1);
        }
        now = r;
        ans[k] = bit.sum(l, r+1);
    }

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


Measured memory_bytes: 19424
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    int N;
    scanf("%d",&N);

    int F[N][10];
    for(int i=0;i<N;i++){
        for(int j=0;j<10;j++) scanf("%d",&F[i][j]);
    }

    long P[N][11];
    for(int i=0;i<N;i++){
        for(int j=0;j<11;j++) scanf("%ld",&P[i][j]);
    }

    long ans=-9999999999;
    for(int p=1;p<(1<<10);p++){
        long tmp=0;
        ///店iについて
        for(int i=0;i<N;i++){
            int c=0;
            for(int j=0;j<10;j++){
                if((p>>j)&F[i][j]) c++;
            }
            tmp+=P[i][c];
        }
        ans=MAX(ans,tmp);
    }
    printf("%ld\n",ans);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll x,y;
	cin>>x>>y;
	if(y % 2 == 0){
		ll x1 = 2*x - y/2;
		if(x1 >= 0 && x1 <= x) cout<<"Yes"<<endl;
		else cout<<"No"<<endl; 
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3632
#!/usr/bin/env python

n, m = map(int, input().split())
l = []
l = [0] * n
for _ in range(m):
    a, b = map(int, input().split())  # 1-index
    l[a-1] += 1
    l[b-1] += 1

for i in l:
    print(i)


Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

int main()
{
	//freopen("read.in","r",stdin);
	//freopen("write.out","w",stdout);
	
	int n,ans=100000007;

	scanf("%d",&n);

	for(int i=1;i<=n/2+1;i++)
	{
		int a=i,b=n-a,suma=0,sumb=0;
		while(a>0)
		{
			suma+=a%10;
			a/=10;
		}
		while(b)
		{
			sumb+=b%10;
			b/=10;
		}
		if(suma+sumb<=ans) ans=suma+sumb;
	}
	printf("%d",ans);
	
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
import bisect

inf = float('inf')

def solve(A: int, B: int, Q: int, s: "List[int]", t: "List[int]", x: "List[int]"):
    for q in x:
        i_s = bisect.bisect(s, q)
        i_t = bisect.bisect(t, q)

        s_l = q - s[i_s-1] if i_s > 0 else inf
        s_r = s[i_s] - q if i_s < A else inf
        t_l = q - t[i_t-1] if i_t > 0 else inf
        t_r = t[i_t] - q if i_t < B else inf

        # 同じ方向に行く場合
        sltl = max([s_l, t_l])
        srtr = max([s_r, t_r])

        # 違う方向に行く場合
        sltr = min([s_l, t_r]) + sum([s_l, t_r])
        srtl = min([s_r, t_l]) + sum([s_r, t_l])

        min_d = min([sltl, srtr, sltr, srtl])

        print(min_d)
        
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    s = [ int(next(tokens)) for _ in range(A) ]  # type: "List[int]"
    t = [ int(next(tokens)) for _ in range(B) ]  # type: "List[int]"
    x = [ int(next(tokens)) for _ in range(Q) ]  # type: "List[int]"
    solve(A, B, Q, s, t, x)

if __name__ == '__main__':
    main()


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

typedef long long ll;

#define REP(i,m,n) for(int i=(int)m; i < (int)n; ++i)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()


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

    int n;
    string s;
    cin >> n >> s;
 
    vector<int> cntW(n+2);
    for(int i = 1; i <= n; ++i) {
    if(s[i-1] == 'W') cntW[i]++;
    cntW[i] += cntW[i-1];
    }
    vector<int> cntE(n+2);
    for(int i = 1; i <= n; ++i) {
    if(s[n-1-(i-1)] == 'E') cntE[i]++;
    cntE[i] += cntE[i-1];
    }

    int ans = 1e9;
    reverse(all(cntE));
    for(int i = 1; i <= n; ++i) {
    ans = min(ans, cntW[i-1]+cntE[i+1]);
    }
    cout << ans << '\n';
    return 0;
}

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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 58;
int N;
int64 A[100000], K;
int64 dp[45][2];
int prop[45];

int64 rec(int idx, bool free) {
  if(idx < 0) return 0;
  if(~dp[idx][free]) return dp[idx][free];
  int64 ret = -INF;
  for(int i = 0; i <= (free ? 1 : ((K >> idx) & 1)); i++) {
    ret = max(ret, rec(idx - 1, free | (((K >> idx) & 1) != i)) + 1LL * (i == 0 ? prop[idx] : N - prop[idx]) * (1LL << idx));
  }
  return dp[idx][free] = ret;
}

int main() {
  cin >> N >> K;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < 45; i++) {
    for(int j = 0; j < N; j++) {
      if((A[j] >> i) & 1) prop[i]++;
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(44, false) << endl;
}


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

int main() {
	
	int n;
	cin >> n;
	vector<vector<int>> table(10, vector<int>(10));
	rep(i, n+1){
		if(i == 0) continue;
		int first = i / pow(10, to_string(i).length()-1);
		int last = i % 10;
		table[first][last]++;
	}
	int ans = 0;
	rep(i, 10){
		rep(j, 10){
			if(i == j){
				ans += pow(table[i][j], 2);
			}else{
				ans += table[i][j] * table[j][i];
			}
		}
	}
	cout << ans << endl;
	
	// rep(i, 10){
	// 	rep(j, 10){
	// 		cout << table[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long int lli;
const long long int MaxN=300005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli arr[MaxN];
	void solve(){
		lli N,i,j,p=-1,q=-1;
		string word;
		cin>>word;
		N=word.size();
		for(i=0;i<N;i++){
			if(word[i]=='A'&&p==-1)p=i;
			if(word[i]=='Z')q=i;
		}	
		cout<<q-p+1;
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1194&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
double R;
int n;
int base = 50;
bool building[55][100];
double solve(){
    fill(*building,*building+100*55,0);
    double res = 0;
    vector<int> xl(n),xr(n),h(n);
    for(int i = 0; i < n;i++) cin >> xl[i] >> xr[i] >> h[i];
    for(int i = 0; i < n;i++){
        xl[i] += base; xr[i] += base;
        for(int j = xl[i]; j < xr[i];j++){
            for(int k = 0; k < h[i];k++){
                building[k][j] = true;
            }
        }
    }
//    for(int i = 10; i >= 0; i--){
//        for(int j = 40; j <= 60; j++){
//            cout << building[i][j];
//        }
//        cout << endl;
//    }
    
    double l = 0,r = 50;
    for(int i = 0; i < 50;i++){
        double m = (l+r)/2;
        bool ok = true;
        for(int x = -R; x < 0; x++){
            double from = R - sqrt(R*R-(abs(x)-1)*(abs(x)-1));
            double H = m - from;
            if(H < 0) continue;
            if(building[(int)H][x+base] == 0) ok = false;
        }
        for(int x = 0; x < R; x++){
            double from = R - sqrt(R*R-x*x);
            double H = m - from;
            if(H < 0) continue;
            if(building[(int)H][x+base] == 0) ok = false;
        }
        if(ok){
            l = m;
        }else{
            r = m;
        }
    }
    res = l;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> R >> n){
        if(n == 0 && R < 1e-9) break;
        cout << fixed << setprecision(4) << solve() << endl;
    }
    return 0;
}



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


def selection_sort(A, N):
    change = 0
    for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
    return (A, change)


if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    result, change = selection_sort(A, N)
    print ' '.join(map(str, result))
    print change

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

//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
 
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define fo(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define foe(i,x) for(auto& i: x)
#define ar array
#define pb push_back
#define vt vector
#define F first
#define S second

template<class T> bool umin(T& a,const T& b){return b<a?a=b,1:0;}
template<class T> bool umax(T& a,const T& b){return b>a?a=b,1:0;}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {cin>>x;}
void read(double& d) {string t;read(t);	d=stod(t);}
void read(long double& d) {	string t;read(t);d=stold(t);}
template<class H, class... T> void read(H& h, T&... t) {read(h);read(t...);}
template<class A> void read(vt<A>& x) {	foe(a, x)read(a);}
int nxt(){int a;cin>>a;return a;}

// no change 
const ll MOD = 1e9+7;  
void Titan(){
	int n,k,t;
	read(n,k,t);
	cout << ((n+(k-1))/k)*t;





	
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T = 1;
	//cin >> T;		//cmt if one test case
    fo(T){
		//cout << "Case #" << i+1 << ": " ;
		Titan();
	}
}
/*///////////////////////////////////////////////////////////
Important Notes : 
* check long long 
* check base cases
* do not loose Hope
* if case fails on 2nd test case maybe some cases are missing check them
* do not sit idle
* try to do it using pen/paper.
*/


Measured memory_bytes: 3648
def main():
    N = int(input())
    BA = []
    for i in range(N):
        A,B = map(int,input().split())
        BA.append([B,A])
    BA.sort()
    time = 0
    fin = False
    for i in range(N):
        time += BA[i][1]
        if time > BA[i][0]:
            fin = True
        if fin:
            print("No")
            return 0
    print("Yes")

if __name__ == '__main__':
    main()

Measured memory_bytes: 77340
import java.util.*;
import java.math.BigInteger;
 
public class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        
        int n = scan.nextInt();
        
        int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;

        for (int i = 0; i < n; i++) {
            switch (scan.next()) {
                case "AC":
                    ++ac;
                    break;
                case "WA":
                    ++wa;
                    break;
                case "TLE":
                    ++tle;
                    break;
                case "RE":
                    ++re;
                    break;
            }
        }

        System.out.println("AC x " + ac);
        System.out.println("WA x " + wa);
        System.out.println("TLE x " + tle);
        System.out.println("RE x " + re);
    }
}

Measured memory_bytes: 58112
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;
int n;
bool operator<(ii& a,ii& b){
      return a.first<b.first||(a.first==b.first&&a.second<b.second);
}
int Swap(vector<ii>&arr){
      int cnt=0;
      for(int i=n-1;i>=0;i--){
            int ind=0;
            for(int j=0;j<n;j++){
                  if(arr[j].second==i)ind=j;
            }
            for(int j=ind;j<n-1;j++){
                  if(arr[j].second>arr[j+1].second){
                        swap(arr[j],arr[j+1]);
                        cnt++;
                  }
            }
      }
      return cnt;
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
//      freopen("q.in","r",stdin);
//      freopen("q.out","w",stdout);

      cin>>n;
      vector<int>A(n),B(n);
      for(int i=0;i<n;i++)cin>>A[i];
      for(int i=0;i<n;i++)cin>>B[i];
      int ans=INF;
      for(int mask=0;mask<(1<<n);mask++){
       //     if(__builtin_popcount(mask)%2)continue;
            vector<ii>arr;
            vector<bool>yes(n);
            bool y=true;
            int cnt=0;
            for(int i=0;i<n;i++){
                  if(yes[i]=((1<<i)&mask))arr.pb({B[i],i});
                  else arr.pb({A[i],i});
            }
            sort(all(arr));
            for(int i=0;i<n-1;i++){
                  if(arr[i].first==arr[i+1].first){
                        int j=i;
                        while(j<n&&arr[i].first==arr[j].first)j++;
                        for(int k=i;k<j;k++){
                              if(yes[arr[k].second]!=abs(arr[k].second-k)%2){
                                    for(int l=k+1;l<j;l+=2){
                                          if(yes[arr[l].second]!=abs(arr[l].second-l)%2){
                                                swap(arr[l],arr[k]);
                                                break;
                                          }
                                    }
                              }
                        }
                        vector<ii>t;
                        for(int k=i;k<j;k+=2)t.pb({arr[k].second,arr[k].first});
                        sort(all(t));
                        int ind=0;
                        for(int k=i;k<j;k+=2,ind++)arr[k]={t[ind].second,t[ind].first};t.clear();
                        vector<ii>tt;
                        for(int k=i+1;k<j;k+=2)tt.pb({arr[k].second,arr[k].first});
                        sort(all(tt));
                        ind=0;
                        for(int k=i+1;k<j;k+=2,ind++)arr[k]={tt[ind].second,tt[ind].first};
                        i=j-1;
                  }
            }
            for(int i=0;i<n;i++){
                  if(yes[arr[i].second]!=abs(arr[i].second-i)%2)y=false;
            }
            if(y)
            ans=min(ans,Swap(arr));
      }
      if(ans==INF)cout<<-1;
      else cout<<ans;
}


Measured memory_bytes: 384
def main():
    n = int(input())
    A = list(map(int,input().split()))
    m = int(input())
    for _ in range(m):
        a,b,c = map(int,input().split())
        A[a:b],A[c:c+(b-a)] = A[c:c+(b-a)],A[a:b]
    print (' '.join(map(str,A)))

if __name__ == '__main__':
    main()




Measured memory_bytes: 5640
import itertools
n, m, q = map(int, input().split())
T = [list(map(int, input().split())) for _ in range(q)]

A = list(itertools.combinations_with_replacement(range(1, m + 1), n))
ans = 0

for i in range(len(A)):
    tmp = 0
    for j in range(q):
        if A[i][T[j][1] - 1] - A[i][T[j][0] - 1] == T[j][2]:
            tmp = tmp + T[j][3]
    ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 21492
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

long int combination(long int n, long int r);

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(data, 10, sizeof(int), compare_int)

long int combination(long int n, long int r)
{
	if(r>n-r) r = n-r;
	if(r == 0) return 1;
	else if(r == 1) return n;
	return (combination(n-1, r) + combination(n-1, r-1));
	//大きくなるとき
	/*
	long int tmp1, tmp2, tmp3;
	tmp1 = combination(n-1, r);
	if(tmp1>=MOD) tmp1 = tmp1%MOD;
	tmp2 = combination(n-1, r-1);
	if(tmp2>=MOD) tmp2 = tmp2%MOD;
	tmp3 = tmp1+tmp2;
	if(tmp3>=MOD) tmp3 = tmp3%MOD;
	return (tmp3);
	*/
}


int main(){
	long long int h, w;
	scanf("%lld%lld", &h, &w);
	long long int ans =h*w;
	ans++;
	ans = ans/2;
	if((h==1) || (w==1)){
		printf("1\n");
		return 0;
	}
	else{
		printf("%lld\n", ans);
		return 0;
	}
}

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

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,sz1,sz2,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX; string str,ttr,ntr;
        long long x=0,y=5,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct,tct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr,mp1,mp2;

        scanf("%lld",&n);

        mp[0]=0;

        for(i=1;i<=200;i++)
        {
            x=i;  fr=1;

            for(j=1;j<=5;j++)
            {
                fr=fr*x;
            }

            //printf("%lld     %lld\n",i,fr);

            mp[i]=fr;    sc=fr*(-1);  p=i*(-1);  mp[p]=sc;


        }


        for(i=-200;i<=200;i++)
        {
            f=mp[i]-n;
            for(j=-200;j<=200;j++)
            {
                if(mp[j]==f)
                {
                   printf("%lld %lld\n",i,j);  flg=1;  break;
                }
            }

            if(flg==1)break;

        }




    return 0;
}





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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N, C, K; cin >> N >> C >> K;
        vector<int> T(N); cin >> T;
        sort(all(T));

        int start = -INF;
        int c = 0;
        int ans = 0;
        for(int t : T) {
            if(t - start > K or c == C) {
                ans++;
                start = t;
                c = 1;
            } else {
                c++;
            }
        }
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


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

int SA[100005];
int SB[100005];
int TA[100005];
int TB[100005];

int main(void){
    string s; cin >> s;
    string t; cin >> t;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'A') SA[i+1] = 1;
        else SB[i+1] = 1;
        SA[i+1] += SA[i];
        SB[i+1] += SB[i];
    }
    for (int i = 0; i < t.length(); i++) {
        if (t[i] == 'A') TA[i+1] = 1;
        else TB[i+1] = 1;
        TA[i+1] += TA[i];
        TB[i+1] += TB[i];
    }
    
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        int SA_cnt = SA[b] - SA[a-1];
        int SB_cnt = SB[b] - SB[a-1];
        int TA_cnt = TA[d] - TA[c-1];
        int TB_cnt = TB[d] - TB[c-1];
        
        if (SA_cnt > TA_cnt) {
            SB_cnt += 2*(SA_cnt - TA_cnt);
            if (abs(SB_cnt - TB_cnt) % 3 == 0) cout << "YES" << endl;
            else cout << "NO" << endl;
        } else {
            TB_cnt += 2*(TA_cnt - SA_cnt);
            if (abs(SB_cnt - TB_cnt) % 3 == 0) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
    
}





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

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

using namespace std;

int ans;
char land[TMP][TMP];

void dfs(int x, int y) {
	if(land[x][y] == '1'){
		land[x][y] = '0';
		if(land[x + 1][y] == '1' && x + 1 < TMP && x >= 0) dfs(x + 1, y);
		if(land[x - 1][y] == '1' && x - 1 >= 0 && x < TMP) dfs(x - 1, y);
		if(land[x][y + 1] == '1' && y + 1 < TMP && y >= 0) dfs(x, y + 1);
		if(land[x][y - 1] == '1' && y - 1 >= 0 && y < TMP) dfs(x, y - 1);
	}
	return ;
}

int main() {
	while(cin >> land[0][0]){
		ans = 0;
		rep(i, TMP) {
			rep(j, TMP) {
				if(i == 0 && j == 0) continue;
				cin >> land[i][j];
			}
		}
		rep(i, TMP){
			rep(j, TMP) {
				if(land[i][j] == '1') {
					dfs(i, j);
					++ans;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2988
#include <stdio.h>
int a(int a,int b,int c){
    if(a+b<=b+c&&a+b<=c+a){
        return a+b;
    }else if(b+c<=c+a&&b+c<=a+b){
        return b+c;
    }else{
        return c+a;
    }
    
}
int main (void){
int P,Q,R;
scanf("%d%d%d",&P,&Q,&R);
printf("%d",a(P,Q,R));
}

Measured memory_bytes: 128
# @author 

import sys

class BMixJuice:
    def solve(self, tc=0):
        n, k = [int(_) for _ in input().split()]
        p = [int(_) for _ in input().split()]
        p.sort()
        print(sum(p[:k]))


solver = BMixJuice()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 9252
#include <iostream>
#include <vector>
#include <string>

const std::vector<char> chars = { 'M', 'A', 'R', 'C', 'H' };

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

  std::vector<long long int> s(26, 0);

  for (int i = 0; i < N; i++) {
    std::string S;
    std::cin >> S;

    s[S[0]]++;
  }

  long long int answer = 0;

  for (int i = 0; i < chars.size(); i++) {
    for (int j = i+1; j < chars.size(); j++) {
      for (int k = j+1; k < chars.size(); k++) {
        answer += s[chars[i]] * s[chars[j]] * s[chars[k]];
      }
    }
  }

  std::cout << answer << std::endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    if (A < 10 && B < 10) {
      System.out.println(A * B);
    }
    else{
      System.out.println(-1);
    }
  }
}


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

using namespace std;
#define ll long long
ll num[200005];
ll prex[200005];
ll ans[200005];
int main()
{
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&num[i]);
    }
    for(int i=1;i+1<n-i;i++)
    {
        prex[i]=prex[i-1]^num[i]^num[n-i+1];
    }
    ll sum=0;
    for(int i=n/2;i>0;i--)
    {
        ans[i]=num[n-i+1]^prex[i-1]^sum;
        ans[n-i+1]=num[i]^prex[i-1]^sum;
        sum^=ans[i]^ans[n-i+1];
    }
    for(int i=1;i<=n;i++)
        printf("%lld ",ans[i]);
    return 0;
}


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

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = Read().ToDouble();
            WriteRead(2 * r * Math.PI);
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }
    }
}


public static class Extentions
{
    public static int ToInt32(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long ToInt64(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))


        {
            return value;
        }
        return new T2();
    }
}



Measured memory_bytes: 18636