akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const int N=1e5+11,INF=~0u>>2;
int n,a[N],ans,t[N],tot;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
int main(){
	n=read();
	for(int i=1;i<=n;++i){
		a[i]=read();
		if(a[i]==i) t[++tot]=i;
	}
	for(int i=1;i<=tot;++i){
		if(t[i]+1==t[i+1]) ans++,i++;
		else ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
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; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
    int a,b,c; cin >> a >> b >> c;
    //vector<int> p(n); rep(i,n) cin >> p[i];
    //sort(all(p));
    //int ans = 0;
    
    
    cout << c << " " << a << " " << b;
    
return 0;
}

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

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

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

  ll ans;
  if(n>=2&&m>=2) ans = (n-2)*(m-2);
  else ans = max(n-2, m-2);
  
  if(ans<0) ans=1;
  cout << ans;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n; cin >> n;
    vector<int> t(n);
    ll sum = 0;
    rep(i, n) {
        cin >> t.at(i);
        sum += t.at(i);
    }
    dump(sum);

    int m; cin >> m;
    vector<int> p(m), x(m);
    rep(i, m){
        cin >> p.at(i) >> x.at(i);
    }

    rep(i, m){
        ll tmp = sum;
        tmp -= t.at(p.at(i)-1);
        tmp += x.at(i);
        cout << tmp << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <bitset>
#include <vector>
using namespace std;
 
const int N = 1e5;
char s[N];

int main() {
    scanf("%s", s);
    int len = strlen(s);
    if (s[len - 1] != 's') {
        s[len] = 's';
        s[++len] = '\0';
    } else {
        s[len] = 'e';
        s[++len] = 's';
        s[++len] = '\0';
    }
    printf("%s\n", s);
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()

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

    vector<int> L(n);
    rep(i, L.size())
    {
        cin >> L[i];
    }
    sort(all(L));
    
    int longest = L.back();
    L.pop_back();

    if (longest < accumulate(all(L), 0))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())

from fractions import Fraction

for i in range(1,3501):
    for j in range(1,3501):
        if 4*i*j - n*i - n*j > 0:
            if (i * j * n) % (4*i*j - n*i - n*j) == 0 and (i * j * n) // (4*i*j - n*i - n*j) > 0:
                print(i,j, (i * j * n) // (4*i*j - n*i - n*j))
                import sys
                sys.exit()

Measured memory_bytes: 66280
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
bool f = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
std::vector<edge>V[100010], W[100010];
typedef std::vector<std::vector<int>>ma;

int main() {
	ll n, r[5010];
	std::cin >> n;
	r[1] = 1;
	for (int i = 2;i <= 5000;i++)r[i] = r[i - 1] + i;
	for (int i = 5000;i >= 1;i--) {
		if (r[i] < n) {
			std::cout << i + 1 << std::endl;
			n -= i + 1;
		}
		if (n == 1) {
			std::cout << 1 << std::endl;
			break;
		}
	}
}

Measured memory_bytes: 5120
#include <stdio.h>

int solve(int,int);

int n;
int A[2000];

int main(void){

  int M[200];
  int i,j,q;

  scanf("%d",&n);

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

  scanf("%d",&q);

  for(j=0;j<q;j++){
    scanf("%d",&M[j]);
  }

  for(i=0;i<q;i++){
    if(solve(0,M[i])){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }
  return 0;
}

int solve(int i,int m){

  int res;

  if(i == n && m == 0){
    return 1;
  }
  if(i == n && m != 0){
    return 0;
  }
  res = solve(i + 1,m) + solve(i + 1,m - A[i]);
  return res;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,q; cin>>n>>q;
  string ans="kogakubu10gokan";
  for(int i=0;i<n;++i){
    int y;
    string s;
    cin>>y>>s;
    if(q>=y) ans=s;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3156
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

class SegmentTree():
    def __init__(self, init_val, N):
        """
        Parameters
        ----------
        init_val:int
            identity element
        N:int
            the number of nodes
        """
        self.init_val=init_val
        # Range Minimum Query
        self.N0 = 2**(N-1).bit_length() #Nを超える最小の2のべき乗
        # 0-indexedで管理(N0-1からはじまる)
        self.data = [self.init_val] * (2 * self.N0)

    def _segfunc(self, left, right):
        res= left | right
        return res

    def update(self,k, x):
        """
        Parameters
        ----------
        k:int
            target index(0-index)
        x:any
            target value
        """
        k += self.N0-1
        self.data[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.data[k] = self._segfunc(self.data[2*k+1], self.data[2*k+2])

    def query(self, l, r):
        """
        Parameters
        ----------
        l,r:int
            target range [l,r)

        Return
        ----------
        res:any
            val
        """
        L = l + self.N0
        R = r + self.N0
        s = self.init_val
        while L < R:
            if R & 1:
                R -= 1
                s = self._segfunc(s, self.data[R-1])
    
            if L & 1:
                s = self._segfunc(s, self.data[L-1])
                L += 1
            L >>= 1; R >>= 1
        return s
def chartobit(c):
    return 1<<(ord(c)-97)
def main():
    n=inp()
    s=[chartobit(i) for i in list(input()) if i!="\n"]
    st = SegmentTree(0, n)
    for i in range(n):
        st.update(i,s[i])
    q = inp()
    ans = []
    for i in range(q):
        mode, first, second = input().split()
        if mode == "1":
            # if second in st.data[int(first) - 1 + st.N0 - 1]:
            #     continue
            st.update(int(first) - 1, chartobit(second))
        else:
            ans.append((st.query(int(first) - 1, int(second))))
    for i in ans:
        print(sum(map(int,bin(i)[2:])))

if __name__ == "__main__":
    main()

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1000 + 5;
const int MAX_N = 1e5 + 5;

bool seen[100020];

int main() {
    int n;
    cin >> n;
    vector<vector<int>> v(n);
    map<P, int> edge_color_map;
    vector<P> edges;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
        edges.emplace_back(a, b);
    }
    vector<int> color(n, 0);
    queue<int> que;
    seen[0] = true;
    que.push(0);
    int max_degree = 0;
    while (!que.empty()) {
        int top = que.front();
        que.pop();
        vector<int> next_vertexes = v[top];
        int curr = 1;
        for (int e : next_vertexes) {
            if (seen[e]) continue;
            que.push(e);
            if (curr == color[top]) curr++;
            edge_color_map[make_pair(top, e)] = curr;
            color[e] = curr;
            max_degree = max(max_degree, curr);
            curr++;
        }
        seen[top] = true;
    }
    cout << max_degree << endl;
    for (auto e : edges) {
        cout << edge_color_map[e] << endl;
    }
}


Measured memory_bytes: 11892
n = int(input())

A = list(map(int, input().split()))

sum_A = sum(A)

A_wa = [0]
A_nokori = [sum_A]

for i in range(n) :
    A_wa.append(A_wa[i] + A[i])
    A_nokori.append(A_nokori[i] - A[i])

dif_A = []

for i in range(n) :
    dif_A.append(abs(A_nokori[i] - A_wa[i]))

print(min(dif_A))

Measured memory_bytes: 37532
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 50;

int n, m;
// to, edge id
vector<pair<int, int>> conn[N];

bitset<N> vis;

void dfs(int v, int id) {
    vis[v] = true;
    for (auto& u : conn[v]) {
        if (!vis[u.first] && u.second != id) dfs(u.first, id);
    }
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        conn[a].push_back({b, i});
        conn[b].push_back({a, i});
    }
    
    int ans = 0;
    for (int i = 0; i < m; i++) {
        vis.reset();
        dfs(0, i);
        
        bool bridge = false;
        for (int j = 0; j < n; j++) {
            if (!vis[j]) bridge = true;
        }
        if (bridge) ans++;
    }
    cout << ans;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c,tmp;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    if(b>c){
        tmp=b;
        b=c;
        c=tmp;
    }
    if(a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    printf("%d %d %d\n",a,b,c);
    
    return 0;
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long double ld;
#define loopi(n) for(i=0;i<n;i++) 
#define loopj(n) for(j=0;j<n;j++)
#define loopnode(v) for(ll i : v)
#define mod7 1000000007
#define mod9 1000000009
#define mod8 100000000
#define modl 998244353
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::vector<ll> vecl;
typedef std::vector<bool> vecb;
typedef std::vector<long double> vecd;
typedef std::vector<string> vecstr;
typedef std::vector<char> vecch;
typedef std::vector< pair<ll,ll> >  vecpair;
typedef unordered_map<ll,ll> umap;
typedef unordered_map<long double,int> umapd;
typedef unordered_map<string,ll> umapstr;
typedef unordered_map<char,ll> umapc;
typedef set< ll,greater<ll>  > st;
typedef priority_queue<ll> q_max;
typedef priority_queue<ll,vector<ll>,greater<ll> > q_min;
ll j=0,i=0;//ll maxm = INT_MIN;

//vecl node[300001];vecl color(300001,-1);umap u;vecl res(300001,0);//ll flag = 1;
//vecb visited(300000+1,false);

int main(int argc, char const *argv[])
{
	ll index= -1;ll ans = -1;ll d;
	ll x,n;cin>>x>>n; umap u;loopi(n){ll p;cin>>p;u[p]++;}
	for(d=0;d<=101;d++)	
	{
		if(u[x-d]==0)
		{
			 ans = x-d;break;
		}
		else if(u[x+d]==0)
		{
			 ans = x+d;break;
		}
	}
  cout<<ans;
	



	return 0;

	
}


Measured memory_bytes: 3628
N,T = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(N)]
AB.sort(key=lambda x: x[0])
#print(AB)

W = T + 1
def dp(AB,W):
    N = len(AB)
    DP = [[0]*W for i in range(N+1)]
    for i in range(N):
        for w in range(W):
            if w != W-1:
                if AB[i][0] <= w:
                    DP[i+1][w] = max(DP[i][w-AB[i][0]]+AB[i][1],DP[i][w])
                else:
                    DP[i+1][w] = DP[i][w]
            else:
                DP[i+1][w] = max(DP[i][w-1]+AB[i][1],DP[i][w])
    return DP

DP1 = dp(AB,W)

ans = DP1[N][T]
print(ans)

Measured memory_bytes: 116696
count_list = Array.new(2, 0)
while str = gets
  a, b, c = str.split(',').map(&:to_i)
  break if a == 0 || b == 0 || c == 0

  if c**2 == (a**2 + b**2)
    count_list[0] += 1
  elsif a == b
    count_list[1] += 1
  end
end

puts count_list

Measured memory_bytes: 8536
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int MOD;
int main(){
	int a,b,c;
	while(cin>>a>>b>>c,a){
		int oa=inf,ob=inf;
		rep(i,100000){
			if((i*a+c)%b==0){
				int j=(i*a+c)/b;
				if(oa+ob==i+j){
					if(oa*a+ob*b>i*a+j*b)oa=i,ob=j;
				}else if(oa+ob>i+j)oa=i,ob=j;
			}
			if(abs(i*a-c)%b==0){
				int j=abs(i*a-c)/b;
				if(oa+ob==i+j){
					if(oa*a+ob*b>i*a+j*b)oa=i,ob=j;
				}else if(oa+ob>i+j)oa=i,ob=j;
			}
		}
		cout<<oa<<" "<<ob<<endl;
	}
}

Measured memory_bytes: 3096
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:52:46 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

"""

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if (e-a) <= k:
    print("Yay!")
else:
    print(":(")


Measured memory_bytes: 23584
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

typedef long long int ll;
typedef long double ld;

int main(){
    ll a;
    cin >> a;
    ll b[a];
    for (int i=0;i<a;++i){
        cin >> b[a-i];
    }
    for (int i=0;i<a;++i){
        cout << b[i+1];
        if (i!=a-1){
            cout << " ";
        }
    }
    cout << endl;
}



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

int NUM[100001];
bool BOX[100001];

int main() {
	int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        NUM[i]=1;
    }
    BOX[1]=true;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        if(BOX[a]) BOX[b]=true;
        if(!--NUM[a]) BOX[a]=false;
        NUM[b]++;
    }
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(BOX[i]&&NUM[i]) cnt++;
    }
    cout<<cnt<<endl;

	return 0;
}

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

int main(){
	double L;
	cin >> L;
	double x, y, z;
	x = L / 3;
	y = L / 3;
	z = L - 2*x;
	printf("%.10lf\n",x*y*z);
	return 0;
}



Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

struct Data {
    ll a, b;

    bool operator< (const Data &other) const {
        if(a == other.a)
            return (b < other.b);
        return ((a * (other.b + 1)) > (other.a * (b + 1)));
    }
};

int main() {
    //freopen("a.in", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    ll t;
    cin >> n >> t;
    vector<Data> v(n + 1, {0, 0});
    for(int i = 1; i <= n; i ++)
        cin >> v[i].a >> v[i].b;
    sort(v.begin() + 1, v.end());

    int m = n;
    n = 1;
    while(n <= m && v[n].a != 0)
        n ++;
    n --;

    int lim = 5;
    if(t > 0)
        lim = (int)log2(t) + 5;
    vector<vector<ll>> dp(n + 1, vector<ll> (lim + 1, t + 5));
    dp[0][0] = 0;
    for(int i = 1; i <= n; i ++) {
        dp[i][0] = 0;
        for(int j = 1; j <= min(lim, i); j ++)
            dp[i][j] = min(dp[i - 1][j], (dp[i - 1][j - 1] + 1) * (v[i].a + 1) + v[i].b);
    }

    int ans = 0;
    for(int i = 0; i <= lim; i ++) {
        int j = n + 1;
        while(j <= m && dp[n][i] + 1 + v[j].b <= t) {
            dp[n][i] += (1 + v[j].b);
            j ++;
        }
        if(dp[n][i] <= t)
            ans = max(ans, i + j - n - 1);
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 64384
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  vector<long> A(N);
  rep (i, N) {
    long tmp;
    cin >> tmp;
    tmp -= i;
    A[i] = tmp;
  }
  sort(A.begin(), A.end());
  long foo = A[N/2];
  long ans = 0;
  rep (i, N) ans += abs(A[i] - foo);
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 1792
x1, y1, x2, y2 = map(int,input().split())
x3 = x2 + y1 -y2
y3 = y2 + x2 - x1
x4 = x1 + y1 - y2
y4 = y1 + x2 - x1
Answer = [x3, y3, x4, y4]
print(*Answer)

Measured memory_bytes: 3060
//
//AtCoder Beginner Contest 138
//A - Red or Not
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    if (a<3200) s="red";
    cout << s << endl;

    return 0;
}


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

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

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

    int N;
    cin>>N;
    set<ll> st;
    rep(i, N) {
        int n;
        cin>>n;
        st.insert(n);
    }
    if (st.size() == N) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 9600
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;

vector<vector<int>> g;
vector<int> ans,used;
void dfs(int now) {
	ans.push_back(now);
	used[now] = 1;
	rep(i, 0, g[now].size()) {
		int go = g[now][i];
		if (!used[go]) return dfs(go);
	}
	return;
}

int main(){
	int n, m; cin >> n >> m;
	g.resize(n); used.resize(n, 0);
	rep(i, 0, m) {
		int p, q; cin >> p >> q;
		p--; q--;
		g[p].push_back(q);
		g[q].push_back(p);
	}
	dfs(0);
	reverse(ans.begin(), ans.end());
	ans.pop_back();
	dfs(0);
	printf("%d\n", ans.size());
	rep(i, 0, ans.size()) printf("%d ", ans[i]+1);
	return 0;
}


Measured memory_bytes: 10104
#include <iostream>
#include <algorithm>

using namespace std;

int n,k;
long long a[5000];

//昇順にソートしたとき初めて必要となるカードを求める
int binary_DP()
{
	int left=-1;
	int right=n;
	int mid;
	bool dp[5001];
	bool flag=false;
	while(right-left>1)
	{
		mid=(left+right)/2;
		cerr<<mid<<endl;
		flag=false;
		for(int i=0;i<5001;i++)
		{
			dp[i]=false;
		}
		dp[0]=true;
		//DP
		for(int i=0;i<n;i++)
		{
			if(i==mid)
			{
				continue;
			}
			for(int j=5000;j>=0;j--)
			{
				if(dp[j]==true && j+a[i]<=5000)
				{
					dp[j+a[i]]=true;
				}
			}
		}
		//ここまでDP
		for(int i=0;i<k;i++)
		{
			if(dp[i]==true&&i+a[mid]>=k)
			{
				flag=true;
				break;
			}
		}
		if(flag==true)
		{
			right=mid;
		}else{
			left=mid;
		}
	}
	return right;
}

int main()
{
	int ans=0;
	cin>>n>>k;
	
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ans = binary_DP();
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>

using namespace std;

int main(int argc, const char* argv[])
{
	int N;
	cin >> N;
	int T[N], A[N];
	for (int i = 0; i < N; i++) cin >> T[i] >> A[i];
	uint64_t t = T[0];
	uint64_t a = A[0];
	for (int i = 1; i < N; i++) {
		uint64_t r = max((t + T[i] - 1) / T[i], (a + A[i] - 1) / A[i]);
		t		   = r * T[i];
		a		   = r * A[i];
	}
	uint64_t ans = a + t;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
<?php

while (true) {
    fscanf(STDIN, "%d %d %d", $m, $f, $r);
    if (is_end($m, $f, $r)) break;

    echo evaluate($m, $f, $r)."\n";
}

function evaluate($m, $f, $r)
{
    if (is_absent($m) || is_absent($f)) {
        return "F";
    }

    $score = $m + $f;

    if (80 <= $score) {
        return "A";
    }

    if (65 <= $score && $score < 80) {
        return "B";
    }

    if (50 <= $score && $score < 65) {
        return "C";
    }

    if (30 <= $score && $score < 50) {
        return (50 <= $r) ? 'C' : 'D';
    }

    return "F";
}

function is_end($m, $f, $r)
{
    return -1 == $m && -1 == $f && -1 == $r;
}

function is_absent($score)
{
    return -1 == $score;
}

Measured memory_bytes: 6572
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,q,l,r,ans=0,b[100005]={};
    string s;
    cin>>n>>q>>s;
    for(int i=0;i<n;i++){
	if(s[i]=='A' && s[i+1]=='C')
	    b[i]++;
	b[i]+=b[i-1];
//	cout << b[i] << " \n"[i == n - 1];
    }
    for(int i=1;i<=q;i++){
	cin>>l>>r;
//	cout<<b[r-2]<<' '<<b[l-2]<<'\n';
	ans+=b[r-2]-b[l-2];
	cout<<ans<<endl;
	ans=0;
    }
    return(0);
}



Measured memory_bytes: 1536
#include <iostream>

using namespace std;

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

    long long a = n / k;
    long long c = a * a * a;
    if (k % 2 == 1)
        cout << c << endl;
    else
    {
        long long b = n / (k / 2) - a, d = b * b * b;
        cout << c + d << endl;
    }
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
n,m=map(int,input().split())
z=n*(n-1)//2
l=[-1]*n
a=[1]*n
b=[input().split() for _ in range(m)]
c=[0]*m+[z]
d=[i for i in range(n)]
def r(s):
  t=l[s]
  if t<0:
    return s
  else:
    l[s]=r(t)
    return l[s]
def f(s):
  return r(int(s)-1)
for i in range(m-1,-1,-1):
  x,y=map(f,b[i])
  if x!=y:
    l[x]=y
    d[y]=d[x]
    z-=a[x]*a[y]
    a[y]+=a[x]
  c[i]=z
for x in c[1:]:
  print(x)

Measured memory_bytes: 52576
#include <stdio.h>
#define MAX_N 100000

int sum(int *array, int begin, int end) {
	int i, s = 0;

	for (i = begin; i < end; i++) {
		s += array[i];
	}
	return s;
}

int main(void) {
	int n, q, com, x, y, bx, by, s;
	int a[MAX_N] = {0}, b[MAX_N] = {0};

	scanf("%d %d", &n, &q);

	while (q--) {
		scanf("%d %d %d", &com, &x, &y);

		x--;
		if (com) {
			bx = x - x % 100 + 100;
			by = y - y % 100;
			if (bx < by) {
				s = sum(a, x, bx) + sum(b, bx/100, by/100) + sum(a, by, y);
			} else {
				s = sum(a, x, y);
			}
			printf("%d\n", s);
		} else {
			a[x] += y;
			bx = x - x % 100;
			b[x/100] = sum(a, bx, bx+100);
		}
	}
	return 0;
}

Measured memory_bytes: 1392
import Data.List
import Debug.Trace

split :: Char->String->[String]
split c str
    | not $ elem c str = [str]
    | otherwise        = word:(split c str')
    where word = takeWhile (/=c) str
          str' = drop ((length word)+1) str

solve :: [[Int]]->[Int]->Int
solve [] cost   = head cost
solve (x:xs) cost 
    | null cost = solve xs x --top
    | l1<l2     = solve xs cost1'
    | otherwise = solve xs cost2'
        where x' = head xs
              (l1,l2) = (length cost, length x)
              cost1' = [(cost!!0)+(x!!0)]++
                       (map (\i->if (cost!!(i-1))>(cost!!i) then (cost!!(i-1))+(x!!i) else (cost!!i)+(x!!i)) [1..(l2-2)])++
                       [(cost!!(l1-1))+(x!!(l2-1))]
              cost2' = (map (\i->if (cost!!i)>(cost!!(i+1)) then (cost!!i)+(x!!i) else (cost!!(i+1))+(x!!i)) [0..(l2-1)])

main = do
    ss <- getContents
    let lst = map (\x->map (\y->read y::Int) x) $ map (split ',') $ lines ss
    print $ solve lst []

Measured memory_bytes: 4564
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
 
template <class Abel> struct UnionFind {
  vector<int> par;
  vector<int> rank;
  vector<Abel> diff_weight;

  UnionFind(int n, Abel SUM_UNITY = 0) : par(n), rank(n, 0), diff_weight(n, SUM_UNITY) {
    for(int i = 0; i < n; ++i) par[i] = i;
  }

  Abel weight(int x) {
    find(x);
    return diff_weight[x];
  }

  int find(int x) {
    if(x == par[x]) return x;

    int r = find(par[x]);
    diff_weight[x] += diff_weight[par[x]];
    return par[x] = r;
  }

  void unite(int x, int y, Abel w) {
    w += weight(x); w -= weight(y);
    x = find(x); y = find(y);

    if(x == y) return;
    if(rank[x] < rank[y]) swap(x, y), w = -w;
    if(rank[x] == rank[y]) ++rank[x];

    par[y] = x;
    diff_weight[y] = w;
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  Abel diff(int x, int y) {
    return weight(y) - weight(x);
  }
};

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {0, -1, 0, 1, 1, 1, -1, -1};
int dy[] = {-1, 0, 1, 0, 1, -1, 1, -1};

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

  int n, m;
  cin >> n >> m;
  UnionFind<int> uf(n);
  rep(i, 0, m) {
    int l, r, d;
    cin >> l >> r >> d;
    
    if(uf.same(l, r)) {
      if(uf.diff(l, r) != d) return cout << "No\n", 0;
    }
    else uf.unite(l, r, d);
  }
  cout << "Yes\n";
}


Measured memory_bytes: 1408
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

N, A, B = list(map(int, sys.stdin.readline().split()))
X = list(map(int, sys.stdin.readline().split()))

X = np.array(X)
ans = 0
for d in np.diff(X):
    ans += min(d * A, B)
print(ans)


Measured memory_bytes: 24088
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
check=[[False]*n for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    check[a-1][b-1]=True
    check[b-1][a-1]=True
l=[i for i in range(1,n)]
import itertools
count=0
for order in itertools.permutations(l,n-1):
    order=[0]+list(order)
    for i in range(n-1):
        if check[order[i]][order[i+1]]:
            pass
        else:
            break
    else:
        count+=1
print(count)


Measured memory_bytes: 40304
// Marcin Knapik
#include<bits/stdc++.h>

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< pair<int, int> , null_type,less<pair<int, int>>, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)
#define losuj_real(a, b) uniform_real_distribution<long double>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;
 
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second
 
template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}
 
template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }
  
const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll BIG_INF = 1e18 + 7;

ll n, m, k, q;

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

    cin >> n >> k;
    vll dp(N, -BIG_INF);
    dp[0] = 0;
    ll ans = 0;

    FOR(i, n){
    	int a, b;
    	cin >> a >> b;

    	for(int i = k; i >= a; i--){
    		setmax(dp[i], dp[i-a] + b);
    		setmax(ans, dp[i]);
    	}
    }
    cout << ans << '\n';
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



struct Edge { int to, id; };

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n;
    cin >> n;
    vector<vector<Edge> > g(n);
    // vector<int> ans(n - 1);
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].eb((Edge){ b, i });
        g[b].eb((Edge){ a, i });
    }
    
    queue<int> q;
    vector<int> used(n - 1);
    q.push(0);
    while (!q.empty()) {
        int v = q.front();
        // cout << v << " ";
        q.pop();
        
        int k = 1;
        int c = -1;
        for (auto e : g[v]) {
            if (used[e.id]) {
                c = used[e.id];
            }
        }
        // cout << c << endl;
        for (auto e : g[v]) {
            if (used[e.id]) continue;
            if (k == c) ++k;
            used[e.id] = k++;
            q.push(e.to);
        }
    }
    
    int mx = 0;
    rep(i, n) chmax(mx, sz(g[i]));
    cout << mx << endl;
    rep(i, n - 1) cout << used[i] << endl;
    
}




Measured memory_bytes: 7040
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;

namespace output{
    void __(short x){cout<<x;}
    void __(unsigned x){cout<<x;}
    void __(int x){cout<<x;}
    void __(long long x){cout<<x;}
    void __(unsigned long long x){cout<<x;}
    void __(double x){cout<<x;}
    void __(long double x){cout<<x;}
    void __(char x){cout<<x;}
    void __(const char*x){cout<<x;}
    void __(const string&x){cout<<x;}
    void __(bool x){cout<<(x?"true":"false");}
    template<class S,class T>
    void __(const pair<S,T>&x){__(DEBUG?"(":""),__(x.first),__(DEBUG?", ":" "),__(x.second),__(DEBUG?")":"");}
    template<class T>
    void __(const vector<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const set<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const multiset<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class S,class T>
    void __(const map<S,T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    void pr(){cout<<"\n";}
    template<class S,class... T>
    void pr(const S&a,const T&...b){__(a);if(sizeof...(b))__(' ');pr(b...);}
}

using namespace output;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,char> pic;
typedef pair<double,double> pdd;
typedef pair<ld,ld> pld;
typedef vector<int> vi;
typedef vector<ll> vl;

#define pb push_back
#define fox(i,x,y) for(int i=(x);i<=(y);i++)
#define foxr(i,x,y) for(int i=(y);i>=(x);i--)
#define F first
#define S second

const int MN = 1e7+5, mod = 998244353;
int N, i, j, fac[MN]={1}, inv[MN]={1}, f[MN], ans;
int qpow(int b,int exp){
    if(exp<=0) return 1;
    else if(exp&1) return 1LL*b*qpow(b,exp-1)%mod;
    else{int r=qpow(b,exp>>1); return 1LL*r*r%mod;}
}
int C(int n,int k){return 1LL*fac[n]*inv[k]%mod*inv[n-k]%mod;}

int main(){
    scanf("%d",&N);
    for(i=1;i<=N;i++)
        fac[i]=1LL*fac[i-1]*i%mod;
    inv[N]=qpow(fac[N],mod-2);
    for(i=N-1;i>=1;i--)
        inv[i]=1LL*inv[i+1]*(i+1)%mod;
    ans=qpow(3,N);
    f[0]=1;
    for(i=1;i<=N/2;i++)
        f[i]=2LL*f[i-1]%mod;
    for(i=N/2+1;i<=N;i++){
        ans=(ans-2LL*f[N-i]*C(N,i))%mod;
        if(ans<0) ans+=mod;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 98560
# https://abc042.contest.atcoder.jp/tasks/arc058_a
N, _ = gets.chomp.split.map(&:to_i)
ary = gets.chomp.split.map(&:to_i)
use_char = [0,1,2,3,4,5,6,7,8,9]-ary

# nはmax10**4なので99999までやればよい
ans = Float::INFINITY
use_char.each do |a|
  tmp = a
  if tmp >= N
    ans = [ans,tmp].min
  end
  use_char.each do |b|
    tmp = a+10*b
    if tmp >= N
      ans = [ans,tmp].min
    end
    use_char.each do |c|
      tmp = a+10*b+100*c
      if tmp >= N
        ans = [ans,tmp].min
      end
      use_char.each do |d|
        tmp = a+10*b+100*c+1000*d
        if tmp >= N
          ans = [ans,tmp].min
        end
        use_char.each do |e|
          tmp = a+10*b+100*c+1000*d+10000*e
          if tmp >= N
            ans = [ans,tmp].min
          end
        end
      end
    end
  end
end
puts ans


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

int main(){
    int A, B, C;
    cin>>A>>B>>C;
    if(A==B){
        if(B==C){
            cout<<"No"<<endl;
        }
        else {
            cout<<"Yes"<<endl;
        }
    }
    else if(B==C){
        cout<<"Yes"<<endl;
    }
    else if(A==C){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define db "NPALIN"
#define fi first
#define se second
#define endl '\n'
#define int long long
const int INF = 1e15 + 1;
const int mod = 1e9 + 7;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<PII, int> PII2;
typedef pair<int, PII> PII3;

void docfile()
{
    if (ifstream("FORM.inp"))
    {
        freopen("FORM.inp", "r", stdin);
        freopen("FORM.out", "w", stdout);
    }
    else if (ifstream(db".inp"))
    {
        freopen(db".inp", "r", stdin);
        freopen(db".out", "w", stdout);
    }
}

//---------------------------------------------------------------------------
const int N = 2 * 1e5 + 2;
int n, a[N];
set <int> s;

void solve()
{
    if(s.size() == n) cout << "YES";
    else cout << "NO";
}

void input()
{
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i], s.insert(a[i]);
    solve();
}

int32_t main()
{
    docfile();
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    //int test = 1; cin >> test; while(test--)
    input();
}


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

/*
int read()
{
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') {x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
void write(int x)
{
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}
*/


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

int comp(const void *a,const void *b){
 int p=*(int*)a;
 int q=*(int*)b;
 return q-p;
}

int main(){
 int a[5];
 scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
 qsort(a,5,sizeof(int),comp);
 printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
 return 0;
}

Measured memory_bytes: 1028
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int x;
	int a,b,W;
	cin>>W>>a>>b;
	if (a<=b){
		x=b-(a+W);
	}else{
		x=a-(b+W);
	}
	if (x<0){
		x=0;
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma warning (disable :4996)
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-7
using namespace std;

ll ans;
ll r, c;
int main() {
	cin >> r >> c;
	if (r == 1 || c == 1) {
		cout << 1 << endl;
		return 0;
	}
	if (r % 2 == 0) {
		ans = (r / 2) * c;
		cout << ans << endl;
	}
	else {
		if (c % 2 == 0) {
			ans = (r / 2) * (c / 2) + (r / 2 + 1) * (c / 2);
			cout << ans << endl;
		}
		else {
			ans = (r / 2) * (c / 2) + (r / 2 + 1) * (c / 2 + 1);
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力

N = input()
anums = list(map(int, input().split()))

Ans = 0

for k, v in enumerate(anums):
  if k % 2 == 0:
    if v % 2 == 1:
      Ans += 1

print(Ans)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[SIZE];
int d[SIZE],u[SIZE],dn,now[SIZE],no_use[SIZE];
VI p[SIZE];
int main(){
    DRIII(N,M,Q);
    REP(i,Q)RI(a[Q-1-i]);
    int upup=1;
    REP(i,Q){
        p[a[i]].PB(i);
        if(!u[a[i]]){
            if(upup>=a[i])no_use[dn]=1;
            u[a[i]]=1;
            while(u[upup])upup++;
            d[dn++]=a[i];
        }
    }
    while(dn>0&&no_use[dn-1])dn--;
    MS1(now);
    REP(i,dn){
        int it=0;
        REP(j,N){
            while(it<SZ(p[d[i]])&&p[d[i]][it]<=now[j])it++;
            if(it>=SZ(p[d[i]])){
                puts("No");
                return 0;
            }
            now[j]=p[d[i]][it++];
        }
    }

    puts("Yes");
    return 0;
}


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

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

  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int ans1=a[0];
  int hf=a[0]/2;
  long dist=1234567890;
  int ans2=a[1];
  for(int i=1;i<N;i++){
    if(dist>abs(hf-a[i])){
      dist=abs(hf-a[i]);
      ans2=a[i];
    }
    }
cout<<ans1<<" "<<ans2<<endl;




  }


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

typedef pair<long long int,long long int>pa;
#define pb push_back 

long long int MAX= 200005;
long long int MOD=1e9+7;
long long int INF=1e18;


    
int main()
{
       ios_base::sync_with_stdio(false); 
       cin.tie(NULL);
       cout.tie(NULL);
     
       long long int i,j,k=0,l=0,r=0,m=0,n,p=0,cnt=0,cnt1=0,x=0,y,z,low,mid,high,ans=0,maxi=0,mini=INF,t;
      string s,s1;
    cin>>x>>y;
    if(x>=13)
    {
        cout<<y;
    }
    else if(x>=6)
    {
        cout<<y/2;
    }
    else
        cout<<0;
         
    
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    
    int count = 0;
    int c_b = b;
    while(c_b > 0){
        c_b /= 10;
        count++;
    }
    int ab = a * pow(10, count) + b;
    bool ans = false;
    for(int i = 0; i <= 316; i++){
        if(ab == i * i){
            ans = true;
            break;
        }
    }
    if(ans){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
}

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

#define pb push_back
#define F first
#define S second
#define rep(i,n) for(int i = 0; i < (n); i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = (1LL<<62);
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
        return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

int main()
{
    ll n , cnt = 0 , dem = 10;

    cin >> n;

    if(n&1){
        cout << "0\n";
        return 0;
    }

    while(dem <= n){
        cnt += n / dem;
        dem *= 5;
    }

    cout << cnt << "\n";

    return 0;
}


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


int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    int ans = 0;
    for (int i = 1; i < n-1; i++) {
        if ((p[i] > p[i-1]) & (p[i] < p[i+1])) {
            ans += 1;
        }else if ((p[i] < p[i-1]) & (p[i] > p[i+1])) {
            ans += 1;
        }else{
            ans += 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import exit

s = input()

if len(s)%2==1:
    print('No')
    exit()


for i in range(len(s)):
    if i%2==0:
        if s[i]!='h':
            print('No')
            exit()
    else:
        if s[i]!='i':
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 3060