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

int main(){
  int d;
  std::cin >> d;
  if(d == 22) std::cout << "Christmas Eve Eve Eve" << std::endl;
  if(d == 23) std::cout << "Christmas Eve Eve" << std::endl;
  if(d == 24) std::cout << "Christmas Eve" << std::endl;
  if(d == 25) std::cout << "Christmas" << std::endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

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

    int o = 0;
    while (n > 0) {
        n /= k;
        o++;
    }
    cout << o << endl;
    return 0;
}

Measured memory_bytes: 3588
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			P[] ps = new P[4];
			String[] vs = sc.next().split(",");
			for(int i=0;i<4;i++) ps[i] = new P( Double.parseDouble(vs[2*i]), Double.parseDouble(vs[2*i+1]) );
			
			System.out.println( ( cross(ps[0], ps[2], ps[1], ps[3])? "YES": "NO" ) );
		}
	}
	
	boolean cross(P p1, P p2, P q1, P q2) {
		return p1.sub(p2).det(q1.sub(p2)) * p1.sub(p2).det(q2.sub(p2)) < 0.0 &&
			   q1.sub(q2).det(p1.sub(q2)) * q1.sub(q2).det(p2.sub(q2)) < 0.0;
	}
	
	class P {
		double x, y;
		P(double x, double y) {
			this.x = x;
			this.y = y;
		}
		
		P sub(P p) {
			return new P(x-p.x, y-p.y);
		}
		
		double det(P p) {
			return x*p.y - p.x*y;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

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

const int MAXN = 100001;

int a[MAXN];

pair <int, bool> g(int x) {
    int j = 0;
    while ((1 << j) < x) {
        j++;
    }

    return { j,  ((1 << j) == x) };
}

int main() {
#ifdef PAUNSVOKNO
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20);
    int n;
    cin >> n;
    int c = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        auto p = g(a[i]);
        int f = p.first;
        bool gg = p.second;
        if (c >= f) {
            c = f;
            if (!gg) c--;
        } else {
            ans += (f - c);
            c = f;
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long
int main()
{
    char S[12]="2019/04/30";
    char S1[12]= {'\0'};
    char Year_t[12]= {'\0'};
    char Month_t[12]= {'\0'};
    char Day_t[12]= {'\0'};

    strncpy(Year_t,S,4);
    strncpy(Month_t,S+5,2);
    strncpy(Day_t,S+8,2);


    int Year1 = atoi(Year_t);
    int Month1= atoi(Month_t);
    int Day1  = atoi(Day_t);

    scanf("%s",S1);

    char Year_t1[12]= {'\0'};
    char Month_t1[12]= {'\0'};
    char Day_t1[12]= {'\0'};

    strncpy(Year_t1,S1,4);
    strncpy(Month_t1,S1+5,2);
    strncpy(Day_t1,S1+8,2);


    int Year2 = atoi(Year_t1);
    int Month2= atoi(Month_t1);
    int Day2  = atoi(Day_t1);


    if (Year2>Year1)
    {
        printf("TBD");
        return 0;
    }
    else if (Month2>Month1)
    {
        printf("TBD");
        return 0;
    }
    else if (Day2>Day1)
    {
        printf("TBD");
        return 0;
    }
    else
        printf("Heisei");



    return 0;
}


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

int main(){

    int h,w;

    cin >> h >> w;

    vector<string> a(h);

    for(int i = 0;i < h; ++i){

        cin >> a[i];

        a[i] += "\n";

        if((int)a[i].find("#") == -1){

            a[i].erase(a[i].begin(),a[i].end());

        }
    }

    int n = w;

    for(int i = 0; i < n; ++i){

        for(int j = 0;j < w; ++j){

            bool b = true;

            for(int k = 0; k < h; ++k){

                if(a[k][j] == '#')b = false; 

            }

            if(b){

                for(int k = 0; k < h; ++k){

                    if(a[k].empty() == false){
                    
                        a[k].erase(a[k].begin() + j);

                    }

                }
                --w;
            }

        }

    }
    for(string i: a)cout << i;

    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int h,i,j,k,w;
    while(1){
        scanf("%d%d",&h,&w);
        if(h==0&&w==0) break;
        for(i=0;i<h;i++){
            if(i==0||i==h-1){
                for(j=0;j<w;j++){
                    printf("#");
                }
                printf("\n");
            }else{
                for(j=0;j<w;j++){
                    if(j==0||j==w-1){
                        printf("#");
                    }else{
                        printf(".");
                    }
                }
                printf("\n");
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2608
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(void){
    int a[10];
    int i, j, f;
    f = 0;

    for(i=1;i<=2;i++) {
        scanf("%d", &a[i]);
    }

    while(a[1] > 0){
        a[1] -= a[2];
        f += 1;
    }

    printf("%d",f);
    return 0;
}

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


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

    sort(a, a + N);
    int c=0;
    for (int i = 0; i < N; ++i) {
      
        if (a[i]==a[i+1]) { 
           
        }
        else { 
          c+=1;
        }
    }
    cout << c << endl;
}
  
  


Measured memory_bytes: 256
/*
   TASK: nocows
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

using namespace std;
#define finish(x) return cout << x, 0;
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

const string USCAO_TAG = "nocows";
void usaco() { setIn(USCAO_TAG + ".in"); setOut(USCAO_TAG + ".out"); }


template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * I didn't wanna do this round :/
 */

vector<vector<int>> adj;
ll v[200005];
bool vi[200005];

void dfs(int node, ll val){

	if(vi[node]) return;

	vi[node] = 1;
	for(auto x: adj[node]){
		dfs(x, val + v[node]);
	}

	v[node] += val;
}

int main() {
	#ifdef LOCAL
	setIn("in.txt");
	#endif

	int n, q;
	cin >> n >> q;

	adj.assign(n + 1, vector<int>());
	for(int i = 0; i < n - 1; i++){
		int p, q;
		cin >> p >> q;

		adj[p].push_back(q);
		adj[q].push_back(p);
	}

	for(int i = 0; i < q; i++){
		int x, y;
		cin >> x >> y;

		v[x] += y;
	}

	dfs(1, 0);

	for(int i = 1; i <= n; i++){
		cout << v[i] << " ";
	}
}


Measured memory_bytes: 24448
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> vec1(n);
    vector<pair<int,int>> vec(m);
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        vec1[i]=x;
    }
    for(int i=0;i<m;i++){
        int b,c;
        cin >> b >> c;
        vec[i]=make_pair(c,b);
    }
    sort(vec1.begin(),vec1.end());
    sort(vec.begin(),vec.end());
    int n_reg=0;
    for(int i=m-1;i>=0;i--){
        for(int j=vec[i].second;j>0;j--){
          //  cout<<"vec[i].second "<<vec[i].second<<endl;
            if(vec[i].first<vec1[n_reg]){
         //       cout<<"Break"<<endl;
                break;
            }else{
            vec1[n_reg]=vec[i].first;
        //    cout<<"書き換え"<<endl;
            n_reg++;
            }
            if(n_reg>n){
                break;
            }
        }
        if(n_reg>n){
            break;
        }
    }
    long long Count=0;
    for(int i=0;i<n;i++){
        Count += vec1[i];
     //   cout<<vec1[i]<<endl;
    }
    cout<< Count <<endl;
}

Measured memory_bytes: 1408
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]
 
A = []
B = []
for i in range(N):
  A.append(AB[i][0])
  B.append(AB[i][1])
A.sort()
B.sort()
if N % 2 == 0:
    n = N // 2
    med1 = A[n-1] + A[n]
    med2 = B[n-1] + B[n]
    x = med2 - med1 + 1
else:
    n = N // 2
    med1 = A[n]
    med2 = B[n]
    x = med2 - med1 + 1
    
print(x)


Measured memory_bytes: 49232
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;

void solve() {
    int s, w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

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


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

using namespace std;

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  int n;
  string s, t;
  cin >> n >> s >> t;
  if (n <= 2) {
    int answer = 0;
    for (int i = 0; i < n; ++i) {
      if (s[i] != t[i]) {
        ++answer;
      }
    }
    printf("%d\n", answer);
    return 0;
  }
  vector<pair<int, int>> diff_s, diff_t;
  for (int i = 0; i < n - 1; ++i) {
    if (s[i] != s[i + 1]) {
      diff_s.emplace_back(i, s[i] - '0');
    }
    if (t[i] != t[i + 1]) {
      diff_t.emplace_back(i, t[i] - '0');
    }
  }
  int answer = INT_MAX;
  auto solve = [&](vector<pair<int, int>> a, vector<pair<int, int>> b) {
    if (a.size() > b.size()) {
      swap(a, b);
    }
    reverse(a.begin(), a.end());
    while (a.size() < b.size()) {
      a.emplace_back(-1, !a.back().second);
    }
    reverse(a.begin(), a.end());
    if (a.back().second == b.back().second) {
      int result = 0;
      for (int i = 0; i < a.size(); ++i) {
        result += abs(a[i].first - b[i].first);
      }
      answer = min(answer, result);
    }
  };
  for (int rotate = 0; rotate < 2; ++rotate) {
    vector<pair<int, int>> new_diff_t = diff_t;
    for (int i = 0; i <= n; ++i) {
      solve(diff_s, new_diff_t);
      new_diff_t.emplace_back(n - 1, !new_diff_t.back().second);
    }
    swap(diff_s, diff_t);
  }
  printf("%d\n", answer);
  return 0;
}


Measured memory_bytes: 852
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

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

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  string s,t;
  cin >> s>>t;
  bool ok=true;
  rep(i,s.size()){
    if(s[i]!=t[i]) ok=false;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int	main(void)
{
	char	str[1001], *tmp;

	scanf("%s", str);
	tmp = str;
	while (*tmp)
	{
		if (!*(tmp + 1))
		{
			if (*tmp == 's')
			{
				*(tmp + 1) = 'e';
				*(tmp + 2) = 's';
				*(tmp + 3) = 0;
			}
			else
			{
				*(tmp + 1) = 's';
				*(tmp + 2) = 0;
			}
			break ;
		}
		tmp++;
	}
	printf("%s\n", str);
	return (0);
}

Measured memory_bytes: 1648
from sys import stdin, setrecursionlimit
setrecursionlimit(10**6)

N, Q = map(int, stdin.readline().split())
graph = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, stdin.readline().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
counter = [0] * N
for i in range(Q):
    p, x = map(int, stdin.readline().split())
    counter[p - 1] += x


def dfs(now, prev=-1):
    for next in graph[now]:
        if next == prev:
            pass
        else:
            counter[next] += counter[now]
            dfs(next, now)


dfs(0)
print(*counter)


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

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

vector<int> ary;

int main() {
  int n,k,m,i,j;
  while(cin>>n>>k>>m, n|k|m) {
    ary.clear();
    ary.resize(n);
    rep(i,n) ary[i] = i;

    vector<int>::iterator it = ary.begin();
    int count = n-1,pos = m-1;
    ary.erase(it+m-1);
    while(count > 1) {
      pos = (pos+k-1)%count;
      ary.erase(ary.begin()+pos);
      --count;
    }
    cout<<*ary.begin()+1<<endl;
  }
}

Measured memory_bytes: 944
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/*
 * SoundHound Inc. Programming Contest 2018 -Masters Tournament- A "F"
 *   https://soundhound2018-summer-qual.contest.atcoder.jp/tasks/soundhound2018_summer_qual_a/
 */
public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int a = in.nextInt();
		int b = in.nextInt();

		if (a + b == 15) {
			out.println("+");
		} else if (a * b == 15) {
			out.println("*");
		} else {
			out.println("x");
		}

		in.close();
		out.close();
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public int nextInt() {
			return scanner.nextInt();
		}

		public long nextLong() {
			return scanner.nextLong();
		}

		public double nextDouble() {
			return scanner.nextDouble();
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

}


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

int main() {
  int a,b,X;
  cin >> a >> b;
  
  X = a * b;
  X %= 2;
  
  if (X == 1) {
    cout << "Odd" << endl;
  }
  else if (X == 0) {
    cout << "Even" << endl;
  }
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if( 1 <= a && a <= 9 &&  1 <= b && b <= 9 ){
    cout << a*b << endl;
  }else{
    cout << -1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int c = scanner.nextInt();
			if ((n | c) == 0)
				break;
			int[] a = new int[n];
			int[] b = new int[c];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < 16; j++)
					a[i] |= (scanner.nextInt() << j);
			for (int i = 0; i < c; i++)
				for (int j = 0; j < 16; j++)
					b[i] |= (scanner.nextInt() << j);
			int[][] dp = new int[n + 1][1 << 16];
			for (int i = 0; i <= n; i++)
				Arrays.fill(dp[i], -1);
			dp[0][0] = 0;
			for (int i = 0; i < n; i++) {
				for (int S = 0; S < 1 << 16; S++) {
					if (dp[i][S] == -1)
						continue;
					int light = S | a[i];
					for (int j = 0; j < c; j++) {
						int pushed = light & b[j];
						int point = Integer.bitCount(pushed);
						int nx = light & ~b[j];
						if (dp[i + 1][nx] < point + dp[i][S])
							dp[i + 1][nx] = point + dp[i][S];
					}
				}
			}
			int max = 0;
			for (int i = 0; i < 1 << 16; i++)
				max = Math.max(max, dp[n][i]);
			System.out.println(max);

		}
	}
}

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

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

    vector<string> w(n);
    cin >> w[0];
    string s;
    int flag = 0;
    for(int i = 1; i < n; i++){
        cin >> s;
        for(int j = 0; j < w.size(); j++){
            if(s == w[j]){
                flag = 1;
            }
        }
        if(s[0] != w[i-1][w[i-1].size()-1]){
            flag = 1;
        }
        w[i] = s;
    }

    if(flag){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;

}



Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
m = map(int,read().split())
ST = zip(m,m)

out_edge = [[] for _ in range(N+1)]
in_edge = [[] for _ in range(N+1)]

for s,t in ST:
    out_edge[s].append(t)
    in_edge[t].append(s)

out_deg = [len(x) for x in out_edge]

arrive_prob = [0]*(N+1)
arrive_prob[1] = 1.0
for n in range(2,N+1):
    arrive_prob[n] = sum(arrive_prob[p]/out_deg[p] for p in in_edge[n])

# その頂点に辿り着くまでの回数期待値
# いらなかったっぽい
# expected_to = [0]*(N+1)
# for n in range(2,N+1):
#     expected_to[n] = 1 + sum(expected_to[p]*arrive_prob[p]/out_deg[p] for p in in_edge[n])/arrive_prob[n]

# その頂点に辿り着いてからの回数期待値
expected_from = [0]*(N+1)
for n in range(N-1,0,-1):
    expected_from[n] = 1+sum(expected_from[c] for c in out_edge[n])/out_deg[n]

current_time = expected_from[1]

improve = 0
for n in range(1,N):
    if out_deg[n] == 1:
        continue
    x = expected_from[n]
    d = out_deg[n]
    y = (d*(x-1)-max(expected_from[c] for c in out_edge[n]))/(d-1) + 1
    value = (x-y)*arrive_prob[n]
    if improve < value:
        improve = value

answer = current_time - improve
print(answer)


Measured memory_bytes: 29724
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let h: i64 = sc.cin();

    let mut a = vec![0i64; n];
    let mut b = vec![0i64; n];
    for i in 0..n {
        a[i] = sc.cin();
        b[i] = sc.cin();
    }
    let amax = max!(..a).unwrap();
    b.sort(); b.reverse();
    // trace!(&amax, &b);

    let mut ans: i64 = (h + amax - 1) / amax;
    // trace!(ans);
    for i in 0..n+1 {
        let rest = h - b[0..i].iter().sum::<i64>();
        let c = if rest <= 0 {
            i as i64
        } else {
            i as i64 + (rest + amax - 1) / amax
        };
        // trace!(i, rest, c);
        ans = min!(ans, c);
    }
    put!(ans);

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 6396
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int sx, sy, tx, ty, nx, ny;
	scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
	nx=sx, ny=sy;
	if(sx==tx){
		if(sy<ty){
			while(ny<ty){putchar('U'); ny++;}
			putchar('R');
			while(ny>sy){putchar('D'); ny--;}
			putchar('L');
			putchar('L');
			while(ny<ty){putchar('U'); ny++;}
			putchar('R');
			putchar('U'); putchar('L'); putchar('L'); ny++;
			while(ny>=sy){putchar('D'); ny--;}
			putchar('R'); putchar('R'); putchar('U');
		}else{
			while(ny>ty){putchar('D'); ny--;}
			putchar('R');
			while(ny<sy){putchar('U'); ny++;}
			putchar('L');
			putchar('L');
			while(ny>ty){putchar('D'); ny--;}
			putchar('R');
			putchar('D'); putchar('L'); putchar('L'); ny--;
			while(ny<=sy){putchar('U'); ny++;}
			putchar('R'); putchar('R'); putchar('D');
		}
	}else if(sy==ty){
		if(sx<tx){
			while(nx<tx){putchar('R'); nx++;}
			putchar('U');
			while(nx>sx){putchar('L'); nx--;}
			putchar('D'); putchar('D');
			while(nx<tx){putchar('R'); nx++;}
			putchar('U');
			putchar('R'); putchar('D'); putchar('D'); nx++;
			while(nx>=sx){putchar('L'); nx--;}
			putchar('U'); putchar('U'); putchar('R');
		}else{
			while(nx>tx){putchar('L'); nx--;}
			putchar('U');
			while(nx<sx){putchar('R'); nx++;}
			putchar('D');
			putchar('D');
			while(nx>tx){putchar('L'); nx--;}
			putchar('U');
			putchar('L'); putchar('D'); putchar('D'); nx--;
			while(nx<=sx){putchar('R'); nx++;}
			putchar('U'); putchar('U'); putchar('L');
		}
	}else{
		//
		if(sx<tx) while(nx<tx){putchar('R'); nx++;}
		if(sx>tx) while(nx>tx){putchar('L'); nx--;}
		if(sy<ty) while(ny<ty){putchar('U'); ny++;}
		if(sy>ty) while(ny>ty){putchar('D'); ny--;}
		//
		if(tx<sx) while(nx<sx){putchar('R'); nx++;}
		if(tx>sx) while(nx>sx){putchar('L'); nx--;}
		if(ty<sy) while(ny<sy){putchar('U'); ny++;}
		if(ty>sy) while(ny>sy){putchar('D'); ny--;}
		//
		if(sy<ty){putchar('D'); ny--;}
		if(sy>ty){putchar('U'); ny++;}
		if(sx<tx) while(nx<=tx){putchar('R'); nx++;}
		if(sx>tx) while(nx>=tx){putchar('L'); nx--;}
		if(sy<ty) while(ny<ty){putchar('U'); ny++;}
		if(sy>ty) while(ny>ty){putchar('D'); ny--;}
		if(sx<tx){putchar('L'); nx--;}
		if(sx>tx){putchar('R'); nx++;}
		//
		if(ty<sy){putchar('D'); ny--;}
		if(ty>sy){putchar('U'); ny++;}
		if(tx<sx) while(nx<=sx){putchar('R'); nx++;}
		if(tx>sx) while(nx>=sx){putchar('L'); nx--;}
		if(ty<sy) while(ny<sy){putchar('U'); ny++;}
		if(ty>sy) while(ny>sy){putchar('D'); ny--;}
		if(tx<sx){putchar('L'); nx--;}
		if(tx>sx){putchar('R'); nx++;}
	}
	putchar(10);
}


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

int main(){

    int N,M;
    cin >> N >> M;
    vector<int> A(M),B(M);
    for(int i=0;i<M;i++)
        cin >> A[i] >> B[i];

    vector<vector<int>> G(N+1); //G(0) will not be used
    for(int i=0;i<M;i++){
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    queue<int> que;
    que.push(1);
    int signs[N+1];
    bool reached[N+1];
    for(int i=0;i<=N;i++)
        reached[i] = false;

    while(!que.empty()){
        int now = que.front();
        que.pop();
        for(auto v : G[now]){
            if(!reached[v]){
                que.push(v);
                reached[v] = true;
                signs[v] = now;
            }
        }
    }

    cout << "Yes" << endl;
    for(int i=2;i<=N;i++){
        cout << signs[i] << endl;
    }

    return 0;
}

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

int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)==2)
    {
        int sum;
        if(b<a)
            sum=a-1;
        else
            sum=a;
        printf("%d\n",sum);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
using namespace std;
int main(){
    int a,b,d,r;
    double f;
    cin>>a>>b;
    d=a/b;
    r=a%b;
    f=a*1.0/b;
    printf("%d %d %lf",d,r,f);
    return 0;
    
}


Measured memory_bytes: 3208
// 6/11
// 3-1-4. 平均最大化
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;


ll dp[51][2510][51];

int main() {
    ll N, A;
    cin >> N >> A;
    vector<ll> x(N);
    rep(i, N) cin >> x[i];

    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;

    for (ll i = 1; i <= N; i++) {
        for (ll j = 0; j <= 2500; j++) {
            // k = 0。
            // dp[i][j][0] = dp[i - 1][j][0];

            for (ll k = 0; k <= i; k++) {
                // i枚目を使わない場合
                dp[i][j][k] += dp[i - 1][j][k];

                // i枚目を使う場合
                if (j + x[i - 1] <= 2500) {
                    dp[i][j + x[i - 1]][k + 1] += dp[i - 1][j][k];
                }
            }
        }
    }

    ll res = 0;
    for (ll k = 1; k <= 50; k++) {
        res += dp[N][k * A][k];
    }

    cout << res << endl;
}

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

using namespace std;

int N, Tlen, Slen;
string Target, Str;

bool judge(int posS, int interval) {
	int posT;

	posT = 2;
	while (posS < Slen) {
		if (Str[posS] != Target[posT]) {
			return false;
		}
		posS += interval;
		++posT;
		if (posT == Tlen) {
			return true;
		}
	}

	return false;
}

int main() {
	int total;
	bool flag;

	cin >> N >> Target;
	Tlen = Target.size();
	total = 0;
	for (int i = 0; i < N; ++i) {
		cin >> Str;
		Slen = Str.size();
		if (Slen < Tlen) {
			continue;
		}
		flag = true;
		for (int i = 0; flag && i < Slen; ++i) {
			if (Str[i] != Target[0]) {
				continue;
			}
			for (int j = i + 1; flag && j < Slen; ++j) {
				if (Str[j] != Target[1]) {
					continue;
				}
				if (judge(j + j - i, j - i)) {
					flag = false;
					++total;
				}
			}
		}
	}
	cout << total << endl;

	return 0;
}


Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    ll N;
    cin >> N;
    vector<int> arr;
    while (N != 0) {
        if (N % 2 != 0) {
            arr.push_back(1);
            N -= 1;
        } else {
            arr.push_back(0);
        }
        N /= -2;
    }
    for(int i = arr.size()-1; i >= 0; i--)
        cout << arr[i];
    if (arr.empty())
        cout << 0;

    return 0;
}



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

#define LL long long

const int maxN=505;

int n;
LL f[maxN+1][maxN+1],A[maxN+1][maxN+1],s1[maxN+1][maxN+1],s2[maxN+1][maxN+1];

inline LL read()
{
	LL num=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))num=(num<<3)+(num<<1)+(ch^48),ch=getchar();
	return num*f;
}

inline LL query(int xu,int yu,int xd,int yd,LL sum[maxN+1][maxN+1])
{
	return sum[xd][yd]-sum[xu-1][yd]-sum[xd][yu-1]+sum[xu-1][yu-1];
}

int main()
{

	n=read();
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			if(i!=j)A[i][j]=read();
			s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1];
			s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1];
			if(i<j)s1[i][j]+=A[i][j];
			if(i>j)s2[i][j]+=A[i][j];
		}
	
	for(int i=1;i<=n-1;i++)
	{
		f[i][0]=query(1,1,i+1,i,s2);
		for(int j=0;j<i;j++)
		{
			f[i][i]=max(f[i][i],f[i-1][j]+query(i+1,j+1,i+1,i,s2)+query(1,i+1,i,i+1,s1));
			for(int k=0;k<j;k++)
				f[i][j]=max(f[i][j],f[j-1][k]+query(j+1,k+1,i+1,i,s2)+query(1,j+1,j,i+1,s1));
		}
	}

	LL ans=0;
	for(int i=0;i<=n-1;i++)ans=max(ans,f[n-1][i]);
	printf("%lld",s1[n][n]+s2[n][n]-ans);
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define ins insert
#define er erase
#define bg begin()
#define ed end()
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define files(name) fin(name".in"); fout(name".out")
#define enter cout << "\n"
#define space cout << " "
#define endl "\n"
#define fi(st,n) for (int i = (st); i <= (n); i++)
#define fj(st,n) for (int j = (st); j <= (n); j++)
#define fk(st,n) for (int k = (st); k <= (n); k++)
#define fq(st,n) for (int q = (st); q <= (n); q++)
#define fw(st,n) for (int w = (st); w <= (n); w++)
#define ff(i, st, n) for (int (i) = (st); (i) <= (n); (i)++)
#define ei(st,n) for (int i = (st); i >= (n); i--)
#define ej(st,n) for (int j = (st); j >= (n); j--)
#define ek(st,n) for (int k = (st); k >= (n); k--)
#define ri(st,n) for (int i = (st); i < (n); i++)
#define rj(st,n) for (int j = (st); j < (n); j++)
#define rk(st,n) for (int k = (st); k < (n); k++)
#define rq(st,n) for (int q = (st); q < (n); q++)
#define rf(i, st, n) for (int (i) = (st); (i) < (n); (i)++)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define y1 dsklmlvmd

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int inf = (int)1e9;
const dbl eps = (dbl) 1e-8;
const int mod = (int) 1000000007;
const int maxn = (int) 1e5 + 5;
//const dbl M_PI = (dbl)2 * (dbl)acos(0);

//cout<<fixed<<setprecision(10);
//srand(time(0))

int n, k;
pii a[maxn];

int main()
{
//	fin("t.in");
	sync;
	cin >> n;
	fi(1, n)
	{
		cin >> a[i].X;
		a[i].Y = i;
	}
	sort(a + 1, a + n + 1);
	k = 0;
	fi(1, n)
	{
		if (i % 2 != a[i].Y % 2)
			k++;
	}
	cout << k / 2 << endl;
 	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>

using namespace std;

const int INF = 1e9;

int main() {
  ios::sync_with_stdio(false);
  int lh, lw;
  cin >> lh >> lw;
  int h, w;
  cin >> h >> w;
  cout << (lh-h) * (lw-w);


}

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

const int64_t MOD = 1e9+7;

//繰り返し二乗法
int64_t pown(int64_t x, int64_t n) {
  int64_t ans = 1;
  while (n > 0) {
    if ((n & 1) == 1) {
      ans = ans * x;
      ans %= MOD;
    }
    x = x * x;//一周する度にx, x^2, x^4, x^8となる
    x %= MOD;
    n >>= 1; //桁をずらす n = n >> 1
  }
  return ans;
}

int64_t calc(int64_t A,int64_t C, int64_t QB, int64_t QA){
    int64_t x = A*C*pown(3,QB+QA); //AC
    x %= MOD;
    x += A*QA*pown(3,QB+QA-1); //A?
    x %= MOD;
    x += QB*C*pown(3,QB+QA-1); //?C
    x %= MOD;
    x += QB*QA*pown(3,QB+QA-2);  //??
    x %= MOD;
    return x;
}

int main() {

    // input from txt （提出時にこの箇所は削除すること）
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    string S;
    cin >> S;
    int64_t a = 0;
    int64_t sum_b = 0;
    int64_t ans = 0;
    int64_t Q_before = 0;
    int64_t Q_after = 0;
    int64_t C = 0;

    
    for(int i=0; i<S.size(); i++){
        if(S.at(i) == '?'){
            Q_after++;
        }
        if(S.at(i) == 'C'){
            C++;
        }
    }
    

    
    for(int i=0; i<S.size(); i++){
        if(S.at(i) == 'A'){
            a++;
        }
        else if(S.at(i) == 'B'){
            ans += calc(a,C,Q_before,Q_after);
            ans %= MOD;
        }
        else if(S.at(i) == 'C'){
            C--;
        }
        else{
            Q_after--;
            ans += calc(a,C,Q_before,Q_after);
            ans %= MOD;
            Q_before++;
        }
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
ll read(){
	ll ans=0,f=1;char a=getchar();while(a>'9'||a<'0'){if(a=='-')f=(-1);a=getchar();}
	while(a>='0'&&a<='9')ans=(ans<<3)+(ans<<1)+a-'0',a=getchar();return ans*f;
}//一条long long的黄金分割线---------------------------------------------------------------------------------------------
int main(){
	ll a=read();
	cout<<a+a*a+a*a*a;
	return 0; 
} 

Measured memory_bytes: 3672
// C - Many Medians
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);++i)
int in(){int x;cin>>x;return x;}

int main(){
	int N; cin>>N;
	vector<pair<int,int>> X;//<x,index>
	rep(i, N) X.emplace_back(in(), i);
	sort(all(X));
	int c = (N-1)/2 + 1;
	vi ans(N);
	rep(i, N) ans[X[i].second] = X[ i<c? c:c-1 ].first;
	rep(i, N) cout<<ans[i]<<endl;
}

Measured memory_bytes: 4592
n = gets.chomp.to_i
a= gets.chomp.split.map(&:to_i)
cnt = a.count{|o| o < 0}
sum = 0
n.times { |i|
  sum += a[i].abs
}
if cnt % 2 != 0
  min = a.min_by{|o| o.abs}
  sum -= 2*min.abs
end
puts sum


Measured memory_bytes: 9732
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;	

int dp[102][102];
int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	lli t,n,m,r,temp,temp1,temp2,temp3,k,a,b,c,d,count,x,y;
	
	cin>>n>>m;
	int grid[n+2][m+2];	
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			dp[i][j]=1e9+7;
		}
	}
	char ch;
	
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>ch;
			if(ch=='#')
			{
				grid[i][j]=1;
			}
			else
			{
				grid[i][j]=0;
			}
		}
	}
	
	if(grid[1][1]==0)
	dp[1][1]=0;
	else
	dp[1][1]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(i>1)
			{
				if(grid[i-1][j]==0&&grid[i][j]==1)
				{
					dp[i][j]=1+dp[i-1][j];
				}
				else
				{
					
					dp[i][j]=dp[i-1][j];
				}
			}
			
			if(j>1)
			{
				if(grid[i][j-1]==0&&grid[i][j]==1)
				{
					
					dp[i][j]=min(1+dp[i][j-1],dp[i][j]);
				}
				else
				{
					dp[i][j]=min(dp[i][j-1],dp[i][j]);
				}
			}
		}
	}
	

	cout<<dp[n][m];
}


Measured memory_bytes: 384
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				//System.out.print(idx2 + " ");
				tmp.add(idx2);
			}	
			//System.out.println();
			adjList.add(tmp);
		}
		
		
		in.close();
	}
	public void printAdjMatrix() {
		int[][] adjMatrix = new int[totalVertex][totalVertex];
		//complete the following
		for (int i = 0; i < totalVertex; i++) {
			LinkedList<Integer> currElement = adjList.get(i);
			Iterator<Integer> it = currElement.iterator();
			for (int j = 0; j < currElement.size(); j++) {
				adjMatrix[i][it.next()] = 1;
			}
		}
		
		for (int i = 0; i < totalVertex; i++) {
			for (int j = 0; j < totalVertex; j++) {
				System.out.print(adjMatrix[i][j]);
				if (j < totalVertex - 1) {
					System.out.print(" ");
				}
			}
			System.out.println();
		}
		
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main{
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}



Measured memory_bytes: 34860
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin>>n;
  vector<int> x(n);
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    while(x[i]%2==0){
      x[i]/=2;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3620
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//221
	int n;
	cin>>n;
	set<int> a;
	while(n--){
		int val;
		cin>>val;
		a.insert(val);
	}
	cout<<a.size();
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3596
// ????????¢?????????????????????????????????????????????????????°????????????????????????????????????
// ?¬????????????????????????¢?????????????????????????????¨??????
// ????????????????????§?¨? (W,H) ????????????????????????
// ????????????????????????????????§?¨? (x,y) ??¨?????? r ??§?????????????????????

#include <stdio.h>

int main(void)
{
	int W, H, x, y, r;

	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

	if (y + r <= H && x + r <= W && 0 <= x - r && 0 <= y - r) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}

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

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back
#define mp std::make_pair
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> inline bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

template <typename T> T read(T& x) {
    T f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 200000;

int n, m;
char st[N + 5];
int ans[N + 5];
vector<int> a, b, c, d;

int main() {
#ifdef Wearry
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    scanf("%d%s", &n, st + 1), st[0] = st[n << 1] = '1';

    for(int i = 0; i < n << 1; ++i) {
        if(st[i] == '0' && st[i+1] == '0') {
            a.pb(i);
        } else if(st[i] == '0' && st[i+1] == '1') {
            b.pb(i);
        } else if(st[i] == '1' && st[i+1] == '0') {
            c.pb(i);
        } else {
            d.pb(i);
        }
    }

    int k = d.size();
    if(k & 1) return puts("No"), 0;
    if(k & 2) {
        int x = 0;
        for(; x < (n << 1) && st[x] == '1'; ++ x);
        if(x >= (n << 1)) return puts("No"), 0;

        while(true) {
            for(; x < (n << 1) && st[x] == '0'; ++ x);
            if(x >= (n << 1)) return puts("No"), 0;

            if(st[x + 1] == '1') {
                break;
            } else {
                x += 2;
            }
        }

        int y = x + 1, z = 0;
        for(; y < (n << 1) && st[y] == '1'; ++ y);
        if(y >= (n << 1)) return puts("No"), 0;

        for(; z < k && d[z] > x-1 && d[z] < y-1; ++ z);
        if(z >= k) return puts("No"), 0;

        for(; z+1 < k && d[z+1] < x-1; ++ z);

        int o = x - 1, p = y - 1;
        ans[o] = ans[p] = ++ m; 
        b.erase(std::lower_bound(b.begin(), b.end(), o)); 
        c.erase(std::lower_bound(c.begin(), c.end(), p));

        int q = x, r = d[z];
        ans[q] = ans[r] = ++ m;
        d.erase(std::lower_bound(d.begin(), d.end(), q)); 
        d.erase(std::lower_bound(d.begin(), d.end(), r));
    }

    for(int i = 0; i < (int) a.size(); i += 2) {
        ans[a[i]] = ans[a[i+1]] = ++ m;
    }
    for(int i = 0; i < (int) b.size(); ++i) {
        ans[c[i]] = ans[b[i]] = ++ m;
    }
    for(int i = 0; i < (int) d.size(); i += 4) {
        ans[d[i]] = ans[d[i + 2]] = ++ m;
        ans[d[i + 1]] = ans[d[i + 3]] = ++ m;
    }

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

    return 0;
}


Measured memory_bytes: 3448
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func main() {
	n := readInt()
	d, x := readInt(), readInt()
	var a []int
	var sum int
	for i := 0; i < n; i++ {
		a = append(a, readInt())
	}

	for i := 0; i < n; i++ {
		sum += 1 + (d-1)/a[i]
	}
	fmt.Println(sum + x)
}


Measured memory_bytes: 640
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		out.println((a-1)*(b-1));
	}
}


Measured memory_bytes: 21588
//ll n_kai[pow(10.0, 5.0)]; なんでだめなの？


#include<iostream>
#include<queue>
#include<vector>
#include<cmath>

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

const int INF = 1001001001;
const int MOD = 1000000007;

ll modpow(ll a, ll n, ll m){
	ll ans = 1;
	while(n>0){
		if(n & 1){
			ans = ans * a % m;
		}
		a = a * a % m;
		n >>= 1;
	}
	return ans;
}

int main(){
	ll n, a, b;cin >> n >> a >> b;
	ll total;
	total = modpow(2, n, MOD);
	total = (total - 1) % MOD;
	if(total < 0){
		total += MOD;
	}
	//cout << total << endl;
	ll ax = 1;
	for(ll i=n-a+1;i<n+1;++i) ax = ax * (i % MOD) % MOD;
	//cout << ax;

	ll ay = 1;
	for(ll i=1;i<a+1;i++) ay = ay * (i % MOD) % MOD;
	//cout << ay << endl;
	ay = modpow(ay, MOD-2, MOD);

	ll acnt = ax * ay % MOD;
	total = (total - acnt) % MOD;
	if(total < 0){
		total+=MOD;
	}

	ll bx = 1;
	for(ll i=n-b+1;i<n+1;++i) bx = bx * (i % MOD) % MOD;
	//cout << bx;

	ll by = 1;
	for(ll i=1;i<b+1;i++) by = by * (i % MOD) % MOD;
	//cout << by << endl;
	by = modpow(by, MOD-2, MOD);

	ll bcnt = bx * by % MOD;
	total = (total - bcnt) % MOD;
	if(total < 0){
		total+=MOD;
	}
	cout << total << endl;

	return 0;
}


Measured memory_bytes: 256
#coding:utf-8
#1_9_D 2015.4.13
s = list(input())
n = int(input())
for i in range(n):
    c = input().split()
    if c[0] == 'print':
        print(''.join(s[int(c[1]) : int(c[2])+1]))
    elif c[0] == 'reverse' and c[1] != '0':
        s[int(c[1]) : int(c[2])+1] = s[int(c[2]) : int(c[1])-1 :-1]
    elif c[0] == 'reverse' and c[1] == '0':
        s[:int(c[2])+1] = s[int(c[2])::-1]
    else: #replace
        s[int(c[1]) : int(c[2])+1] = list(c[3])

Measured memory_bytes: 6732
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
long long k;
int main() {
	cin >> a >> b >> c >> k;
	if(k <= a) cout << k << endl;
	else if(k <= a + b) cout << a << endl;
	else cout << a - (k - a - b) << endl;
	return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define Set(a,b) memset(a,b,sizeof(a))
template<class T>inline void init(T&x){
	x=0;char ch=getchar();bool t=0;
	for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') t=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+(ch-48);
	if(t) x=-x;return;
}typedef long long ll;
char s[5];
int num[27];
int main()
{
	scanf("%s",s+1);
	for(int i=1;i<=4;++i) ++num[s[i]-'A'+1];
	for(int i=1;i<=26;++i) if(num[i]&&num[i]!=2) puts("No"),exit(0);
	puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, K = 0;
    cin >> N;
    string slime;
    cin >> slime;
for(int i = 0; i < N; i++){
    if(i == 0)
    K++;
    if(i > 0){
        if(slime[i] != slime[i - 1])
        {
            K++;
        }
    }
}
cout << K << endl;
}

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

int main(){
    int x;
    cin >> x;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(i*j == x){
                cout << "Yes" << "\n";
                return 0;   
            }    
        }    
    }
    cout << "No" << "\n";
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n, k,x,y;
	cin >> n >> k>>x>>y;
	int sum = 0;
	int i;
	for (i = 1; i <= n; i++)
	{
		if (i <= k)
			sum += x;
		else
			sum += y;
	}
	cout << sum << endl;
} 

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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;}

int n;
ll cnt = 0;

void dfs(ll num, int i, bool f3, bool f5, bool f7){
    ll tmp = num*10 + i;
    if(tmp <= n){
        if(f3 && f5 && f7) cnt++;
        dfs(tmp, 3, true, f5, f7);
        dfs(tmp, 5, f3, true, f7);
        dfs(tmp, 7, f3, f5, true);
    }
}

int main(){
    cin >> n;
    
    dfs(0, 3, true, false, false);
    dfs(0, 5, false, true, false);
    dfs(0, 7, false, false, true);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256