akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
    int n; cin >> n;
    int min = 1000000;
    int max = -1000000;
    long long int sum = 0;
    for (long long int i = 0; i < n; i++) {
        int num; cin >> num;
        if (num < min) {
            min = num;
        }
        if (num > max) {
            max = num;
        }

        sum = sum + num;
    }

    cout << min << ' ' << max << ' ' << sum << '\n';

    return 0;
}



Measured memory_bytes: 3096
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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

	priority_queue<int,vector<int>,less<int> > former;
	priority_queue<int,vector<int>,greater<int> > latter;

	long long min=0;

	for(int i=0;i<q;i++)
	{
		int v;
		cin >> v;

		if(v==1)
		{
			int a,b;
			cin >> a >> b;

			min+=b;

			former.push(a);
			latter.push(a);

			int f=former.top();
			int l=latter.top();

//			cout << "f : " << f << "  l : " << l << endl;

			if(f>l)
			{
				min+=abs(f-l);
				former.pop();
				latter.pop();
				former.push(l);
				latter.push(f);
			}
		}
		else
		{
			cout << former.top() << " " << min << endl;
		}
	}
}

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

int main(){
  int n, pos = 0;
  string s;
  vector<string> vs;
  std::cin >> n >> s;
  while(s[pos] == '0')pos++;
  s = s.substr(pos);
  for (int i = 0; s.length() != 0; i++) {
    while(i < s.length() - 1 and not(s[i] == '0' and s[i + 1] == '0'))i++;
    if(i < s.length() - 1)vs.push_back(s.substr(0, i));
    else vs.push_back(s);
    while(i < s.length() - 1 and not(s[i] == '0' and s[i + 1] == '1'))i++;
    if(i == s.length()) s = "";
    else s = s.substr(i + 1);
    i = 0;
  }
  int ans = 0;
  vector<int> len(n, 0);
  for (int i = 0; i < vs.size(); i++) {
    int l = 0, size = 0;
    for (int j = 0; j < vs[i].size(); j++) {
      if(j < vs[i].size() and vs[i][j] == '1')l++;
      else if(j < vs[i].size() and vs[i][j] == '0')len[size++] = l, l = 0;
    }
    if(l != 0)len[size++] = l;
    vector<vector<int> > dp(3, vector<int>(size, 0));
    //0:LEFT, 1:RIGHT, 2:NOT UASD
    for (int j = 0; j < size - 1; j++) {
      for (int k = 0; k < 3; k++) {
        dp[2][j + 1] = max(dp[2][j + 1], dp[k][j]);
      }
      dp[0][j + 1] = max(dp[0][j + 1], dp[2][j] + len[j]);
      dp[1][j + 1] = max(dp[1][j + 1], dp[2][j] + len[j + 1]);
      
      //L -> L
      dp[0][j + 1] = max(dp[0][j + 1], dp[0][j] + len[j] - 1);
      //L -> R
      if(len[j] > 1)dp[1][j + 1] = max(dp[1][j + 1], dp[0][j] + len[j + 1]);
      //R -> R
      dp[1][j + 1] = max(dp[1][j + 1], dp[1][j] + len[j + 1] - 1);
    }
    ans += max(dp[0][size - 1], max(dp[1][size - 1], dp[2][size - 1]));
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 6224
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	string s, t;
	cin >> s >> t;
	int n = s.size();
	string ts = t.substr(0, n);
	if (s == ts)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

	solve();
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
 
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;
 
int main() {
    auto time = clock();
    int n; cin >> n;
    vll f(n + 1);
    FOR(i, 1, n) {
        for (int j = i; j <= n; j += i) {
            f[j]++;
        }
    }
    ll sum = 0;
    FOR(i, 1, n) sum += i * f[i];
    cout << sum << endl;
}


Measured memory_bytes: 81384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main() {
    int x, a, b; cin >> x >> a >> b;
    if(abs(x-a) < abs(x-b)) cout << 'A' << endl;
    else cout << 'B' << endl;
    
    return 0;
}



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

int main() {
  int n, m;
  cin >> n >> m;
  cout << max(n+m,max(n-m,n*m)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

int main(){
    int n;
    vector<int> vi;
    cin >> n;
    rep(i,2 * n){
        int inp;
        cin >> inp;
        vi.pb(inp);
    }
    sort(all(vi));
    int sum = 0;
    for(int i = 0; i < vi.size(); i+=2){
        sum+=vi[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int heap_size = 0;
void maxHeapify(int* array, int i) {
    int l, r, largest;
    int work;
    l = i * 2;
    r = i * 2 + 1;
    if (l <= heap_size && array[l] > array[i]) {
        largest = l;
    } else {
        largest = i;
    }
    if (r <= heap_size && array[r] > array[largest]) {
        largest = r;
    }
    if (largest != i) {
        work = array[i];
        array[i] = array[largest];
        array[largest] = work;
        maxHeapify(array, largest);
    }
}
void heapIncreaseKey(int* array, int i, int key) {
    int work;
    array[i] = key;
    while (i > 1 && array[i / 2] < array[i]) {
        work = array[i];
        array[i] = array[i / 2];
        array[i / 2] = work;
        i = i / 2;
    }
}
void maxHeapInsert(int* array, int key) {
    heap_size++;
    array[heap_size] = -1;
    heapIncreaseKey(array, heap_size, key);
}
int heapExtractMax(int* array) {
    long max;
    max = array[1];
    array[1] = array[heap_size];
    heap_size--;
    maxHeapify(array, 1);
    return max;
}
int main() {
    char com[10];
    int heap[2000000];
    int arg;
    while (1) {
        scanf("%s", com);
        if (com[0] == 'i') {
            scanf("%d", &arg);
            maxHeapInsert(heap, arg);
        } else if (com[1] == 'x') {
            printf("%d\n", heapExtractMax(heap));
        } else {
            break;
        }
    }
     return 0;
}

Measured memory_bytes: 5428
////////////////////////  : |)  W H I T E C L O U D : |)   ////////////////////////
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    string str;
    ll i,sum=0;
    cin>>str;
    for(i=0; i<str.size(); i++)
        sum+=(str[i]-'0');
    if(sum%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}







Measured memory_bytes: 3780
from typing import List


def answer(n: int, m: int, x: int, y: int, xs: List[int], ys: List[int]) -> str:
    xs.append(x)
    ys.append(y)
    if min(ys) <= max(xs):
        return 'War'
    return 'No War'


def main():
    n, m, x, y = map(int, input().split())
    xs = list(map(int, input().split()))
    ys = list(map(int, input().split()))
    print(answer(n, m, x, y, xs, ys))


if __name__ == '__main__':
    main()



Measured memory_bytes: 10212
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
typedef pair<int, Pii> PiP;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

#define MAX_V 1000
int V;
struct edge{int to, cost;};
vector<edge> G[MAX_V];

void add_edge2(int v1, int v2, int cost){
    G[v1].push_back(edge({v2, cost}));
    G[v2].push_back(edge({v1, cost}));
}

int mod = 1000000007;
bool is_used[1000];

int pow2(int r){
    int a = 1;
    REP(i, r){
        a = (a << 1) % mod;
    }
    return a;
}

signed main(){

    int N, M, X;
    cin >> N >> M >> X;
    V = N;
    vec u(M), v(M), w(M);
    REP(i, M){
        cin >> u[i] >> v[i] >> w[i];
        u[i]--; v[i]--;
        add_edge2(u[i], v[i], w[i]);
    }

    int N1 = 0, N2 = 0;

    REP(i, M){
        fill(is_used, is_used + N, false);
        int N_used = 0, x = 0;

        priority_queue<Pii> que;
        is_used[u[i]] = true;
        is_used[v[i]] = true;
        N_used = 2;
        x += w[i];
        REP(k, G[u[i]].size()){
            que.push(Pii(-1 * G[u[i]][k].cost, G[u[i]][k].to));
        }
        REP(k, G[v[i]].size()){
            que.push(Pii(-1 * G[v[i]][k].cost, G[v[i]][k].to));
        }
        while(N_used < N){
            Pii q = que.top(); que.pop();
            int qv = q.second, qc = -1 * q.first;
            if(!is_used[qv]){
                is_used[qv] = true;
                N_used++;
                x += qc;
                REP(k, G[qv].size()){
                    que.push(Pii(-1 * G[qv][k].cost, G[qv][k].to));
                }
            }
        }
        if(x < X) N1++;
        if(x == X) N2++;
    }

    int ans;
    if(N1 == 0 && N2 == 0){
        ans = 0;
    }else if(N1 == 0 && N2 > 0){
        ans = ((pow2(N2) - 2) * pow2(M - N2)) % mod;
    }else{
        ans = (pow2(M - N1 - N2) * (pow2(N2) - 1) * 2) % mod;
    }
    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    double r,up=3.141592;
    cin>>r;
    cout<<(up)*r+(up)*r<<endl;
    return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
using namespace std;
typedef long long ll;

int main(){
    int a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) cin>>a[i][j];
    }
    int n; cin>>n;
    bool ok[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) ok[i][j]=false;
    }
    for(int i=0;i<n;i++){
        int b; cin>>b;
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(a[j][k]==b) ok[j][k]=true;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(ok[i][0]&&ok[i][1]&&ok[i][2]){
            cout<<"Yes"<<endl;
            return 0;
        }
        if(ok[0][i]&&ok[1][i]&&ok[2][i]){
            cout<<"Yes"<<endl;
            return 0;
        }
        if(ok[0][0]&&ok[1][1]&&ok[2][2]){
            cout<<"Yes"<<endl;
            return 0;
        }
        if(ok[0][2]&&ok[1][1]&&ok[2][0]){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x,2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
#define co(x) cout << x << endl;
#define cins(n,v) rep(i,n){cin >> v.at(i);}
#define couts(v) rep(i,v.size()){cout << v.at(i) << endl;}
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  ll n,j=7,i=1;
  cin >> n;
  if(n%5==0||n%2==0){
    cout << -1 << endl;
    return 0;
  }
  j%=n;
  while(j!=0){
    i++;
    j=(j*10+7)%n;
  }
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
long long A[3];
int main()
{
long long a,b,i,c=1,d=0,n,m,t,j;
for(i=0;i<3;i++) cin>>A[i];
sort(A,A+3);
j=A[2]*2-(A[0]+A[1]);
if(j%2==0) cout<<j/2;
else cout<<(j+3)/2;
return 0;
}


Measured memory_bytes: 3648
import scala.util.control.Breaks
object Main extends App {
  val b = new Breaks()
  b.breakable {
    while (true) {
      val Seq(h, w) = readLine().split(' ').map(_.toInt).toList

      if ((h, w) == (0, 0)) b.break

      println("#" * w)
      print(("#" + ("." * (w - 2)) + "#\n") * (h - 2))
      println("#" * w)
      println()
    }
  }
}


Measured memory_bytes: 44140
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int n = tmp[0], m = tmp[1], x = tmp[2], y = tmp[3];

        int[] xs = ReadIntArray();
        int[] ys = ReadIntArray();

        int z1 = -101;
        for (int i = 0; i < n; i++)
        {
            z1 = Math.Max(z1, xs[i]);
        }
        z1++;

        int z2 = 101;
        for (int i = 0; i < m; i++)
        {
            z2 = Math.Min(z2, ys[i]);
        }

        if ((z1 <= z2) && (x < z1) && (z2 <= y))
        {
            WriteLine("No War");
        }
        else
        {
            WriteLine("War");
        }
    }
}


Measured memory_bytes: 13268
readint()=parse.(Int,readline())
n=readint()

MOD = 10^9+7
NMax = n
fac=ones(Int,NMax)#factorial_mod
for i in 2:NMax
    fac[i]=fac[i-1]*i%MOD
end

function CMOD(a,b)#binominal_mod
    fac[a]*invmod(fac[b],MOD)%MOD*invmod(fac[a-b],MOD)%MOD
end
function pp(n)
    MOD = 10^9+7
    allP=powermod(10,n,MOD)                 #全パターン
    allP-=powermod(8,n,MOD)                    #0個
    allP = mod(allP+MOD,MOD)
    for i in 1:(n-1)
        allP-=2*powermod(8,n-i,MOD)*CMOD(n,i)
        allP = mod(allP+MOD,MOD)
    end
    allP = mod(allP+MOD-2,MOD)
end
print(pp(n))

Measured memory_bytes: 229808
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

#define ketasitei setprecision(15) //15桁表示



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

	ll n, m;
	cin >> n >> m;
	vector<ll> p(m);
	vector<string> s(m);
	rep(i, m)
	{
		cin >> p[i] >> s[i];
	}

	vector<ll> ans(n, 0), pe(n, 0);

	rep(i, m)
	{
		if (s[i] == "AC" && ans[p[i]-1]==0)
		{
			ans[p[i]-1] = 1;
		}
		if (s[i] == "WA" && ans[p[i]-1] == 0)
		{
			pe[p[i]-1]++;
		}
	}

	ll an = 0, pen = 0;
	rep(i, n)
	{
		if (ans[i] == 1)
		{
			an++;
			pen += pe[i];
		}
	}
	cout << an << " " << pen << endl;
	return 0;
}

Measured memory_bytes: 8064
// minpro2019_A
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    int N, M;
    cin >> N >> M;
    
    // calculation
    int num = (N + 1)/2;
    if (num  >= M) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }
    
    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 = 1; i <= (n); ++i)
#define ll long long
#define pp pair<int,int> 
#define v(T) vector<T>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順
 
int main(){
  int n,m;
  cin >> n >> m;
  v(int) x(m),y(m-1);
  rep(i,m) cin >> x[i];
  sort(x.begin(),x.end());
  rep(i,m-1) y[i]=x[i+1]-x[i];
  sort(y.begin(),y.end());
  int ans=0;
  rep(i,m-n) ans+=y[i];
  cout << ans << endl;
  }    

Measured memory_bytes: 1024
n, x = map(int, input().split())

sum_p = [1]
sum_dim = [1]

for i in range(n):
    sum_p.append(sum_p[i] * 2 + 1)
    sum_dim.append(sum_dim[i] * 2 + 3)


def cal(n, rem):
    if n == 0:
        return 0 if rem<= 0 else 1
    elif rem <= 1 + sum_dim[n-1]:
        return cal(n - 1, rem - 1)
    else:
        return sum_p[n-1] + 1 + cal(n - 1, rem - 2 - sum_dim[n-1])


print(cal(n, x))


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[225816],p[410410],f[410410],s[410410]={0};
vector<int> ans;

int main(void){
	int n,i,t=0,d=0;
	ll k;
	cin >> n >> k;
	fill(f,f+n*2,n*2);
	fill(p,p+n*2,-1);
	for(i=0; i<n; ++i){
		cin >> a[i]; --a[i];
		if(p[a[i]]>=0){
			f[p[a[i]]] = i;
		}
		p[a[i]] = i;
	}
	for(i=0; i<n; ++i){
		if(p[a[i]]>=0){
			f[p[a[i]]] = i+n;
		}
		p[a[i]] = i+n;
	}
	while(true){
		if(f[t]==(n-1)){
			++d;
			break;
		}else if(f[t] == (2*n-1)){
			++d;
			s[d] = n;
			++d;
			break;
		}else if(f[t]>=n){
			++d;
			t = f[t]+1-n;
			s[d] = t;
		}else{
			t = f[t]+1;
		}
	}
	--k; k %= d;
	for(i=s[k]; i<n; ++i){
		if(f[i]<n){
			i = f[i];
			continue;
		}
		ans.push_back(a[i]+1);
	}
	for(i=0; i<ans.l_ength(); ++i){
		cout << ((i)?" ":"") << ans[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 7156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (1e5) + 5;
bool done[N][3];
int memo[N][3];
int a[3][N], n;

int dp(int pos, int opt) {
	if (pos == n) {
		return 0;
	}
	int &ret = memo[pos][opt];
	if (done[pos][opt]) return ret;
	done[pos][opt] = 1;
	ret = a[opt][pos] + max(dp(pos + 1, (opt + 1) % 3), dp(pos + 1, (opt + 2) % 3));
	return ret;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d %d", &a[0][i], &a[1][i], &a[2][i]);
	}
	memset(done, 0, sizeof done);
	int ans = max(dp(0, 0), max(dp(0, 1), dp(0, 2)));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 10752
g[24][21],*p;x,X,y,Y;m,i,j,c;main(n){for(memset(g,scanf("%d%d",&n,&m),2e3);scanf("%d,%d,%d,%d",&x,&X,&y,&Y),m--;g[X][x]=Y)g[x][X]=y;for(m=++n;--m;)for(i=n;--i;)for(j=n,p=g[i];--j;p[j]=p[j]<c?p[j]:c)c=p[m]+g[m][j];exit(!printf("%d\n",y-Y-g[x][X]-g[X][x]));}

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

int main()
{
  int N;
  cin >> N;
  int H[N];
  for(int i=0;i<N;i++)
  {
    cin >> H[i];
  }

  bool judge;
  int total = 1;

  for(int i=1;i<N;i++)
  {
    for(int j=0;j<i;j++)
    {
      if(H[i]>=H[j])
      {
        judge = true;
      }
      else
      {
        judge = false;
        break;
      }
    }
    if(judge)total += 1;
  }

  cout << total << endl;

  return 0;
}

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

using namespace std;

int main() {
  int N, K;
  string S, s;
  cin >> N >> K >> S;

  transform(S.begin(), S.end(), s.begin(), ::tolower);

  for (int i = 0; i < N; i++) {
    printf("%c", ((K - 1) == i) ? s[i] : S[i]);
  }

  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.in;

public class Main {
    long mod = 1000000000+7;
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        Integer[] a = new Integer[n];
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        PriorityQueue<Integer> queue = new PriorityQueue<>( Collections.reverseOrder());
        queue.addAll(Arrays.asList(a));
        // greedy. simulate one by one
        for(int i=0;i<m;i++){
            if(queue.size()==0) break;
            int big = queue.poll();
            big /= 2;
            if(big>0) queue.add(big);
        }
        long ans = 0;
        while(queue.size()>0){
            ans += queue.poll();
        }
        return ans;
    }
}



Measured memory_bytes: 62932
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int n = in.nextInt();
            int[][] dp = new int[10][10];
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++) dp[i][j] = 0;

            for (int i = 1; i <= n; i++)
            {
                int ld = i % 10;
                int lg = (int) Math.log10(i);
                int fd = i / (int) Math.pow(10, lg);
                dp[fd][ld] += 1;

            }
            long ans = 0;
            for (int i = 1; i < 10; i++)
            {
                for (int j = 1; j < 10; j++)
                {
                    ans += (dp[i][j] * dp[j][i]);
                }
            }
            out.print(ans);
        }

    }
}



Measured memory_bytes: 25300
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

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

    double ans = 0;

    if (N >= K) {
        ans += 1.0 * (N - K + 1) / N;
    }

    int max_coin = 0;
    {
        int k = K;
        while (k > 0) {
            max_coin++;
            k /= 2;
        }
    }

    int low = K;
    for (int i = 1; i <= max_coin; ++i) {
        int high = low;
        low = (high + 1) / 2;

        double p = 1.0;
        for (int j = 0; j < i; ++j) p /= 2;

        int cnt = 0;
        if (low <= N) {
            cnt = min(N + 1, high) - low;
        }

        ans += p * cnt / N;
    }

    printf("%.9f\n", ans);
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int a,p;
    cin >> a >> p;

    int pi = (a * 3 + p) / 2;
    cout << pi << endl;
    return 0;
}

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

int main(){
  const int64_t mod=1e9+7;
  int64_t N;
  cin >> N;
  int64_t sum=0;
  vector<int64_t> A(N);
  for(int64_t i=0;i<N;i++){
    cin >> A.at(i);
    sum+=A.at(i);
    sum%=mod;
  }
  int64_t ans=0;
  for(int64_t i=0;i<N-1;i++){
    sum-=A.at(i);
    if(sum<0){
      sum+=mod;
    }
    ans+=(sum*A.at(i))%mod;
    ans%=mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4840
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <tuple>
#include <vector>

// lib/quo.hpp
#ifndef QUO_H
#define QUO_H

/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T quo(const T lhs, const T rhs) {
    return lhs > 0 ? lhs / rhs : rhs > 0 ? -((-lhs - 1 + rhs) / rhs) : (-lhs - 1 + -rhs) / -rhs;
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// lib/extgcd.hpp
#ifndef EXTGCD_HPP
#define EXTGCD_HPP


/*
usage:

std::tuple<int, int, int> result = tools::extgcd(4, 5);
int gcd = std::get<0>(result);
int x0 = std::get<1>(result);
int y0 = std::get<2>(result);
*/

namespace tools {
  template <typename T>
  std::tuple<T, T, T> extgcd(T prev_r, T r) {
    T prev_s = 1;
    T prev_t = 0;
    T s = 0;
    T t = 1;
    while (r != 0) {
      const T q = quo(prev_r, r);
      const T next_r = prev_r - q * r;
      prev_r = r;
      r = next_r;
      const T next_s = prev_s - q * s;
      prev_s = s;
      s = next_s;
      const T next_t = prev_t - q * t;
      prev_t = t;
      t = next_t;
    }
    return std::make_tuple(std::abs(prev_r), prev_s, prev_t);
  }
}

#endif

// main.cpp

int main() {
  i64 N, K;
  std::cin >> N >> K;
  std::vector<i64> A;
  tools::read(A, N);

  std::cout << (K <= *std::max_element(A.begin(), A.end()) && K % std::accumulate(A.begin(), A.end(), static_cast<i64>(0), [](const i64 gcd, const i64 A_i) {
    return std::get<0>(tools::extgcd(gcd, A_i));
  }) == 0 ? "POSSIBLE" : "IMPOSSIBLE") << std::endl;
  return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

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

//main code

int main(int argc, char const* argv[])
{
	int d;
	cin >> d;
	cout << "Christmas";
	for (int i = 25; i > d; i--) {
		cout << " Eve";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main(){

        ios::sync_with_stdio(false);
        cin.tie(0);

	int n,m;

	cin >>n >>m;
	int sum=0;
	for(int i=0;i<m;i++){
		int tmp;
		cin >> tmp;
		sum+= tmp;
	}

	if(n-sum>=0) cout<<n-sum;
	else cout<<"-1";

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <list>       // ヘッダファイルインクルード
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()

const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}



// check
// 問題文を復唱する
// cぐらいから問題文を読み替える
// 読み替える

// DP?
// 配置?
// 詰めるのは最後で良い
// 左右二回試せば


int main() {
  ll n, k, h, w, m;
  cin >> n ;


  vector<ll> a(n - 1);
  vector<ll> b(n - 1);
  vector<ll> c(n);

  for (int i = 0; i < n - 1; i++) {
    ll aa, bb;
    cin >> aa >> bb;
    a[i] = aa - 1;
    b[i] = bb - 1;
  }

  cin >> c;


  vector<vector<ll>> nmp(n, vector<ll>());
  vector<bool> nmpc(n,false);
  vector<ll> nmpans(n,-1);

  for (int i = 0; i < n-1; i++) {
    nmp[a[i]].push_back(b[i]);
    nmp[b[i]].push_back(a[i]);
  }


  ll ans = 0;


  sort(c.begin(), c.end(), greater<ll>());

  ll start = 0;
  for (int i = 0; i < n; i++) {
    if (nmp[i].size() == 1){
      start = i;
      break;
    }
  }


  ll count = 0;
  vector<ll> p;
  p.push_back(start);
  nmpc[start] = true;
  nmpans[start] = c[count];
  count++; 



  while (p.size()>0) {
    vector<ll> p2;
    for(auto v:p){
      for(auto v2:nmp[v]){
        if (nmpc[v2] == false){
          nmpc[v2] = true;
          nmpans[v2] = c[count];
          count++;
          p2.push_back(v2);
        }
      }
    }
    p = p2;
  }


  for (ll i = 1; i < n; i++) {
    ans += c[i];
  }



  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    cout << nmpans[i];
    if (i<n-1)cout << " ";
  }


  // cout << (true? "Yes":"No");


}




















Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ull N; cin >> N;
  cout << (N % 2 ? N*2 : N) << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<pair<int,int>>ab(n); for(auto&&i:ab)cin>>i.second>>i.first;
	sort(ab.begin(),ab.end());
	int64_t sum=0;
	bool yes=true;
	for(auto&&i:ab){
		sum+=i.second;
		if(sum>i.first)yes=false;
	}
	cout<<(yes?"Yes"s:"No"s)<<"\n"s;
}

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

int a,b;
int cnt1=0,cnt2=0;
int num[100][100];

int main (){
    scanf("%d %d",&a,&b);
    cout<<100<<" "<<100<<endl;
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            num[i][j]=0;
        }
    }
    for(int i=50;i<100;i++){
        for(int j=0;j<100;j++){
            num[i][j]=1;
        }
    }
    for(int i=0;i<100;i+=2){
        for(int j=0;j<100;j+=2){
            if(cnt1!=a-1){
                num[i][j]=1;
                cnt1++;
            }
        }
    }
    for(int i=99;i>=0;i-=2){
        for(int j=0;j<100;j+=2){
            if(cnt2!=b-1){
                num[i][j]=0;
                cnt2++;
            }
        }
    }
    for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
        if(num[i][j]==0) printf("#");
        else printf(".");
    }cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import math

h=int(input())
if h==1:
  print(1)
  exit(0)
tmp=math.log(h, 2)
tmp2=math.floor(tmp)
if tmp-tmp2>0:
  h=h//2+1
count=0
for i in range(tmp2+1):
  p=int(math.pow(2, i))
  count+=p
  
print(count)


Measured memory_bytes: 3060
s = list(input())

max_len = 0
tmp_len = 0

acgt = ['A','C','G','T']
s.append('B')

for i in s:
    if i in acgt:
        tmp_len += 1
    else:
        max_len = max(max_len, tmp_len)
        tmp_len = 0

print(max_len)

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }
template<typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template<typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


ll solve(int N, string& s) {
    vll ac(N*2+1, 0);
    int lo = N, hi = N;
    ac[lo] = 1;
    for (int i=0; i<N-1; ++i) {
        if (s[i] == '<') {
            for (int j=lo; j<=hi; ++j) {
                (ac[j] += ac[j-1]) %= MOD;
            }
            --lo;
        } else {
            for (int j=hi; j>=lo; --j) {
                (ac[j] += ac[j+1]) %= MOD;
            }
            ++hi;
        }
    }

    return accumulate(ALL(ac), 0LL) % MOD;
}

int main() {
    int N; cin >> N;
    string s; cin >> s;
    assert(s.size() == N-1);
    cout << solve(N,s) << endl;
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
    var n = input.split("\n")[0];
    var stringNums = []
    var nums = [];
    var count = 0;

    for(var i = 1; i <= n; i++) {
        stringNums.push(input.split("\n")[i]);
    }



    for(var i = 0; i < n; i++ ) {
        nums.push(Number(stringNums[i]));
    }
    
    nums.sort(
        function(a,b){
          return b - a;
        }
      );
      

    for (var i = 0; i < n ; i++) {
        if (nums[i] > nums[i + 1] ){
            count ++;
        }
    }
    console.log(count + 1);
}
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF LONG_MAX/3

int main(){
    cin.sync_with_stdio(false);
    ll h, w;
    cin >> h >> w;

    if (h % 3 == 0 || w % 3 == 0) {
        cout << 0 << endl;
    } else {
        ll ans = INF;
        ll a = (h / 3) * w, b = ((h - (h / 3)) / 2) * w, c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        a = (h / 3 + 1) * w, b = ((h - (h / 3 + 1)) / 2) * w, c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        a = (h / 3) * w, b = (h - (h / 3)) * (w / 2), c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        a = (h / 3 + 1) * w, b = (h - (h / 3 + 1)) * (w / 2), c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        swap(h, w);
        a = (h / 3) * w, b = ((h - (h / 3)) / 2) * w, c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        a = (h / 3 + 1) * w, b = ((h - (h / 3 + 1)) / 2) * w, c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        a = (h / 3) * w, b = (h - (h / 3)) * (w / 2), c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        a = (h / 3 + 1) * w, b = (h - (h / 3 + 1)) * (w / 2), c = w * h - a - b;
        minch(ans, max(abs(a - b), max(abs(a - c), abs(b - c))));
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<int> H(N);
  for(int i=0;i<N;i++){
  	cin >> H.at(i);
  }
  
  int Answer=1;
  int flag=0;
  
  for(int i=1;i<N;i++){
  flag=0;
  for(int j=0;j<i;j++){
  	if(H.at(i)<H.at(j)){ 
    flag=1;
    break;
    }
  }
    if(flag==0) Answer++;
  }
  
  cout << Answer << endl;
  
  return 0;
}


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

using namespace std;

const int N = 1e5 + 5;
vector<pair<long long , int> > st[N] , en[N];
long long dp[N];

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

    int s , e , c;
    while (m--) {
        scanf("%d%d%d" , &s , &e , &c);
        en[e].push_back({s , c});
    }

    // first : shortest path to n
    // second : node
    multiset<pair<long long , int> > info;
    for (int i = n ;i >= 1 ;i--) {
        if (i == n)
            dp[i] = 0;
        else
            dp[i] = info.size() ? info.begin()->first : -1;

        if (dp[i] == -1) {
            puts("-1");
            return 0;
        }

        for (auto &p : en[i]) {
            info.insert({p.second + dp[i] , i});
            st[p.first].push_back({p.second + dp[i] , i});
        }

        for (auto &c : st[i])
            info.erase(info.find(c));
    }

    printf("%lld" , dp[1]);
}

Measured memory_bytes: 13568
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
ll inf = 1000000000;
typedef pair<ll, ll> P;
int main() {
	ll x;
	cin >> x;
	ll ans = 0;
       if (x >= 500) {
			ans += x / 500 * 1000;
			x = x % 500;
		}

		
			ans += x / 5 * 5;
		
		cout << ans << endl;
		return 0;



}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 100000

int depth(int);
void pchild(int);

typedef struct{
  int parent;
  int left;
  int right;
} data;
data node[N];


int main(){
  int n,i,j,c,t,l,x,d[20];
  char typ[N][20],a[] = "root",b[] = "leaf",e[] = "internal node";

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    node[i].parent = node[i].left = node[i].right = -1;
  }
  for(i = 0;i < n;i++){
    scanf("%d%d",&x,&c);
    for(j = 0;j < c;j++){
      if(j == 0){
	scanf("%d",&node[x].left);
      node[node[x].left].parent = x;
      l = node[x].left;
      }
      else {scanf("%d",&node[l].right);
      node[node[l].right].parent = x;
      l = node[l].right;
      }
    }
  }
  for(i = 0;i < n;i++){

    if(node[i].parent == -1) strcpy(typ[i], a);
    else if(node[i].left == -1) strcpy(typ[i], b);
    else strcpy(typ[i], e);
    
    d[i] = depth(i);
    printf("node %d: parent = %d, depth = %d, %s, [",i,node[i].parent,d[i],typ[i]);
    pchild(i);
  printf("]\n");
  }
  return 0;
}

int depth(int u){
  int d=0;
  while(node[u].parent != -1){
    u = node[u].parent;
    d++;
  }
  return d;
}

void pchild(int u){
  int c = node[u].left,i=0;
  while(c != -1){
    if(i != 0) printf(", ");
    printf("%d",c);
    c = node[c].right;
    i++;
  }
}



Measured memory_bytes: 4976
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  string S, T;
  cin >> S >> T;
  vector<int> SCount(26);
  vector<int> TCount(26);
  int offset = (int)'a';
  int s, t;
  for (size_t i = 0; i < S.size(); ++i) {
    s = (int)S[i] - offset;
    t = (int)T[i] - offset;
    SCount[s] += 1;
    TCount[t] += 1;
  }

  sort(SCount.begin(), SCount.end(), greater<int>());
  sort(TCount.begin(), TCount.end(), greater<int>());

  for (size_t i = 0; i < SCount.size(); ++i) {
    if (SCount[i] != TCount[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main(){
  
  int n, m;
  cin >> n >> m;
  
  vector<string> a(n), b(m);
  rep(i,n) cin >> a.at(i);
  rep(i,m) cin >> b.at(i);
  
  bool flag;
  for(int i = 0; i <= n-m; i++){
    for(int j = 0; j <= n-m; j++){
      flag = true;
      rep(k,m){
        rep(l,m){
          if(a.at(i+k).at(j+l) != b.at(k).at(l)){
            flag = false;
            break;
          }
        }
        if(!flag) break;
      }//rep
      if(flag) break;
    }
    if(flag) break;
  }
  
  if(flag)
    cout << "Yes" << endl;
  else 
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
N,K=list(map(int, input().split()))
H=list(map(int, input().split()))
"""c=[0]
for i in range(N-1):
    if i+1<K:
        d = [c[i-j]+abs(H[i-j]-H[i+1]) for j in range(i+1)]
    else:
        d = [c[i-j]+abs(H[i-j]-H[i+1]) for j in range(K)]
    c.appeNd(miN(d))
#print(c[-1])"""
H = [H[0]] * K + H
#print(H)
INF = 10**18
dp = [INF] *(K+N)
#print(dp)
dp[0]=0
#print(dp)
for i in range(K, N+K):
    h = H[i]
    costs = [x+abs(y-h) for x, y in zip(dp[i - K:i], H[i - K:i])]
    dp[i] = min(costs)
#print(dp)
print(dp[-1])

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

int main()
{
    char s[300005];
    int n;

    cin >> n;
    cin >> s;

    int sum[300005];
    for(int i = 1 ; i <= n ; i ++)
    {
       if(s[i-1]=='W')
       {
           sum[i]=sum[i-1] + 1;
       }
       else
       {
           sum[i]=sum[i-1];
       }
    }

    int minn=999999999;
    for(int i = 1 ; i <= n  ; i ++)
    {
        int cw=sum[i-1];
        int ce=(n-i)-(sum[n]-sum[i]);
        int ans=cw+ce;
        if(ans<minn)
             minn=ans;
    }

    cout << minn << endl;
    return 0;
}


Measured memory_bytes: 1664