akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author P.Alizadeh
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll,ll>     pll;
typedef complex<ld>     cld;

#define all(x)          x.begin(),x.end()
#define Sort(x)         sort(all(x))
#define kill(x)         return cout << x << endl, 0;
#define Mp              make_pair
#define X               first
#define Y               second
#define sep             " "
#define endl            "\n"
#define fastio          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io         freopen("in.txt" , "r" , stdin) ; freopen("out.txt" , "w" , stdout);
#define ld_io           cout << setprecision(10) << fixed;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll pw(ll a, ll b, ll md) {
    if (!b)
        return 1;
    if (b & 1)
        return a * pw(a * a % md, b / 2, md) % md;
    return pw(a * a % md, b / 2, md) % md;
}

const ll MAXN = 23,
         INF  = 8e18,
         MOD  = 1e9 + 7,
         LOG  = 32;
//const ld PI   = M_PI;

ll n, a[23][23], dp[1LL<<MAXN], cnt[1LL<<MAXN];

int main()
{
    fastio;
    //ld_io;

    cin >> n;
    for (ll i = 0; i < n; i++)
        for (ll j = 0; j < n; j++)
            cin >> a[i][j];

    for (ll i = 0; i < (1LL << n); i++) {
        for (ll j = 0; j < n; j++) {
            cnt[i] += (i & (1LL << j)) ? 1 : 0;
        }
    }

    dp[0] = 1;

    for (ll i = 0; i < (1LL << n); i++) {
        for (ll j = 0; j < n; j++) {
            ll mask = 1LL << j;
            if (!(i & mask)) continue;
            dp[i] += (a[j][cnt[i]-1]) ? dp[i - mask] : 0;
            dp[i] %= MOD;
        }
    }

    cout << dp[(1LL << n) - 1] << endl;

    return 0;
}



Measured memory_bytes: 37120
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; 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;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){
      lint n;
      cin>>n;
      map<P,lint> mp;
      lint add=0;
      rep(i,n){
          lint a,b;
          cin>>a>>b;
          lint x;
          if(a>0&&b>0){
           x=gcd(a,b);
           mp[{a/x,b/x}]++; 
          }else if(a<0&&b>0){
           x=gcd(abs(a),abs(b));
           mp[{a/x,b/x}]++;
          }else if(a>0&&b<0){
            x=gcd(abs(a),abs(b));
            mp[{-a/x,-b/x}]++;
          } else if(a<0&&b<0){
           x=gcd(abs(a),abs(b));
           mp[{-a/x,-b/x}]++;
          } else if(a==0&&b==0){
            add++;
          }else if(a==0){
            mp[{0,-1}]++;
          }else mp[{1,0}]++;     
      }
      lint ans=1;
      for(auto t:mp){
          P p=t.first;
          lint h;
          if(p.first>=0){
          h=mp[{-p.second,p.first}];
          mp.erase({-p.second,p.first});
          }else{
          h=mp[{p.second,-p.first}];
          mp.erase({p.second,-p.first});           
          }
          lint mul=modpow(2,h,MOD)+modpow(2,t.second,MOD)-1;
          mul+=MOD;
          mul%=MOD;
          ans*=mul;
          ans%=MOD;
      }
      ans+=add;
      ans--;
      ans+=MOD;
      ans%=MOD;
      cout<<ans<<endl;
      }
      

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

#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back

const int MAXN=302,MOD=1e9+7;
int n,m,dp[MAXN][MAXN][MAXN],l[MAXN],r[MAXN],x[MAXN];
vector<int>g[MAXN];
int solve(int i,int j,int k) {
	int pos=max({i,j,k})+1;
	for(int p:g[pos]) {
		int expected=x[p];
		int have=(i>=l[p])+(j>=l[p])+(k>=l[p]);
		if(expected!=have) {
			return dp[i][j][k]=0;
		}
	}
	if(pos>n)return 1;
	if(dp[i][j][k]!=-1)return dp[i][j][k];
	int res=solve(pos,j,k);
	res=res+solve(i,pos,k);if(res>MOD)res-=MOD;
	res=res+solve(i,j,pos);if(res>MOD)res-=MOD;
	// cout<<i<<" "<<j<<" "<<k<<" : "<<res<<endl;
	return dp[i][j][k]=res;
}

int main() {FIN;
	memset(dp,-1,sizeof(dp));
	cin>>n>>m;
	fore(i,0,m) {
		cin>>l[i]>>r[i]>>x[i];r[i]++;
		g[r[i]].pb(i);
	}
	cout<<solve(0,0,0)<<"\n";
}

Measured memory_bytes: 107904
#include<bits/stdc++.h>
using namespace std;
int a,b,c,i,j,n,s;int main(){scanf("%d%d%d%d",&a,&b,&c,&n);for(i=0;i<=a;i++)for(j=0;j<=b;j++)if((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50))++s;printf("%d\n",s);return 0;}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 3000 + 5
#define Mod 1000000007
#define rep(i, l, r) for(int i = l; i <= r; ++i)
int n, m, ans, dp[N][N][2];
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int Inc(int a, int b){ return (a += b) >= Mod ? a - Mod : a;}
int main(){
    n = read(), m = read();
    dp[0][0][1] = 1;
    rep(i, 1, n) dp[0][i][0] = 1;
    rep(i, 1, m) rep(j, 0, n){
        if(j >= 1) dp[i][j][0] = Inc(dp[i][j][0], dp[i - 1][j + 1][0]);
        if(j >= 1) dp[i][j][1] = Inc(dp[i][j][1], dp[i - 1][j + 1][1]);
        if(j == 0) dp[i][j][1] = Inc(dp[i][j][1], Inc(dp[i - 1][j + 1][1], dp[i - 1][j + 1][0]));
        dp[i][j][0] = Inc(dp[i][j][0], dp[i - 1][j - 1][0]);
        dp[i][j][1] = Inc(dp[i][j][1], dp[i - 1][j - 1][1]);
        if(j >= 2) dp[i][j][0] = Inc(dp[i][j][0], dp[i - 1][j][0]);
        if(j >= 2) dp[i][j][1] = Inc(dp[i][j][1], dp[i - 1][j][1]);
        if(j == 1) dp[i][j][1] = Inc(dp[i][j][1], Inc(dp[i - 1][j][1], dp[i - 1][j][0]));
        if(j < n) dp[i][j][0] = Inc(dp[i][j][0], dp[i - 1][j][0]);
        if(j < n) dp[i][j][1] = Inc(dp[i][j][1], dp[i - 1][j][1]);
    }
    rep(i, 0, n) ans = Inc(ans, dp[m][i][1]);
    printf("%d", ans);
    return 0;
}

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long H;
	scanf("%lld",&H);
	long long W;
	scanf("%lld",&W);

	if (H == 1 || W == 1)
	{
		cout << 1 << endl;
	}
	else
	{
		cout << H * W / 2 + (H * W % 2) << endl;
	}

	return 0;
}


Measured memory_bytes: 256
s = gets.chomp.split("")
t = gets.chomp.split("")

flg = false

(0..s.length-1).reverse_each do |i| 
  (0..t.length-1).reverse_each do |j| 
    target = i-(t.length-1-j)
    break if target < 0
    v1 = s[target] 
    v2 = t[j]
    break unless v1 == v2 or v1 == "?"
    if j == 0 then
      flg = true
      s[i-t.length+1..i] = t
    end
  end
  break if flg
end

if flg then
  puts s.join.gsub( /\?/,"a")
else
  puts "UNRESTORABLE"
end



Measured memory_bytes: 1788
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forr(i,a,b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const ll MX = 300005;
const ll inf = 2e18;
#define ptr nodo*
#define tam 301000

int main () 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,r;
    cin>>n>>r;
    if (n>=10)
    cout<<r<<endl;
    else
    cout<<r+(10-n)*100;    
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
N,D = parseMap(split(readline()))
X = []
for _ in 1:N
    x = parseMap(split(readline()))
    push!(X,x)
end   

function isLen_int(y,z,D)
    sum = 0
    for i in 1:D
        s = (y[i] - z[i])^2
        sum += s
    end 
    return ceil(sqrt(sum)) == floor(sqrt(sum))   
end 
ans = 0
for i in 1:N
    for j in i+1:N
        y = X[i]
        z = X[j]
        if isLen_int(y,z,D)
            ans += 1
        end
    end
end
println(ans)            
            

Measured memory_bytes: 112268
#include<stdio.h>

int main(){
	int N,K;
	scanf("%d\n%d", &N,&K);
	int start = 1;
	while(N--){
		start = start*2>start+K?start+K:start*2;
	}
	printf("%d\n",start);
	
	return 0;
}

Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let d = read::<f64>();
    let t = read::<f64>();
    let s = read::<f64>();
    let ans = if d / s <= t {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}


Measured memory_bytes: 2200
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

# 早期終了

if len(set(A)) != len(A):
    print(0)
    exit()
if len(set(B)) != len(B):
    print(0)
    exit()

# 高速化のため事前ソート

A.sort(reverse=True)
B.sort(reverse=True)

n_A, n_B = 0, 0  # ある数よりも大きい要素数(単調増加)
# この問題は場合分けを思いつけるか、計算量を減らせるかにかかっている
# 与えられた集合の中にxょり大きい要素がいくつあるかという処理に大きく時間がかかっている
# これをn_Aとおくと、n_Aには単調増加性があることがすぐにわかる
# xをどんどん小さくしているからである。
# n_Aを逐一計算する代わりに、いままでの情報を使ってn_Aを求められると処理が高速化される
# A=[182, 181, 180, 179, 178, 176, 175, 169, 168, 167, 158, 151, 147, 129]とする(sorted)とすると、
# A[n_A]=xとなるn_Aがほしい。xが登場するまでのイテレーションでx_pre in Aとなる要素があるたび、その回数をカウントすればよい
#


def ret_n_given_x(x):
    global n_A, n_B
    flgA = False
    flgB = False
    for a in A[n_A:]:
        if a == x:
            flgA = True
            break
    for a in B[n_B:]:
        if a == x:
            flgB = True
            break
    if flgA and flgB:
        n_A += 1  # 上記で解説した個数カウント
        n_B += 1  # xより大きな要素が何個あったかついでに記録できる
        return 1
    elif flgA:
        n_A += 1
        return n_B
    elif flgB:
        n_B += 1
        return n_A
    else:
        return (n_A * n_B)-(N*M-x)


MOD = 10**9 + 7
ans = 1
for x in range(N * M, 0, -1):
    ans *= ret_n_given_x(x)
    ans %= MOD
    # print(x, ans, ret_n_given_x(x))
    if ans == 0:
        break

print(int(ans))


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
  int n;
  cin>>n;
  cout<<"ABC"<<n<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#define RI register int
#define CI const int&
using namespace std;
const int N=200005;
struct edge
{
	int to,nxt;
}e[N<<1]; int n,head[N],cnt,x,y,len,dis[N],q[N];
inline void addedge(CI x,CI y)
{
	e[++cnt]=(edge){y,head[x]}; head[x]=cnt;
	e[++cnt]=(edge){x,head[y]}; head[y]=cnt;
}
#define to e[i].to
inline int BFS(CI st=1)
{
	RI H=0,T=1,i,id=st; for (i=1;i<=n;++i) dis[i]=0;
	dis[q[1]=st]=len=1; while (H<T)
	{
		int now=q[++H]; if (dis[now]>len) len=dis[now],id=now;
		for (i=head[now];i;i=e[i].nxt) if (!dis[to])
		dis[to]=dis[now]+1,q[++T]=to;
	}
	return id;
}
#undef to
int main()
{
	RI i; for (scanf("%d",&n),i=1;i<n;++i)
	scanf("%d%d",&x,&y),addedge(x,y);
	return BFS(BFS()),puts((len-2)%3?"First":"Second"),0;
}

Measured memory_bytes: 7092
import sys
sys.setrecursionlimit(200000)

def dfs(array, current, count):
  array[current - 1] = count
  for neighbour in graph[current]:
    if array[neighbour - 1] == -1:
      array = dfs(array, neighbour, count + 1)
  else:
    return array

T = [-1 for x in range(100000)]
A = [-1 for x in range(100000)]

graph = {}

N,u,v = map(int,input().split())

for i in range(N-1):
  a,b = map(int,input().split())
  try:
    graph[a].append(b)
  except KeyError:
    graph[a] = [b]

  try:
    graph[b].append(a)
  except KeyError:
    graph[b] = [a]

T = dfs(T, u, 0)
A = dfs(A, v, 0)

ans = -1
for i in range(N):
  if T[i] < A[i]:
    ans = max(ans, A[i] - 1)
print(max(0,ans))


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

int main(){
  ll N, M;
  cin >> N >> M;
  
  vector<ll> AX(N), AY(N), BX(M), BY(M);
  for (int i = 0; i < N; i++){
    cin >> AX.at(i) >> AY.at(i);
  }
  for (int i = 0; i < M; i++){
    cin >> BX.at(i) >> BY.at(i);
  }
  
  vector<ll> ans(N);
  for (int i = 0; i < N; i++){
    ll near = 1000000000, pos = 0;
    for (int j = 0; j < M; j++){
      ll dist = abs(AX.at(i) - BX.at(j)) + abs(AY.at(i) - BY.at(j));
      if (near > dist){
        near = dist;
        pos = j;
      }
    }
    
    ans.at(i) = pos + 1;
  }
  
  for (int i = 0; i < N; i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 3616
# list(input())
# list(map(int, input().split()))
# int(input())
from collections import deque
S = deque(list(input()))
Q = int(input())
queries = []
rv_flag = False
for _ in range(Q):
    q = list(input().split())
    if len(q) == 1:
        rv_flag = not rv_flag
        continue
    _, f, c = q
    if f == '1' and rv_flag:
        S.append(c)
    elif f == '1' and not rv_flag:
        S.appendleft(c)
    elif f == '2' and rv_flag:
        S.appendleft(c)
    elif f == '2' and not rv_flag:
        S.append(c)

ans = ''.join(S)
if rv_flag:
    print(ans[::-1])
else:
    print(ans)

        



Measured memory_bytes: 76392
from math import *

N,K = tuple(map(int,input().split()))

def f(x):
    if x>=K: return 1
    kaidero = ceil(log2(K/x))
    return pow(2,-kaidero)

re = 0
for x in range(1,N+1):
    re += f(x)/N
print(re)

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

int main(){
  int n, l;
  string s[100];
  cin >> n >> l;

  for(int i=0;i<n;i++)
    cin >> s[i];
  
  sort(s, s+n);

  for(int i=0;i<n;i++)
    cout << s[i];

  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_6_A
{
    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');

            for (int i = n - 1; i >= 0; i--)
            {
                int a = int.Parse(str[i]);

                if (i != 0) Console.Write(a + " ");

                else Console.WriteLine(a);
            }
        }
    }
}

Measured memory_bytes: 9144
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    int n;
    cin >> n;
    vector<int> a(n), ori(n);
    REP(i, n) cin >> a[i];
    ori = a;
    sort(all(a));
    int ans1 = a[n/2-1], ans2 = a[n/2];
    REP(i, n){
        if(ori[i] <= ans1) cout << ans2 << endl;
        else cout << ans1 << endl;
    }
}

Measured memory_bytes: 3840
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int p = sc.nextInt();
		int q = sc.nextInt();
		int r = sc.nextInt();

		int abc = p + q;
		int acb = r + q;
		int bac = p + r;

		int a = Math.min(abc, acb);
		int b = Math.min(a, bac);

		System.out.println(b);

		sc.close();

	}
}

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

        using namespace std;
        typedef long long ll;




        int main(){

ll n,k;
cin >> n >> k ;
ll X[n];
for(int i=0 ; i<n ; i++){
    cin >> X[i] ;
}
ll Cost[n];
for(int i=0 ; i<n ; i++){
    Cost[i]=1e9+5;
}
//cout << Cost[2] <<endl;


Cost[0]=0;


for(int i=0 ; i<n ; i++){
for(int j=i+1 ; j<=i+k  ; j++){
        if(j<n){
              //  cout << Cost[i] << " , " << i <<endl;
    Cost[j]=min(Cost[j],Cost[i]+abs(X[i]-X[j]));
   // cout << Cost[i] << " , "<< i <<endl;
   // cout << Cost[i-(j)] << " , "<< i-(j) <<endl;
        }
}
}

cout << Cost[n-1];



          return 0;
        }


Measured memory_bytes: 5140
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_map>

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

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int count = 0;
    for(int i = 1; i < n - 1; i++) {
        if((v[i-1] < v[i] && v[i+1] > v[i]) ||(v[i-1] > v[i] && v[i+1] < v[i]))
            count++;
    }
    cout << count << endl;
}



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

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(Solve());
        Console.Out.Flush();
    }

    static object Solve() {
        Console.ReadLine();
        var A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var logicalSum = 0;
        foreach (var val in A) {
            var ai = val;
            if ((ai & 1) == 1) {
                logicalSum = 0;
                break;
            }
            logicalSum |= ai;
        }
        var result = 0;
        if (logicalSum == 0) return result;
        while ((logicalSum & 1) == 0) {
            logicalSum >>= 1;
            result++;
        }
        return result;
    }
}

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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define INF 1e16
#define mod 1e9+7


int main() {
  ll n,k;
  cin>>n>>k;
  vll v(n);
  FOR(i,0,n){
    cin>>v[i];
  }
  ll sum=0;
  FOR(i,0,n){
    if(v[i]>k/2){
      sum+=(k-v[i])*2;
    }
    if(v[i]<=k/2){
      sum+=v[i]*2;
    }
  }
  co(sum);
}


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

typedef pair<int, int> ii;

int A[25];
int B[25];

int perm[25];

ii set1[25];
ii set2[25];

const int INF = 1012345678;

long long nxs(long long r){
    long long ls1 = r&(-r);
    long long rest = r+ls1;
    return rest|(((rest^r)/ls1) >> 2);
}

int main(){
    int N;
    scanf("%d", &N);

    for(int i = 0; i < N; i ++){
        scanf("%d", &A[i]);
    }

    for(int i = 0; i < N; i ++){
        scanf("%d", &B[i]);
    }

    int ans = INF;
    int noBits = (N+1)>>1;
    for(int i = (1<<noBits)-1; i < (1<<N); i = nxs(i)){
        //printf("i=%d\n", i);
        int size1 = 0;
        int size2 = 0;
        for(int j = 0; j < N; j ++){
            if(i&(1<<j)){
                // Place in first set, parity is even (0-indexed)
                if((j&1) == 0){
                    set1[size1++] = ii(A[j], j);
                }else{
                    set1[size1++] = ii(B[j], j);
                }
            }else{
                // Place in second set, parity is odd
                if((j&1) == 0){
                    set2[size2++] = ii(B[j], j);
                }else{
                    set2[size2++] = ii(A[j], j);
                }
            }
        }

        sort(set1, set1+size1);
        sort(set2, set2+size2);

        bool boleh = true;
        for(int j = 0; j < (int)size2; j ++){
            //printf("set1[%d]=ii(%d, %d), set2[%d]=ii(%d, %d)\n", j, set1[j].first, set1[j].second, j, set2[j].first, set2[j].second);
            if(set1[j].first > set2[j].first){
                boleh = false;
                break;
            }

            if( ((N&1) == 0) && j == (int)size2-1 ){
                break;
            }

            if(set1[j+1].first < set2[j].first){
                boleh = false;
                break;
            }
        }

        if(boleh){
            for(int j = 0; j < size2; j ++){
                perm[j<<1] = set1[j].second;
                perm[(j<<1)|1] = set2[j].second;
            }
            if(N&1){
                perm[N-1] = set1[size2].second;
            }

            int inv = 0;
            for(int j = 0; j < N; j ++){
                for(int k = j+1; k < N; k ++){
                    if(perm[j] > perm[k]){
                        inv ++;
                    }
                }
            }

            ans = min(ans, inv);
        }
    }

    if(ans == INF){ans = -1;}
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 384
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        Map<Character,Integer> m = new HashMap<>();
        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);
            if(!m.containsKey(c)){
                m.put(c,1);
            }else{
                m.put(c,m.get(c)+1);
            }
        }
        if(m.size() ==2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

    }

}


Measured memory_bytes: 23124
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACirclePond solver = new ACirclePond();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACirclePond {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int t = in.nextInt();
            double res = 2 * 3.14 * t;
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 33164
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int INF=mod;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<int, int>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,k,n) for(int i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long id=0;id<N;id++) cin>>v.at(id)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)


//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////



int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  int res = 0;

  sort(all(a));

  vector<ll> s(N);
  s[0] = a[0];
  rep(i, N-1){
    s[i+1] = s[i] + a[i+1];
  }

  for(int i = N - 1; i >= 0; i--){
    if(i == N - 1){
      res++; continue;
    }

    if(2 * s[i] < a[i+1]) break;

    res++;
    //cout << i << endl;
  }

  cout << res << endl;
}

Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A,B = map(int, lines.pop(0).split(' '))
    res = 0
    for i in range(2):
        if A > B:
            res += A
            A -= 1
        else:
            res += B
            B -= 1
    print(res)


lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(void){
  int N;
  int i,j;
  int d[60];
  scanf("%d", &N);
  for (i = 1; i <= N ; i++) {
    scanf("%d", &d[i]);
  }


  int ans = 0;
  for (i = 1 ; i <= N-1; i++) {
    for (j = N; j > i; j--) {
      ans += d[i] * d[j];
    }
  }

  printf("%d\n", ans);
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n;
    while (cin >> n, n) {
        vector<vector<ll>> t(n, vector<ll>(n+1));
        cin >> t;
        vector<ll> dp(1<<n, linf);
        dp[0] = 0;
        REP(i, 1<<n) {
            if (dp[i] == linf) continue;
            REP(j, n) {
                ll ni = i | (1<<j);
                dp[ni] = min(dp[ni], dp[i]+t[j][0]);
            }
            REP(j, n) REP(k, n) {
                if (i & (1<<k)) {
                    ll ni = i | (1<<j);
                    dp[ni] = min(dp[ni], dp[i]+t[j][k+1]);
                }
            }
        }
        cout << dp[(1<<n)-1] << endl;
    }
}

Measured memory_bytes: 3608
unittest
{
	assert( [ "4 3", "1 2", "2 3", "3 4" ].parse.expand.solve == 6 );
	assert( [ "5 4", "1 2", "1 3", "1 4", "4 5" ].parse.expand.solve == 48 );
	assert( [ "16 22", "12 1", "3 1", "4 16", "7 12", "6 2", "2 15", "5 16", "14 16", "10 11", "3 10", "3 13", "8 6", "16 8", "9 12", "4 3" ].parse.expand.solve == 271414432 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	auto abs = new long[ 2 ][ nk[ 0 ] - 1 ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
		ab[] -= 1;
	}
	return tuple( nk[ 0 ], abs, nk[ 1 ] );
}

auto solve( long n, long[ 2 ][] abs, long k )
{
	auto us = new bool[ n ];
	auto nss = transformEtoN( n, abs );
	return k.mulMod( dfs( us, nss, k, 0, 0 ) );
}

long dfs( ref bool[] us, long[][] nss, long k, long i, long d )
{
	auto nn = nss[ i ].length.signed - ( 0 < d );		// 自分から一つ先のノードの数（根ノード以外は辿ってきたノードを含んでいるので-1する）
	auto nk = k - ( d < 2 );							// 自分から一つ先のノードが使える色数（一つ前と二つ前で使われた色は使えない）
	auto nd = d + 1;
	auto ct = nk.permutationMod( nn );
	us[ i ] = true;
	foreach( ni; nss[ i ] )
	{
		if( !us[ ni ] ) ct = ct.mulMod( dfs( us, nss, nk, ni, nd ) );
	}
	return ct;
}

// 辺配列を頂点配列に変換
auto transformEtoN( bool directed = false )( long n, long[ 2 ][] es )
{
	auto nss = new long[][ n ];
	foreach( e; es )
	{
		nss[ e[ 0 ] ] ~= e[ 1 ];
		static if( !directed ) nss[ e[ 1 ] ] ~= e[ 0 ];
	}
	return nss;
}

// 掛け算
auto mulMod( long MOD = 10L ^^ 9 + 7 )( long x, long y )
{
	return x * y % MOD;
}

// 割り算
auto divMod( long MOD = 10L ^^ 9 + 7 )( long x, long y )
{
	return x * y.powMod!MOD( MOD - 2 ) % MOD;
}

// べき乗
auto powMod( long MOD = 10L ^^ 9 + 7 )( long x, long y )
{
	auto a = 1L;
	for( ; 0 < y; y >>= 1 )
	{
		if( y & 1 ) a = a * x % MOD;
		x = x ^^ 2 % MOD;
	}
	return a;
}

// 階乗
auto factorialMod( long MOD = 10L ^^ 9 + 7 )( long x )
{
	static memo = [ 1L ];
	if( memo.length <= x )
	{
		auto i = memo.length;
		memo.length = x + 1;
		for( ; i <= x; i++ ) memo[ i ] = memo[ i - 1 ] * i % MOD;
	}
	return memo[ x ];
}

// 順列数
auto permutationMod( long MOD = 10L ^^ 9 + 7 )( long x, long y )
{
	return ( x < y ) ? 0L : x.factorialMod!MOD.divMod!MOD( ( x - y ).factorialMod!MOD );
}


Measured memory_bytes: 20988
//     THE ONLY WAY IS UP

#include<bits/stdc++.h>

#define ll              long long int
#define ld              long double
#define f1(i, a, b)     for(ll i = a; i < b; i++)
#define f2(a, b)        for(auto a : b)
#define ar(v, i)        v[i]
#define in_(x)          ll x; cin >> x;
#define ino_(type, x)   type x; cin >> x;
#define pb              push_back
#define nl              "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    
    f1(i, 0, 3){
        ino_(char, c)
        if(c=='7'){
            cout << "Yes" << nl;
            return 0;
        }
    }
    
    cout << "No" << nl;
    
}

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <cassert>

#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
#include <queue>
#include <unordered_map>
using namespace std;

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

void Main()
{
	int T;
	cin >> T;
	vector<uint64_t> ans(T);
	rep(i, T)
	{
		uint64_t N, A, B, C, D;
		cin >> N >> A >> B >> C >> D;

		priority_queue<uint64_t> q;
		unordered_map<uint64_t, uint64_t> cost;
		q.push(N);
		cost[N] = 0;
		while (q.top() != 0)
		{
			auto p = q.top();
			q.pop();

			auto Push = [&](uint64_t j, uint64_t cc)
			{
				if (cost.find(j) == cost.end())
				{
					cost[j] = cc;
					q.push(j);
				}
				else
				{
					cost[j] = min(cost[j], cc);
				}
			};

			auto L = [&](uint64_t k, uint64_t F) {
				auto r = p / k;

				if (r == 0)
				{
					auto cc = cost[p] + p * D;
					Push(0, cc);

					if (p % k != 1)
					{
						cc = cost[p] + F + (k - p) * D;
						Push(1, cc);
					}
				}
				else
				{
					if (p % k == 0)
					{
						auto cc = cost[p] + F;
						Push(r, cc);
					}
					else
					{
						{
							auto cc = cost[p] + F + (p - r * k) * D;
							Push(r, cc);
						}

						{
							auto cc = cost[p] + F + ((r+1) * k - p) * D;
							Push(r+1, cc);
						}
					}
				}
			};

			L(5, C);
			L(3, B);
			L(2, A);

			Push(0, cost[p] + p * D);
		}

		ans[i] = cost[0];
	}

	rep(i, T)
	{
		cout << ans[i] << endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 4144
#include <bits/stdc++.h>
using namespace std;
#define long long long
const long MOD = 1e9+7;
signed main()
{
    long test;
    test=1;
    // cin>>test;
    while(test--){
    long i,j,a,b,n,x,ans,most,index,c,maxi=0,temp,aw,bw,w,count,sum;
    cin>>n;
    i=1;sum=0;
    while(1)
    {
       sum+=i;
       if(sum>=n)
       {
           cout<<i;
           break;
       }
       i++;
    }
    
    }
}

Measured memory_bytes: 256
# C - Streamline

N, M = map(int, input().split())
X = list(int(x) for x in input().split())
X.sort()
diff_x = []
for i in range(1, M):
    diff_x.append(X[i] - X[i-1])
diff_x.sort(reverse=True)

print(sum(diff_x[(N-1):]))

Measured memory_bytes: 13968
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n,k;
    cin >> n >> k;

    set<int> snk;
    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;

        for (int j = 0; j < d; j++)
        {
            int a;
            cin>>a;
            snk.insert(a);
        }
    }

    const int ans = n - snk.size();

    cout << ans << endl;
}


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

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

int main() {
  string s;
  cin >> s;
  rep(i, s.size()) {
    s.at(i) = 'x';
  }
  cout << s << endl;
return 0;
}

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

int main(){
  int x,a,b;
  cin>>x>>a>>b;

  if(b-a>=x+1)cout<<"dangerous"<<endl;
  else if(x>=b-a && b-a>0)cout<<"safe"<<endl;
  else cout<<"delicious"<<endl;
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int64 N;
  cin >> N;
  if(N & 1) {
    cout << 0 << endl;
  } else {
    // 5 の素因数
    int64 ret = 0;
    for(int64 x = 10; x <= N; x *= 5) {
      ret += N / x;
    }
    cout << ret << endl;
  }
}

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

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

  set<char> st;
  rep(i, S.size()) st.insert(S[i]);

  if (S.size() == st.size())
    cout << "yes" << endl;
  else
    cout << "no" << endl;
  return 0;
}

Measured memory_bytes: 3524
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
using LL = long long;
using ULL = unsigned long long;
#define NUM 1000000007

using namespace std;

int main()
{
    int n;
    cin >> n;
    if (n >= 64)
    {
        cout << 64 << endl;
    }
    else if (n >= 32)
    {
        cout << 32 << endl;
    }
    else if (n >= 16)
    {
        cout << 16 << endl;
    }
    else if (n >= 8)
    {
        cout << 8 << endl;
    }
    else if (n >= 4)
    {
        cout << 4 << endl;
    }
    else if (n >= 2)
    {
        cout << 2 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
/*
the top of the losers
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    Lcm(a,b)  ((a*b)/(__gcd(a,b)))
#define   length(a)      hypot( (a.imag()),(a.real()) )
#define    x            real()
#define    y            imag()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     point        complex<double>
#define    dp(a,b)          (((conj(a))*(b)).real())
#define    cp(a,b)          (((conj(a))*(b)).imag())
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const double eps= (1e-9);
using namespace std;
using namespace __gnu_pbds;
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
int vis[1009],par[1009];
vector< vector<int> > v(1009);
int mi=100000;
vector<int> fans;
void bfs(int str){

   clr(vis,0);
   queue<int> q;
   q.push(str);
   vis[str]=1;
   par[str]=-1;
   int fl=0;
   while(sz(q)>0&&fl==0){
    int cur=q.front();
    q.pop();
    for(int i=0;i<sz(v[cur]);i++){
        int nw=v[cur][i];
        if(nw==str){
            fl=1;
            par[nw]=cur;
            break;
        }
        if(vis[nw])
            continue;
        vis[nw]=1;
        par[nw]=cur;
        q.push(nw);
    }

   }

   vector<int> ans;
   if(fl){
      int cur=str;
      ans.pb(cur);
      while(1){
        if(par[cur]==str) break;
        ans.pb(par[cur]);
        cur=par[cur];

      }

      if(sz(ans)<mi){
        mi=sz(ans);
        fans=ans;
      }
   }
}
int main(){
    GO();
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int f,t;
        cin>>f>>t;
        v[f].pb(t);
    }

    for(int i=1;i<=n;i++){
        bfs(i);
    }
    if(sz(fans)>0){
    cout<<sz(fans)<<endl;
    for(int i=0;i<sz(fans);i++){
        cout<<fans[i]<<endl;
    }
    }
    else
    cout<<"-1\n";
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
#define em3 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define X real()
#define Y imag()
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define EPS 1e-7
long long mod = 1e9 +7;
typedef long long ll;
typedef long double ld;
const double pi = acos(-1);
typedef complex <double> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
int n, ans[3];
 
int main()
{
 
    em3
    cin >> n;
    int a, b, c;
    cin >> a >> b >> c;
    ans[0] = a;
    ans[1] = b;
    ans[2] = c;
    for(int i = 1 ; i < n ; i++)
    {
        cin >> a >> b >> c;
        int x = ans[0] , y = ans[1] , z = ans[2];
        ans[0] = max(y + a, z + a);
        ans[1] = max(x + b, z + b);
        ans[2] = max(x + c, y + c);
 
    }
    cout << max(ans[0], max(ans[1], ans[2]));
 
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

//a??¨b?????\??????????????¢??°
void swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int x, y;

	//x,y?????¨??????0??§???????????°?????????
	while (scanf("%d %d", &x, &y), !(x == 0 && y == 0)) {
		//x,y????°????????????§???????????°??\?????????
		if (x > y) {
			swap(&x, &y);
		}
		printf("%d %d\n", x, y);
	}

	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
signed main(){
    long long n , lucas[87];
    cin >> n;
    lucas[0] = 2 , lucas[1] = 1;
    
    for(int i=2 ;i<=n ;i++ ){
        lucas[i] = lucas[i-1] + lucas[i-2];
    }
    
    cout << lucas[n] << endl;
    return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9+10)
#define ll_MIN (ll)(-1e9*1e9-10)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
//using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX
 



int f1(vi& q, int k)
{
 
  int tot = 0;
  for(auto it: q)
     tot += it;
  if(tot >= 0)
  { 
    int r = k%q.size();
    int ans = ll_MIN;
    int curr = 0;
    for(int i=0; i<r; i++)
      curr += q[i], ans = max(ans, curr);
    int ans1 = ll_MIN;
    int curr1 = 0;
    for(int i=0; i<q.size(); i++)
      curr1 += q[i], ans1 = max(ans1, curr1);
    int ret = ans + tot*(k/q.size());
    if(k/q.size() >= 1)
      ret = max(ret, tot*(k/(int)q.size()-1)+ans1);
    return ret;
  }

  int ans = ll_MIN;
  int curr = 0;
  for(int i=0; i<min((int)q.size(), k); i++)
    curr += q[i], ans = max(ans, curr);
  return ans;

}




void solve()
{
  int n,k;
  cin >> n >> k;
  int p[n], c[n];
  inp(p, n);
  inp(c, n);
  int ans = ll_MIN;
  for(int i=0; i<n; i++)
  {
    
    bool v[n] = {0};
    int j = i;
    vector<int> q;
    while(1)
    {
      j = p[j]-1;
      if(v[j])
        break;
      q.push_back(c[j]);
      v[j] = 1;
    }
    ans = max(ans, f1(q, k));
  }

  cout << ans << endl;
}

 
signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3844
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;
const ll MOD = 1000000000+7;
int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n);

  for(ll i = 0;i < n;i++)cin >> a[i];

  ll ans = 0;
  for(ll i = 0;i < n-1;i++){
    for(ll j = i+1;j < n;j++){
      if(a[i] > a[j]){
        ans += (k+1)*k/2;
        ans %= MOD;
      }
      else if(a[i] < a[j]){
        ans += k*(k-1)/2;
        ans %= MOD;
      }
    }
  }

  cout << ans << endl;
}
      
       


Measured memory_bytes: 256