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

#define endl '\n'
#define precise(n,k) fixed << setprecision(k) << n
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define uint  unsigned int
#define ll    long long
#define ull   unsigned long long
#define ld    long double

const int MOD = int(1e9+7);
const int oo  = int(1e9 + 20);
const ll lloo  = (ll)(1e18 + 10);


class SegmentTree {
    int NEUTRAL;
    int n;
    vector<int> tree;
    function <int(int, int)> func;
public:
    
    SegmentTree(vector<int> values, function <int(int, int)> f, int neutral) {
        func = static_cast<function <int(int, int)>> (f);
        NEUTRAL = neutral;
        
        n = values.size();
        tree.resize(n*2);
        // Build
        for (int i=0; i < n; i++){
            tree[n+i] = values[i];
        }
        for (int i = n - 1; i > 0; --i) {
            tree[i] = func(tree[i<<1], tree[i<<1 | 1]);
        }
    }
    
    void update(int index, int value) {
        tree[index+n] = value;
        index = index + n;
        for (int i = index; i > 1; i >>= 1){
            tree[i>>1] = func(tree[i], tree[i^1]);
        }
    }
    
    int query(int l, int r) {
        int ans = NEUTRAL;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l&1) {
                ans = func(ans, tree[l++]);
            }
            if (r&1) {
                ans = func(ans, tree[--r]);
            }
        }
        return ans;
    }
};

int myMax(int x, int y) {
    return max(x, y);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    n++;
    vector<int> val(n);
    for(int i = 1; i < n; ++i) {
        cin >> val[i];
    }
    
    SegmentTree st(val, myMax, -oo);
    
    vector<bool> visited(n, false);
    int colors = 0;
    int last;
    for(int i = 1; i < n; ++i) {
        if(!visited[i]) {
            colors++;
            last = val[i];
            visited[i] = true;
            st.update(i, -oo);
            
            if(st.query(i+1, n) <= last) continue;
            
            for(int j = i + 1; j < n; ++j) {
                if(!visited[j] && last < val[j]) {
                    last = val[j];
                    visited[j] = true;
                    st.update(j, -oo);
                    if(st.query(j+1, n) <= last) break;
                }
            }
        }
    }
    cout << colors << endl;

    return 0;
}

Measured memory_bytes: 4644
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    
    sort(s.begin(),s.end());

    int i,x=0;

    for(i=0;i<s.size();i++)
    {
        if(s[i]==s[i+1])
            x++;
    }

    if(x==2)
        cout<<"Yes\n";
    else
        cout<<"No\n";


    return 0;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  vector<int> cnt(26);

  for (auto c : s) {
    cnt[c - 'A']++;
  }

  bool ok = true;
  for (auto i : cnt) {
    if (i != 0 && i != 2) {
      ok = false;
    }
  }
  puts(ok ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include <cmath>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long long a[n],b[n],in;
    for(int i = 0;i<n;i++){
        a[i]=0;
        b[i]=0;
    }
    for(int i = 0;i<n;i++){
        cin >> in;
        b[i] = in;
        a[in-1]++;
    }
    long long sum=0;
    for(int i = 0;i<n;i++){
        sum+=a[i]*(a[i]-1)/2;
    }
    for(int i = 0;i<n;i++){
        cout << (sum-a[b[i]-1]+1) << endl;
    }
}

Measured memory_bytes: 5760
#include<stdio.h>
int main()
{
    long long int a,b,i,odd=0,even=0;
    scanf("%lld",&a);
    for(i=0;i<a;i++){
        scanf("%lld",&b);
        if(b%2==0)
            even++;
        else if(b%2!=0)
            odd++;
    }
    if(odd%2==0)
        printf("YES");
    else
        printf("NO");
    return 0;
}


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


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

    int n,k,L;
    double t,u,v;
    cin>>n>>k>>t>>u>>v>>L;
    int d[n+1];
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    double ans = 0;
    int cal=0;
    d[n] = 0;
    int l=0;
    int calt=t*v;
    for(int i=1;i<=L;i++){
        if(calt<t*v){
            calt++;
            ans += 1/v;
            if(calt>=t*v && cal) cal--,calt=0;
        }
        else{
            ans += 1/u;
        }
        if(i==d[l]){
            l++;
            if(cal==k) calt=0;
            else cal++;
            if(calt>=t*v) cal--,calt=0;
        }
    }
    cout << setprecision(10) << ans << endl;
    //printf("%.10f",ans);
    
}


Measured memory_bytes: 3304
#include<stdio.h>
int main(){
    int a[4][14],n,i,j;
    scanf("%d",&n);
    
    for(i=0;i<4;i++){
        for(j=0;j<14;j++){
            a[i][j]=0;
        }
    }
    int c;
    scanf("%d",&c);
    for(i=0;i<n;i++){
        char b;
        int c;
        scanf("%c %d\n",&b,&c);
        if(b=='S'){
            a[0][c]=1;
        }else if(b=='H'){
            a[1][c]=1;
        }else if(b=='C'){
            a[2][c]=1;
        }else if(b=='D'){
            a[3][c]=1;
        }
    }
    
    char pattern[] = {'S','H','C','D'};
    for(i=0;i<4;i++){
        for(j=1;j<14;j++){
            if(a[i][j]==0){
                printf("%c %d\n",pattern[i],j);
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll K;
  cin >> K;
  ll m = K/ll(50);
  ll rem = K%50;
  vector<ll> A(50);
  for(int i=0; i<rem; i++){
    A[i] = ll(49) + m + ll(50) - (rem-1LL);
  }
  for(int i=rem; i<50; i++){
    A[i] = ll(49) + m - rem;
  }
  cout << 50 << endl;
  for(int i=0; i<50; i++){
    if(i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define li long
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define pb push_back
#define fori(i,k,n) for(int i = k;i<n; i++)
#define rfori(i,k,n) for(int i = k; i>=n; i--)
#define cd complex<double>
const int N = 10000000;
vector<int> bit(N+2,0);
int next(int x)
{
    return x+(x&(-x));
}
int par(int x)
{
    return x-(x&(-x));
}
void update(int x,int val,int n)
{
    while(x<n)
    {
        bit[x]+=val;
        x = next(x);
    }
}
void bitify(vector<int> &a,int n)
{
    for(int i = 1; i<=n; i++)
    {
        update(i,a[i-1],n);
    }
}

int getsum(int x)
{
    int sum = 0;
    while(x>0)
    {
        sum+=bit[x];
        x = par(x);
    }
    return sum;
}
int rsum(int a,int b)
{
    return getsum(b)-getsum(a-1);
}
void optimize()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int power(int x, int y)
{
   int res = 1;

    //x = x % p;

    while (y > 0)
    {

        if (y & 1)
            res = (res*x) ;


        y = y>>1;
        x = (x*x) ;
    }
    return res;
}

//const int N = 10000000;
int lp[N+1];
unordered_set<int> st;
vector<int> pr;
void solve(){
for (int i=2; i<=N; ++i) {
    if (lp[i] == 0) {
        lp[i] = i;
        st.insert(i);
        pr.push_back(i);
    }
    for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
        lp[i * pr[j]] = pr[j];
}
}
class TrieNode
{
public:

    TrieNode* left;
    TrieNode* right;
    TrieNode()
    {
        left = NULL;
        right = NULL;
    }
};
void insert(TrieNode* head,int x)
{
    TrieNode* curr = head;
    for(int i = 31; i>=0; i--)
    {
        int b = (x>>i)&1;
        if(b == 0)
        {
            if(!curr->left)curr->left = new TrieNode();
            curr = curr->left;
        }
        else
        {
            if(!curr->right)curr->right = new TrieNode();
            curr = curr->right;
        }
    }
}
int maxXorVal(TrieNode* head,vector<int> &arr,int n)
{
    int max_xor = INT_MIN;
    for(int i = 0; i<n; i++)
    {
        int val = arr[i];
        TrieNode* curr = head;
        int curr_xor = 0;
        for(int j = 31; j>=0; j--)
        {
            int b = (val>>j)&1;
            if(b == 0)
            {
                if(curr->right)curr = curr->right,curr_xor+=power(2,j);
                else curr = curr->left;
            }
            else
            {
                if(curr->left)curr = curr->left,curr_xor += power(2,j);
                else curr = curr->right;
            }
        }
        max_xor = max(max_xor,curr_xor);
    }
    return max_xor;
}

void test_case()
{

    solve();
    int x;
    cin>>x;
    cout<<*(lower_bound(pr.begin(),pr.end(),x));
}

int main()
{
	optimize();
	test_case();
}



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

using namespace std;

const int mod = 998244353;

int mul(int x, int y) {
    return (1LL * x * y) % mod;
}

int power(int a, int b) {
    if (b == 0) {
        return 1 % mod;
    }
    if (b % 2 == 0) {
        return power(mul(a, a), b / 2);
    }
    return mul(a, power(a, b - 1));
}

int inv(int x) {
    return power(x, mod - 2);
}

const int max_f = 4444;

int f[max_f], rf[max_f];

void get_all_f() {
    f[0] = rf[0] = 1;
    for (int i = 1; i < max_f; ++i) {
        f[i] = mul(i, f[i - 1]);
    }
    rf[max_f - 1] = inv(f[max_f - 1]);
    for (int i = max_f - 2; i > 0; --i) {
        rf[i] = mul(i + 1, rf[i + 1]);
    }
}

int get_c(int n, int k) {
    if (n == -1 && k == -1) return 1;
    if (n < k || n < 0) {
        return 0;
    }
    return mul(f[n], mul(rf[k], rf[n - k]));
}

int n, k;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    get_all_f();
    cin >> k >> n;
    for (int I = 2; I <= 2 * k; ++I) {
        int i = min(I, 2 * k - I + 2);
        int ans = 0;
        int c = i / 2;
        for (int j = 0; j <= c; ++j) {
            int add = mul(get_c(c, j), get_c(n + k - 1 - 2 * j, k - 1));
            if (j % 2) {
                add = mod - add;
            }
            ans += add;
            ans %= mod;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def get_pow(x, n):
    if n == 0:
        return 1
    ans = get_pow(x * x % 1000000007, int(n / 2))
    if n % 2 == 1:
        ans *= x
        ans %= 1000000007
    return ans

n = int(input())
a = list(map(int, input().split()))
c = [2] * ((n + 1) // 2)
if n % 2 == 1:
    c[0] = 1
for i in a:
    c[i // 2] -= 1
if c == [0] * len(c):
    print(get_pow(2, n // 2))
else:
    print(0)

Measured memory_bytes: 13880
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int K = Integer.parseInt(scanner.next());
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(scanner.next());
        }
        Arrays.sort(A);

        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + K - 1 < N; i++) {
            ans = Math.min(ans, A[K - 1 + i] - A[i]);
        }

        System.out.println(ans);
    }

}



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

int main() {
  int N, M = 0;
  cin >> N;
  
  vector<int> a(N),b(N);
  for (int i = 0; i < N; i++){
  	cin >> a.at(i);
    b.at(i) = 0;
  }
  
  for (int i = N - 1; i >= 0 ; i--){
    int c = 0;
    for (int j = i; j < N; j = j + i + 1){
      c += b.at(j);
    }
    c = c % 2;
    if( c == a.at(i)){
      b.at(i) = 0;
    }
    else{
      b.at(i) = 1;
    }
    M += b.at(i);
  }
 
  cout << M << endl;
  for (int i = 0; i < N; i++){
    if(b.at(i) ==1){
      cout << i+1 << endl;
    }
  }
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	string tmp;
	tmp = s;
	reverse(ASC(tmp));

	if (s != tmp) {
		cout << "No" << endl;
		return 0;
	}

	int n = s.size();
	string t = s.substr(0, (n - 1) / 2);
	tmp = t;
	reverse(ASC(tmp));
	if(t != tmp) {
		cout << "No" << endl;
		return 0;
	}

	t = s.substr((n + 3) / 2 - 1, n);
	tmp = t;
	reverse(ASC(tmp));
	if (t != tmp) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
	int n;
	int i ,j ,k ,t ;
	int namelen ,kanbanlen ;
	int cnt  = 0 ;
	char name[ 26 ] ,kanban[ 201 ] ;
	scanf( "%d", &n ) ;
	scanf( "%s", name ) ;
	namelen=strlen(name);
	for( i = 0 ; i < n ; i++ )
	{
		scanf( "%s", kanban ) ;
		kanbanlen=strlen(kanban);
		for( j = 0 ; j < kanbanlen ; j++ )
		{
			for( k = 1 ; j + ( namelen - 1 ) * k < kanbanlen ; k++ )
			{
				for( t = 0 ; t < namelen ; t++ )
				{
					if( kanban[ j + t * k ] != name[ t ] )
					{
						goto one ;
					}
				}
				cnt++ ;
				goto two ;
				one : ;
			}
		}
		two : ;
	}
	printf( "%d\n", cnt ) ;
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <vector>

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

    std::vector<long long> h;
    h.reserve(N);
    long long x;
    for (int i = 0; i < N; ++i) {
        std::cin >> x;
        h.push_back(x);
    }

    std::vector<long long> dp(N, std::numeric_limits<long long>::max());

    dp[0] = 0;

    for (int i = 0; i < N; ++i) {
        dp[i] = std::min(dp[i], dp[i - 1] + std::abs(h[i] - h[i - 1]));

        if (i > 1) {
            dp[i] = std::min(dp[i], dp[i - 2] + std::abs(h[i] - h[i - 2]));
        }
    }

    const auto ret = dp[N - 1];

    std::cout << ret << std::endl;
}


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


using namespace std;

#define all(v)              v.begin(),v.end()
#define allr(v)             v.rbegin(),v.rend()
#define sz(v)               (int)sizeof(v)
#define pb(x)               push_back(x)
#define mkpr(x,y)           make_pair(x,y)
#define oo                  INT_MAX
#define noo                 INT_MIN
#define forn(i, n)          for(ll i=0;i<n;i++)
#define fore(i,b,e)         for(ll i=b;i<=e;i++)
#define ford(i,n)           for(ll i=n-1;i>=0;i--)


typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef pair<int, int> ii;

int dx[] = { 1,-1, 0, 0, 1, 1,-1, -1 };
int dy[] = { 0, 0, 1,-1, 1,-1, 1, -1 };

void dance()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

void file()
{
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
}

ll gcd(ll a, ll b)
{
    return !b ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

template<typename t>
void printV(vector<t> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << ' ';
    }
    cout << endl;
}

bool isPrime(int n)
{

    if (n == 2)
        return true;
    if (n < 2 || n % 2 == 0)
        return false;
    for (int i = 3; i * i <= n; i += 2)
        if (n % i == 0)
            return false;
    return true;
}

/**
 *****code begins here*****
**/
ull ncr(ull n,ull r)
{
    r=max(r,n-r);
    ull u=1,d=1;
    for(ull i=r+1; i<=n; i++)
        u*=i;
    for(ull i=1; i<=n-r; i++)
        d*=i;
    return u/d;
}

int main()
{
    dance();
    int n,x,sum=0,mx=0;
    cin>>n;
    while(n--)
    {
        int x;
        cin>>x;
        mx=max(mx,x);
        sum+=x;
    }
    cout<<sum-mx/2<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int D = int.Parse(input[1]);
        if (N % (2 * D + 1) == 0) { Console.WriteLine(N / (2 * D + 1)); }
        else { Console.WriteLine(N / (2 * D + 1) + 1); }
    }
}


Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int main()
{
    int i,flag1=0,flag2=0,a,b,n1[7]= {1,3,5,7,8,10,12},n2[4]= {4,6,9,11};
    cin>>a>>b;
    for(i=0; i<7; i++)
    {
        if(n1[i]==a)
            flag1=1;
        if(n1[i]==b)
            flag2=1;
    }
    if(flag1==1&&flag2==1)
    {
        cout<<"Yes";
            return 0;
    }
    flag1=flag2=0;
    for(i=0; i<4; i++)
    {
        if(n2[i]==a)
            flag1=1;
        if(n2[i]==b)
            flag2=1;
    }
    if(flag1==1&&flag2==1)
    {
        cout<<"Yes";
            return 0;
    }
    cout<<"No";
}


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

long long N, A[1 << 18];

int main() {
	cin >> N; long long S = 0;
	for (int i = 1; i <= N; i++) { cin >> A[i]; S += A[i]; }

	long long minx = S, sum = 0;
	for (int i = 1; i <= N; i++) {
		sum += A[i];
		minx = min(minx, abs(sum - (S - sum)));
	}
	cout << minx << endl;
	return 0;
}


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


template<typename T>
struct Dijkstra {
    struct Edge {
        int to;
        T cost;
        Edge(int to, T cost) : to(to), cost(cost){}
        bool operator<(const Edge& e) const { return cost > e.cost; }
    };
    vector<vector<Edge>> G;
    vector<T> ds;
    vector<int> bs;
    Dijkstra() = default;
    Dijkstra(int n) : G(n){}
    void addEdge(int u, int v, T c){
        G[u].emplace_back(v, c);
    }
    void build(int s){
        int n = G.size();
        ds.assign(n, numeric_limits<T>::max());
        bs.assign(n, -1);
        priority_queue<Edge> pq;
        ds[s] = 0;
        pq.emplace(s, ds[s]);
        while(!pq.empty()){
            auto p = pq.top(); pq.pop();
            int v = p.to;
            if(ds[v] < p.cost) continue;
            for(auto e : G[v]){
                if(ds[e.to] > ds[v]+e.cost){
                    ds[e.to] = ds[v]+e.cost;
                    bs[e.to] = v;
                    pq.emplace(e.to, ds[e.to]);
                }
            }
        }
    }
    T operator[](int k){ return ds[k]; }
    vector<int> restore(int to){
        vector<int> res;
        if(bs[to] < 0) return res;
        while(~to) res.emplace_back(to), to = bs[to];
        reverse(begin(res), end(res));
        return res;
    }
};


int V, E, r;
Dijkstra<int> G;


signed main(){
    cin >> V >> E >> r;
    G = Dijkstra<int>(V);
    for(int i = 0;i < E;i++){
        int s, t, d;
        cin >> s >> t >> d;
        G.addEdge(s, t, d);
    }

    G.build(r);
    for(int i = 0;i < V;i++)
        if(G[i] < numeric_limits<int>::max()) cout << G[i] << endl;
        else cout << "INF" << endl;

    return 0;
}


Measured memory_bytes: 13324
package main

import "fmt"

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	taste := 0
	apple := 1000
	for i := 1; i <= n; i++ {
		taste += l + i - 1
		if abs(l+i-1) < abs(l+apple-1) {
			apple = i
		}
	}
	fmt.Println(taste - (l + apple - 1))
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<map>

int main(){
    int n;
    std::cin >> n;
    std::map<int, int> mp;
    for(int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        mp[a]++;
    }

    int cnt = 0;
    for(auto m : mp){
        if(m.second >= m.first){
            cnt += m.second - m.first;
        }else{
            // 全て消す必要がある
            cnt += m.second;
        }
    }
    std::cout << cnt << std::endl;
    return 0;
}


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

int main () {
  int n;
  int a[110];
  cin >> n;
  for(int i = 0; i < n; ++i) cin >> a[i];
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      int diff = (a[i] > a[j]) ? a[i] - a[j] : a[j] - a[i];
      if (diff > ans) ans = diff;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <map>
#include <queue>
#include <tuple>

using namespace std;

typedef long long ll;
typedef tuple<int,int,int> P;


int main(){
    int N;
    cin >> N;
    cout << N/2+N%2;




    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
        int n;
        long long a;
        long long minValue = 1000000;
        long long maxValue = -1000000;
        long long sum=0;

        cin >> n;

        for (int i=0; i<n; i++) {
                cin >> a;
                if (a<minValue) minValue = a;
                if (a>maxValue) maxValue = a;
                sum+=a;
        }

        cout << minValue << " " << maxValue << " " << sum << endl;

        return 0;
}

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

namespace B_087
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = Convert.ToInt32(Console.ReadLine());
            int B = Convert.ToInt32(Console.ReadLine());
            int C = Convert.ToInt32(Console.ReadLine());
            int X = Convert.ToInt32(Console.ReadLine());

            int cnt = 0;

            for(int E = 0; E <= A; ++E) {
                for (int F = 0; F <= B; ++F) {
                    for (int G = 0; G <= C; ++G) {
                        int N = 500 * E + 100 * F + 50 * G;
                        if (N == X)
                        {
                            cnt++;
                        }
                    }
                }
            }
            Console.WriteLine(cnt);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11220
class UnionFind():
    # https://www.slideshare.net/chokudai/union-find-49066733
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        # root[x]>=0の場合は、特に直接的な意味を持たない気がする。計算に寄与するので意味はあるのだろうが。
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        # 無結合の時はRank=0,結合して1つ木が深くなると根がRank+=1
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    #
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]

    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return
        # 違う木に属していた場合rnkを見てくっつける方を決める
        # (1)xのランクの方が大きい(位置が深い)場合
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        # (2)yのランクの方が大きい(位置が深い)場合 or 等しい場合
        # また等しい場合、引数の2つめのyの方のランクを1つ増やす
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1

    # xとyが同じグループに属するか判断
    # Return: True or False
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
################################################################      
N,M=map(int,input().split())
a=[0]*M
b=[0]*M
for i in range(M):
  a[i],b[i]= map(int,input().split())
cnt=0

for i in range(M):
  UN=UnionFind(N)
  for j in range(M):
    if j==i:
      pass
    else:
      UN.Unite(a[j],b[j])
  if UN.isSameGroup(a[i], b[i])==False:
    cnt +=1
    
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

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

	int count = 0;
	for (int i = 0; i < N; i++) {
		int h; cin >> h;
		if (h >= K) { count++; }
	}

	cout << count << endl;

	return 0;
}

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

#define rep(i, s, n) for (Int i = s; i < (Int)(n); i++)
#define rrep(i, n, s) for (Int i = n - 1; i >= s; i--)
#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).end()
 
double EPS = 1e-10;
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<Int> s(m);
    vector<char> c(m);
    rep(i, 0, m) {
        cin >> s[i] >> c[i];
        s[i]--;
    }
    rep(i, 0, 1000) {
        if (to_string(i).size() != n) continue;
        string t = to_string(i);
        bool check = true;
        rep(j, 0, m) {
            if (t[s[j]] != c[j]) {
                check = false;
            }
        }
        if (check) {
            dump(i);
            return 0;
        }
    }
    dump(-1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	vector<int> a(m);
	rep(i,m) cin >> a.at(i);
	sort(a.begin(),a.end());
	vector<int> b(m-1);
	rep(i,m-1) b.at(i)=a.at(i+1)-a.at(i);
	sort(b.begin(),b.end());
	ll ans=0;
	if(n>=m) cout << 0 << endl;
	else{
		rep(i,m-n) ans+=b.at(i);
		cout << ans << endl;
	}
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int A[10][10];

int main() {

    int N;
    cin >> N;
    long long ans = 0;
    for ( int n = 1; n <= N; n++ ) {
        int a = to_string(n)[0] - '0';
        int b = n%10;
        ans += A[b][a]*2;
        if ( a == b ) { ans++; }
        A[a][b]++;
    }
    cout << ans << endl;

    return 0;
}

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

b = [0] * (n+1)

for i in range(n):
  b[i+1] = a[i] - b[i]

M = (b[0] + b[n] // 2)

i = 0
while i < n:
  b[i] = (b[i] + M) * 2
  i += 1
  b[i] = (b[i] - M) * 2
  i += 1

print(' '.join(map(str, b[:n])))

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

using namespace std;
using ll = long long;

int K;

template<class T>
struct Vector {
  vector<T> v;
  Vector(int sz) : v(sz, 0) {}
  Vector() : v(0) {}
  Vector(vector<T> t) : v(t) {}
  inline auto& operator[](size_t pos) {
    return v[pos];
  }
  inline auto begin() {
    return v.begin();
  }
  inline auto end() {
    return v.end();
  }
  inline auto size() {
    return v.size();
  }
  auto push_back(T t) {
    v.push_back(t);
  }
  auto pop_back() {
    v.pop_back();
  }
  inline auto& back() {
    return v.back();
  }
  friend auto& operator>>(istream& lhs, Vector& rhs) {
    for (int i = 0; i < rhs.size(); i++) lhs >> rhs[i];
    return lhs;
  }
  friend auto& operator<<(ostream& lhs, Vector& rhs) {
    for (int i = 0; i + 1 < rhs.size(); i++) lhs << rhs[i] << endl;
    if (rhs.size()) lhs << rhs.back();
    return lhs;
  }
};

Vector<ll> calc(Vector<ll>& x, Vector<ll>& y)
{
  Vector<ll> res;
  for (ll X : x) {
    for (ll Y : y) {
      res.push_back(X + Y);
    }
  }
  sort(res.begin(), res.end(), greater<ll>());
  while (res.size() > K) res.pop_back();
  return res;
}

int main()
{
  int x, y, z;
  cin >> x >> y >> z >> K;
  Vector<ll> a(x), b(y), c(z);
  cin >> a >> b >> c;
  auto v = calc(a, b);
  v = calc(v, c);
  cout << v << endl;
}


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

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    ll ans = 0;
    bool possible = true;
    if (A[0] != 0) possible = false;
    
    ll prev = 0;
    rep(i,N - 1){
        if (A[i + 1] == prev + 1){
            ans += 1;
            prev = A[i + 1];
        }
        else if (A[i + 1] <= prev){
            ans += A[i + 1];
            prev = A[i + 1];
        }
        else{
            possible = false;
        }
    }
    if (possible) cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 4792
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define all(a) a.begin(), a.end()
#define sz(a) a.size()
#define pb push_back
using namespace std;

const ll mod = 1e9+7;

ll n, a[200001], b[200001], k, x=0, y=0, ans=1;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("A.txt", "r", stdin);
    #endif
    cin >> n >> k;
    for(int i=0; i<n; i++){
        ll in;
        cin >> in;
        if(in>0){
            a[x]=in;
            x++;
        }
        else if(in<0){
            b[y]=abs(in);
            y++;
        }
    }
    if(x+y<k||(x+y<n&&x+y==k&&y%2==1)){
        cout << 0;
        return 0;
    }
    sort(a, a+x);
    sort(b, b+y);
    if(x==0&&k%2==1){
        if(y<n){
            cout << 0;
        }
        else{
            for(int i=0; i<k; i++){
                ans = (ans * -b[i]) % mod;
                if(ans<0) ans += mod;
            }
            cout << ans;
        }
        return 0;
    }
    int kk=0, i=x-1, j=y-1;
    while(kk<k){
        if(i<0) {
            j--;
        }
        else if(j<0){
            i--;
        }
        else{
            if(a[i]>b[j]){
                i--;
            }
            else{
                j--;
            }
        }
        kk++;
    }
    i++;
    j++;
    if((y-j)%2==1){
        if(j==0){
            if(i>0){
                j++;
                i--;
            }
        }
        else if(i==0){
            if(j>0){
                i++;
                j--;
            }
        }
        else if(i==x){
            if(x>0){
                i--;
                j++;
            }
        }
        else{
            ll c = a[i-1]*a[i];
            ll d = b[j-1]*b[j];
            if(c>d){
                i--;
                j++;
            }
            else{
                j--;
                i++;
            }

        }
    }
    for(; i<x; i++){
        ans = ans * a[i] % mod;
    }
    for(; j<y; j++){
        ans = ans * -b[j] % mod;
        if(ans < 0) ans += mod;
    }
    cout << ans;
}


Measured memory_bytes: 5188
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    if(n&1){
        cout<<n/2<<'\n';
    }
    else{
        cout<<n/2-1<<'\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
  ll n,mx=1;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n,greater<ll>());
  for(int i=0;i<n;i++)
  {
    ll c=1,cur=a[i];
    for(int j=i+1;j<n;j++)
    {
      if(cur>a[j])
      {
        c++;
        cur=a[j];
      }
    }
    mx=max(c,mx);
  }
  cout<<mx<<endl;


    
}
return 0;
}

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

class C
{
	static void Main()
	{
		Func<long[]> read = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
		var h = read();
		var t = read();
		Console.WriteLine(Enumerable.Range(0, (int)h[0]).Sum(i => Math.Min(h[1], i == h[0] - 1 ? h[1] : t[i + 1] - t[i])));
	}
}


Measured memory_bytes: 30880
#[allow(unused_imports)]
use proconio::marker::*;
use proconio::*;

#[allow(unused_macros)]
macro_rules! echo {
    ($ x : expr ) => {
        println!("{}", $x);
    };
}

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize, X: usize, T: usize,
    }
    echo!(if N % X == 0 {
        N / X * T
    } else {
        (N / X + 1) * T
    })
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int n, fac[100010]={1}, inv[100010]={1};
int s[100010], ss[100010];
int modpow(int a, long long n, int mod = MOD) {
	int r = 1, b = a;
	while(n > 0) {
		if(n & 1) r = 1ll * r * b % mod;
		b = 1ll * b * b % mod;
		n >>= 1;
	}
	return r;
}
int C(int n, int k) {
	if(k < 0 || k > n) return 0;
	return 1ll * fac[n] * inv[k] % MOD * inv[n-k] % MOD;
}
int main() {
	scanf("%d", &n);
	for(int i=1; i<100010; i++) {
		fac[i] = 1ll * i * fac[i-1] % MOD;
		inv[i] = modpow(fac[i], MOD - 2);
	}
	for(int i=1; i<=n; i++) {
		scanf("%d", s+i);
		s[i] = (s[i-1] + s[i]) % MOD;
		ss[i] = (ss[i-1] + s[i])  % MOD;
	}
	int res = 1ll * s[n] * fac[n] % MOD;
	for(int j=1; j<n; j++) {
		int tot = (ss[n-1] - ss[j] + MOD) % MOD;
		tot = (tot - ss[n-j-1] + MOD) % MOD;
		if(n-j-2>=0) res = (res + 1ll * tot * fac[n - j - 2] % MOD * fac[j] % MOD * 2 % MOD * C(n,j+2) % MOD) % MOD;
		res = (res + 1ll * s[j] * fac[n-j-1] % MOD * fac[j] % MOD * C(n, j+1) % MOD) % MOD;
		res = (res + 1ll * (s[n] - s[n-j] + MOD) % MOD * fac[n-j-1] % MOD * fac[j] % MOD * C(n, j+1) % MOD) % MOD;
	}
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 1792
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    h, w = map(int, input().split())
    # 整数 N 個 (改行区切り)
    S = [list(input()) for i in range(h)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    flag = True
    for i in range(h):
        for j in range(w):
            if S[i][j] == ".":
                continue
            else:
                neighbor = False
                N = [[i-1, j], [i+1, j], [i, j-1], [i, j+1]]
                for s in N:
                    if s[0] >= 0 and s[0] <= h-1 and s[1] >= 0 and s[1] <= w-1:
                        if S[s[0]][s[1]] == "#":
                            neighbor = True
                            break
#                print(neighbor)
                if neighbor == False:
                    flag = False
                    break
        if flag == False:
            break

    if flag == False:
        print("No")
    else:
        print("Yes")


resolve()

Measured memory_bytes: 39280
using System;

class Plogram
{
    static void Main()
    {

        int num = int.Parse(Console.ReadLine());
        int count = 0;
        int ans = 0;

        for(int i=1; i<=num; i+=2)
        {
            count = 0;
            for (int j=1; j<=num; j++)
            {
                if(i%j==0)
                {
                    count++;
                }
            }
            if(count == 8)
            {
                ans++;
            }
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=2e5+5;



int main(){
	int L;
	cin>>L;
	ll a[MAX];
	rep1(i,L)cin>>a[i];
  	a[0]=0;
	
	ll dp[5][MAX];
	rep(j,5)dp[j][0]=0;
	rep1(i,L){
		dp[0][i]=dp[0][i-1]+a[i];
      	ll p;
      	if(a[i]==0)p=2;
      	else p=a[i]%2;
		dp[1][i]=min(dp[0][i],dp[1][i-1]+p);
		dp[2][i]=min(dp[1][i],dp[2][i-1]+(a[i]+1)%2);
		dp[3][i]=min(dp[2][i],dp[3][i-1]+p);
		dp[4][i]=min(dp[3][i],dp[4][i-1]+a[i]);
	}
	cout<<dp[4][L]<<endl;	
}

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

using namespace std;
using ll = long long int;

ll gcd(ll a, ll b) {
    ll aa = max(a, b);
    ll bb = min(a, b);
    if (bb == 0) {
        return aa;
    }
    return gcd(bb, aa % bb);
}

ll total_gcd(vector<ll> A) {
    ll ans = A[0];
    for (ll a : A) {
        ans = gcd(ans, a);
    }
    return ans;
}

int main() {
    ll N;
    cin >> N;
    vector<ll> A = vector<ll>();
    vector<ll> front = vector<ll>();
    vector<ll> back = vector<ll>();
    for (ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A.emplace_back(a);
    }
    ll front_prime = A[0];
    ll back_prime = A[N-1];
    front.emplace_back(0);
    back.emplace_back(0);
    for (ll i = 0; i < N - 1; i++) {
        front_prime = gcd(front_prime, A[i]);
        back_prime = gcd(back_prime, A[N-1-i]);
        front.emplace_back(front_prime);
        back.emplace_back(back_prime);
    }
    reverse(back.begin(), back.end());
    ll ans = total_gcd(A);
    for (int i = 0; i < N; i++){
        ans = max(ans, gcd(front[i], back[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3484
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static Reader;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {

        Console.WriteLine(int.Parse(Console.ReadLine()) == Console.ReadLine().Split().Select(int.Parse).ToArray().Distinct().Count() ? "YES" : "NO");
    }
}

static class Reader
{
    const int BUF_SIZE = 1 << 12;
    static Stream Stream = Console.OpenStandardInput();
    static byte[] Buffer = new byte[BUF_SIZE];
    static int ptr = BUF_SIZE - 1;
    static void Move() { if (++ptr >= Buffer.Length) { Stream.Read(Buffer, 0, BUF_SIZE); ptr = 0; } }

    public static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0; int sign = 1; while (Buffer[ptr] < 45) Move();
            if (Buffer[ptr] == 45) { Move(); sign = -1; }
            do { res = res * 10 + (Buffer[ptr] ^ 48); Move(); } while (48 <= Buffer[ptr]);
            return res * sign;
        }
    }
}


Measured memory_bytes: 42824
<?php
fscanf(STDIN, "%d %d", $a, $b);

$outlet = $a - 1;
$tap = 0;
$continue = true;

while ($continue) {
    if (($outlet * $tap + 1) < $b) {
        $tap++;
    } else {
        $continue = false;
    }
}

echo $tap;

Measured memory_bytes: 4728
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		System.out.println(fact(n));
	}
	static long fact(long n) {
		if (n == 0) {
			return 1;
		} else {
			return n * fact(n - 1);
		}
	}
}



Measured memory_bytes: 25816
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    long long A[N + 1], B[N];
    for (int i = 0; i < N + 1; ++i) cin >> A[i];
    long long total = 0;
    for (int i = 0; i < N; ++i) {
        cin >> B[i];
        long long m = min(A[i], B[i]);
        total += m;
        if (A[i] < B[i]) {
            long long nm = min(A[i + 1], B[i] - m);
            A[i + 1] -= nm;
            total += nm;
        }
    }
    cout << total << endl;
}


Measured memory_bytes: 1792
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N = NI()
a = [0,0,0]
for x in LI():
    a[x-1] += 1
dp = [[[0.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]

for k in range(a[2]+1):
    for j in range(a[1]+a[2]+1):
        for i in range(N+1):
            if not (0 < i+j+k <= N): continue
            x = 0.0
            if i > 0: x += dp[i-1][j][k] * (i/N)
            if j > 0: x += dp[i+1][j-1][k] * (j/N)
            if k > 0: x += dp[i][j+1][k-1] * (k/N)
            x += 1.0
            x *= N / (i+j+k)
            dp[i][j][k] = x
print(dp[a[0]][a[1]][a[2]])



Measured memory_bytes: 254596
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 1005003
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
vector<int>primes;
int put[mxn];
int cnt[mxn+2]={0};
void sieve(){
	for(int i=2;i<mxn;i++){
		if(!put[i]){
			primes.pb(i);
			for(int j=1;j*i<mxn;j++)
			put[i*j]=1;
		}
	}
}
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int n,cr=0,i,bad=0;
	cin>>n;
	int a[n],g=0;
	sieve();
	for(i=0;i<n;i++){
		cin>>a[i];
		g=__gcd(g,a[i]);
		cnt[a[i]]++;
	}
	for(auto x:primes){
		cr=0;
		for(i=1;i*x<=mxn;i++)
		cr+=cnt[i*x];
		if(cr>1)
		bad=1;
	}
	if(bad){
		if(g==1)
		cout<<"setwise coprime";
		else
		cout<<"not coprime";
	}
	else
	cout<<"pairwise coprime";
}


Measured memory_bytes: 15484
#include <bits/stdc++.h>
using namespace std;
struct conv { 
	int l, r, x, pa;
       	bool can_merge(conv oth){
		if(r + 1 == oth.l){
			if(pa != oth.pa) return false;
			if(pa){
				if(x + r + 1 == oth.x + l) return true;
			} else {
				if(x == oth.x) return true;
			}
		}
		return false;
	}	
	conv operator + (conv oth){
		assert(can_merge(oth));
		return {l, oth.r, x, pa};
	}
};
struct node {
	vector<conv> convs;
	int get_id(int x){
		int id = 0;
		for(conv c : convs){
			if(c.l <= x && x <= c.r) return id;
			id++;
		}
		return id;
	}
	int get_val(int x){
		for(conv c : convs) if(c.l <= x && x <= c.r){
			if(c.pa) return c.x + x;
			else return c.x;
		}
		return -1;
	}
	conv get_conv(int l, int r, int x, int y){
		int cl = get_val(x);
		int cr = get_val(y);
		if(cl == cr) return { l, r, cl, 0 };
		return { l, r, cl - l, 1 };
	}
	void simplify(){
		sort(convs.begin(), convs.end(), [](conv a, conv b){
			return a.l < b.l;
		});
		vector<conv> rconvs;
		for(conv c : convs){
			if(rconvs.empty() || !rconvs.back().can_merge(c)) rconvs.push_back(c);
			else rconvs.back() = rconvs.back() + c;
		}
	}
	node operator + (node oth){
		node ans;
		for(conv c : convs){
			if(c.pa){
				int l = c.l, r = c.r;
				while(l <= r){
					int desired = oth.get_id(c.x + l);
					int lo = l + 1, hi = r, best = l;
					while(lo <= hi){
						int mid = (lo + hi)>>1;
						if(oth.get_id(c.x + mid) == desired){
							best = mid;
							lo = mid + 1;
						} else {
							hi = mid - 1;
						}
					}
					ans.convs.push_back(oth.get_conv(l, best, c.x + l, c.x + best));
					l = best + 1;
				}	
			} else {
				ans.convs.push_back({c.l, c.r, oth.get_val(c.x), 0});
			}
		}
		//ans.simplify();
		return ans;
	}
};
int main(){
	int X; scanf("%d", &X);
	int k; scanf("%d", &k);
	vector<int> pts(k + 2); for(int i = 0; i < k; i++) scanf("%d", &pts[i + 1]);
       	pts.back() = 1'000'000'001;
	int q; scanf("%d", &q);
	int pt = 0;
	node cur;
	cur.convs.push_back({0, X, 0, 1});
	for(int i = 0; i < q; i++){
		int t, a; scanf("%d %d", &t, &a);
		while(pts[pt + 1] <= t){
			int sz = pts[pt + 1] - pts[pt];
			node now;
			if(pt&1){
				if(sz <= X)
					now.convs.push_back({0, X - sz, sz, 1});
				now.convs.push_back({max(0, X - sz + 1), X, X, 0});
			} else {
				now.convs.push_back({0, min(sz, X), 0, 0});
				if(sz < X)
			       		now.convs.push_back({sz + 1, X, -sz, 1});
			}
			cur = cur + now;	
			pt++;
		}
		int now = cur.get_val(a);
		if(pt&1){
			now += t - pts[pt];
			now = min(now, X);
		} else {
			now -= t - pts[pt];
			now = max(now, 0);
		}
		printf("%d\n", now);
	}	
	return 0;
}


Measured memory_bytes: 1664