akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	string s;
	cin >> s;
	int c = 0;
	for(size_t i = 1; i < s.size(); ++i){
		c += s[i - 1] != s[i];
	}
	cout << c << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
      	int temp = scan.nextInt();
      	if(temp>=30){
          	System.out.println("Yes");
        }
      	else{
        	System.out.println("No");
        }
      	scan.close();
    }
}

Measured memory_bytes: 27040
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)



function main()
    n,k=parseMap(split(readline()))
    mi,ma=0,0
    ans=Int128(0)
    for i in 0:n
        mi+=i
        ma+=n-i
        if i>=k-1
            ans+=ma-mi+1
        end
    end
    println(ans%(10^9+7))
end
main()

Measured memory_bytes: 169368
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    double H,W,x,y;
    cin>>W>>H>>x>>y;

    double area;
    area = (1.0*H*1.0*W)/2.0;

    
    if(x == W/2 && y == H/2) {
        cout<<area<<" "<<1<<endl;
    } else {
        cout<<area<<" "<<0<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

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

// ---------------------
#define INF 922337203685477580
#define IINF (1<<21)
typedef long long ll;

int dp[22][50100];
int n, m;
int coin[22];

int main() {
  cin >> n >> m;
  REP(i, m) {
    cin >> coin[i + 1];
  }

  REP(i, 50100) {
    dp[0][i] = IINF;
  }
  REP(i, 22) {
    dp[i][0] = 0;
  }

  // coin, kane

  FOR(c, 1, m + 1) {
    FOR(k, 1, n + 1) {
      if (k - coin[c] >= 0) {
        dp[c][k] = min(dp[c][k - coin[c]] + 1, dp[c - 1][k]);
      } else {
        dp[c][k] = dp[c - 1][k];
      }
    }
  }




  cout << dp[m][n] << endl;
  return 0;
}

Measured memory_bytes: 7176
#include<iostream>
int main(){
	int n;
	while(std::cin>>n){
		int ans=0;
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				for(int k=0;k<10;k++){
					for(int l=0;l<10;l++){
						if(i+j+k+l==n)ans++;
					}
				}
			}
		}
		std::cout<<ans<<std::endl;
	}
	return 0;
}

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

vector<ll> divisors(ll n) 
{
    vector<ll> res;
    for (ll i = 1; i <= n / i; ++i) 
    {
        if (n % i == 0)
        {
            res.push_back(i);
            
            if (n / i != i) 
                res.push_back(n / i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main()
{
    ll n, res;
    cin >> n;

    auto divs = divisors(n);
    ll mid = divs.size() / 2;

    if(divs.size() % 2 == 0)
        res = divs[mid - 1] + divs[mid] - 2;
    else 
        res = divs[mid] + divs[mid] - 2;

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[1001][1001], prm[2003];
int vis[100005], cnt;
void euler() {
    vis[1] = 1;
    for (int i = 2; i <= 10000; ++i) {
        if (!vis[i]) prm[++cnt] = i;
        for (int j = 1; j <= cnt && i * prm[j] <= 10000; ++j) {
            vis[i * prm[j]] = 1;
            if (!(i % prm[j])) break;
        }
    }
}

long long gcd(long long x, long long y) {
    while (y ^= x ^= y ^= x %= y) void();
    return x;
}

long long lcm(long long x, long long y) {
    if (!x || !y) return x + y;
    return x / gcd(x, y) * y;
}

int main() {
    scanf("%d", &n), euler();
    if (n == 2) return puts("4 7\n23 10\n"), 0;
    for (int i = 1; i <= n; ++i)
        for (int j = (i + 1 & 1) + 1; j <= n; j += 2)
            a[i][j] = prm[(i + j) / 2] * prm[n + (i - j) / 2 + (n + 1) / 2];
    for (int i = 1; i <= n; ++i)
        for (int j = (i & 1) + 1; j <= n; j += 2)
            a[i][j] = lcm(lcm(a[i - 1][j], a[i][j - 1]),
                          lcm(a[i][j + 1], a[i + 1][j])) +
                      1;
    for (int i = 1; i <= n; ++i, puts(""))
        for (int j = 1; j <= n; ++j) printf("%lld ", a[i][j]);
    return 0;
}

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


int main(){
    ll n;
    cin >> n;
    ll m = 1e+16;
    rep(i,5){
        ll c;
        cin >> c;
        m = min (c, m);
    }
    ll res;
    if(n % m == 0) res = n / m;
    else res = n / m + 1;
    cout << 4 + res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Useful constants
#define INF  (int)1e9
#define EPS   1e-9
#define MOD 1000000007ll
#define PI 3.14159
// for input-output
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
// iteration macros: have advantage of auto-casting and not recomputing arguments
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
// input macro
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
//output macro
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
// shortcut for data type
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define uset unordered_set
#define umap unordered_map
//--namespace
using namespace std;
//--useful function
ll gcd(ll a, ll b){ll temp;while (b > 0){temp = a%b;a = b;b = temp;} return a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
// --clock funtion
clock_t time_p=clock();
void TimeTaken()
{
    time_p=clock()-time_p;
    cerr<<"Completion time : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
// --solve function
void solve() {

}
//--main function
int main(){
	int n,flag=1;
	cin>>n;
  	REP(i,1,9){
      REP(j,1,9){
        if(i*j==n){
          flag=0;
          break;
        }
      }
    }
  if(flag==1)cout<<"No";
  else cout<<"Yes";
	return 0;
//   TimeTaken();
}



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

using namespace std;


int main(){

    int N, D;
    cin >> N >> D;
    int a=D * 2 +1;
    int ans = (N+(a-1))/a;
    cout << ans << endl;
}


Measured memory_bytes: 256
import math

N = int(input())

def trial_division(target):
  dest = int(math.sqrt(target))

  for i in range(dest, 1, -1):
    if target % i == 0:
      return i
  
  return 1

A = trial_division(N)
B = int(N / A)
print(A + B - 2)

Measured memory_bytes: 3060
N, K, Q = map(int, input().split())
A = list(map(int, input().split()))
ans = 10 ** 10

for a in A:
    candidates = []
    tmp = []
    for b in A:
        if a <= b:
            tmp.append(b)
        else:
            if K > 1:
                for i in sorted(tmp)[:-K+1]:
                    candidates.append(i)
            else:
                for i in sorted(tmp):
                    candidates.append(i)
            tmp = []
    if K > 1:
        for i in sorted(tmp)[:-K+1]:
            candidates.append(i)
    else:
        for i in sorted(tmp):
            candidates.append(i)
    candidates.sort()
    if len(candidates) >= Q:
        ans = min(ans, candidates[Q-1] - a)
print(ans)


Measured memory_bytes: 3316
#include<stdio.h>
int main(void){
	int n;
	int i;
	int a=100000;
	while(scanf("%d",&n)!=EOF){
	for(i=0;i<n;i++){
		a=a+a*0.05;
		if((a%1000)>0){
			a=a-a%1000+1000;
		}
	}
	printf("%d\n",a);
	}
	return 0;
}

Measured memory_bytes: 592
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	double a[103];
	double sum = 0.00;

	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%lf",&a[i]);
		sum += (1 / a[i]);
	}
	printf("%.12f\n", (1.00 / sum));
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, p, c;
    cin >> n;
    vector<int> v;
    for(int i=0; i<n; ++i){
        cin >> p;
        v.push_back(p);
    }
    vector<int>::iterator it=max_element(v.begin(), v.end());
    c = std::accumulate(v.begin(), v.end(), 0);
    cout << (c -(*it) + (*it/2)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

bool isPrime(int n){
    if(n <= 1) return false;
    for(int i=2; i*i<=n; i++) if(n%i == 0) return  false;
    
    return true;
}

int main(){
    vector<int> a(100005, 0);
    for(int i=3; i<=100000; i++) if(isPrime(i) && isPrime((i+1)/2)) a[i] = 1;

    vector<int> cum(100005, 0);
    for(int i=1; i<=100000; i++) cum[i] = cum[i-1] + a[i];

    int Q; cin >> Q;
    vector<int> ans(Q);
    for(int i=0; i<Q; i++){
        int l, r; cin >> l >> r;
        ans[i] = cum[r] - cum[l-1];
    }

    for(int i=0; i<Q; i++) cout << ans[i] << endl;
}

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

int main(void){
	int i,len;
    char s[11],t[12];
    scanf("%s%s",s,t);
    len=strlen(s);
    for(i=0;i<len;i++){
        if(s[i]!=t[i]){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
	return 0;
}


Measured memory_bytes: 1732
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    int water[3001];
    int sugar[3001];
    for(int i=0; i<=3000; i++){
        water[i]=0;
        sugar[i]=0;
    }
    for(int i=0; i<=30; i++){
        if(i*a*100>f)break;
        for(int j=0; j<=30; j++){
            if((i*a+j*b)*100>f)break;
            water[100*(i*a+j*b)]=1;
        }
    }
    for(int i=0; i<=3000; i++){
        if(c*i>f)break;
        for(int j=0; j<=3000; j++){
            if(c*i+d*j>f)break;
            sugar[c*i+d*j]=1;
        }
    }
    int Water=0,Sugar=0;
    double C=0;
    for(int i=0; i<=f; i++){
        if(i>f)break;
        if(water[i]!=1)continue;
        for(int j=0; j<=f; j++){
            if(i+j>f)break;
            if(sugar[j]!=1)continue;
            if((double)j/(i+j)>C && (double)j/(i/100)<=e){
                C=(double)j/(i+j);
                Water=i,Sugar=j;
            }
        }
    }
    if(Sugar==0)Water=100*min(a,b);
    cout << Water+Sugar << " " << Sugar << endl;
    return 0;
}

Measured memory_bytes: 256
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

ans = 0
for i in range(N):
    code = 0
    for j in range(M):
        code += B[j] * A[i][j]
    if code + C > 0:
        ans += 1

print(ans)

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

using namespace std;

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

    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());

    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += p[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 3632
/*
AUTHOR: Aman Raj
LANG: C++
*/

using namespace std;

typedef   long long ll;
#include <bits/stdc++.h>


//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
#define fast  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define all(a) a.begin(),a.end()
//#define mod 998244353
#define mod 100000007
#define inf 1e18
//#define mod 3
#define flush fflush(stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<ll, ll, hash<ll> > ht;

// find_by_order()  // order_of_key
typedef tree<
    int,
    null_type,
    less<long long int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;






ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c=c%mod;if(b%2==1) c*=a;c=c%mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }



 struct less_then_greater {
    template<typename T, typename U>
    bool operator()(T const& lhs, U const& rhs) const {
        if (lhs.first < rhs.first) return true;
        if (rhs.first < lhs.first) return false;
        return lhs.second > rhs.second;
    }
};
 /*std::priority_queue<std::pair<int, int>,
                    std::vector<std::pair<int, int>>,
                    less_then_greater
                   > pq;*/



  int main()
{    fast;
 cout<<setprecision(10)<<fixed;
  double a,b;cin>>a>>b;
    double h,m;cin>>h>>m;
      m+=h*60;
      double angle = abs(6*m - m/2 );
      while(angle>360)angle-=360;
       //cout<<angle<<endl;
      angle*=3.14159265358979323846;angle/=180;
     double ans= a*a + b*b -2*a*b* cos(angle);
      ans=sqrt(ans);
  cout<<ans;
        return 0;
}


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

using namespace std;

const int N = 101, W = 1e5 + 1;

int dp[N][W], n, w, s = 0, v[N], wt[N];

/*
	dp(i, j) = minimum weight to get value j from i first things
	dp(i, j) = min(dp(i - 1, j), wt[i] + dp(i - 1, j - v[i]))
*/

signed main(){
	memset(dp, 0x3f, sizeof(dp));
	cin >> n >> w;
	
	dp[0][0] = 0;
	for(int i = 1; i <= n; ++i) cin >> wt[i] >> v[i], s += v[i], dp[i][0] = 0;
	
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= s; ++j){
			dp[i][j] = min(dp[i - 1][j], wt[i] + dp[i - 1][max(j - v[i], 0)]);
		}
	}
	int ans = 0;
	for(int j = 0; j <= s; ++j) if(dp[n][j] <= w) ans = max(ans, j);

	cout << ans;
}


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

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

#define INPUT(arr,n) for(ll i = 0;i<n;i++) cin>>arr[i];
#define PRINT(arr,n) for(ll i = 0;i<=n;i++) printf("%lld ",arr[i]);printf("\n");
#define MEM(var,val) memset(var,(val),sizeof(var))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define mp make_pair
#define pb push_back

const ll NMAX = 100000+7;
const ll MOD = 1000*1000*1000+7;
const ll INT_BITS = 32 ;
ll arr[NMAX];

inline ll add(ll a, ll b) {
  ll r = a + b;
  return (r >= MOD ? r - MOD : r);
}

inline ll sub(ll a, ll b) {
  ll r = a - b;
  return (r < 0 ? r + MOD : r);
}

inline ll mul(ll a, ll b) {
  ll r = a * b;
  return (r >= MOD ? r % MOD : r);
}
ll dp[NMAX];

ll N,K=2;
ll func(ll i){
  if(dp[i]!=-1)return dp[i];
  if(i>=N-1)
    return 0;
  ll res = 1e18;
  for(ll k = 1;k<=K;k++){
    if(i+k<=N-1)
      res = min(res,func(i+k)+ abs(arr[i]-arr[i+k]));
  }
  return dp[i] = res;
}

int main(int argc, char const *argv[])
{
	MEM(dp,-1);
  cin>>N;
  // cin>>K;
	INPUT(arr,N);
  cout<<func(0)<<endl;
  // PRINT(dp,N);
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
int A[100000];
int main(){
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  sort(A, A+N);
  if(N%3 && A[0]==A[N-1]){
    wt_L("Yes");
    wt_L('\n');
    return 0;
  }
  if(N%3){
    wt_L("No");
    wt_L('\n');
    return 0;
  }
  if(A[0]==A[N/3-1] && A[N/3]==A[2*N/3-1] && A[2*N/3]==A[N-1] && (A[0]^A[N/3]^A[2*N/3])==0){
    wt_L("Yes");
    wt_L('\n');
    return 0;
  }
  wt_L("No");
  wt_L('\n');
  return 0;
}
// cLay varsion 20190714-1

// --- original code ---
// int N, A[1d5];
// {
//   rd(N,A(N));
//   sort(A, A+N);
// 
//   if(A[0]==A[N-1]==0){
//     wt("Yes");
//     return 0;
//   }
// 
//   if(N%3){
//     wt("No");
//     return 0;
//   }
// 
//   if(A[0]==A[N/3-1] && A[N/3]==A[2N/3-1] && A[2N/3]==A[N-1] && (A[0]^A[N/3]^A[2N/3])==0){
//     wt("Yes");
//     return 0;
//   }
// 
//   wt("No");
// }


Measured memory_bytes: 640
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<functional>

using namespace std;
#define LL long long
#define ALF "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define LLBIG 1999999999999999999
#define INTBIG 1111111111
#define MOD 1000000007
#define PI pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>

int main() {
	int n; cin >> n;
	int h = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		int H; cin >> H;
		if (h <= H) {
			ans++; h = H;
		}
	}
	cout << ans << endl;

	return 0;
}


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

int main() {
  long long  a,b,c;
  cin >> a>> b>> c;
  if(c-a-b<0) cout << "No";
  else if ((c-a-b)*(c-a-b)-4*a*b > 0) cout << "Yes";
  else cout << "No";
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 1; i <=(int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

intll gcd (intll x, intll y) {
  int tmp ;
  if( x < y )
    swap(x,y);
  
  while(y>0){
    tmp = x % y ;
    x = y ;
    y = tmp ;
  }
  return x ;
}

int main() {
  int k ; 
  cin >> k ;
  intll ans = 0;
  
  rep(a,k){
    rep(b,k){
      rep(c,k){
        int d = gcd(a,b);
        ans +=  gcd(c,d);
      }
    }
  }
  
  cout << ans ;
 


}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
const int mod = 1000000007;
#define ll long long

ll A[100010];
int main()
{
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	ll sum = 0;
	ll ans1 = 0, ans2 = 0;
	int x = 1;
	for (int i = 0; i < N; i++) {
		sum += A[i];
		if (sum * x >= 0) {
			ans1 += abs(sum + x);
			sum = -x;
		}
		x *= -1;
	}
	sum = 0; x = -1;
	for (int i = 0; i < N; i++) {
		sum += A[i];
		if (sum * x >= 0) {
			ans2 += abs(sum + x);
			sum = -x;
		}
		x *= -1;
	}
	cout << min(ans1, ans2) << endl;
}



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

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

int main() {
    fast_io;

    ll a,b,c,k;

    cin>>a>>b>>c>>k;

    ll ans=0;
    while(k>0) {
        while(k>0&&a>0) {
            ans+=1;
            a--;
            k--;
        }
        while(k>0&&b>0) {
            k--;
            b--;
        }
        while(k>0&&c>0) {
            k--;
            ans-=1;
            c--;
        }
    }
    cout<<ans<<endl;

}




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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;

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

int main(){
	//input
	ll N,M; cin>>N>>M;

	//solve
	cout<<max(N-2*M,0ll);
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((a + b) < (c + d)){
    cout << "Right" << endl;
  } else if ((a + b) > (c + d)) {
    cout << "Left" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m,k,s;
int a[11][11];
bool flag=false;
int sumx[15][15][15];
int sumy[15][15][15];
vector<int> decx[15];
vector<int> decy[15];

void dfs(int dep,int v,int now){
	if(flag)return;
	if(now>k)return;
	if(decx[dep].size()==0){
		if(decy[dep].size()==0){
			flag=true;
			return;
		}
		if(decy[dep].size()==v){
			decx[dep+1].clear();
			decy[dep+1].clear();
			memset(sumx,0,sizeof(sumx));
			memset(sumy,0,sizeof(sumy));
			for(int i=0;i<n;i++){
				bool flag=false;
				for(int j=0;j<m;j++){
					for(int k=j;k<m;k++){
						sumx[i][j][k+1]+=sumx[i][j][k];
						sumx[i][j][k+1]+=a[i][k];
						if(sumx[i][j][k+1]>s){
							if(!flag)decx[dep+1].push_back(i);
							flag=true;
						}
					}
				}
			}
			for(int i=0;i<m;i++){
				bool flag=false;
				for(int j=0;j<n;j++){
					for(int k=j;k<n;k++){
						sumy[i][j][k+1]+=sumy[i][j][k];
						sumy[i][j][k+1]+=a[k][i];
						if(sumy[i][j][k+1]>s){
							if(!flag)decy[dep+1].push_back(i);
							flag=true;
						}
					}
				}
			}
			if(max((int)decx[dep+1].size(),(int)decy[dep+1].size())<=k-now)dfs(dep+1,0,now);
		}else{
			for(int i=0;i<n;i++){
				a[i][decy[dep][v]]*=-1;
				dfs(dep,v+1,now+1);
				a[i][decy[dep][v]]*=-1;
			}
		}
	}else{
		if(decx[dep].size()==v){
			decx[dep+1].clear();
			decy[dep+1].clear();
			memset(sumx,0,sizeof(sumx));
			memset(sumy,0,sizeof(sumy));
			for(int i=0;i<n;i++){
				bool flag=false;
				for(int j=0;j<m;j++){
					for(int k=j;k<m;k++){
						sumx[i][j][k+1]+=sumx[i][j][k];
						sumx[i][j][k+1]+=a[i][k];
						if(sumx[i][j][k+1]>s){
							if(!flag)decx[dep+1].push_back(i);
							flag=true;
						}
					}
				}
			}
			for(int i=0;i<m;i++){
				bool flag=false;
				for(int j=0;j<n;j++){
					for(int k=j;k<n;k++){
						sumy[i][j][k+1]+=sumy[i][j][k];
						sumy[i][j][k+1]+=a[k][i];
						if(sumy[i][j][k+1]>s){
							if(!flag)decy[dep+1].push_back(i);
							flag=true;
						}
					}
				}
			}
			if(max((int)decx[dep+1].size(),(int)decy[dep+1].size())<=k-now)dfs(dep+1,0,now);
		}else{
			for(int i=0;i<m;i++){
				a[decx[dep][v]][i]*=-1;
				dfs(dep,v+1,now+1);
				a[decx[dep][v]][i]*=-1;
			}
		}
	}
}

int main(void){
	scanf("%d%d%d%d",&n,&m,&k,&s);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			scanf("%d",&a[i][j]);
			if(a[i][j]>s){
				k--;
				a[i][j]*=-1;
			}
		}
	}
	if(k<0){
		printf("No\n");
		return 0;
	}
	for(int i=0;i<n;i++){
		bool flag=false;
		for(int j=0;j<m;j++){
			for(int k=j;k<m;k++){
				sumx[i][j][k+1]+=sumx[i][j][k];
				sumx[i][j][k+1]+=a[i][k];
				if(sumx[i][j][k+1]>s){
					if(!flag)decx[0].push_back(i);
					flag=true;
				}
			}
		}
	}
	for(int i=0;i<m;i++){
		bool flag=false;
		for(int j=0;j<n;j++){
			for(int k=j;k<n;k++){
				sumy[i][j][k+1]+=sumy[i][j][k];
				sumy[i][j][k+1]+=a[k][i];
				if(sumy[i][j][k+1]>s){
					if(!flag)decy[0].push_back(i);
					flag=true;
				}
			}
		}
	}
	if(decx[0].size()>k || decy[0].size()>k){
		printf("No\n");
		return 0;
	}
	dfs(0,0,0);
	printf("%s\n",flag?"Yes":"No");
	return 0;
}

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

using namespace std;
typedef  long long ll;
const int maxn=1e5+5;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
int a[maxn],b[maxn];

int main()
{
    ll n;
    cin>>n;
    if(n%2)
        cout<<0<<endl;
    else {ll sum=0;
    ll s=5;
    n>>=1;
    for(int i=0;; i++)
    {
        sum+=n/s;
        s*=5;
        if(s>n)
            break;
    }
    printf("%lld\n",sum);}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>

using namespace std;
using ull = unsigned long long;
using ll = long long;

ull gcd(ull a, ull b) {
	return (b == 0) ? a : gcd(b, a%b);
}


bool is_prime(ull num) {
	if (num <= 3) {
		return num > 1;
	} else if (num % 2 == 0 || num % 3 == 0) {
		return false;
	} else {
		for (ull i = 5; i * i <= num; i += 6) {
			if (num % i == 0 || num % (i + 2) == 0) {
				return false;
			}
		}
		return true;
	}
}


int main() {
//	sieve(1000000000);

	// 素数判定の表
	int N;
	cin >> N;

	vector<ull> vec(N);

	for (size_t i = 0; i < N; i++) {
		cin >> vec[i];
	}

	// 最大公約数は順番を入れ替えてもOK
	// なので累積和風に、事前に計算しておく
	vector<ull> left(N);
	left[0] = vec[0];
	for (size_t i = 0; i < N - 1; i++) {
		left[i+1] = gcd(left[i], vec[i+1]);
	}

	vector<ull> right(N);
	right[N - 1] = vec[N - 1];
	for (size_t i = N - 1; i > 1; i--) {
		right[i - 1] = gcd(right[i], vec[i - 1]);
	}

	ull ans = 1;
	for (size_t i = 0; i < N; i++) {
		if (i == 0) {
			ans = max(ans, right[i + 1]);
		} else if (i == N - 1) {
			ans = max(ans, left[i - 1]);
		} else {
			ans = max(ans, gcd(left[i - 1], right[i + 1]));
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>
#include <string>
int main(void)
{
	int a, b, c;
	std::cin >> a>> b>> c;
	if (c >= a && c <= b)
	{
		std::cout << "Yes";
	}
	else
	{
		std::cout << "No";
	}
	
	return 0;
}

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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
int INF = numeric_limits<int>::max();
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

/* if in function
template <class T>
bool contain(vector<T> &vec, T find_it) {
  auto it = find(vec.begin(), vec.end(), find_it);
  return it != vec.end();
}

bool contain(string &str, char c) {
  return str.find(c) != string::npos;
}
*/

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <utility>
#include <functional>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

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

	while (n) {
		vector<int> point(n);
		rep(i, 0, n) cin >> point[i];

		SORT(point);
		REV(point);
		int ans = point[0] - point[1];
		rep(i, 1, n - 1) {
			int sub = point[i] - point[i + 1];
			ans = min(ans, sub);
		}
		cout << ans << endl;

		cin >> n;
	}

	return 0;
}


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

int main() {
  int N, K;
  int sum = 0;
  
  cin >> N >> K;
  
  for (int i=0; i<N; i++){
    int x;
    cin >> x;
    if(x < K - x){
      sum += x;
    }
    else{
      sum += K - x;
    }
  }
  cout << sum*2 << endl;
      
  
  
}

Measured memory_bytes: 256
program intervals_on_tree
  implicit none
  integer(8) :: n, i, u, v, x
  read(*,*) n
  x = n * (n + 1) * (n + 2) / 6
  do i = 1, n - 1
    read(*,*) u, v
    x = x - min(u, v) * (n - max(u, v) + 1)
  end do
  write(*,'(i0)') x
end program intervals_on_tree

Measured memory_bytes: 2904
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}
bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
    
int main(){
    string Sp, T; cin >> Sp >> T;
    
    bool ok = false;
    string ret_str = Sp;
    for (ll i = Sp.size() - T.size(); i >= 0; i--) {
        auto sub_str = Sp.substr(i, T.size());
        bool is_matched = true;
        for (int j = 0; j < sub_str.size(); j++) {
            if(sub_str[j] != T[j] && sub_str[j] != '?'){
                is_matched = false;
                break;
            }
        }
        if(is_matched){
            ret_str.replace(i, T.size(), T);
            for (int k = 0; k < ret_str.size(); k++){
                if(ret_str[k] == '?') ret_str[k] = 'a';
            }
            ok = true; break;
        }
    }
    cout << (ok ? ret_str : "UNRESTORABLE") << endstr;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  ans = ceil(double(n - 1) / (m - 1));
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;

//ll bit[200010];
//ll kai[3010];
//ll Cnt[10010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }



/*ll sum(ll i)
{
	i += 1;
	ll t = 0;
	while (i > 0)
	{
		t += bit[i];
		i -= i & -i;
	}
	return t;
}

void add(ll i, ll x)
{
	i += 1;
	while (i <= 200005)
	{
		bit[i] += x;
		i += i & -i;
	}
}*/

/*`ll SAIKI(ll S) {
	for (ll T = S; ; T = (T - 1) & S) {

	}
}*/



void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}


/*map<ll, ll> pres;
ll ct;

void makePrimeList(ll x) {
	ll X = x;
	for (ll j = 2; j * j <= x; j++) {
		ll cnt = 0;
		while (X % j == 0) {
			cnt++;
			X /= j;
		}
		if (cnt) {
			if (pres[j] == 0) {
				ct++;
				pres[j] = ct;
			}
			Cnt[pres[j]] += cnt;
		}
	}
	if (X != 1) {
		if (pres[X] == 0) {
			ct++;
			pres[X] = ct;
		}
		Cnt[pres[X]] += 1;
	}
}*/

ll N;
ll a[200010];
map<ll, ll> mp;

void solve() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
		mp[a[i]]++;
	}
	if (mp.size() == N) cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

Measured memory_bytes: 14336
def segfunc(x,y):
    return x | y

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

ide_ele = 0

n = 500000
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num
def main():
    N = int(input())
    S = input()
    for i, s in enumerate(S):
        update(i, 1 << (ord(s) - 97))
        
    Q = int(input())
    for _ in range(Q):
        t, a, b = input().split()
        if t == '1':
            update(int(a) - 1, 1 << (ord(b) - 97))
        else:
            print(bin(query(int(a) - 1, int(b))).count('1'))

main()


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

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

	vector<int> v(n);

	for(int i=0;i<n;++i){
		int a;
		cin >> a;
		v[i] = a;
	}

	for(int i=n-1;i > -1;--i){
		cout << v[i];
		if(i != 0)
			cout << ' ';
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>
#include<stdlib.h>

#define string(num,c) \
    for(i = 0;i < num;i++){ \
        printf("%s",c); \
    } \

int main(void){

    int sx,sy,tx,ty,i,dx,dy;

    scanf("%d %d %d %d",&sx,&sy,&tx,&ty);

    dx = tx - sx;
    dy = ty - sy;

    string(dy,"U");
    string(dx,"R");
    string(dy,"D");
    string(dx,"L");
    printf("L");
    string(dy+1,"U");
    string(dx+1,"R");
    printf("D");
    printf("R");
    string(dy+1,"D");
    string(dx+1,"L");
    printf("U\n");

    return 0;
}


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

#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define gsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define gkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define zen(h) (h).begin(),(h).end()
#define yu(h) v.erase(unique(zen(h)), h.end());
#define mugen 10000000111
#define yo 10000000711
#define kyo 1e-9
#define datu break
#define saiki(a) while(a)
#define seiri(h) sort(zen(h))
#define sin() main()
#define hen return
#define nyu(a) cin >> a
#define syutu(a) cout << a << endl
#define ru(a) if(a)
#define ta else
#define ruguo(a) else if(a)
#define tyo() length()

using namespace std;
typedef int seisu;
typedef void mu;
typedef long long sei;
typedef long double xyo;
typedef string moji;
typedef pair<sei, sei> so;
typedef vector<sei> hs;
typedef vector<xyo> hx;
typedef vector<hs> hhs;
typedef vector<hx> hhx;
typedef vector<moji> hm;
typedef vector<so> hso;
typedef bool singi;

const seisu h1[8] = {1,1,0,-1,-1,-1,0,1};
const seisu h2[8] = {0,1,1,1,0,-1,-1,-1};

sei dai(sei a, sei b){return max(a,b);}
sei syo(sei a, sei b){return min(a,b);}

moji m,n;
sei t;
singi s;

seisu sin(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    nyu(m);
    nyu(n);
    s = 0;
    t = m.tyo();
    m = m+m;
    sai(j,t){
        ru(m.substr(j,t) == n) s = 1;
    }
    ru(s) syutu("Yes");
    ta syutu("No");
    hen 0;
}


Measured memory_bytes: 256
N=int(input())
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))

ans=0
#i番目で下に移動すると仮定
for i in range(N):
  ans=max(ans,sum(A1[:i+1])+sum(A2[i:]))
print(ans)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
#define M 1000000007

int main() {
    int h, w; cin >> h >> w;
    string f[1001];
    for (int i = 0; i < h; i++) cin >> f[i];
    long long dp[1001][1001] = {};
    dp[0][0] = 1;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++) {
            if (f[i][j] == '#') continue;
            if (i > 0) dp[i][j] += dp[i-1][j];
            if (j > 0) dp[i][j] += dp[i][j-1];
            if (dp[i][j] >= M) dp[i][j] -= M;
        }

    cout << dp[h-1][w-1] << endl;
}


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

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

  int j = 1;
  int ans = 0;
  rep(i, n) {
    if (a[i] == j)
      j++;
    else
      ans++;
  }
  if (ans != n)
    cout << ans << endl;
  else
    cout << -1 << endl;

  return 0;
}

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

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

    if(n % 2 == 1){
        cout << "No" << endl;
    }else{
        string a, b;
        int k = n / 2;
        for(int i = 0; i < k; i++){
            a += s[i];
        }
        for(int i = k; i < n; i++){
            b += s[i];
        }

        if(a == b){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N, M; cin >> N >> M;
    int S[2020], T[2020];
    rep(i, N) cin >> S[i];
    rep(i, M) cin >> T[i];
    ll dp[2020][2020], sdp[2020][2020];
    memset(dp, 0, sizeof(dp));
    memset(sdp, 0, sizeof(sdp));
    dp[0][0] = 1LL;
    sdp[1][1] = 1LL;
    for(int i = 0; i <= N ; i++) {
        for(int j = 0; j <= M; j++) {
            if(i == 0 && j == 0) continue;
            if(i - 1 >= 0 && j - 1 >= 0 && S[i - 1] == T[j - 1]) {
                dp[i][j] = sdp[i][j];
            }
            sdp[i + 1][j + 1] = sdp[i][j + 1] + sdp[i + 1][j] - sdp[i][j] + dp[i][j];
            sdp[i + 1][j + 1] = (sdp[i + 1][j + 1] % mod + mod) % mod;
        }
    }
    cout << sdp[N + 1][M + 1] << endl;
	return 0;
}

Measured memory_bytes: 64000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    int H,W,K; cin >> H>>W>>K;
    vector<vector<char>> a(H, vector<char>(W));
    int i,j;
    int ans=0;
 
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a[i][j];
        }
    }
    for(int bit=0; bit < (1<<H); bit++){
        for(int bit2=0; bit2 < (1<<W); bit2++){
            int cou=0;
            rep(i,H){
                if(bit & (1<<i)) continue;
                rep(j,W){
                    if(bit2 & (1<<j)) continue;
                    if(a[i][j]=='#') cou++;
                }
            }
            if(cou == K) ans++;
        }
    }
    AA(ans);
    return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int main() {
	map<int, int> mp;
	inc(i, 3) { int a; cin >> a; mp[a]++; }
	
	FOR(it, mp) {
		if(it -> SE == 1) { cout << (it -> FI) << endl; }
	}
		
	return 0;
}


Measured memory_bytes: 256