akhauriyash/Code-Regression huggingface dataset:
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") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end
s=gets.chomp
if s=="AAA" or s=="BBB"
  puts "No"
else
  puts "Yes"
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	int n, a, k = 0, t = 0;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (a % 4 == 0)
			k++;
		else if (a % 2 == 0)
			t++;
	}

	int l = ceil((n - 1) / 2.0);
	if (k + t / 2 >= l)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main (String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        System.out.printf("%d %d %.9f\n", a / b, a % b, 1.0 * a / b);
    }
}


Measured memory_bytes: 26460
#include<iostream>
using namespace std;
using ll = long long;
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

mint f(int n) {
	if (n == 0)return 1;
	mint x = f(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

mint choose(int n, int a) {
	mint x = 1, y = 1;
	for (int i = 0; i < a; i++)x *= n - i, y *= i + 1;
	return x / y;
}

int main() {
	int n, a, b; cin >> n >> a >> b; cin >> n >> a >> b;
	mint ans = f(n);
	ans -= 1;
	ans -= choose(n, a);
	ans -= choose(n, b);
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 256
void main()
{
    long a, b;
    rdVals(a, b);

    writeln(a * b);
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

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

int main(){
  vector<vector<char>> A (3,vector<char>(3,'a'));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> A.at(i).at(j);
    }
  }
  for(int i=0;i<3;i++){
    cout << A.at(i).at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll inf=9999999999999999;
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        ll a,b,c,k,ans;
        cin>>a>>b>>c>>k;
        if(a>=k)
        {
        	ans=k;
        }
        else if(a+b>=k)
        {
        	ans=a;
        }
        else
        {
        	ans=2*a+b-k;
        }
        cout<<ans<<"\n";
        return 0;
}


Measured memory_bytes: 3692
#include<stdio.h>

int main(void){
  int n,m,h[100],i,j,maxup,maxdown;

  scanf("%d",&n);

  while(n--){
    scanf("%d",&m);

    for(i=0;i<m;i++){
      scanf("%d",&h[i]);
    }

    maxup=maxdown=0;

    for(i=0;i<m-1;i++){
      j=h[i]-h[i+1];
      if(j>0)maxdown=maxdown<j?j:maxdown;
      else maxup=maxup>j?j:maxup;
    }
    printf("%d %d\n",-1*maxup,maxdown);
  }

  return 0;
}

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

int main(){
	int n;
	int b;
	cin >> n;
	vector<int> a;
	for (int i=0 ;i<n ;i++ ) {
		a.push_back(i);
		cin >> a[i];
	}
	for (int i=0 ;i<n ;i++ ) {
		for (int t=i-1 ;t>=0 ;t-- ) {
			if ( a[t] <= a[t+1] ) break;
			b = a[t];
			a[t] = a[t+1];
			a[t+1] = b;
		}
		for (int t=0 ;t<n ;t++ ) {
			cout << a[t];
			if ( t < n-1 ) cout << " ";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<cmath>
using namespace std;
int a,b;
long long ans;
int ws(int x)
{
    int m=x,cnt=0;
    while(x) {x/=10;cnt++;}
    return cnt;
}
int power(int x)
{
    int ans=1;
    for(int i=1;i<=x;i++) ans*=10;
    return ans;
}
int main()
{
    cin>>a>>b;
    ans=a*power(ws(b))+b;
    int n=floor(sqrt(ans)+0.5);
    if(n*n==ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}
    

Measured memory_bytes: 256
strings = list(input())
len_str = len(strings)
ans = "Yes"

for i in range((len_str-1)//2):
  # Sは回文である。
  if strings[i] != strings[-i-1]:
    ans = "No"
for i in range((len_str-1)//4):
  # NをSの長さとするとき、Sの1文字目から (N−1)/2文字目まで(両端含む)からなる文字列は回文である。
  if strings[i] != strings[(len_str-1)//2-i-1]:
    ans = "No"
  # Sの(N+3)/2文字目からN文字目まで(両端含む)からなる文字列は回文である。
  if strings[(len_str+3)//2+i-1] != strings[-i-1]:
    ans = "No"
print(ans)

Measured memory_bytes: 3060
N = int(input())
x_y_h_list = [list(map(int, input().split())) for _ in range(N)]
x_y_h_list.sort(key=lambda x: x[2], reverse=True)

for cx in range(0, 101):
    for cy in range(0, 101):
        flag = 0
        H = 1
        for idx, x_y_h in enumerate(x_y_h_list):
            if H == 1:
                H = x_y_h[2] + abs(cx - x_y_h[0]) + abs(cy - x_y_h[1])
            else:
                if x_y_h[2] != max(H - abs(cx-x_y_h[0]) - abs(cy-x_y_h[1]), 0):
                    flag = 1
                    break
        if flag == 0:
            print(cx, cy, H)

Measured memory_bytes: 41968
#ifdef HIRO
#include "../stdc++.h"
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#include <bits/stdc++.h>
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;

int main() {
#ifdef HIRO
  string file_path(QUIZ);
  ifstream cin(file_path + "/input.txt");
  std::cin.rdbuf(cin.rdbuf());
#endif
  // 40x = 98y + 58 -> Yes
  // 7x = 5y + 1 -> Yes
  // 2x = 2y + 1 -> No
  // 77x = 42y + 36 -> No
  int a, b, c;
  cin>>a>>b>>c;
  for(int i=1;i<=b;++i){
    if(a*i%b==c){
      cout<<"YES";
      return 0;
    }
  }
  cout<<"NO";
  // int n;
  // int m;
  // cin >> n;
  // cin >> m;
  


  // cout << ans << endl;
  return 0;
}



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

int main()
{
  int N,p[100001],road[100001];
  queue<int> Q;

  cin>>N;
  for(int i=0;i<N;i++){
    cin>>p[i];
    road[i]=10000000;
  }
  road[0]=0;
  Q.push(0);
  while(!Q.empty()){
    int a=Q.front();Q.pop();
    if(p[a]!=0){
      if(road[a]<road[p[a]+a]){
      Q.push(a+p[a]);
      road[p[a]+a]=road[a];
      }
    }
    else{
      for(int i=1;i<=6;i++){
	if(a+i<N){
	  if(road[a+i]>road[a]+1){
	    road[a+i]=road[a]+1;
	    Q.push(a+i);
	  }
	}
      }
    }
  }
  cout<<road[N-1]<<endl;
  return 0;
}

Measured memory_bytes: 2020
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	if(!(a==b)){
		if(!(a==c)){
			d=a;
	}}
    if(!(b==a)){
		if(!(b==c)){
			d=b;
	}}
	if(!(c==a)){
		if(!(c==b)){
			d=c;
	}}
	printf("%d\n",d);
}

Measured memory_bytes: 128
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();

        long x = in.nextLong();
        long temp = x;
        int count = 0;
        long y= in.nextLong();


        while (temp <= y)
        {
            temp*=2;
            count++;
        }
        System.out.println(count);




    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
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 H, A;

int main() {
  cin >> H >> A;
  cout << (H + A - 1) / A << endl;
  return 0;
}


Measured memory_bytes: 256
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

cn = 0
for ai in a:
    cn += 1 if sum(ai[j]*b[j] for j in range(m)) + c > 0 else 0
print(cn)

Measured memory_bytes: 3060
/*** author: yuji9511 ***/
/***
                                  ...   ..
                                  TMD  dM#`         ....           `  ...      ..,           ..,
                                                 .MMMMMMm      .MMMMMMMM#! ..gMMMF       ..kMMMt
       .N,   dM;  ..,    +M     .gN.  ..,      .MM"   JMF    .MM$         ?MB".MM`      TM9=.M#
      .M#`  .MM{  JMF   (M#    .JM#   MMF     .dMb..JMMM`    7MMMMMNa,        .MF           JMF
      MM!  .dMM`  dM%  -MMN. .dMHM@   MM[   ..MtT"""=dM]           TMM.       dM]           MM\
      MMNgM#4M#  .MM..M#!(MMMB^ JM@   MMb..gMD`     .M#     .J.  ..MM@      ..MMNMMMM    ...MMNMMM@
       7"!  dM]   TMM9^         (MF   .WMMM"        (MF     TMMMMMM"!    ,MMMWWMD      -MMMYWMD
     .J.   .M#                  dM%
     .TMMNMMB`              ?MNMMF

***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if(a1+a2+a3 >= 22){
        print("bust");
    }else{
        print("win");
    }
    

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <class T, int N, int I = 0>
auto gen_vec(const int (&list)[N], typename std::enable_if<(I == N), const T&>::type value = T()) { 
  return value; 
}

template <class T, int N, int I = 0>
auto gen_vec(const int (&list)[N], typename std::enable_if<(I != N), const T&>::type value = T()) { 
  return std::vector<decltype(gen_vec<T, N, I + 1>(list, value))>(list[I], gen_vec<T, N, I + 1>(list, value)); 
}

constexpr long long inf = (1ll << 60);
constexpr int mx = 20000;

int main() {
  int N;
  std::cin >> N;
  std::vector<int> W(N), S(N), V(N);
  for (int i: range(0, N)) {
    std::cin >> W[i] >> S[i] >> V[i];
  }
  std::vector<int> order(N);
  std::iota(order.begin(), order.end(), 0);
  std::sort(order.begin(), order.end(), [&](int i, int j) {
    return W[i] + S[i] < W[j] + S[j];
  });
  auto dp = gen_vec<long long>({ N + 1, mx + 1 }, 0);
  for (int i: range(0, N)) {
    for (int j: range(0, mx + 1)) {
      chmax(dp[i + 1][j], dp[i][j]);
      if (S[order[i]] >= j) {
        chmax(dp[i + 1][j + W[order[i]]], dp[i][j] + V[order[i]]);
      }
    }
    for (int j: range(0, mx)) {
      chmax(dp[i + 1][j + 1], dp[i + 1][j]);
    }
  }
  std::cout << dp[N][mx] << '\n';
  return 0;
}


Measured memory_bytes: 160640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

string S;
ll N;
vector<ll> dp(200100, -1);
ll dfs(ll n){
    ll cnt = 0;
    if(dp[n] != -1) return 0;
    rep(i,30){
        if((n >> i)&1LL)cnt++;
    }
    ll m = n % cnt;
    if(m == 0){
        dp[n] = 1;
        return 0;
    }else{
        dfs(m);
        dp[n] = dp[m] + 1;
        return 0;
    }
}

int main(){
    cin >> N;
    cin >> S;
    vector<ll> memo(N), memom(N), memop(N);
    ll cnt = 0;
    rep(i,N){
        if(S[i] == '1')cnt++;
    }
    if(cnt == 0){
        rep(i,N){
            cout << 1 << endl;
        }
        return 0;
    }else if(cnt == 1){
        if(S[N-1] == '1'){           
            rep(i,N-1){
                cout << 2 << endl;
            }
            cout << 0 << endl;
        }else{
            rep(i,N-1){
                if(S[i] == '0'){
                    cout << 1 << endl;
                }else{
                    cout << 0 << endl;
                }
            }
            cout << 2 << endl;
        }
        return 0;
    }
    ll t = 1 % cnt;
    memom[0] = 1%(cnt-1);
    memo[0] = 1%cnt;//caution.
    memop[0] = 1 %(cnt+1);
    rep(i,N-1){
        memom[i+1] = (memom[i]*2) % (cnt-1);
        memo[i+1] = (memo[i]*2) % cnt;
        memop[i+1] = (memop[i]*2) % (cnt+1);
    }
    reverse(memo.begin(), memo.end());
    reverse(memom.begin(), memom.end());
    reverse(memop.begin(), memop.end());
    dp[0] = 0;
    REP(i,1,200010){
        if(dp[i] != -1) continue;
        dfs(i);
    }
    //PR(dp, 15);
    //PR(memo,N);
    ll h=0, hm=0, hp = 0;
    rep(i,N){
        if(S[i] == '1'){
            h += memo[i];
            h %= cnt;
            hm += memom[i];
            hm %= (cnt - 1);
            hp += memop[i];
            hp %= (cnt + 1);
        }
    }
    //cout << h << " a " <<endl; 
    rep(i,N){
        ll tmp;
        if(S[i] == '1'){
            tmp = hm - memom[i];
            tmp += (cnt-1);
            tmp %= (cnt-1);
            //cout <<"a "<< tmp <<endl;
            cout << dp[tmp]+1 << endl;
        }else{
            tmp = hp + memop[i];
            tmp %= (cnt+1);
            //cout <<"b "<< tmp <<endl;
            cout << dp[tmp]+1 << endl;
        }
    }
}


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

using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    char c;
    cin>>c;
    if(c=='A') cout<<"T";
    else if(c=='T') cout<<"A";
    else if(c=='C') cout<<"G";
    else if(c=='G') cout<<"C";
    cout<<endl;
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t, n, ma = 0;
    ll ans = 0;
    cin >> n;
    while(n--){
        cin >> t;
        ma = max(ma, t);
        ans += (ma - t);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3616
#include<cmath>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<stack>
#include<vector>
#include<string.h>
#include<string>
#include<iomanip>
#include <sstream>
#include<map>
#include<complex>
#include<set>
using namespace std;
#define rep(i,t,n)  for(ll i =(t);i<=(n);++i)
#define per(i,n,t)  for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define Decimal fixed<<setprecision(20)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2e5 + 5;
typedef double db;
const db pi = acos(-1.);
ll n, k;


int main() {
	FAST_IO;

	int a, b;
	cin >> a >> b;
	cout << max(0, a - 2 * b);
	cin >> n;
}         
/*
2
A 0 0 2
B 1 0 2


*/


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int N = 0;
  int S = 0;
  //入力
  scanf("%d", &N );
  //計算
  int ans = N;
  for (size_t i = 0; i < 9; i++) {
    S += N%10;
    N = N/10;
  }
  //出力
  if ( S == 0 ) {
    printf("Yes\n");
  } else if ( (ans%S) == 0 ) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    long long n,cou=0;
    cin>>n;
    if(n%2==1)
    {
        cout<<"0"<<endl;
    }
    else
    {
        while(n)
        {
            cou+=n/10;
            n/=5;
        }
        cout<<cou<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fail() return puts("No"), 0

const int N = 100054;

int n;
int a[N], b[N], c[N], d[N];
bool vis[N];

bool parity(int n, int *p) {
	int i, j; bool par = n & 1;
	memset(vis, false, n);
	for (i = 0; i < n; ++i) if (!vis[i])
		for (par ^= 1, j = i; !vis[j]; j = p[j]) vis[j] = true;
	return par;
}

int main() {
	int i; div_t r; bool flip[2] = {false, false};
	scanf("%d", &n);
	for (i = 0; i < n; ++i) scanf("%d", a + i);
	for (i = 0; i < n; ++i) scanf("%d", b + i);
	for (i = 0; i < n; ++i) scanf("%d", c + i);
	for (i = 0; i < n; ++i)
		if (r = div(b[i], 3), r.rem != 2) fail();
		else if ((r.quot ^ i) & 1) fail();
		else if (a[i] == 3 * r.quot + 1 && c[i] == 3 * (r.quot + 1)) d[i] = r.quot / 2;
		else if (a[i] == 3 * (r.quot + 1) && c[i] == 3 * r.quot + 1) d[i] = r.quot / 2, flip[i & 1] ^= 1;
		else fail();
	for (i = 0; i < n; ++i) (i & 1 ? b : a)[i / 2] = d[i];
	puts(parity((n + 1) / 2, a) == flip[1] && parity(n / 2, b) == *flip ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n,k;
    cin>>n>>k;
    int res = 1;
    int p = 1;
    rep(i,n){
        if(p>=k){
            res+=k;
        }
        else{
            res+=p;
            p*=2;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    for(int i=1;i<=n;i++){
        int x=i;
        if(x%3==0){
            cout << " "<< i;
        }
        else if(x%10==3){
            cout << " " << i;
        }
        else if(x>=10){
            while(x>0){
                x/=10;
                if(x%10==3){
                    cout << " " << i;
                    break;
                }
            }
        }
    }
    cout << endl;
    return 0;
    
}


Measured memory_bytes: 3112
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL A, B, C, K, ans;

int main()
{
	in >> A >> B >> C >> K;
	ans = A + B + C;
	ans -= std::max({ A,B,C });
	ans += (std::max({ A,B,C }) << K);
	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define loop(n) for(int lp=0; lp<(n); lp++)
#define ascent(i, a, b)  for(int (i)=(a); (i)<(b); (i)++)
#define descent(i, a, b) for(int (i)=(a); (i)<(b); (i)--)

int main() {
	int k, c, ans;
	while(cin >> k, k) {
		ans = 0;
		loop(k*(k-1)/2) {
			cin >> c;
			ans += c;
		}
		cout << ans/(k-1) << endl;
	} 
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    if(s[0]=='7' || s[1]=='7' || s[2]=='7')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	vi a(n),b(n);
	rep(i,0,n)cin>>a[i];
	rep(i,0,n)cin>>b[i];
	int ans=0;
	rep(i,0,n){
		if(a[i]>b[i]){
			ans+=a[i]-b[i];
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;

#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
#define INF 1000000000

int main() {
  IN(N); IN(M); IN(R);

  vector<int> r(R);
  REP(i, R) {
    cin >> r[i];
    r[i] -= 1;
  }

  VVI edge(N, VI(N, INF));
  REP(i, M) {
    IN(a); IN(b); IN(c);
    if (edge[a-1][b-1] > c)
      edge[a-1][b-1] = edge[b-1][a-1] = c;
  }

  VVI d(N, VI(N, INF));
  REP(i, N)
    REP(j, N) {
      d[i][j] = edge[i][j];
      if (i == j)
        d[i][i] = edge[i][i] = 0;
    }

  REP(k, N)
    REP(i, N)
      REP(j, N)
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

  sort(ALL(r));
  int ans = INF;
  do {
    int sum = 0;
    int before = r[0];
    for (auto it = r.begin() + 1; it != r.end(); ++it) {
      sum += d[before][*it];
      before = *it;
    }
    ans = min(ans, sum);
  } while (next_permutation(ALL(r)));

  OUT(ans);

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
// #include <iomanip>
// #include <cstdio>
// #include <cmath>
// #include <string>
// #include <vector>
// #include <limits>
// #include <algorithm>
// #include <utility>
// #include <sstream>
// #include <numeric>
// #include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for (int i=(a-1);i>=(b);--i)
#define rrep(i,n) rrepd(i,n,0)
typedef long long ll;
typedef pair<int, int> P;

const int mod=int(1e9)+7;
// vector<ll> fac(1000001);
// vector<ll> ifac(1000001); //k!^{M-2} (mod M)

// ll mpow(ll x, ll n){
//     ll ans = 1;
//     while(n != 0){
//         if(n&1) ans = ans*x % mod;
//         x = x*x % mod;
//         n = n >> 1;
//     }
//     return ans;
// }


// ll comb(ll a, ll b){ //aCbをmod計算
//     if(a == 0 && b == 0)return 1;
//     if(a < b || a < 0)return 0;
//     ll tmp = ifac[a-b]* ifac[b] % mod;
//     return tmp * fac[a] % mod;
// }

int fact(int n){
  if(n==0)return 1;
  return ((long)n*(long)fact(n-1))%mod;
}
 
int pow(int n, int i){
  if(i==0)return 1;
  long s = pow(n, i/2);
  if(i%2==0){
    return (s*s)%mod;
  }
  else {
    return (((s*s)%mod)*(long)n)%mod;
  }
}
 
int comb(int n, int r){
  if(r<0 || r>n)return 0;
  long nf=fact(n), rf=fact(r), rnf=fact(n-r);
  return (((nf*pow(rf, mod-2))%mod)*pow(rnf, mod-2))%mod;
}

int main(int argc, const char * argv[]) {
  int x, y;
  cin >> x >> y;
  if ( (y + x) % 3 != 0){
    cout << 0 << endl;
    return 0;
  }

  int ans=0;

  //大した量ではないので，先にfax[i]とifax[i]を全て計算しておく
  // fac[0] = 1;
  // ifac[0] = 1;
  // for(ll i = 0; i<1000002; i++){
  //     fac[i+1] = fac[i]*(i+1) % mod; // n!(mod M)
  //     ifac[i+1] = ifac[i]*mpow(i+1, mod-2) % mod; // k!^{M-2} (mod M) ←累乗にmpowを採用
  // }
  // ll a = (2*y - x) / 3;
  // ll b = (y - 2*a);
  int n = (x+y) / 3;
  int r = y-n;
  ans = comb(n, r) % mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10624
local n, k = io.read("*n", "*n")
local t = {}
for i = 1, n do
  local a = io.read("*n")
  if t[a] then t[a] = t[a] + 1 else t[a] = 1 end
end
local tm = {}
for k, v in pairs(t) do
  table.insert(tm, v)
end
table.sort(tm, function(x, y) return x > y end)
if #tm <= k then print(0)
else
  local c = 0
  for i = k + 1, #tm do
    c = c + tm[i]
  end
  print(c)
end


Measured memory_bytes: 10080
import sys
input = sys.stdin.readline


def main():
    P = int(input())
    A = list(map(int, input().split()))

    # コンビネーション
    mod = P
    def cmb(n, r, mod=mod):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    NN = 10**5 # 使うデータによって変える
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range( 2, NN + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    ans = [0]*P
    for j, a in enumerate(A):
        if a == 1:
            ans[0] = (ans[0] + 1) % P
            t = 1
            for k in range(P):
                ans[P-1-k] = (ans[P-1-k] - cmb(P-1, k) * t) % P
                t = t * (-j) % P
    print(*ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 58736
p = 10**9+7
N,K = map(int,input().split())
A = list(map(int,input().split()))
inner=0
for i in range(N-1):
    for j in range(i+1,N):
        if A[i]>A[j]:
            inner += 1
B = A+A
outer = 0
for i in range(2*N-1):
    for j in range(i+1,2*N):
        if B[i]>B[j]:
            outer += 1
outer -= 2*inner
cnt = (inner*K)%p
a = ((K*(K-1))//2)%p
cnt = (cnt+outer*a)%p
print(cnt)

Measured memory_bytes: 9236
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <time.h>
#include <ctype.h>

int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; }
int max(int a, int b) { return a >= b ? a : b; }
int min(int a, int b) { return a <= b ? a : b; }
int dsum(int x) { int r=0; while(x){ r+=(x%10); x/=10; } return r;}
int gcd(int a, int b) { int i; for(i=a; i>0; i--) { if(a%i == 0 && b%i == 0) { break; } } return i; }
int lcm(int a, int b) { return (a*b)/gcd(a,b); }
void swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp; return; }

int main(void) {
	double t1,t2;
	while(scanf("%lf%lf",&t1,&t2) != EOF) {
	  if(t1 < 35.50 && t2 < 71) puts("AAA");
	  else if(t1 < 37.50 && t2 < 77) puts("AA");
	  else if(t1 < 40 && t2 < 83) puts("A");
	  else if(t1 < 43 && t2 < 89) puts("B");
	  else if(t1 < 50 && t2 < 105) puts("C");
	  else if(t1 < 55 && t2 < 116) puts("D");
	  else if(t1 < 70 && t2 < 148) puts("E");
	  else puts("NA");
	}
	return 0;
}



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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
int inf = 1000000000; //10e9
 
bool isacgt(char c){
    return (
        c=='A' || c=='C' || c=='G' || c=='T'
    );
}

int main() {

    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    rep(i,m) cin >> a[i];
    
    int lcost=0, rcost=0, ans=0;
    rep(i,m){
        if(a[i]<x) lcost++;
        else rcost++;
    }
    ans = min(lcost,rcost);

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>

int main(void) {
	int s;

	std::cin >> s;

	std::vector<int> v(1000002, 0);

	v[s]++;
	int count = 1;
	while (true) {
		if (s % 2 == 0) {
			s /= 2;
		}
		else {
			s = 3 * s + 1;
		}
		count++;
		if (v[s] != 0) {
			std::cout << count << std::endl;
			return 0;
		}
		v[s]++;
	}

	return 0;
}

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

typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e5+5;
int n;
ll k;
ll fac[maxn],inv[maxn];
vector<int>G[maxn];

struct node
{
    int sz,cs;
}a[maxn];

ll quickpow(ll a, ll b)
{
    ll ret = 1;
    while(b)
    {
        if(b&1)
            ret = (ret*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return ret;
}

void init(int p)
{
    fac[0] = 1;
    for(int i = 1; i <= p; i++)
    {
        fac[i] = (fac[i-1]*i)%mod;
    }
    inv[p] = quickpow(fac[p],mod-2);
    for(int i = p-1; i >= 0 ; i--)
    {
        inv[i] = (inv[i+1]*(i+1))%mod;
    }
}

ll A(ll n, ll m)
{
    if(m > n)
        return 0;
    else
        return fac[n]%mod*inv[n-m]%mod;
}

void dfs(int x, int fa, int cs)
{
    a[x].cs = cs;
    for(int i = 0; i < G[x].size(); i++)
    {
        int v = G[x][i];
        if(v == fa)
            continue;
        dfs(v,x,cs+1);
        a[x].sz++;
    }
}

int main()
{
    init(100001);
    while(~scanf("%d%lld",&n,&k))
    {
        int u,v;
        for(int i = 1; i < n; i++)
        {
            scanf("%d %d",&u,&v);
            G[u].push_back(v);
            G[v].push_back(u);
        }
        dfs(1,0,1);
        ll ans = k;
        for(int i = 1; i <= n; i++)
        {
            if(a[i].cs == 1)
            {
                ans = ans*A(k-1,a[i].sz)%mod;
            }
            else
            {
                ans = ans*A(k-2,a[i].sz)%mod;
            }
        }
        ans %= mod;
        printf("%lld\n",ans);
    }
    return 0;
}



Measured memory_bytes: 13952
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include <algorithm>
#include <functional>

using namespace std;

int main (void){
    int N,D;
    int temp;
    int n = 0;
    vector<int> list;
    vector<vector<int>> np;

    cin >> N >> D;

    for(int i = 0; i < N;i++){
        vector<int> a; 
        for(int j = 0;j < D;j++){
            cin >> temp;
            a.push_back(temp);
        }
        np.push_back(a);
    }

    for(int i = 1; i < 160 ; i++){
        int d = i*i;
        list.push_back(d);
    }

    for(int i = 0; i < N; i ++){
        for(int j = i + 1 ;  j < N ; j++){
            int num = 0;
            for(int k = 0; k < D;k++){
                num += (np[i][k]-np[j][k])*(np[i][k]-np[j][k]);
            }
            //cout << num << endl;
            //find
            for(int f=0; f < 160;f++){
                //cout << list[f] << endl;
                if(list[f] == num){
                    n++;
                    break;
                }
                else if(list[f] > num) break;
            }
        }
    }

    cout << n << endl;

    return 0; 
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n = ni()
MOD = 10**9+7

ans = 1
for i in range(1,n+1):
    ans *= i
    ans %= MOD
    
print(ans)

Measured memory_bytes: 3064
// C++ program to find  
// maximum XOR subset 
#include<bits/stdc++.h>

#define int long long

using namespace std;

// Number of bits to  
// represent int 
#define INT_BITS 64

// Function to return 
// maximum XOR subset 
// in set[] 
int maxSubarrayXOR(vector<int> set, int X) {
    int n = set.size();
    // Initialize index of 
    // chosen elements 
    int index = 0;

    // Traverse through all 
    // bits of integer  
    // starting from the most 
    // significant bit (MSB) 
    for (int i = INT_BITS - 1; i >= 0; i--) {
        if( (X >> i & 1) == 0 ) {
            // Initialize index of
            // maximum element and
            // the maximum element
            int maxInd = index;
            int maxEle = LONG_LONG_MIN;
            for (int j = index; j < n; j++) {
                // If i'th bit of set[j]
                // is set and set[j] is
                // greater than max so far.
                if ((set[j] & (1ll << i)) != 0)
                    maxEle = set[j], maxInd = j;
            }

            // If there was no
            // element with i'th
            // bit set, move to
            // smaller i
            if (maxEle == LONG_LONG_MIN)
                continue;

            // Put maximum element
            // with i'th bit set
            // at index 'index'
            swap(set[index], set[maxInd]);

            // Update maxInd and
            // increment index
            maxInd = index;

            // Do XOR of set[maxIndex]
            // with all numbers having
            // i'th bit as set.
            for (int j = 0; j < n; j++) {
                // XOR set[maxInd] those
                // numbers which have the
                // i'th bit set
                if (j != maxInd &&
                    (set[j] & (1ll << i)) != 0)
                    set[j] = set[j] ^ set[maxInd];
            }

            // Increment index of
            // chosen elements
            index++;
        }else{

        }
    }

    // Final result is  
    // XOR of all elements 
    int res = 0;
    for (int i = 0; i < n; i++)
        res ^= set[i];
    return res;
}

signed main() {
    int n;
    cin >> n;
    vector<int> a;

    int tot = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a.push_back(x);
        tot ^= x;
    }
    int t = maxSubarrayXOR(a, tot);
    cout << t + (t ^ tot) << endl;
}

  

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

int main(){
	ll n, k;
    cin >> n >> k;
    vector<pair<int, int>> v(0);
    int a[100010], b[100010];

    for(ll i = 0; i < n; i++)
    {
        ll a1, b1;
        cin >> a1 >> b1;
        v.push_back(make_pair(a1, b1));
    }

    sort(v.begin(), v.end());

    for(int i = 0; i < n; i++)
    {
        a[i] = v[i].first;
        b[i] = v[i].second;
    }

    for(int i = 0; i < n; i++)
    {
        if(b[i] >= k){
            cout << a[i] << endl;
            break;
        }
        else
        {
            k -= b[i];
        }
            
    }
    

	return 0;
}

Measured memory_bytes: 1908
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <bitset>
#include <queue>

using namespace std;
#define rep(i, n) for(i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x)*(x)
typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    fill(a.begin(), a.end(), 0);
    int i;
    rep(i, n-1) {
        int tmp;
        cin >> tmp;
        a[tmp-1]++;
    }
    rep(i, n) {
        cout << a[i] << endl;
    }
}

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

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

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)

#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31)) /*オーバーフローしない程度に大きい数*/
#define MOD 1000000007

int main(){
// ここに処理を記述
    int N, K;
    cin >> N >> K;

    vector<int> h;
    int temp = 0;
    h.push_back(0); // 1-indexed
    for(int i=0; i<N; i++){
        cin >> temp;
        h.push_back(temp);
    }

    vector<int> dp(N+1, 0);
    FOR(i,2,N+1){
        dp[i] = dp[i-1]+abs(h[i-1]-h[i]);
        FOR(j,2,K+1)
        if(i-j >= 1){
            dp[i] = min(dp[i], dp[i-j]+abs(h[i-j]-h[i]));
        }
    }

    int ans = dp[N];

    cout << ans << "\n";

return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#include <iostream>
#include <string> 
using namespace std;
int main(){
  int A,B;
  char op;
  while(1){
    cin >> A >> op >> B;
    if(op == '?'){
      break;
    }
    else if(op == '+'){
    cout << A+B << endl;
    }
    else if(op == '-'){
    cout << A-B << endl;
    }
    else if(op == '*'){
    cout << A*B << endl;
    }
    else if(op == '/'){
    cout << A/B << endl;
    }
  }
}


Measured memory_bytes: 3112
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>
#include<iomanip>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, k;
    cin >> n >> k;
    vector<double> e(n);
    for(int i = 0; i < n; i++){
        ll p;
        cin >> p;
        e[i] = (1 + p) / 2.0;
    }
    double sum = 0;
    for(int i = 0; i < k; i++){
        sum += e[i];
    }
    double ans = sum;
    for(int i = k; i < n; i++){
        sum -= e[i - k];
        sum += e[i];
        ans = max(ans, sum);
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    set<int>S;
    int x;
    for(int i = 0; i < n; i++){
        cin >> x;
        S.insert(x);
    }
    int q;
    cin >> q;
    int cnt = 0;
    for(int i = 0; i < q; i++){
        cin >> x;
        if(S.find(x) != S.end()){
            cnt++;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;

int main()
{
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    set<int> s;
    for (int i = 0; i < N; i++)
    {
       s.insert(A[i]);
    }
    if (s.size() == N)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
}

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

using namespace std;
#define int long long
#define pii pair <int , int>
#define F first
#define S second
const int N = 2e5 + 10, MOD = 1e9 + 7;
int col[N], fac[N], inv[N], c[N], w[N], cnt[N], mark[N], CNT = 0;
vector <int> g[N];
vector < pair <int , int> > vec[N], mn;
set <int> st;

int mul(int a, int b) {return (a * b) % MOD;}

int Pow(int a, int b)
{
    int res = 1;
    for (; b; b>>=1, a = mul(a, a)) if (b & 1) res = mul(res, a);
    return res;
}

void dfs(int v)
{
    mark[v] = 1;
    cnt[c[v]]++;
    st.insert(c[v]);
    CNT++;
    for (int u : g[v]) if (!mark[u]) dfs(u);
}

int32_t main()
{
    int n, X, Y; cin >> n >> X >> Y;
    fac[0] = 1;
    for (int i = 1; i <= n; i++) fac[i] = mul(fac[i - 1], i);
    inv[n] = Pow(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; i--) inv[i] = mul(inv[i + 1], i + 1);
    for (int i = 1; i <= n; i++) {
        cin >> c[i] >> w[i];
        vec[c[i]].push_back({w[i], i});
    }
    for (int i = 1; i <= n; i++) {
        if (vec[i].empty()) continue ;
        sort(vec[i].begin(), vec[i].end());
        int W = vec[i][0].F, ID = vec[i][0].S;
        for (auto p : vec[i]) {
            int _W = p.F, _ID = p.S;
            if (W + _W <= X) {
                g[ID].push_back(_ID);
                g[_ID].push_back(ID);
            }
        }
        mn.push_back({W, ID});
    }
    sort(mn.begin(),mn.end());
    for (int i = 1; i <= n; i++) {
        if (c[i] != c[mn[0].S] && w[i] + mn[0].F <= Y) {
            g[i].push_back(mn[0].S);
            g[mn[0].S].push_back(i);
        }
        else if (mn.size() > 1 && w[i] + mn[1].F <= Y) {
            g[i].push_back(mn[1].S);
            g[mn[1].S].push_back(i);
        }
    }

    int ans = 1;
    for (int i = 1; i <= n; i++) if (!mark[i]) {
        dfs(i);
        int res = fac[CNT];
        for (int col : st) {
            res = mul(res, inv[cnt[col]]);
            cnt[col] = 0;
        }
        st.clear();
        CNT = 0;
        ans = mul(res, ans);
    }
    cout << ans << "\n";
}




Measured memory_bytes: 42176
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

inline int signof(int a) {
	if(a>0) return 1;
	if(a<0) return -1;
	return 0;
}

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];

	int count = 0;
	for(int i=0;i<n;i++) {
		count++;
		while(a[i+1]-a[i]==0) {
			i++;
			if(i+1==n) goto stop;
		}
		int sign = signof(a[i+1]-a[i]);
		while((a[i+1]-a[i])*sign>=0) {
			i++;
			if(i+1==n) goto stop;
		}
	}

stop:
	print(count);

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("Curtain","r",stdin);
	//freopen("Curtain","r",stdin);
	int n,i,a[50],j,b,x=0;
	cin>>n;
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			x+=a[i]*a[j];
		}
	}
	cout<<x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define pb push_back 
#define x first 
#define y second 
#define MOD 1000081
 
using namespace std;
typedef long long ll;
typedef pair< int , int > PII;
const int dirx[] = {-2,-1,1,2, 1, -1};
const int diry[] = {0,1,1,0, -1, -1};
inline void debugMode() {
    #ifndef ONLINE_JUDGE
    freopen("eqs.in", "r", stdin);
    freopen("eqs.out", "w", stdout);
    #endif
}
 
int n, m;
int a[100100];
vector < int > V, R;
set < int > S;
 
int main(){ 
    //debugMode();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i <= n; i++)
		for (int j = 0; j <= n; j++){
			if (i + j > n) continue;
			if (i * 10000 + j * 5000 + (n - i - j) * 1000 == m) return cout << i << " " << j << " " << n - i - j, 0; 
		}
	cout << "-1 -1 -1";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;

int main(){
    int A,B;

    cin >> A >> B;

    if(A>B){
        swap(A,B);
    }

    if((B-A)%2 == 1){
        cout << "IMPOSSIBLE" << endl;
    }else{
        cout << (A+B)/2 <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

vector<int> xs[620],ys[620];

signed main(){
	int h,w,ans = 0;
	string field[310];
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		cin >> field[i];
		for(int j = 0;j < w;j++){
			if(field[i][j] == '#'){
				xs[i + j].pb(i - j + 300);
				ys[i - j + 300].pb(i + j);
			}
		}
	}
	for(int i = 0;i < 620;i++) sort(all(xs[i]));
	for(int i = 0;i < 620;i++) sort(all(ys[i]));
	for(int i = 0;i < 620;i++){
		for(int j = 0;j < xs[i].size();j++){
			for(int k = j + 1;k < xs[i].size();k++){
				if(i + xs[i][k] - xs[i][j] < 620) ans += upper_bound(all(xs[i + xs[i][k] - xs[i][j]]),xs[i][k]) - lower_bound(all(xs[i + xs[i][k] - xs[i][j]]),xs[i][j]);
				if(i - xs[i][k] + xs[i][j] >= 0) ans += upper_bound(all(xs[i - xs[i][k] + xs[i][j]]),xs[i][k]) - lower_bound(all(xs[i - xs[i][k] + xs[i][j]]),xs[i][j]);
			}
		}
	}
	for(int i = 0;i < 620;i++){
		for(int j = 0;j < ys[i].size();j++){
			for(int k = j + 1;k < ys[i].size();k++){
				if(ys[i][k] - ys[i][j] >= 2){
					if(i + ys[i][k] - ys[i][j] < 620) ans += upper_bound(all(ys[i + ys[i][k] - ys[i][j]]),ys[i][k] - 1) - lower_bound(all(ys[i + ys[i][k] - ys[i][j]]),ys[i][j] + 1);
					if(i - ys[i][k] + ys[i][j] >= 0) ans += upper_bound(all(ys[i - ys[i][k] + ys[i][j]]),ys[i][k] - 1) - lower_bound(all(ys[i - ys[i][k] + ys[i][j]]),ys[i][j] + 1);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560