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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;


lli num[1001]; // i の長さ未満の本数の合計
bool done[1001][1001];

int main() {
    lli n;
    cin1(n);
    lli l[n];
    ncin1(n,l);

    sort(l, l+n);

    lli ans = 0;
    REP(i,0,n) {
        REP(j,i+1,n) {
            // j+1 〜n の間で満たす個数
            auto it_r = lower_bound(l, l+n, l[i]+l[j]);
            if ((lli)(it_r-1 - &l[j]) <= 0)
                continue;
            ans += (lli)(it_r-1 - l-j);

        }
    }
    cout << ans << endl;
}


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

int main() {
    ll n, m;
    map<ll, ll> mp1, mp2;
    cin >> n;
    rep(i, 0, n) {
        ll a;
        cin >> a;
        mp1[a]++;
    }
    cin >> m;
    rep(i, 0, m) {
        ll a;
        cin >> a;
        mp2[a]++;
    }
    bool f = true;
    for(auto p : mp2) {
        if(p.second > mp1[p.first]) f = false;
    }
    if(f) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 28528
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) (vec).begin(),(vec).end()
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
string s,t;
int res=1e9,cur;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s>>t;
	for(int i=0;i<=s.size()-t.size();i++){
		cur=0;
		for(int j=0;j<t.size();j++) if(s[i+j]!=t[j])
			cur++;
		res=min(res,cur);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>

#include <deque>

#include <stdio.h>

#include <cstdio>

#include <algorithm>

#include<bits/stdc++.h>

#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define sp <<" "
#define nw <<"\n"
#define ca "Case "<<tc++<<": "
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define ull unsigned LL
#define check cout<<"* ";
#define show_vector for(int q=0;q<v.size();q++){cout<<v[q]<<" ";}
#define REP(i,n) for (int i=0;i<(n);++i)
#define N_MAX 26


const int inf=1<<30;
const long long int INF=1e10;
const int MOD=1e9+7;
const int maxn = 1e5+10;
int a[200005],b[1000005];

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
/*
int ck_prime(int n)
{
    int coun;
     coun=0;
     if(n>1){
      for(int i=2;i*i<=n;i++){
        if( n%i==0 ){
            coun++;
            break;
          }
        }
      }
     if(n==1){
       coun=coun;
         }
    if(coun==0){
           return 1; // n is prime
        }
    return 0;
}
*/
int main()
{
    int n;
    cin>>n;
    char s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    int x=1,i=0,j;
    st:
        char p=s[i];
        for(j=i+1;j<n;j++){
            if(p==s[j]){
                continue;
            }
            x=x+1;
            i=j;
            goto st;
        }
    cout<<x nw;
}



Measured memory_bytes: 3700
#include <iostream>
using namespace std;
int main()
{
	int N,M;
	cin >> N >> M;
    int K[31];
    int C[31] = {};
    int A[31][31];
    for(int i=0; i<N; i++)
    {
    	cin >> K[i];
        for(int j=0; j<K[i]; j++)
        {
        	cin >> A[i][j];
            C[A[i][j]]++;
        }
    }
    int sum = 0;
    for(int i=0; i<31; i++)
    {
    	if(C[i]==N) sum++;
    }
    cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int n; scanf("%d",&n);
    int f=0;
    for (int i=1;i<=9;i++) {
        for (int j=1;j<=9;j++) if (i*j==n) f=1;
    }
    printf(f?"Yes\n":"No\n");
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {

	var A string
	fmt.Scan(&A)

	var length int  = len(A)

	flag := true


	for i:=0 ; i < length ; i++ {
		if i  % 2 == 0 { //奇数
			if A[i] == 'L'{
				flag = false
				break
			}
		}else {
			if A[i] == 'R'{
				flag = false
				break
			}
		}
	}

	if flag == true {
		fmt.Println("Yes")
	}else {
		fmt.Println("No")
	}





}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {


	int N, D,E;
	scanf("%d%d%d",&N, &D, &E);

	if (N == 1)printf("Hello World");
	if(N==2)printf("%d", D + E);





}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using LL = long long;
const int N = 50000;
int n, sie[N], pr[N], pt, now;
LL a[505][505];
void sieve() {
	for (int i = 2; i < N; i++) {
		if (!sie[i]) pr[++pt] = i;
		for (int j = 1, t; j <= pt && (t = i * pr[j]) < N; j++) {
			sie[t] = 1;
			if (i % pr[j] == 0) break; 
		}
	}
}
LL lcm(LL x, LL y) { if (x == 0) return y; if (y == 0) return x; return x / std::__gcd(x, y) * y; }
#define P(number) namespace map##number {\
int vis[N];\
int map(int x) {\
	static int *vis = map##number::vis + N / 2;\
	if (vis[x]) return vis[x];\
	else return vis[x] = pr[now++];\
}\ 
}
P(0) P(1)
int main() {
	std::scanf("%d", &n);
	if (n == 2) { std::puts("2 3\n5 4\n"); return 0; }
	sieve(); now = 2;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) if (i + j & 1) {
			a[i][j] = map0::map(i + j >> 1);
		}
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) if (i + j & 1) {
			a[i][j] *= map1::map(i - j >> 1);
		}
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) if (!a[i][j]) {
			a[i][j] = lcm(lcm(a[i - 1][j], a[i + 1][j]), lcm(a[i][j + 1], a[i][j - 1])) + 1;
		}
//	for (int i = 1; i <= n; i++)
//		for (int j = 1; j <= n; j++) if (a[i][j] > 1e15) std::puts("!!!!"), std::exit(0);
	for (int i = 1; i <= n; i++, std::puts(""))
		for (int j = 1; j <= n; j++) std::printf("%lld ", a[i][j]);
	return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  int n;
  cin >> n;
  int p;
  cin >> p;
  vll C(n + 1, vl(n + 1));
  rep (i, n + 1) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i) {
        C[i][j] = 1;
      }
      else {
        C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
      }
    }
  }
  vi a(n);
  ll gu = 0, ki = 0;
  rep (i, n) {
    cin >> a[i];
    a[i] %= 2;
    if (a[i]) ki++;
    else gu++;
  }
  ll gu_cnt = 0;
  rep (i, gu + 1) {
    gu_cnt += C[gu][i];
  }
  ll ans = 0;
  rep (j, ki + 1) {
    if (j % 2 != p) {
      continue;
    }
    ans += gu_cnt * C[ki][j];
  }
  cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
    
  for (int i = 0; i < N; i++) {
  	int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  
  cout << sum << endl;
}


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

int main() {
  int N; cin >> N;
  vector<int> v(N);
  for (int i =0; i<N; i++) {
    int a; cin >> a; v.at(i) = a;
    }
  
  sort(v.begin(),v.end());
  double ans =v.at(0);
  for (int i =1; i<N; i++) {
    ans = (double)(v.at(i) + ans) / 2;
  }
  cout << ans << endl;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int k = scanner.nextInt();

        int ans;

        int[] array = {a, b, c};

        Arrays.sort(array);

        for (int i = 0; i < k; i++) {
            array[2] *= 2;
        }

        ans = array[0] + array[1] + array[2];

        System.out.println(ans);

    }
}

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

int main(){
	int x;
	cin >> x;
	int y = x / 100;
	int m = x % 100;
	if(m > y * 5){
		cout << 0 << endl;
	}else{
		cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
class Problem
  attr_accessor :a, :b, :n, :m, :h, :w, :dp

  def initialize
    @l,@r,@d = gets.to_s.split.map{ |v| v.to_i }
  end

  def solve
    a = @r / @d
    b = (@l - 1) / @d
    a - b
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 14340
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(input())


ans_counter = 0
ans = 1
for n in range(1, N+1):
    i = n
    counter = 0
    while i % 2 == 0:
        i = i // 2
        counter += 1
    if counter > ans_counter:
        ans_counter = counter
        ans = n
print(ans)

Measured memory_bytes: 3064
using System;
using System.Linq;

namespace atCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var count = int.Parse(Console.ReadLine());
            var nums = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();
            var div = count / 2; 
            Array.Sort(nums);
            var maxnum = nums[div];
            var minnum = nums[div-1];

            Console.WriteLine(maxnum - minnum);
        }

    }
}


Measured memory_bytes: 20064
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int n;cin>>n;
	ll maxi=0; ll ans=0;
	for(int i=0;i<n;i++){
		ll a;cin>>a;
		if(a<maxi){
			ans += maxi-a;
		}
		maxi = max(maxi,a);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3636
import numpy as np

def main():

    N, K, Q = map(int, input().split())
    player = np.array([K - Q] * N)
    sub = np.array([-1] * N)
    A = [int(input()) for i in range(Q)]
    for i in range(Q):
        player[A[i] - 1] += 1
    for k in range(N):
        if player[k] <= 0:
            print("No")
        else:
            print("Yes")

if __name__ == "__main__":
    main()

Measured memory_bytes: 21672
#include<stdio.h>
#include <string.h>
#include <math.h>

int main(){
    int n,i,x=1;
    scanf("%d",&n);
    int a[n], b[n];
    b[0] = 0;
    for(i=1;i<n;i++){
        scanf("%d",&a[i]);
        b[i] = 0;
    }
    for(i=1;i<n;i++){
        b[a[i]-1]++;
    }
    for(i=0;i<n;i++){
        printf("%d\n",b[i]);
    }
    return 0;
}

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

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

  deque<char> que;
  for(auto c: S){
    que.push_back(c);
  }

  bool flipped = false;
  int Q;
  cin >> Q;
  for(int q = 0; q < Q; q++){
    int T;
    cin >> T;

    if(T == 1){
      flipped = !flipped;
    }else{
      int F;
      char C;
      cin >> F >> C;

      bool Fmod2 = F % 2;
      if(Fmod2 == flipped){
        que.push_back(C);
      }else{
        que.push_front(C);
      }
    }
  }

  if(flipped){
    for(auto itr = que.rbegin(); itr != que.rend(); itr++){
      cout << *itr;
    }
  }else{
    for(auto itr = que.begin(); itr != que.end(); itr++){
      cout << *itr;
    }
  }
  cout << endl;
}


Measured memory_bytes: 960
<?php
$array_data=array();
$array_temp=array();
$input=trim(fgets(STDIN));

while($input<>""){
	$array_data[]=$input;
	$input=trim(fgets(STDIN));
}


// print_r($array_data);

foreach($array_data as $val){

	$array_temp[]=explode(" ",$val);
}

// print_r($array_temp);

$array_result=array();

for($i=$array_temp[0][0]-1;$i>=0;$i--){

	// print $array_temp[1][$i];
	$array_result[]=$array_temp[1][$i];

}

print implode(" ",$array_result) . "\n";

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

int main(){
  int n;
  cin >> n;
  int a[n+2];
  a[0] = a[n+1] = 0;
  long long suma = 0;
  for(int i=1; i<n+1; i++){
    cin >> a[i];
    suma += abs(a[i-1] - a[i]);
  }
  suma += abs(a[n] - a[n+1]);
  for (int i=1; i<n+1; i++){
    cout << suma - abs(a[i-1]-a[i])-abs(a[i] - a[i+1])+ abs(a[i-1] - a[i+1])<<endl;
  }
}


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

using namespace std;

int main() {
	int A, B, C, K;
	scanf("%d%d%d%d", &A, &B, &C, &K);
	if (K <= A + B) printf("%d\n", min(A, K));
	else printf("%d\n", A - (min(C, (K - A - B))));
}

Measured memory_bytes: 3832
import sys
stdin = sys.stdin

mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

N, K = na()
h = list()
for _ in range(N):
    h.append(ni())

h.sort()
ans = 10**10
for i in range(0, N-K+1):
    #print(i, i+K-1)
    ans = min(ans, h[i+K-1]-h[i])
print(ans)



Measured memory_bytes: 7388
W,H,N = map(int,input().split())
Xl=0
Xr=W
Yu=0
Yh=H

for i in range(N):
    Xt,Yt,At = map(int,input().split())
    if((At==1)and(Xl<Xt)):
        Xl=Xt
    elif((At==2)and(Xr>Xt)):
        Xr=Xt
    elif((At==3)and(Yu<Yt)):
        Yu=Yt
    elif((At==4)and(Yh>Yt)):
        Yh=Yt

if((Xr<=Xl)or(Yh<=Yu)):
    print("0")
else:
    print((Xr-Xl)*(Yh-Yu))

Measured memory_bytes: 3064
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[]$) {
        String s = new Scanner(System.in).next();
        IntStream.rangeClosed('a', 'z').map(c -> Arrays.stream(s.split(String.valueOf((char)c), -1)).mapToInt(String::length).max().getAsInt()).min().ifPresent(System.out::println);
    }
}

Measured memory_bytes: 28880
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N; cin>>N;
    int K=(N+1)/2;
    cout<<fixed<<setprecision(10)<<(double)K/N<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右下左上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, -1 };
constexpr int dy[] = { 0, 1, 0, -1, 1, 1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; ++i) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j]; return a;
        }
    };
    inp inp1;
}

int main() {

    int n, k;
    cin >> n >> k;
    vector<int> p = inp(n);

    sort(allof(p));

    int ans = 0;
    rep(i, k) ans += p[i];

    Cout(ans);

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int n, m, v, p; cin >> n >> m >> v >> p;
	vector<Int> a(n);
	for(auto &i:a) cin >> i;
	sort(a.begin(), a.end());
	Int l = -1, r = n-1;
	while((r-l) > 1){
		Int x = (l+r) / 2;
		Int s = m*v;
//		cerr << x << "\n";
		vector<Int> b(n, 0ll);
		bool f = true;
		s -= m;
		b[x] += m;
		for(Int i=0; i<n; ++i){
			if(i == x){
				continue;
			}else if(a[i] > a[x]+b[x]){
				Int t = min(s, m);
				s -= t;
				b[i] += t;
			}else if(a[i] < a[x]+b[x]){
				Int t = min({s, m, a[x]+b[x]-a[i]});
				s -= t;
				b[i] += t;
			}
		}
/*		if(x == 1){
			for(Int i=0; i<n; ++i)
				cerr << i << " " << b[i] << "\n";
		}
*/		Int cnt = 0;
		for(Int i=0; i<n; ++i)
			if(a[i]+b[i] > a[x]+b[x])
				++cnt;
//		cerr << cnt << "\n";
		if(cnt >= p){
			f = false;
		}else if(s > 0){
			Int d = 0;
			for(Int i=n-1; i>=0; --i){
				if(b[i] < m){
					bool g = a[i]+b[i] > a[x]+b[x];
					Int t = min(s, m-b[i]);
					s -= t;
					b[i] += t;
					if(!g && a[i]+b[i] > a[x]+b[x]) ++d;
				}
				if(s == 0) break;
			}
//			cerr << " d " << d << "\n";
			if(cnt+d >= p){
				f = false;
			}
		}
		if(f) r = x;
		else l = x;
	}
	cout << n-r << "\n";
}

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

int main() {
  string S;
  int Q;
  cin >> S >> Q;
  
  string Sf = "";
  string Sb = "";
  int c = 0;
  for (int i = 0; i < Q; i++) {
    int T;
    cin >> T;
    if (T == 1) {
      c += 1;
    }
    else {
      int F;
      char C;
      cin >> F >> C;
      if ((F + c) % 2 == 1) {
        Sf += C;
      }
      else {
        Sb += C;
      }
    }
  }
  
  reverse(Sf.begin(), Sf.end());
  S = Sf + S + Sb;
  
  if (c % 2 == 1) {
    reverse(S.begin(), S.end());
  }
    
  cout << S << endl;
}

Measured memory_bytes: 4296
#include<bits/stdc++.h>
#define clr(x) memset(x, 0, sizeof(x))
#define sz(x) (int)x.size()

using namespace std;

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

const ll mx = 105;
const ll maxn = 1000001;
const ll mod = 1000000007;

vector<vector<int>> adj;
vector<ll> lis;
bool vis[maxn];
bool pos;

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

  ll t = 1;

  //cin>>t;

  while(t--){
    

     double r, pi = 3.1415926535;
     cin>>r;
     cout<<2*pi*r;     
  }     
        
}


Measured memory_bytes: 3800
#include <stdio.h>
#include <string.h>
#define MAXNUM 100
#define MAXLENGTH 10

int main(void){
    int n, i, j;
    char word[MAXNUM][MAXLENGTH + 1];
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%s", word[i]);
    }

    for(i = 0; i < n - 1; i++){
        if(word[i][strlen(word[i]) - 1] != word[i + 1][0]){
            printf("No\n");
            goto END;
        }

        for(j = i + 1; j < n; j++){
            //printf("word(%d) = %s, word(%d) = %s\n", i, word[i], j, word[j]);
            if(strcmp(word[i], word[j]) == 0){
                printf("No\n");
                goto END;
            }
        }
    }

    printf("Yes\n");
END:
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;
int x,y,z;
vector<int> eve;
vector<int> board;
vector<int> n;
double dp[(1<<13)][51] = {0.0};

int main(){
    while(true){
	cin >> x >> y >> z;
	if(x==0&&y ==0&&z==0)break;
	memset(dp,0,sizeof(dp));
	REP(i,x){
	    int temp;
	    cin >> temp;
	    n.PB(temp);
	}
	eve = vector<int>(y+1,0);
	board = vector<int>(y+1,0);
	REP(i,z){
	    int a,b,c;
	    cin >> a >> b >> c;
	    board[a] = b;
	    eve[a] = c;
	}

	dp[0][0] = 1.0;
	REP(i,y)REP(j,(1<<13))REP(k,x){
	    int np = n[k] + i;
	    np = min(np,y);
	    int a = board[np];
	    if(a==1){
		dp[j][min(y,np+eve[np])] += dp[j][i]/(double)(x);
	    }else if(a==2){
		dp[min(5000,j+eve[np])][np] += dp[j][i]/(double)(x);
	    }else if(a==3){
		dp[max(0,j-eve[np])][np] += dp[j][i]/(double)(x);
	    }else{
		dp[j][np] += dp[j][i]/(double)(x);
	    }
	}
	double ans = 0.0;
	REP(i,5001) {
	    ans += dp[i][y] * i;
	}
	cout << (int)(ans) << endl;
	n.clear();
	eve.clear();
	board.clear();
    }
    return 0;
}

Measured memory_bytes: 4488
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include<iomanip>
using namespace std;

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

int main()
{
   int N;
   cin>>N;
   string S;
   cin>>S;
   string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   rep(i,S.size())
   {
       S[i] = alphabet[(alphabet.find(S[i])+N)%26];
   }
   cout<<S<<endl;
}

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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

int main()
{
    solve();
}

void solve()
{
    int a, b, c, x, y;
    in3(a, b, c);
    in2(x, y);
    int sum = 0;
    if (a + b < 2 * c)
    {
        sum = a * x + b * y;
    }
    else
    {
        if (x > y)
        {
            sum = 2 * c * y;
            if (a < 2 * c)
            {
                sum += a * (x - y);
            }
            else
            {
                sum += 2 * c * (x - y);
            }
        }
        else
        {
            sum = 2 * c * x;
            if (b < 2 * c)
            {
                sum += b * (y - x);
            }
            else
            {
                sum += 2 * c * (y - x);
            }
        }
    }
    out(sum);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,c=0;
	scanf("%d",&n);
	if(n>=1&&n<=100)
	{
		for(int x=1;x<=n;x++)
		{
			c+=800;
			if(x==15||x==30||x==45||x==60||x==75||x==90)
			{
				c-=200;
			}
			
		}
		printf("%d",c);
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N, M;
  cin >> N;
  vector<string> s(N);
  rep(i,N){
    cin >> s.at(i);
  }
  cin >> M;
  vector<string> t(M);
  rep(i,M){
    cin >> t.at(i);
  }
  int max=0;
  rep(i,N){
    int temp=0;
    rep(j,N){
      if(s.at(i)==s.at(j)){
        temp++;
      }
    }
    rep(j,M){
      if(s.at (i)==t.at(j)){
        temp--;
      }
    }
    if(temp>max){
      max=temp;
    }
  }
  cout << max << endl;
}

Measured memory_bytes: 256
from bisect import bisect_left

INF = 10**9 + 1
n = int(input())
dp = [INF] * (n+1)

for _ in range(n):
    a = int(input())
    i = bisect_left(dp, a)
    dp[i] = a
    # print(dp)

print(bisect_left(dp, INF))


Measured memory_bytes: 9472
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int N,M,R;
ll G[205][205];
ll d[205][205];

void dij(int s)
{
	bool u[205]={0};
	d[s][s]=0;
	while(1)
	{
		int v=-1;
		for(int i=0;i<N;i++)
		{
			if(!u[i]&&(v==-1||d[s][i]<d[s][v]))
				v=i;
		}
		if(v==-1)break;
		u[v]=true;
		for(int i=0;i<N;i++)
		{
			d[s][i]=min(d[s][i],d[s][v]+G[v][i]);
		}
	}
}


int main()
{
	vector<int>r;
	memset(G,0x0f,sizeof(G));
	memset(d,0x0f,sizeof(d));
	scanf("%d%d%d",&N,&M,&R);
	for(int i=0;i<R;i++)
	{
		int p;
		scanf("%d",&p);
		r.push_back(p-1);
	}
	for(int i=0;i<M;i++)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		a--;b--;
		G[a][b]=G[b][a]=c;
	}
	for(int i=0;i<R;i++)
	{
		dij(r[i]);
	}
	sort(r.begin(),r.end());
	ll res=1e11;
	do
	{
		ll t=0;
		for(int i=0;i<R-1;i++)
			t+=d[r[i]][r[i+1]];
		res=min(res,t);
	} while(next_permutation(r.begin(),r.end()));
	printf("%lld\n",res);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using llong = long long;
using P = pair<int, int>;
const int inf = 1e9;
const int mod = 1e9 + 7;

int main() {
   int h, n;
   cin >> h >> n;
   vector<int> a(n), b(n);
   rep(i, n) { cin >> a[i] >> b[i]; }
   vector<vector<int>> dp(n + 1, vector<int>(h + 1, inf));
   dp[0][0] = 0;
   rep(i, n) {
      rep(j, h + 1) {
         if (j < a[i])
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + b[i]);
         else
            dp[i + 1][j] = min(dp[i + 1][j - a[i]] + b[i], dp[i][j]);
      }
   }
   /*
   rep(i, n + 1) {
      rep(j, h + 1) { cout << dp[i][j] << " "; }
      cout << endl;
   }*/
   cout << dp[n][h] << endl;
   return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

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

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

int SolveMaxRectangle(const vector<int>& input_xs, int w) {
  vector<int> xs(input_xs.begin(), input_xs.end());
  xs.push_back(0);

  int max = w;
  stack<pair<int, int>> stack;
  for (int i = 0; i < xs.size(); i++) {
    if (stack.empty()) {
      stack.push(make_pair(xs[i], i));
    } else {
      if (xs[i] >= stack.top().first) {
        stack.push(make_pair(xs[i], i));
      } else {
        int push_index = i;
        while (!stack.empty() && xs[i] < stack.top().first) {
          int r_width = i - stack.top().second + 1;
          int r_area = r_width * stack.top().first;
          UpdateMax(max, r_area);
          push_index = stack.top().second;
          // if (DEBUG) {
          //   cout << "i: " << i << endl;
          //   cout << "stack.top().second: " << stack.top().second << endl;
          //   cout << "v: " << stack.top().first << endl;
          //   cout << "r_area: " << r_area << endl;
          // }
          stack.pop();
        }

        stack.push(make_pair(xs[i], push_index));
      }
    }
  }
  return max;
}

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

  int h, w;
  cin >> h >> w;
  vector<string> board(h);
  for (int r = 0; r < h; r++) {
    cin >> board[r];
  }

  vector<vector<int>> dp1 = Make2DVector(h - 1, w, -1);
  for (int r = 0; r < h - 1; r++) {
    int current = -1;
    for (int c = w - 1; c >= 0; c--) {
      if (c == w - 1) {
        current = board[r][c] == board[r + 1][c];
        dp1[r][c] = 1;
      } else {
        if ((board[r][c] == board[r + 1][c]) == current) {
          dp1[r][c] = dp1[r][c + 1] + 1;
        } else {
          current = board[r][c] == board[r + 1][c];
          dp1[r][c] = 1;
        }
      }
    }
  }

  if (DEBUG) {
    for (int r = 0; r < h - 1; r++) {
      cout << "dp1[" << r << "]: " << dp1[r] << endl;
    }
  }

  int ans = 0;
  for (int c = 0; c < w; c++) {
    vector<int> xs(h - 1);
    for (int r = 0; r < h - 1; r++) {
      xs[r] = dp1[r][c];
    }
    if (DEBUG) {
      cout << "SolveMaxRectangle(" << c << ")" << endl;
      cout << "xs: " << xs << endl;
    }
    int max_rectanle = SolveMaxRectangle(xs, w - c);
    if (DEBUG) cout << "c: " << c << " max_rectangle: " << max_rectanle << endl;
    UpdateMax(ans, max_rectanle);
  }
  cout << ans << endl;
}

Measured memory_bytes: 20224
#include <bits/stdc++.h>
using namespace std;
vector<int> dy = {0, 1, 0, -1};
vector<int> dx = {1, 0, -1, 0};
int INF = 1000000;
int main(){
  while (1){
    int w, h;
    cin >> w >> h;
    if (w == 0 && h == 0){
      break;
    }
    vector<vector<int>> s(h, vector<int>(w));
    for (int i = 0; i < h; i++){
      for (int j = 0; j < w; j++){
        cin >> s[i][j];
      }
    }
    vector<int> c(4);
    for (int i = 0; i < 4; i++){
      cin >> c[i];
    }
    int V = h * w * 4 + 1;
    vector<vector<pair<int, int>>> E(V);
    for (int i = 0; i < h; i++){
      for (int j = 0; j < w; j++){
        for (int k = 0; k < 4; k++){
          for (int l = 0; l < 4; l++){
            int y = i + dy[(k + l) % 4];
            int x = j + dx[(k + l) % 4];
            if (0 <= y && y < h && 0 <= x && x < w){
              int u = (i * w + j) * 4 + k;
              int v = (y * w + x) * 4 + (k + l) % 4;
              int cost = c[l];
              if (s[i][j] == l){
                cost = 0;
              }
              E[u].push_back(make_pair(cost, v));
            }
          }
        }
      }
    }
    for (int i = 0; i < 4; i++){
      E[V - 5 + i].push_back(make_pair(0, V - 1));
    }
    vector<int> d(V, INF);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    pq.push(make_pair(0, 0));
    while (!pq.empty()){
      int c = pq.top().first;
      int u = pq.top().second;
      pq.pop();
      if (d[u] == INF){
        d[u] = c;
        for (auto P : E[u]){
          int v = P.second;
          if (d[v] == INF){
            pq.push(make_pair(c + P.first, v));
          }
        }
      }
    }
    cout << d[V - 1] << endl;
  }
}


Measured memory_bytes: 3308
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	long long Min,Max,sum=0,n,m;
	scanf("%lld%lld",&n,&Max);
	Min=sum=Max;
	for(int i=1;i<n;i++){
		scanf("%lld",&m);
		if(m>Max) Max=m;
		if(m<Min) Min=m;
		sum+=m;
	}
	printf("%lld %lld %lld\n",Min,Max,sum);
	return 0;
}


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

typedef long long ll;

int main()
{
  int n, x;
  vector<int> a, b, c;

  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x; a.push_back(x);
  }
  for(int i = 0; i < n; i++){
    cin >> x; b.push_back(x);
  }
  for(int i = 0; i < n; i++){
    cin >> x; c.push_back(x);
  }

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  ll ans = 0;
  for(int i = 0; i < n; i++){
    ll x = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
    ll y = c.end() - upper_bound(c.begin(), c.end(), b[i]);
    ans += x * y;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1784
// Problem : F - LCS
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define tc ll t;cin>>t;while(t--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF 1e18

vector< vector<ll> > dp;

int main()
{
	io;
	string s1,s2,ans="",c1="",c2="";
	
	cin>>s1>>s2;
	ll n=s1.size(),m=s2.size();
	
	dp.resize(n);
	for(auto &x:dp)
	{
		x.resize(m);
	}
	
	bool yes=0;
	FOR(i,0,m)
	{
		if(s1[0]==s2[i])
		{
			yes=1;
			c1=s1[0];
		}
		if(yes){dp[0][i]=1;}
	}
	yes=0;
	FOR(i,0,n)
	{
		if(s1[i]==s2[0]){yes=1;c2=s2[0];}
		if(yes){dp[i][0]=1;}
	}
	
	FOR(i,1,n)
	{
		FOR(j,1,m)
		{
			if(s1[i]==s2[j]){dp[i][j]=dp[i-1][j-1]+1;}
			else
			{
				dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
			}
		}
	}
	//cout<<ans+s1;
	//cout2d(dp);
	ll i=n-1,j=m-1;
	while(i>0 && j>0)
	{
		if(s1[i]==s2[j]){ans+=s1[i];i--;j--;}
		else
		{
			if(dp[i-1][j]>=dp[i][j-1]){i--;}
			else{j--;}
		}
	}
	if((i==0 || j==0) && dp[i][j]!=0)
	{
		if(i==0 && j!=0){ans+=c1;}
		else if(i!=0 && j==0){ans+=c2;}
		else{if(s1[0]==s2[0]){ans+=c1;}}
	}
	
	reverse(all(ans));
	cout<<ans;
	return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define li long long int
#define ld long double
#define F first
#define S second
const li M = 1000000007;
#define ld long double
li dx[]={-1,1,0,0};
li dy[]={0,0,-1,1};

li A[10000007];
int main()
{
	li N,M,K,k,i,j; // cin>>N>>M>>K;
	for(i=1;i<10000007;i++)
		A[i]=1;
	
	for(i=2;i<10000007;i++)
	{
		if(A[i] != 1)
			continue;
		for(j=i;j<10000007;j=j+i)
		{
			li ct=1,jj=j;
			while(jj%i == 0)
				{
					ct++; jj=jj/i;
				}
				A[j]*=ct;
		}
	}
	for(i=2;i<10000007;i++)
	{
		A[i]=i*A[i];
		A[i]+=A[i-1];
	}
	cin>>N;
	cout<<A[N];
			
}



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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;
namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long a = s[0];
            long b = s[1];
            long c = s[2];
            WriteLine(
                c - a - b >= 0 && 4*a*b < (c - a - b) * (c - a - b) ? "Yes" : "No"
                );
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
bool seen[120];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    int cnt = 0;
    for(int i = 0,x;i<N;i++) {
        cin >> x;
        if(!seen[x]) {
            seen[x] = 1;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

const ll MOD = 1e9+7;
int N;
int a[111111];
map<int, int> mp;

ll f(ll x) {
   ll ret = 1;
   while (x > 0) {
      ret = ((ret%MOD) * (2%MOD)) % MOD;
      x--;
   }
   return ret;
}

int v1[111111];
int v2[111111];

int main() {
   cin >> N;
   rep (i, N) {
      cin >> a[i];
      v1[a[i]]++;
   }

   bool ok = true;
   if (N&1) {
      if (v1[0] != 1) ok = false;
      for (int i = 2; i < N; i+=2) {
         if (v1[i] != 2) ok = false;
      }
   } else {
      for (int i = 1; i <= N; i+=2) {
         if (v1[i] != 2) ok = false;
      }
   }

   if (ok) {
      cout << f(N/2) % MOD << endl;
   } else {
      cout << 0 << endl;
   }

   return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#define MAX_LEN 100

int array[MAX_LEN];

int main()
{
	int len;
	std::cin>>len;
	for (int i = 0; i < len; i++)
	{
	    std::cin>>array[i];
	}
	for(int i=len-1;i>=0;i--)
	{
	    std::cout<<array[i];
	    if(i>0) std::cout<<" ";
	}
	std::cout<<"\n";
}


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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

int N;
long ans{1};

int main() {
  scanf("%d", &N);
  for (int i{1}; i <= N; ++i) {
    ans *= i;
    ans %= 1000000007;
  }

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


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

using namespace std;
typedef long long ll;

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

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

  int p,q;
  bool pflag, qflag;
  
  for(p=0; p<N-1; p++)
    {
      if(P[p]>P[p+1])
	break;
    }

  for(q=N-1; q>0; q--)
    {
      if(P[q-1]>P[q])
	break;
    }
  if(p==N-1&&q==0)
    cout << "YES" << endl;
  else
    {
      int tmp;
      tmp=P[p];
      P[p]=P[q];
      P[q]=tmp;
      for(int i=0; i<N-1; i++)
	{
	  if(P[i]>P[i+1])
	    {
	      cout << "NO" << endl;
	      return 0;
	    }
	}
      cout << "YES" << endl;
    }


  return 0;
}


//cout << setprecision(13);
//next_permutation(v.begin(), v.end());



Measured memory_bytes: 256
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    x = ni()
    d = 0
    for i in range(1, x + 1):
        d += i
        if d >= x:
            print(i)
            return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9184
#include <stdio.h>
int main(){
	int n,m,l[10000],i,x,p,a;
	while(1){
		scanf("%d%d",&n,&m);
		p=0;
		a=0;
		if(n==0&&m==0){
			break;
		}

		for(i=0;i<1024;i++){
			l[i]=0;
		}


		for(i=0;i<n;i++){
			scanf("%d",&l[i]);
		}
		for(i=0;i<m;i++){
			scanf("%d",&x);
			p+=x+l[p+x];
			if(p>=n-1&&a==0){
				a=i+1;
			}
		}
		printf("%d\n",a);
	}
    return 0;
}

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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if(H == 0 and W == 0){
            break;
        }
        
        for(int h = 0; h < H; h++){
            if(h == 0 || h == (H - 1)){
                for(int w = 0; w < W; w++){
                    cout << "#";
                }
                cout << endl;
            }else{
                for(int w = 0; w < W; w++){
                    if(w == 0 || w == (W -1)){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }
                cout << endl;
            }
        }
        cout << endl;
    }
}



Measured memory_bytes: 3084
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end

def max(a,b)
  return a>b ? a : b
end
n,W=get_i
wv=Array.new(n).map{Array.new(2)}
n.times do|i|
  wv[i]=get_i
end
wv.sort!{|x,y| x[0]<=>y[0]}
dp=Array.new(W+1,0)
wv.each do|w,v|
  W.downto(w) do|u|
    dp[u]=dp[u-w]+v if dp[u]<dp[u-w]+v
  end
end
puts dp.max

Measured memory_bytes: 2556
#include <iostream>

using namespace std;

int main()
{
	long long n;
	cin >> n;
	
	int sum = 0;
	long long tmp = n;
	while(tmp != 0)
	{
		sum += (tmp % 10);
		tmp /= 10;
	}
	
	if(sum == 0)
	{
		sum++;
	}
	
	if((n % sum) == 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;
ll kaijo[200000];
ll pnum[10000];

void init() {
	kaijo[0] = 1;
	for (ll i = 1;i < 200000;i++)kaijo[i] = (kaijo[i - 1] * i) % N;
}

ll inv(ll x) {
	ll res = 1;
	ll k = N - 2;
	ll y = x;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N*y%N) % N;
		k /= 2;
	}
	return res;
}

ll Comb(ll n, ll k) {
	if (n < 0 || k < 0 || (n - k) < 0)return 0;
	ll b = kaijo[n];
	ll c = kaijo[n - k];
	ll d = kaijo[k];
	ll cd = (c*d) % N;
	return ((b%N)*(inv(cd)) % N) % N;
}


int main(void){
    ll n,m;
    cin>>n>>m;
    if(n==1){
        cout<<1<<endl;
        return 0;
    }
    if(m==1){
        cout<<1<<endl;
        return 0;
    }
    vector<ll>primenumber;
    ll y=(ll)sqrt(m)+1;
    for(ll i=2;i<=y;i++){
        if(m%i==0){
            ll num=0;
            while(m%i==0){
                num++;
                m=m/i;
            }
            primenumber.push_back(num);
        }
    }
    if(m>1){
        primenumber.push_back(1);
    }
    ll ans=1;
    init();
    for(auto itr=primenumber.begin();itr!=primenumber.end();++itr){
        ll x=*itr;
        ans=(ans*Comb(x+n-1,n-1))%N;
    }
    cout<<(ans+N)%N<<endl;
    return 0;
}

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

int main(){
  string str;
  vector<char>  ch;
  while( cin >> str ){
    ch.clear();
    int len = str.size();
    int i;
    for( i = 0; i < len; i++ ){
      if( str[i] == '@' ){
	int end = str[i+1] -'0';
	for( int j = 0 ; j < end-1; j++ ) ch.push_back(str[i+2]);
	i++;
      }else ch.push_back(str[i]);
    }
    
    int len2 = ch.size();
    for( i = 0; i < len2; i++ ){
      cout << ch[i];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
long long s=0,t=0,h,w,n;
int main()
{
	cin>>h>>w>>n;
	if(h>w)
	{
		while(s<n)
		{
			t++;
			s+=h;
		}
	}
	else 
	{
	    while(s<n)
		{
			t++;
			s+=w;
		}
	}
	cout<<t;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
  
  let L = arg.split(" ")[0],
      R = arg.split(" ")[1],
      Lmod = arg.split(" ")[0] % 2019,
      Rmod = arg.split(" ")[1] % 2019;

  let min = 2018;
  if(R - L + 1 >= 2019) {
        console.log(0);
  } else {
    for(let i = Lmod; i <= Rmod; i++){
      for(let j = Lmod; j <= Rmod; j++){
        let num = (i*j) % 2019;
        if( (num < min) && (i < j) ){
          min = num;
        }
      }
    }

    console.log(min);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
int main() {
     int A,B,K;
     cin >> A >> B >> K;
     if((B - A + 1) >= 2*K){
          for(int i = A; i < A + K; i++) cout << i << endl;
          for(int j = B - K + 1; j <= B; j++) cout << j << endl; 
     }else{
          for(int i = A; i <= B; i++) cout << i << endl;
     }
}

Measured memory_bytes: 256
n,y=map(int,input().split())
l=[]
c=0
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j)==y:
            print(i," ",j," ",n-i-j)
            c+=1
            break
    if c!=0:
        break
if c==0:
    print(-1," ",-1," ",-1)

Measured memory_bytes: 3064