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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;
ll a[3 * MAX_N];

priority_queue<ll, vector<ll>, greater<ll>> leftpq;
priority_queue<ll> rightpq;

ll l, r;
ll scorel[3 * MAX_N];
ll scorer[3 * MAX_N];
ll ans;

int main(void){
    // Here your code !
    scanf("%d", &n);
    for (int i = 0; i < 3 * n; ++i) {
      scanf("%lld", &a[i]);
    }

    for (int i = 0; i < n; ++i) {
      leftpq.push(a[i]);
      l += a[i];
    }
    scorel[n] = l;

    for (int i = 3 * n - 1; i >= 2 * n; --i) {
      rightpq.push(a[i]);
      r += a[i];
    }
    scorer[2 * n] = r;

    for (int i = n; i < 2 * n; ++i) {
      leftpq.push(a[i]);
      l += a[i];
      l -= leftpq.top();
      leftpq.pop();
      scorel[i + 1] = l;
    }

    for (int i = 2 * n - 1; i >= n; --i) {
      rightpq.push(a[i]);
      r += a[i];
      r -= rightpq.top();
      rightpq.pop();
      scorer[i] = r;
    }

    ans = scorel[n] - scorer[n];
    for (int i = n; i <= 2 * n; ++i) {
      ans = max(ans, scorel[i] - scorer[i]);
    }

    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 7668
import itertools
import decimal
import math
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def iskaijo(n):
    i=1
    while True:
        if(n==1):
            break
        if(n%i==0):
            n=n/i
            i=i+1
        else:
            i=-1
            break
    return i

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


N=int(input())


ng=False
ans=0
List =factorization(N)
#c=collections.Counter(List)
for i in range(len(List)):
    test = List[i][1]
    i=1
    while True:
        test=test-i
        i=i+1
        ans=ans+1
        if(test == 0):
            break
        elif(test < 0 ):
             ans=ans-1
             break
#print(List)
if N!=1:
    print(ans)
else:
    print(0)

Measured memory_bytes: 10196
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
  int n,m,ans=0; cin>>n>>m;
  vector<vector<int>> path(n);
  vector<int> p;
  rep(i,n) p.push_back(i);
  rep(i,m){
    int a,b; cin>>a>>b;
    a--; b--;
    path[a].push_back(b);
    path[b].push_back(a);
  }
    do{
      if(p[0]!=0) break;
      
      int ju=0;
      rep(i,n-1){
        ju=0;
        for(auto q : path[p[i]]) if(q==p[i+1]) ju=1;
        if(ju!=1) break; 
        if(i==n-2) ans++;
      }
    } while(next_permutation(al(p)));
  
  cout<<ans<<endl;
}


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

int f1() {
    int N, X, T;
    cin >> N >> X >> T;

    int cnt = N / X;
    if(N % X > 0) cnt++;
    int ans = T * cnt;
    cout << ans << endl;
    return 0;
}

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



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

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  // int A, B, C, D, E;
  // cin >> A >> B >> C >> D >> E;
  int n[5];
  REP(i, 5)
  cin >> n[i];
  int ans = INT32_MAX;
  REP(i, 5)
  REP(j, 5)
  REP(k, 5)
  REP(l, 5)
  REP(m, 5)
  {
    if (i == j)
      break;
    if (i == k)
      break;
    if (i == l)
      break;
    if (i == m)
      break;
    if (j == k)
      break;
    if (j == l)
      break;
    if (j == m)
      break;
    if (k == l)
      break;
    if (k == m)
      break;
    if (l == m)
      break;
    map<int, int> mp;
    mp[i] = n[0];
    mp[j] = n[1];
    mp[k] = n[2];
    mp[l] = n[3];
    mp[m] = n[4];
    int tmp = 0;
    REP(a, 5)
    {
      while (tmp % 10 != 0)
      {
        tmp++;
      }
      tmp += mp[a];
    }
    if (tmp < ans)
      ans = tmp;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    while(cin >> n, n){
        vector<int> v(n);
        for (auto &&i : v) scanf("%d", &i);
        string s;
        cin >> s;
        auto f = [](char c){
            if('a' <= c && c <= 'z') return int(c-'a');
            else return int(c-'A'+26);
        };
        auto g = [](int x){
            x = (x%52+52)%52;
            if(0 <= x && x < 26) return char('a'+x);
            else return char('A'+(x-26));
        };
        for (int i = 0; i < s.size(); ++i) {
            s[i] = g(f(s[i])-v[i%n]);
        }
        cout << s << "\n";
    }
    return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
#define lli long long int
#define in int
#define el endl
#define oo cout
#define ii cin
#define pb push_back
#define bg begin()
#define en end()
#define p1 first
#define p2 second
#define FOR(i,a,b,c) for (int i = (a); i < (b); i=i+(c))
#define ROF(i,a,b,c) for (int i = (a); i > (b); i=i-(c))
using namespace std;

//vector< pair<lli,lli> >ccr;
//vector< pair<lli,lli> >jjr;
//vector<string>r;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,aa,bb,cc,i,j,ar[10000],br[10000],cr[10000];
ii>>n;
FOR(i,1,n+1,1){
ii>>cc;
ar[i]=cc;
}
FOR(i,1,n+1,1){
ii>>cc;
br[i]=cc;
}
FOR(i,1,n,1){
ii>>cc;
cr[i]=cc;
}
int ss=0;
aa=ar[1];
ss=br[aa];
FOR(i,2,n+1,1){
    aa=ar[i-1];
    bb=ar[i];

if((aa+1)==bb){
    //oo<<aa<<" "<<br[aa]<<" "<<cr[aa-1]<<el;

    ss=ss+br[bb]+cr[bb-1];
}
else{
    ss=ss+br[bb];
}


}
oo<<ss;


}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  vector<string> S(N);
  set<string> s;
  rep(i, N) {
    cin >> S[i];
    s.insert(S[i]);
  }

  int ans=len(s);
  cout << ans << endl;
  
}

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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
# define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+7;

ll cnt = 0;
ll mpow(ll x, ll y){
  if (y==0) return 1;
  if (y==1) return x;
  // ll t, ans;
  // ans = 1;
  // while(y>0){
  //   t =  mpow(x, y/2);
  //   if (y%2==0) {
  //     ans *= t*t;
  //     y /= 2;
  //   }
  //   else{
  //     ans *= x;
  //     y -=1;
  //   }
  // }
  ll t =  mpow(x, y/2);

  if (y%2==0) {
    return t * t % MOD;
  }
  //else return x * mpow(x,y-1) % MOD;
  else return ((x * t)%MOD*t) % MOD;

  //  return ans;
}


int main(){
  ll n,a,b;
  cin >> n >> a>>b;
  ll ans = 1;

  // rep(i,n) {
  //   ans *=2;
  //   ans = ans % MOD;
  // }
  ans = mpow(2, n);
  ans--;

  ll comb_a = 1;
  ll tmp = 1;
  
  
  //cout << ans << endl;
  rep(i,a) {
    comb_a = comb_a* (n-i) % MOD;
     tmp =tmp* (i+1) % MOD;
  }

  //cout << comb_a<<" " <<mpow(tmp, MOD-2)<< endl;

  comb_a = comb_a * mpow(tmp, MOD-2) % MOD;

  ll comb_b = 1;
  tmp = 1;

  rep(i,b) {
    comb_b = comb_b* (n-i) % MOD;
    tmp =tmp* (i+1) % MOD;
  }

  //cout <<tmp<<" "<< comb_b<<" " <<mpow(tmp, MOD-2)<< endl;

  comb_b = comb_b * mpow(tmp, MOD-2) % MOD;

  ans = ans - comb_a - comb_b ;
  while (ans<0) ans += MOD;
  //if (ans<0) ans += MOD;
  cout << ans % MOD << endl;

}


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

int main(){
    ll N, K; cin >> N >> K;
    
    ll cn = 0;
    ll ans = 0;
    bool f = false;
    map<ll, ll> mp;
    for(ll i = 0; i < N; i++){
        ll a, b; cin >> a >> b;
        mp[a] += b;
    }

    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        if(K <= iter->second + cn){
            cout << iter->first << endl;
            return 0;
        }
        cn += iter->second;
    }

}

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

int main() {
int n,a[100001]={0},c=0;
cin>>n;
for(int i=0;i<n;i++){
    int b;
    cin>>b;
    if(b>n){
        c++;
    }else{
        a[b]++;
    }
}
for(int i=1;i<=n;i++){
    if(a[i]>i){
        c+=a[i]-i;
    }else if(a[i]<i){
        c+=a[i];
    }
}
cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public enum pattern {
        lu, //左足を踏み台に上げる
        ru, //右足を踏み台に上げる
        ld, //左足を踏み台に下げる
        rd, //右足を踏み台に下げる
        ;
    }

    static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = br.readLine().trim()) != null && !"0".equals(line)) {
            int ans = 0;
            String[] input = line.split(" ");
            if(Stream.of(pattern.values()).map(e->e.name()).anyMatch(code->code.equals(input[0]))) {
                for(int i = 0 ; i < input.length; i++) {
                    if(i < input.length -1 && input[i].substring(1).equals("u") == input[i+1].substring(1).equals("u")) ans ++;
                    if(i < input.length -1 && input[i].substring(1).equals("d") == input[i+1].substring(1).equals("d")) ans ++;
                }
                System.out.println(ans/2);
            }
        }
    }
}



Measured memory_bytes: 34696
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int a,b;
  cin >>a>>b;
  
  cout << (a%b==0?0:1) << endl;
}



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

int main() {
    ll n;cin>>n;
    ll tmp = 7;
//    ll ans = 0;

    for(ll i=1;i<100000000;++i){
        if(tmp%n ==0){
            cout<<i<<endl;
            return 0;
        }
        tmp*=10;
        tmp+=7;
        tmp%=n;
    }
    cout<<-1<<endl;
//    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

//sort(rng(P),[](const vi &a, const vi &b){return a[1]<b[1];});

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

struct uf{
  private:
    vi par, rank, size;
  public:
    uf(i64 n){ init(n); }
    void init(i64 n){
      par.resize(n);
      rank.resize(n,0);
      size.resize(n,1);
      rep(i,n) par[i] = i;
    }
    i64 root(i64 x){
      if(par[x] == x) return x;
      return par[x] = root(par[x]);
    }
    bool same(i64 x, i64 y){ return root(x) == root(y); }
    void unite(i64 x, i64 y){
      x = root(x), y = root(y);
      if(x==y) return;
      if(rank[x]==rank[y]) rank[x]++;
      if(rank[x]<rank[y]) swap(x,y);
      par[y] = x;
      size[x] += size[y];
    }
    i64 num(i64 x){ return size[root(x)]; }
};

void Main()
{
  i64 N;
  cin >> N;
  vi H(N);
  cin >> H;

  i64 ans = H[0];
  rep(i, 1, N){
    if(H[i]>H[i-1]){
      ans += H[i]-H[i-1];
    }
  }
  cout << ans << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

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

struct edge {
    int u;
    int v;
    int cost;
    edge(int u, int v, int cost) : u(u), v(v), cost(cost) {}
};

class UnionFindTree {
   public:
    vector<int> parent;

    UnionFindTree(int n) {
        parent.resize(n);
        for (int i = 0; i < n; i++) {
            parent[i] = i;
        }
    }

    int root(int x) {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y) {
        int rx = root(x); int ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int kruscal(vector<edge> e, int n) {
    UnionFindTree uft(n);
    sort(e.begin(), e.end(), [](edge l, edge r) { return l.cost < r.cost; });
    
    int cost = 0;
    for (auto now : e) {
        if (!uft.same(now.u, now.v)) {
            uft.unite(now.u, now.v);
            cost += now.cost;
        }
    }

    return cost;
}

int main() {
    int N; cin >> N;
    vector<pair<int, int>> xy(N);
    REP(i, 0, N) cin >> xy[i].first >> xy[i].second;

    vector<edge> e;
    vector<int> idx(N);
    iota(idx.begin(), idx.end(), 0);

    sort(idx.begin(), idx.end(), [&](int l, int r){ return xy[l].first < xy[r].first; });
    REP(i, 0, N - 1) {
        int cost = min(abs(xy[idx[i]].first - xy[idx[i + 1]].first), abs(xy[idx[i]].second - xy[idx[i + 1]].second));
        e.push_back(edge(idx[i], idx[i + 1], cost));
    }

    sort(idx.begin(), idx.end(), [&](int l, int r){ return xy[l].second < xy[r].second; });
    REP(i, 0, N - 1) {
        int cost = min(abs(xy[idx[i]].first - xy[idx[i + 1]].first), abs(xy[idx[i]].second - xy[idx[i + 1]].second));
        e.push_back(edge(idx[i], idx[i + 1], cost));
    }

    cout << kruscal(e, N) << endl;
    
    return 0;
}

Measured memory_bytes: 7280
import java.util.Scanner;
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);
        }
        
        scan.close();
    }
}

Measured memory_bytes: 23892
#include <stdio.h>

int main(){
   	int n;
   	char input[100000];
   	scanf("%d", &n);
   	scanf("%s", input);
   	
   	for(int i = 0; input[i] != '\0'; i++){
   		for(int j = 0; j < n; j++){
   			
		 	if(input[i] == 90){
			 	input[i] -= 26;
				 	
			 	input[i]++;
		    } 
			else {
		    	input[i]++;
			}
		}
		printf("%c", input[i]);	
	}
	return 0;
} 

Measured memory_bytes: 1668
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define y1 abcde
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
#define int long long

const int inf = 2e9;
const int mod = 1e9 + 7;
const int N = 2e5 + 15;
int I, O, T, J, L, S, Z, ans;

inline int gt(int x) {
    return x - (x & 1);
}

main() {
    cin >> I >> O >> T >> J >> L >> S >> Z;
    int is = (I % 2) + (L % 2) + (J % 2);
    if(is >= 2 && I && L && J) {
        ans += 3;
        --I, --L, --J;
    }
    ans += gt(I) + gt(J) + gt(L) + O;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long A = long.Parse(str[0]);
		long V = long.Parse(str[1]);
		string[] str2 = Console.ReadLine().Split();
		long B = long.Parse(str2[0]);
		long W = long.Parse(str2[1]);
		long T = long.Parse(Console.ReadLine());
		string ans = "YES";
		if(V<=W){
			ans = "NO";
		} else {
			if(Math.Abs(A-B)>(V-W)*T){
				ans = "NO";
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 17888
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();

		BigDecimal wSide = new BigDecimal((double)len/3);
		BigDecimal tSide = new BigDecimal((double)len/3);
		BigDecimal hSide = new BigDecimal((double)len/3);

		BigDecimal result = wSide.multiply(tSide).multiply(hSide);

		System.out.print(result);
		sc.close();
	}
}


Measured memory_bytes: 22868
#include<stdio.h>
int map[51][51];
int w,h;
void search(int _h,int _w){
	if(_h<0||_w<0||_h>h||_w>w||map[_h][_w]==0)return;
	int i,j;
	map[_h][_w]=0;
	search(_h-1,_w);
	search(_h-1,_w+1);
	search(_h,_w+1);
	search(_h+1,_w+1);
	search(_h+1,_w);
	search(_h+1,_w-1);
	search(_h,_w-1);
	search(_h-1,_w-1);
}int main(){
	int i,j,c;
	while(1){
		c=0;
		scanf("%d %d",&w,&h);
		if(!w && !h)break;
		for(i=0;i<h;i++){
			for(j=0;j<w;j++)scanf("%d",&map[i][j]);
		}
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(map[i][j]==1){
					search(i,j);
					c++;
				}
			}
		}
		printf("%d\n",c);
	}
	return 0;
}

Measured memory_bytes: 0
def main(list_A):

    list_A = sorted(list_A)
    prev_A = 0
    for A in list_A:
        if A == prev_A:
            return "NO"
        else:
            prev_A = A
    else: return "YES"


if __name__ == "__main__":

    N      = int(input())
    list_A = list(map(int, input().split(' ')))

    answer = main(list_A)
    print(answer)




Measured memory_bytes: 26804
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    ll min_num = min(a, min(b, c));
    a -= min_num, b -= min_num, c -= min_num;
    ll count = 0;
    if (
        (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) ||
        (a % 2 == 1 && b % 2 == 1 && c % 2 == 1))
    {
        ll max_num = max(a, max(b, c));
        count += (max_num - a) / 2 + (max_num - b) / 2 + (max_num - c) / 2;
        cout << count << endl;
        return 0;
    }

    if (
        (a % 2 == 1 && b % 2 == 0 && c % 2 == 0) ||
        (a % 2 == 0 && b % 2 == 1 && c % 2 == 0) ||
        (a % 2 == 0 && b % 2 == 0 && c % 2 == 1))
    {
        count++;
        if (a % 2)
        {
            b++, c++;
        }
        else if (b % 2)
        {
            c++, a++;
        }
        else if (c % 2)
        {
            a++, b++;
        }
        ll max_num = max(a, max(b, c));
        count += (max_num - a) / 2 + (max_num - b) / 2 + (max_num - c) / 2;
        cout << count << endl;
        return 0;
    }

    if (
        (a % 2 == 0 && b % 2 == 1 && c % 2 == 1) ||
        (a % 2 == 1 && b % 2 == 0 && c % 2 == 1) ||
        (a % 2 == 1 && b % 2 == 1 && c % 2 == 0))
    {
        count++;
        if (a % 2 == 0)
        {
            b++, c++;
        }
        else if (b % 2 == 0)
        {
            c++, a++;
        }
        else if (c % 2 == 0)
        {
            a++, b++;
        }
        ll max_num = max(a, max(b, c));
        count += (max_num - a) / 2 + (max_num - b) / 2 + (max_num - c) / 2;
        cout << count << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
from functools import reduce

n = int(input())
t = list(int(input()) for _ in range(n))

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(t))


Measured memory_bytes: 9420
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(n,b):
        if n < b:
            return n
        return f(n//b, b)+(n%b)
    n,s = IR(2)
    if n == s:
        print(n+1)
        return
    for b in range(2,10**6+2):
        if f(n,b) == s:
            print(b)
            return
    if n <= 10**6:
        print(-1)
        return
    N = 10**6+1
    for i in range(1,N)[::-1]:
        l = (n//(i+1))+1
        r = (n//i)+1
        while r-l > 1:
            m = (l+r) >> 1
            fx = f(n,m)
            if fx >= s:
                l = m
            else:
                r = m
        if f(n,l) == s:
            print(l)
            return
    print(-1)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 54896
#include "bits/stdc++.h"

using namespace std;

const int maxn = 2005;
const int mod = 1e9 + 7;

int a[maxn], b[maxn];
int dp[maxn][maxn];


int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    for (int i = 1; i <= n; ++i) scanf("%d", a + i);
    for (int i = 1; i <= m; ++i) scanf("%d", b + i);

    for (int i = 0; i <= n; ++i) dp[i][0] = 1;
    for (int i = 0; i <= m; ++i) dp[0][i] = 1;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
            dp[i][j] %= mod;

            if (a[i] != b[j]) {
                dp[i][j] -= dp[i - 1][j - 1];
                dp[i][j] %= mod;
                if (dp[i][j] < 0) dp[i][j] += mod;
            }
        }
    }    

    printf("%d\n", dp[n][m]);
}

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

int main() {
    string s;

    cin >> s;

    if (s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
using System;
public class Hello{
    public static void Main(){

    string input1=Console.ReadLine();
    string input2=Console.ReadLine();
    
    string bin=input2.Remove(input2.Length-1,1);

    if(input1==bin) {
        Console.WriteLine("Yes");
    } else {
        Console.WriteLine("No");
    }

    }
    
}


Measured memory_bytes: 17356
a = list(map(int,input().split()))

N = a[0]
K = a[1]

if K >= 2*N:
    print(N)
elif K > N :
    print(abs(N-K))
elif N >= K:
    res = N%K
    min = res
    cul_result1 = abs(res-K)
    if cul_result1 < min:
        min = cul_result1
    cul_result2 = abs(cul_result1-K)
    if cul_result2 < min:
        min = cul_result2
    print(min)



Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

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

int main()
{
	int N;
	std::cin >> N;
	std::vector<int> a(N);
	rep(i, N)	std::cin >> a[i];
	std::sort(a.begin(), a.end());

	int A = 0;
	int B = 0;
	rep(i, N)
	{
		if((i % 2) != 0)
		{
			A += a[i];
		}
		else
		{
			B += a[i];
		}
	}	

	int ans = abs(A - B);
	std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+7;
int mod = 1e9+7;
vector<ll> v1;
vector<ll> v2;
vector<ll> v3;
int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	ll w;
	cin>>n>>k;
	int r1 = 0,r2 = 0;
	for(int i=0;i<n;i++){
		cin>>w;
		if(w>0) v1.push_back(w);
		else if(w<0) v2.push_back(w);
		else v3.push_back(0);
	}
	ll ans = 1;
	sort(v1.begin(),v1.end() );
	sort(v2.begin(),v2.end(),greater<int>());
	//if(v1.size)
	if(k%2==1){
		if(v1.size()!=0){
			ans = v1[v1.size()-1];
			v1.pop_back();
			ans %= mod;
			k--;
		}
		else if(v3.size()!=0){
			cout<<0<<endl;
			return 0;
		}
		else{
			for(int i=0;i<k;i++){
				ans *= v2[i];
				if(ans<0){
					ll t = ans/mod;
					ans += (-t+1)*mod;
				}
				ans %= mod;
			}
			if(ans<0){
					ll t = ans/mod;
					ans += (-t+1)*mod;
				}
			cout<< ans%mod << endl;
			return 0;
		}
	}
	if(k%2==0){
		for(int i=0;i<k;){
			ll z = 0, f = 0;
			if(v2.size()<2&&v1.size()==0&&v3.size()!=0){
				cout<<0<<endl;
				return 0;
			}
			else if(v2.size()<2&&v1.size()==0){
				ans *= v2[0];
				if(ans<0){
					ll t = ans/mod;
					ans += (-t+1)*mod;
				}
				cout<<ans%mod<<endl;
				return 0;
			}
			if(v1.size()==1&&v2.size()<2){
				if(ans<0){
					ll t = ans/mod;
					ans += (-t+1)*mod;
				}
				ans *= v1[0];
				ans %= mod;
				v1.pop_back();
				i++;
				continue;
			}
			if(v1.size()>=2){
				z = v1[v1.size()-2]*v1[v1.size()-1];
			}
			if(v2.size()>=2){
				f = v2[v2.size()-2]*v2[v2.size()-1];
			}
			if(z>=f){
				if(ans<0){
					ll t = ans/mod;
					ans += (-t+1)*mod;
				}
				v1.pop_back(); v1.pop_back();
				z %= mod;
				ans *= z;
				ans %= mod;
			}
			else{
				if(ans<0){
					ll t = ans/mod;
					ans += (-t+1)*mod;
				}
				v2.pop_back(); v2.pop_back();
				f %= mod;
				ans *= f;
				ans %= mod;
			}
			i+=2;
		}
	}
	cout<<ans%mod<<endl;
}

Measured memory_bytes: 5676
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val h = sc.nextInt()
    val w = sc.nextInt()
    val c = Array(10) { Array(10) { sc.nextInt() } }
    val a = Array(h) { Array(w) { sc.nextInt() } }
    val wf = Array(10) { Array(10) { 1000000000 } }
    for (i in 0 until 10) {
        for (j in 0 until 10) {
            if (i != j) {
                wf[i][j] = c[i][j]
            }
        }
    }
    for (k in 0 until 10) {
        for (i in 0 until 10) {
            for (j in 0 until 10) {
                if (wf[i][j] > wf[i][k] + wf[k][j]) {
                    wf[i][j] = wf[i][k] + wf[k][j]
                }
            }
        }
    }
    var ans = 0
    for (i in 0 until h) {
        for (j in 0 until w) {
            val v = a[i][j]
            if (v != -1 && v != 1) {
                ans += wf[v][1]
            }
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

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

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

	ll n;
	cin >> n;
	ll ans = 1e12+1;

	if(!n)
		ans = 1;
	else
		for(ll i = 1; i*i <= n; i++)
			if(n%i==0)
				ans = min(ans, n/i+i-2);
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())

if a == b:
    if a != c:
        print("Yes")
        exit(0)
if a == c:
    if a != b:
        print("Yes")
        exit(0)
if b == c:
    if a != b:
        print("Yes")
        exit(0)
print("No")


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vll = vector<vector<ll> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using the = pair<int, int>;
using lthe = pair<ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


priority_queue<the> p[200000];
const int MAXP = 2 * 1e5;

int main()
{
	int n, k;
	cin >> n >> k;
	Vi P(n);
	rep(i, n)  cin >> P[i];

	sort(P.begin(), P.end());
	ll ans = 0;
	rep(i, k)  ans += P[i];
	cout << ans << endl;
}


Measured memory_bytes: 9872
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"
#include "map"
#include "algorithm"
#include "functional"
#include "set"
#include "numeric"
#include "unordered_map"

using namespace std;

const long long int MOD = 1000000007;

int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	vector<int>num(N,1);
	vector<int>flag(N);
	flag[0] = 1;
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		L--;
		R--;
		flag[R] |= flag[L];
		num[R]++;
		num[L]--;
		if(!num[L])flag[L] = 0;
	}
	int ans = 0;
	for (auto i : flag)ans += i;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
import math
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
cp = 1
lp = n
for i in range(n):
  pi = p.pop(0)
  lp -= 1
  cp += (pi-1)*math.factorial(lp)
  for j in range(lp):
    if p[j] > pi:
      p[j] -= 1
cq = 1
lq = n
for i in range(n):
  qi = q.pop(0)
  lq -= 1
  cq += (qi-1)*math.factorial(lq)
  for j in range(lq):
    if q[j] > qi:
      q[j] -= 1
print(abs(cp-cq))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
ll fn(ll n) { return n * n * n * n * n; }
int main() {
    ll x;
    cin >> x;
    for(ll a = 0; fn(a) <= x; a++) {
        for(ll b = 0; fn(b) <= x; b++) {
            if(fn(a) + fn(b) == x) {
                cout << a << " " << -b << endl;
                return 0;
            }
        }
    }
    ll m = 1000;
    for(ll a = 0; a < m; a++) {
        for(ll b = 0; b < m; b++) {
            if(fn(a) - fn(b) == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int f(int x) {
  if (x == 1000000000) {
    return 999999999;
  } else {
    return x+1;
  }
}

int main()
{
  int n,k,s;
  cin>>n>>k>>s;
  for(auto&& i:irange(0,k)) {
    if(i) cout<<' ';
    cout<<s;
  }
  for(auto&& i:irange(k,n)) {
    if(i) cout<<' ';
    cout<<f(s);
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000000
void MatrixChainMultiplication(int*,int);
int **F;
int main(){
  int n,i,j,*matrix;
  scanf("%d",&n);
  matrix = (int*)malloc(sizeof(int) * (n + 1));
  F = (int**)malloc(sizeof(int*) * (n + 1));
  for(i=1; i<=n; i++) F[i] = (int*)malloc(sizeof(int) * (n + 1));
  for(i=0; i<n; i++){
    scanf("%d",&matrix[i]);
    scanf("%d", (i != n - 1 ? &j : &matrix[i+1]));
  }
  MatrixChainMultiplication(matrix,n);
  printf("%d\n",F[1][n]);
  return 0;
}

void MatrixChainMultiplication(int* p,int n){
  int i,j,k,l,q;
  // n--;
  for(i=1; i<=n; i++) F[i][i] = 0;
  for(l=2; l<=n; l++){
    for(i=1; i<=n-l+1; i++){
      j = i + l - 1;
      F[i][j] = MAX;
      for(k=i; k<=j-1; k++){
        q = F[i][k] + F[k+1][j] + p[i-1] * p[k] * p[j];
        F[i][j] = (F[i][j] < q ? F[i][j] : q);
      }
    }
  }
}

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

int gcd (int a,int b){
    while(b){
        int t=a%b;
        a=b;
        b=t;
    }
    return a;
}
/*
L(0) = 0
L(i + 1) = gcd(L(i), A(i))
R(N + 1) = 0
R(i) = gcd(R(i + 1), A(i))
*/
int n, a[100005], b[100005], c[100005], res;
int main () {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
      
    b[1] = a[1];
    for (int i = 2; i <= n; i++) b[i] = gcd(b[i-1], a[i]);
    c[n] = a[n];
    for (int i = n-1; i >= 1; i--) c[i] = gcd(c[i+1], a[i]);
    for (int i = 2; i < n; i++) res = max(gcd(b[i-1], c[i+1]), res);
    cout << max(res, max(c[2], b[n-1])) << endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll modpow(ll n, ll r, ll mod) {
    ll ret = 1;
    ll p = n;
    while (r > 0) {
        if (r & 1)
            ret = (ret * p) % mod;
        p = (p * p) % mod;
        r /= 2;
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, P;
    cin >> N >> P;
    string S;
    cin >> S;

    ll ans = 0;
    if (P == 2 || P == 5) {
        REP(i, N) {
            if ((S[i] - '0') % P == 0)
                ans += i + 1;
        }
    }
    else {
        ll s = 0;
        std::map<ll, ll> M;
        M[0]++;
        REP(i, N) {
            s = (s * 10LL + S[i] - '0') % P;
            ll t = s * modpow(10LL, i * (P - 2), P) % P;
            ans += M[t];
            M[t]++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1044
#include <iostream>//cout
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <list>
#include <utility>//swap
using namespace std;
static const int MAX = 200000;
#define rep(i,n) for(int i=0;i<n;i++)
#define GET_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
 
int main() {
  long long int x;
  cin >> x;
  long long int k = x/11;
  long long int m = x%11;

  if(m==0){
    cout << 2*k << endl;
  }  
  else if(m<7){
    cout << 1 + 2*k << endl;
  }  else {
    cout << 2 + 2*k << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL               long long
#define PB               push_back
using namespace std;
int main (){
  int n,k,x; cin >> n>>k;
  int v[n];
  for (int i=0;i<n;i++){
    cin >> v[i];
  }
  for (int i=0;i<n-k;i++){
    if (v[i]<v[i+k]) cout<< "Yes"<< endl;
    else cout<< "No"<<endl;
  }
}

Measured memory_bytes: 4316
import sys
def gcd(a,b):
    if a==b:
        return a
    while(b>0):
        a,b = b,a%b
        if b==0:
            return a
def lcm(a,b):
    n=1
    m=1
    while(n*a!=m*b):
        if n*a>m*b:
            m+=1
        elif n*a<m*b:
            n+=1
    return n*a
lines = sys.stdin.readlines()
for line in lines:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(int(i))
    inp.sort()
    a = inp[0]
    b = inp[1]
    print("%d %d" % (gcd(a,b),lcm(a,b)))

Measured memory_bytes: 7644
#include <iostream>
 using namespace std;
 int main(){
 string S;
 cin >> S;
 int L = S.size();
 string ans = "AC";
 if(S[0] != 'A'){
 ans = "WA";
 }
 int cnt = 0;
 for(int i = 1; i < L; ++i){
 if(isupper(S[i])){
 if(i == 1 || i == L - 1 || S[i] != 'C'){
 ans = "WA";
 }
 ++cnt;
 }
 }
 if(cnt != 1){
 ans = "WA";
 }
 cout << ans << endl;
 }

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

using namespace std;

#define REP(i,x,y) for (int i=x;i<y;i++)

const int8_t INFC=0x3f;
const int16_t INFS=0x3f3f;
const int32_t INF=0x3f3f3f3f;
const int64_t INFL=0x3f3f3f3f3f3f3f3fLL;
set<int> s;
int main()
{
    ios::sync_with_stdio(0);
    s.clear();
    int n;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        s.insert(x);
    }
    cout << (s.size()-(s.size()&1?0:1)) << endl;

    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (ll i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << (x) << endl
#define debug2(x, y) cerr << #x << ": " << (x) << " " << #y << ": " << y << endl;
#define int long long
using namespace std;
using II = pair<int, int>;
using VII = vector<II>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { int n = d.size(); REP (i, n) s << d[i] << " "; return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& dd) { for (vector<T> d: dd) s << d << endl; return s; }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
const int MOD = 1e9 + 7;

class UndirectedGraph {
  struct Edge { int to, cost; };
public:
  vector<vector<Edge>> G;
  VI d;
  int V;
  UndirectedGraph(int V) : G(V), V(V), d(V) {}
  void add_edge(int u, int v, int cost) {
    G[u].push_back({v, cost});
    G[v].push_back({u, cost});
  }
  VI dijkstra(int s) {
    fill(ALL(d), 1e18); d[s] = 0;
    priority_queue<II, VII, greater<II>> que; // {dist, v}
    que.push({0, s});
    while (!que.empty()) {
      II p = que.top(); que.pop();
      int v = p.second;
      if (d[v] < p.first) continue;
      for (Edge e: G[v]) {
        int tmp = d[v] + e.cost;
        if (d[e.to] <= tmp) continue;
        d[e.to] = tmp;
        que.push({tmp, e.to});
      }
    }
    return move(d);
  }
};
signed main() {
  int n, m, s, t; cin >> n >> m >> s >> t;
  s--; t--;
  UndirectedGraph g1(n), g2(n);
  REP (i, m) {
    int u, v, a, b; cin >> u >> v >> a >> b;
    u--; v--;
    g1.add_edge(u, v, a);
    g2.add_edge(u, v, b);
  }
  VI d1 = g1.dijkstra(s);
  VI d2 = g2.dijkstra(t);
  VI ans(n + 1, 1e18);
  for (int i = n - 1; i >= 0; i--) {
    ans[i] = min(ans[i + 1], d1[i] + d2[i]);
  }
  REP (i, n) {
    cout << (int)1e15 - ans[i] << endl;
  }
}


Measured memory_bytes: 19016
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    N = int(input())
    S = list(map(int, input().split()))
    odd = {}
    even = {}
    for i in range(N):
        if i % 2 == 0:
            if S[i] not in even:
                even[S[i]] = 1
            else:
                even[S[i]] += 1
        else:
            if S[i] not in odd:
                odd[S[i]] = 1
            else:
                odd[S[i]] += 1

    n = 1000000000
    emk = None
    ev1 = None
    ev2 = 0
    for ek, ev in even.items():
        if emk is None:
            emk = ek
            ev1 = ev
        elif ev > ev1:
            emk = ek
            ev2 = ev1
            ev1 = ev
        elif ev > ev2:
            ev2 = ev

    omk = None
    ov1 = None
    ov2 = 0
    for ok, ov in odd.items():
        if omk is None:
            omk = ok
            ov1 = ov
        elif ov > ov1:
            omk = ok
            ov2 = ov1
            ov1 = ov
        elif ov > ov2:
            ov2 = ov

    if emk != omk:
        n = min(n, N - ev1 - ov1)
    else:
        n = min(n, N - ev1 - ov2, N - ev2 - ov1)

    print(n)

main()


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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    priority_queue<ll> pq;
    set<ll> st;

    for(int i = 0; i < n; i++){
        ll a; cin >> a;
        if(st.count(a)){
            pq.push(a);
            st.erase(a);
        } else {
            st.insert(a);
        }
    }

    if(pq.size() < 2) cout << 0 << endl;
    else {
        ll l, m;
        l = pq.top();
        pq.pop();
        m = pq.top();
        cout << l * m << endl;
    }

    return 0;
}


Measured memory_bytes: 4992
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
p = p[a-x:]
q = q[b-y:]
pi = 0
qi = 0
ri = 0
while ri < c:
    if pi == x:
        if qi == y:
            break
        else:
            if q[qi] >= r[ri]:
                break
            else:
                q[qi] = r[ri]
                qi += 1
                ri += 1
                continue
    elif qi == y:
        if p[pi] >= r[ri]:
            break
        else:
            p[pi] = r[ri]
            pi += 1
            ri += 1
            continue
    else:
        if p[pi] >= r[ri] and q[qi] >= r[ri]:
            break
        else:
            if p[pi] <= q[qi]:
                p[pi] = r[ri]
                pi += 1
                ri += 1
                continue
            else:
                q[qi] = r[ri]
                qi += 1
                ri += 1
                continue

print(sum(p) + sum(q))

Measured memory_bytes: 105444
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    string s;
    int t=0,max=0;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='R')
        {
           t++;
        }
        else
        {
           if(t>max)
           {
               max=t;
           }
           t=0;
        }
    }
     if(t>max)
     {
         max=t;
     }
     cout<<max<<endl;
    return 0;    
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> dp(n,INT_MAX);
  while(n--){
    int in;
    cin >> in;
    *lower_bound(dp.begin(), dp.end(), in) = in;
  }
  cout << lower_bound(dp.begin(), dp.end(), INT_MAX)-dp.begin() << endl;
  return 0;
}

Measured memory_bytes: 1532
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

int main() {
    int N;
    cin >> N;
    ll MOD = pow(10, 9) + 7;
    vector<int> C(N);
    vector<vector<int>> places(210000);
    vector<ll> dp(210000);
    int prev = -1;
    rep(i, N) { cin >> C[i]; }

    for (int i = 0; i < 210000; i++) {
        places[i].clear();
    }

    for (int i = 0; i < N; i++) {
        places[C[i]].push_back(i);
    }

    // dp
    dp[0] = 1;
    for (int i = 1; i <= N; i++) {
        dp[i] += dp[i - 1];
        dp[i] %= MOD;

        int c = C[i - 1];
        int it = lower_bound(places[c].begin(), places[c].end(), i - 1) -
                 places[c].begin();

        if (it > 0) {
            int j = places[c][it - 1];
            if ((i - 1) - j > 1)
                dp[i] += dp[j + 1], dp[i] %= MOD;
        }
    }

    cout << dp[N] << endl;
}


Measured memory_bytes: 16940