akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;


int main(){

    string s; cin>>s;
    int paa=0;
    REP(i,s.size())if(s[i]=='p')paa++;
    
    cout<<s.size()/2-paa<<endl;
    
    return 0;
}

Measured memory_bytes: 640
from string import ascii_lowercase
alphabets = ascii_lowercase
s = input()
if len(s) < len(alphabets):
    for c in alphabets:
        if c not in s:
            print(s + c)
            exit()
if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    exit()

# 14253 next 143,  54213 next 5423, 35421 next 4, 43521 next 45
# 右端からみてi-1, iを比較して減少(S[i]>S[i-1])してたらi-1を基準に切り替える
# 切り替えるのは勘だけどi-1より右側でi-1より大きい最小のやつ？
for i in range(len(s) - 1, 0, -1):
    if s[i] > s[i - 1]:
        t = []
        for j in range(i, len(s)):
            if s[i - 1] < s[j]:
                t.append(s[j])
        x = min(t)
        print(s[:i - 1] + x)
        exit()


Measured memory_bytes: 9912
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = sum(b)
for i in range(1, n):
    if a[i] - 1 == a[i - 1]:
        s += c[a[i - 1] - 1]
print(s)

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

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

  stack<char> st;

  st.push(s[0]);
  for (int i = 1; i < n; i++) {
    if (st.empty()) {
      st.push(s[i]);
      continue;
    }
    char b = st.top();
    if (b == '(' && s[i] == ')') st.pop();
    else st.push(s[i]);
  }

  while (!st.empty())
  {
    if (st.top() == ')') s = '(' + s;
    else s = s + ')';
    st.pop();
  }
  
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
ans=n
for i in range(n+1):
    c=0
    t=i
    while(t>0):
        c+=(t%6)
        t=(t//6)
    t=n-i
    while(t>0):
        c+=(t%9)
        t=(t//9)
    if ans>c:
        ans=c
print(ans)

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

typedef long long ll;

ll t[101][101];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //Älä käytä, jos tehtävä on interaktiivinen!
    ll n;
    cin >> n;
    ll ans=0;
    for (int i=1; i<=n; ++i){
        string s;
        cin >> s;
        ll a=0;
        ll j=0;
        while (s[j]!='.' && j<s.size()){
            a*=10;
            a+=s[j]-'0';
            j++;
        }
        a*=1e9;
        //cout << i << " " << a << "\n";
        if (j!=s.size()){
            ll b=1e8;
            j++;
            while (j<s.size()){
                a+=(s[j]-'0')*b;
                b/=10;
                j++;
            }
        }
        //cout << i << " " << a << "\n";
        ll c=0;
        ll d=0;
        while (a%2==0){
            a/=2;
            c++;
        }
        while (a%5==0){
            a/=5;
            d++;
        }
        ll e, f;
        if (c>18) e=18;
        else e=c;
        if (d>18) f=18;
        else f=d;
        ans+=t[18-e][18-f];
        for (int j=0; j<=c; ++j){
            for (int k=0; k<=d; ++k){
                t[j][k]++;
            }
        }
    }
    cout << ans << "\n";
}





Measured memory_bytes: 3672
#include <iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
using namespace std;
typedef long long int ll;
#define EPS 1e-9
#define pb push_back
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
ll frog1(ll n,ll k,vector<ll> &h)
{
    vector<ll>dp(n+1,1e9);
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    //dp[3]=
    FOR(i,3,n+1)
    {
        //dp[i]=1e9;
        FOR(j,1,k+1)
        {
            if(i-j<1)
            {
                break;
            }
            ll ans=dp[i-j]+abs(h[i]-h[i-j]);
            if(ans<dp[i])
                dp[i]=ans;
        }
        //cout<<i;
    }
    /*FOR(i,1,n+1)
    {
        cout<<dp[i]<<" ";
    }
    cout<<endl;*/
    return dp[n];
}
int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;//k;
    cin>>n;//>>k;
    vector<ll>h(n+1,0);
    FOR(i,1,n+1)
        cin>>h[i];
    cout<<frog1(n,2,h)<<endl;
    return 0;
}

Measured memory_bytes: 1792
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}

#define lim 262145
#define maxval 51
int dp[lim][maxval];
bool done[lim][maxval];
int a[19][2];
int n;
int f(int bitmask, int mini)
{

	if(done[bitmask][mini]){return dp[bitmask][mini];}
	done[bitmask][mini]=1;
	int tot=__builtin_popcount(bitmask);
	bool tone=0;
	vector<int> pzros;pzros.push_back(0);
	int pres=0;
	for(int i=0;i<n-1;++i)
	{
		if((bitmask&(1<<i))==0){++pres;}
		pzros.push_back(pres);
	}
	for(int i=n-1;i>=0;--i)
	{
		if(bitmask&(1<<i)){tone=(!tone);continue;}
		pair<int,int> here={a[i][(0+tone+pzros[i])%2],a[i][(1+tone+pzros[i])%2]};
		if(here.x>=mini)
		{
			dp[bitmask][mini]=min(dp[bitmask][mini],f((bitmask|(1<<i)),here.x)+pzros[i]);
		}
	}
	return dp[bitmask][mini];
}
signed main()
{
	speed
	for (int i = 0; i < lim; ++i)
	{
		for (int j = 0; j < maxval; ++j)
		{
			done[i][j]=0;
			dp[i][j]=INT_MAX;
		}
	}
	cin>>n;
	int tlim=(1<<n)-1;
	for(int i=0;i<maxval;++i)
	{
		done[tlim][i]=0;
		dp[tlim][i]=0;
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i][0];
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i][1];
	}
	cout<<((f(0,0)>=INT_MAX)?-1:f(0,0));

}

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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

int H, W, N;
vector<vector<int>> ans(100,vector<int>(100,-1));

bool is_safe(int x, int y){
    if((0 <= x && x < W)&&(0 <= y && y < H)){
        return ans[y][x] == -1;
    }
    return false;
}

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

signed main(){
    cin >> H >> W >> N;

    queue<int> brush;
    reps(i,1,N){
        int a; cin >> a;
        rep(j,a) brush.push(i);
    }
    
    int x = 0, y = 0, dir = 0;
    rep(i, H*W){
        ans[y][x] = brush.front();
        brush.pop();
        if(!is_safe(x+dx[dir], y+dy[dir])){
            dir = (dir + 1) % 4;
        }
        x += dx[dir];
        y += dy[dir];
    }
    
    rep(i,H){
        rep(j,W) cout << (j ? " " : "") << ans[i][j];
        cout << endl;
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string a;
	cin >> a;
	int s = a.size();
	int ans = 0;
	for (int i = 0; i < 8; i++) {
		if (a.substr(0, i)+a.substr(s-(7-i),7-i)=="keyence")ans=1;
	}
	if (ans == 1)cout <<"YES"<<endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i;
  vector<int> vec(n);
  for(i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  cout << vec.at(n-1)-vec.at(0);
}


Measured memory_bytes: 256
n = input()
dlist = []
count = 0

for i in range(int(n)):
  d = input().split()
  dlist.append(d)

for j in range(int(n)):
  if dlist[j][0] == dlist[j][1]:
    count += 1
    if count == 3:
      break
  else:
    count = 0

if count == 3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9188
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){


    int N;
    cin >> N;

    int v1[100010]={};
    int v2[100010]={};


    if(N==2){
        int val1;
        int val2;
        cin >> val1;
        cin >> val2;
        if(val1==val2){
            cout << 1;
        }else{
            cout << 0;
        }

    }else{
        int val;
        for( int ni = 0 ; ni < N/2 ; ni++ ){
            cin >> val;
            v1[val]++;
            cin >> val;
            v2[val]++;
        }

        int r11=0,r12=0,r21=0,r22=0;
        int v11=0,v12=0,v21=0,v22=0;
        for( int ni = 1 ; ni <= 100000 ; ni++ ){
            if(v1[ni]>v11){
                v12 = v11;
                r12 = r11;

                v11 = v1[ni];
                r11 = ni;
            }else if(v1[ni]>v12){
                r12 = ni;
                v12 = v1[ni];
            }

            if(v2[ni]>v21){
                v22 = v21;
                r22 = r21;

                v21 = v2[ni];
                r21 = ni;
            }else if(v2[ni]>v22){
                r22 = ni;
                v22 = v2[ni];
            }
        }
        if(r11!=r21){
            cout << N - v11 - v21;
        }else{
            cout << min(N-v12-v21,N-v11-v22);
        }

    }





}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N; deque<int>dq;
    rep(i,N){
        int a; cin >> a;
        if(i%2==0)
        dq.push_back(a);
        else
        dq.push_front(a);
    }
    if(N%2!=0) reverse(dq.begin(),dq.end());
    rep(i,dq.size()){
        cout << dq[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3840
import sys
sys.setrecursionlimit(10**5)
n = int(input())
t = {i:{} for i in range(n)}
ans = [-1]*n
for _ in range(n-1):
    u ,v, w = map(int, input().split())
    t[u-1][v-1] = w
    t[v-1][u-1] = w


def dfs(x):
    for y in t[x]:
        del t[y][x]
        ans[y] = ans[x] if t[x][y] % 2 == 0 else 1 - ans[x]
        if len(t[y]) > 0:
            dfs(y)


ans[0] = 0
dfs(0)
for i in range(n):
    print(ans[i])

Measured memory_bytes: 94624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}    
ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}

int main() {
    int n,x,t;
    cin >> n >> x >> t;

    int total = (n+x-1)/x;
    cout << t * total << endl;
}

Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M := scanInt(), scanInt()
	A, B := make([]int, 0), make([]int, 0)
	for i := 0; i < M; i++ {
		a, b := scanInt(), scanInt()
		if a == 1 {
			B = append(B, b)
		}
		if b == N {
			A = append(A, a)
		}
	}

	sort.Ints(A)
	sort.Ints(B)
	i, j := 0, 0
	for i < len(A) && j < len(B) {
		if A[i] == B[j] {
			fmt.Println("POSSIBLE")
			return
		} else if A[i] < B[j] {
			i++
		} else {
			j++
		}
	}
	fmt.Println("IMPOSSIBLE")
}


Measured memory_bytes: 7668
N,K=parse.(Int,split(readline()))
A=parse.(Int,split(readline()))

B=zeros(Int,N)

function telepo(nokori,nowstep,A,B)
    if B[nowstep]==0
        B[nowstep]=nokori
    else
        nokori%=(B[nowstep]-nokori)
    end
    if nokori == 0
        print(A[nowstep])
    else
        telepo(nokori-1,A[nowstep],A,B)
    end
end
telepo(K-1,1,A,B)

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

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

struct edge
{
    int to;
    long long cost;
    edge(int x, long long y): to(x), cost(y) {}
};

template <typename T>
void dijkstra(int s, vector<T>& d, vector<vector<edge>>& G){
    d[s] = 0;

    priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> q;
    q.push({(T) 0, s});
    while(!q.empty()){
        auto tmp = q.top(); q.pop();
        T d_min = tmp.first;
        int v = tmp.second;
        if(d[v] < d_min) continue;
        for(auto e: G[v]){
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                q.push({d[e.to], e.to});
            }
        }
    }
}

const long long INF = 1e+18;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<edge>> G(N);
    for(int i = N-1; i > 0; --i) G[i].push_back({i-1, 0});
    REP(i, M){
        int L, R, C;
        cin >> L >> R >> C;
        --L, --R;
        G[L].push_back({R, C});
    }

    vector<long long> d(N, INF);
    dijkstra<long long>(0, d, G);
    if(d[N-1] == INF) cout << -1 << endl;
    else cout << d[N-1] << endl;

    return 0;
}

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

// a_n- b_n= (S_{n-1}- a_{n-1})- (S_{n-1}- b_{n-1})
//         = -(a_{n-1}- b_{n-1})
//         = (-1)^n (a_0- b_0)
int main(){
  int A0,B0,C0; int64_t K;
  cin >> A0 >> B0 >> C0 >> K;

  int ans= (K%2==0) ? A0- B0
                    : -(A0- B0);
  cout << ans << endl;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)

const int MOD = 1e9+7;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        public static List<long> GeneratePrime(long max)
        {
            long prime;
            double sqrtMax = Math.Sqrt(max);
            var primeList = new List<long>();

            List<long> searchList = new List<long>();
            for (long i = 2; i <= max - 1; i++)
            {
                searchList.Add(i);
            }

            do
            {
                prime = searchList.First();
                primeList.Add(prime);
                searchList.RemoveAll(n => n % prime == 0);
            } while (prime < sqrtMax);

            primeList.AddRange(searchList);

            return primeList;
        }

        void Omame()
        {
            cin = new Scanner();
            long N = cin.nextLong();

            var list = new List<long>();

            for (int i = 0; i < N; i++)
            {
                list.Add(cin.nextLong());
            }

            list[list.IndexOf(list.Max())] /= 2;

            Console.WriteLine(list.Sum());
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;
int main(void){
    
    int n,i,a[100];
    cin >> n;
    
    for(i=0;i<n;i++){
        cin >> a[i];
    }
   
    for(i=n-1;i>=0;i--){
        cout << a[i];
        if(i!=0) cout << " ";
        else cout << endl;
    }
    
}



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,C,K;
    cin >> N >> C >> K;
    auto T = InputVec(N);
    sort(T.begin(),T.end());
    queue<ll> q;
    q.push(T[0]);
    ll count = 0;
    for (int i = 1; i < N; ++i) {
        if(!q.empty() && q.front() + K < T[i]){
            count++;
            q = queue<ll>();
        }
        q.push(T[i]);
        if(q.front() + K <= T[i] || q.size() == C){
            count++;
            q = queue<ll>();
        }
    }
    if(!q.empty()){
        count++;
    }
    cout << count << endl;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int INF = 0x3f3f3f3f;
ll a[200012];
int main(){
	//IOS;
	ll k,sum=0,n;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	cin>>a[i];
	if(k>=n)
	{
		cout<<"0"<<endl;
	}else
	{
		sort(a,a+n);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>   
#define ll long long
#define sz size
#define pb push_back
#define x first
#define y second
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define int long long    
#define rc(s) return cout<<s,0
using namespace std;


int n;

signed main(){ 
    ios_base::sync_with_stdio(0);  cin.tie(); cout.tie();
    cin >> n;
    if(n==1) cout<<"Hello World";
    else{
        int a,b;
        cin >> a >> b;
        cout<<a+b;
    }
    
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String o = in.next();
            String e = in.next();
            for (int i = 0; i < e.length(); i++) {
                out.print(o.charAt(i));
                out.print(e.charAt(i));
            }
            if (o.length() != e.length())
                out.print(o.charAt(o.length() - 1));
            out.println();
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



Measured memory_bytes: 22868
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(){
    int n;
    cin >> n;
    int a;
    cin >> a;
    int k = n%500;
    if(k<=a)puts("Yes");
    else puts("No");
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

template <typename T>
inline T gi()
{
	T f = 1, x = 0; 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 f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1, mod = 1000000007;

LL n, a, b, x[N];

int main()
{
	//File("");
	n = gi <LL> (), a = gi <LL> (), b = gi <LL> ();
	for (int i = 1; i <= n; i+=1) x[i] = gi <LL> ();
	LL ans = 0;
	for (int i = 2; i <= n; i+=1) ans += min(b, (x[i] - x[i - 1]) * a);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4552
//=====================================================
// 
// (setq backup-inhibited t)
// (setq auto-save-default nil)
// 
// (column-number-mode t)
// (setq-default tab-width 2 indent-tabs-mode nil)
// 
// (global-set-key "\C-h" 'delete-backward-char)
// 
// (setq indent-line-function 'indent-relative-maybe)
// (global-set-key "\C-m" 'newline-and-indent)
// 
//=====================================================

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int combi[1024][1024];

void init() {
  REP(i,1023){
    REP(j,1023){
      combi[i][j] = 0;
    }
  }
  combi[0][0] = 1;
  REP(i,1023){
    REP(j,1023){
      combi[i+1][j] += combi[i][j];
      combi[i+1][j] %= 100000007;
      combi[i][j+1] += combi[i][j];
      combi[i][j+1] %= 100000007;
    }
  }
}

int main() {
  init();
  int r,c,a1,a2,b1,b2;
  cin >> r >> c >> a1 >> a2 >> b1 >> b2;
  b1 = (b1 + r - a1) % r;
  b2 = (b2 + c - a2) % c;
  b1 = min(b1, (r - b1) % r);
  b2 = min(b2, (c - b2) % c);
  int sum = combi[b1][b2];
  if (b1 == r - b1 && r != 1) sum *= 2;
  sum %= 100000007;
  if (b2 == c - b2 && c != 1) sum *= 2;
  sum %= 100000007;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 5260
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int n;
    cin>>n;
    string s=to_string(n);
    if(s[0]==s[1]&&s[1]==s[2]||s[1]==s[2]&&s[2]==s[3]){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans=0;
int check(int a)
{
	int u=0;
	for(int i=2;i*i<=a;i++)
	{
		if(a%i==0)
		{
			if(i*i==a) return 0;
			else u++;
		}
		if(u>3) return 0;
	}
	if(u==3) return 1;
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int i=1;
	while(i<=n)
	{
		ans+=check(i);
		i+=2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }
void printint(uint32_t x){ if(x<0){x=-x; putchar_unlocked('-');}else if(x==0){putchar_unlocked('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar_unlocked(s[i]); putchar_unlocked('\n'); }
void rsort_str(void *base, const int count, const int size);

char str[200000][11];

int main(void){
	uint32_t n=nextpint();
	for(uint32_t i=0; i<n; i++){
		nextstr(str[i]);
	}
	rsort_str(str, n, 11);
	uint32_t ans=1;
	for(uint32_t i=1; i<n; i++){
		if(strcmp(str[i], str[i-1])) ans++;
	}
	printint(ans);
}

void rsort_str(void *base, const int count, const int size){
	char (*a)[size]=base;
	char (*b)[size]=malloc(count*size);
	int c[0x100];
	for(int j=size-1; j>=0; j--){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[a[i][j]]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ memcpy(&b[--c[a[i][j]]], a[i], size); }{void *t=a; a=b; b=t;}
	}
	if((size&1)==0){
		free(b);
	}else{
		memcpy(b, a, count*size);
		free(a);
	}
}


Measured memory_bytes: 5564
x  = int(input())
lis = list(map(int,input().split()))
it = 0
count = 0
for i in range(len(lis)):
    for j in range(len(lis)-i):
   	    if lis[len(lis)-1-i]>=lis[len(lis)-1-j-i]:
   	        it = it + 1
   	    else:
   	        break
    if it==(len(lis)-i):
        count+=1
    it = 0    
print(count)    

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

typedef long long ll;

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

int main(){
	int T;
	scanf("%d",&T);
	for(;T>0;T--){
		ll A,B,C,D;
		scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
		if(B > D || A < B){
			puts("No");
			continue;
		}
		ll g = gcd(B,D);
		if(A%g > C%g)C -= g;
		if(C < 0)C = -1;
		else C /= g;
		B /= g;
		if(C+1 >= B)puts("Yes");
		else puts("No");
	}
}



Measured memory_bytes: 256
require 'prime'
h = {}
n = gets.chomp.to_i
t = gets.chomp.split.map(&:to_i)
t.reverse!
dl = 2
ul = 2
bc = 2
t.each do |d|
  dl = d*((dl+(d-1))/d)
  if(ul < dl)
    puts -1
    exit
  end
  ul = d + d*(ul/d) -1
  bc = d
end

puts "#{dl} #{ul}"

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

struct edge { int to, cost; };
typedef pair<int, int> P;
typedef pair<string, int> SP;
#define rep(i, n) for(int i = 0; i < n; ++i)

const int INF = 1e9 + 7;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // vvvi V (50, vvi(50, vi(2500)));

    int R;
    cin >> R;
    printf("%f\n", 2*M_PI*R);

    return 0;
}

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

int main() {
  int n, x;
  cin >> n >> x;
  int m[n];
  
  int c = 0;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    if(x - m[i] < 0) break;
    x -= m[i];
    c++;
  }
  
  if (x > 0) {
    sort(m, m + n);
    c = c + x / m[0];
  }
  
  cout << c << endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

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

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int limit = 100010;
vector<int> graph[limit];

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

	vector<int> d(n), a(m), b(m);

	using pii = pair<int, int>;
	vector<pii> dary;

	rep(i, n){
		cin >> d[i];
		dary.push_back(pii(d[i], i));
	}

	sort(begin(dary), end(dary));

	rep(i, m) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		graph[a[i]].push_back(i);
		graph[b[i]].push_back(i);
	}

	const int wmax = 1000000000;

	bool has_ans = true;
	string ans_color = string(n, '#');
	vector<int> ans_weight(m, wmax);


	for(auto &it: dary) {
		const int w = it.first;
		const int v = it.second;

		if (ans_color[v] != '#') continue;
		bool ok = false;

		for(auto &idx: graph[v]) {
			const int u = v ^ a[idx] ^ b[idx];

			if(ans_color[u] != '#' or w == d[u]) {
				if(w == d[u]) {

					if (ans_color[u] == '#') {
						ans_color[u] = 'W';
					}

					ans_color[v] = 'W' ^ 'B' ^ ans_color[u];
					ans_weight[idx] = w;

				} else {
					ans_color[v] = ans_color[u];
					ans_weight[idx] = w - d[u];
				}

				ok = true;
				break;
			}
		}

		if(ok == false) has_ans = false;
	}

	if(has_ans) {
		cout << ans_color << endl;
		for(auto &elem: ans_weight) {
			cout << elem << endl;
		}
	} else {
		cout << -1 << endl;
	}

	return 0;
}

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

int main(){
int N;
int i,a[3];
  scanf("%d",&N);
  a[0] = N/100;
  a[1] = N/10;
  a[2] = N%10;
  if(a[0]==a[2]){
    printf("Yes");
  }else{
    printf("No");
    }
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	ll N;
	cin >> N;
	vector<ll> D;
	for(int i = 1; i <= sqrt(N); i ++){
		if(N%i == 0){
			D.pb(i);
			if(i != N / i)D.pb(N / i);
		}
	}
	ll dsize = D.size();
	ll ans = 0;
	for(int i = 0; i < dsize; i ++){
		//cout << D[i] << endl;
		if(0 <= N / D[i] && N / D[i] < D[i] - 1){
			ans += D[i] - 1;
			//cout << D[i] << endl;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1e9+7;
const int INF=1e9;
const ll LINF=(ll)1e18;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1)res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

struct Combination{
    vector<ll> fac,finv,inv;
    Combination(int mx){init(mx);}
    void init(int mx){
        fac.resize(mx+1);
        finv.resize(mx+1);
        inv.resize(mx+1);
        fac[0]=fac[1]=1;
        finv[0]=finv[1]=1;
        inv[1]=1;
        for(int i=2;i<=mx;i++){
            fac[i]=fac[i-1]*i%MOD;
            inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
            finv[i]=finv[i-1]*inv[i]%MOD;
        }
    }
    ll calc(int n,int k){
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
    }
};

int main(){
    int b,w;
    cin>>b>>w;
    ll half=modpow(2,MOD-2);
    ll s=0,t=0;
    Combination comb(b+w);
    for(int i=1;i<=b+w;i++){
        ll ans=(half+half*s-t*half)%MOD;
        cout<<(ans+MOD)%MOD<<endl;
        if(i>=w){
            s=(s+comb.calc(i-1,w-1)*modpow(half,i))%MOD;
        }
        if(i>=b){
            t=(t+comb.calc(i-1,b-1)*modpow(half,i))%MOD;
        }
    }
}


Measured memory_bytes: 6912
import math
a,b,x = map(int,input().split())
if x > a*a*b/2:
    tan = 2*(a*a*b - x)/(a*a*a)
elif x <= a*a*b/2:
    tan = a*b*b/(2*x)
print(math.degrees(math.atan(tan)))

Measured memory_bytes: 9296
#include<stdio.h>

int main(void)
{
	int a, b;
	for ( ; ; )
	{
		scanf("%d", &a);
		if (a == 0)
			return 0;
		b = 0;
		for ( ; a != 1; )
		{
			if (a % 2 == 0)
				a /= 2;
			else
				a = a * 3 + 1;
			b++;
		}
		printf("%d\n", b);
	}
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,j,k) for(int i=j;i<k;i++)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
#define mp make_pair
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
const int  COMMAX = 510000;

long long fac[COMMAX], finv[COMMAX], inv[COMMAX];

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcd(int a,int b){return a*b / gcd(a,b);}
// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < COMMAX; 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(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind {
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
  vector<int> rank;
  int num;
  UnionFind(int N) : par(N) , rank(N) { //最初は全てが根であるとして初期化
    num = N;
    for(int i = 0; i < N; i++){
      par[i] = i;
      rank[i] = 0;
    }
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    if(rank[rx] < rank[ry]){
      par[rx] = ry;  
    }else{
      par[ry] = rx;
      if(rank[rx] == rank[ry])rank[rx]++;
    }
    num--;
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    return root(x) == root(y);
  }
};

const int MS = 2;
const long long mod[] = {999999937LL, 1000000007LL}, base = 9973;
struct rolling_hash {
    int n;
    vector<long long> hs[MS], pw[MS];
    rolling_hash(){}
    rolling_hash(const string &s) {
        n = s.size();
        for (int i = 0; i < MS; i++) {
            hs[i].assign(n+1,0);
            pw[i].assign(n+1,0);
            hs[i][0] = 0;
            pw[i][0] = 1;
            for (int j = 0; j < n; j++) {
                pw[i][j+1] = pw[i][j]*base%mod[i];
                hs[i][j+1] = (hs[i][j]*base+s[j])%mod[i];
            }
        }
    }

    long long hash(int l, int r, int i) { return ((hs[i][r]-hs[i][l]*pw[i][r-l])%mod[i]+mod[i])%mod[i]; }

    bool match(int l1, int r1, int l2, int r2) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l1,r1,i)==hash(l2,r2,i);
        return ret;
    }

    bool match(int l, int r, long long h[]) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l,r,i)==h[i];
        return ret;
    }
};

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,0,n)cin >> v[i];
  sort(all(v));
  bool flag = false;
  rep(i,0,n-1)if(v[i] == v[i+1])flag = true;
  cout << (flag?"NO":"YES") << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A,B,C,D,area1,area2;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	area1=A*B;
	area2=C*D;
	if(area1>area2)
		printf("%d",area1);
		else
		printf("%d",area2);
	
	return 0;
	
}


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

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

using namespace std;

int main() {
    vector<vector<int>> bingo(3, vector<int>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> bingo.at(i).at(j);
        }
    }

    int n;
    cin >> n;

    int b;
    rep(i, n) {
        cin >> b;

        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (bingo.at(j).at(k) == b) {
                    bingo.at(j).at(k) = 0;
                }
            }
        }
    }

    if ((bingo.at(0).at(0) == 0 && bingo.at(0).at(1) == 0 && bingo.at(0).at(2) == 0) ||
        (bingo.at(1).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(1).at(2) == 0) ||
        (bingo.at(2).at(0) == 0 && bingo.at(2).at(1) == 0 && bingo.at(2).at(2) == 0) ||
        (bingo.at(0).at(0) == 0 && bingo.at(1).at(0) == 0 && bingo.at(2).at(0) == 0) ||
        (bingo.at(0).at(1) == 0 && bingo.at(1).at(1) == 0 && bingo.at(2).at(1) == 0) ||
        (bingo.at(0).at(2) == 0 && bingo.at(1).at(2) == 0 && bingo.at(2).at(2) == 0) ||
        (bingo.at(0).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(2).at(2) == 0) ||
        (bingo.at(2).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(0).at(2) == 0)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    int n,k;
    cin >> n >> k;
    int res = k;
    rep(i,n-1) {
        res *= k-1;
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 1e5 + 10;
int N;
int A[MAXN];
int cnt[MAXN];
int X1, X2, c1, c2, Y1, Y2;

int main() {
	register int i;
	scanf("%d", &N);
	for(i = 1; i <= N; ++i)
		scanf("%d", A + i);
	for(i = 1; i <= N; i += 2) {
		++cnt[A[i]];
		if(A[i] != X1 && cnt[A[i]] > cnt[X1])
			X2 = X1, X1 = A[i];
		else
			if(A[i] != X1 && A[i] != X2 && cnt[A[i]] > cnt[X2])
				X2 = A[i];
	}
	c1 = cnt[X1], c2 = cnt[X2];
	memset(cnt, 0, sizeof(cnt));
	for(i = 2; i <= N; i += 2) {
		++cnt[A[i]];
		if(A[i] != Y1 && cnt[A[i]] > cnt[Y1])
			Y2 = Y1, Y1 = A[i];
		else
			if(A[i] != Y1 && A[i] != Y2 && cnt[A[i]] > cnt[Y2])
				Y2 = A[i];
	}
	if(X1 != Y1) printf("%d\n", N - c1 - cnt[Y1]);
	else if(c2 + cnt[Y1] > c1 + cnt[Y2]) printf("%d\n", N - c2 - cnt[Y1]);
	else printf("%d\n", N - c1 - cnt[Y2]);
	return 0;
}

Measured memory_bytes: 896
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var n2 = n << 1;
        var a = new int[n2];
        var asum = 0L;
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(Console.ReadLine().Trim());
            a[i + n] = a[i];
            asum += a[i];
        }
        var b = new long[n2 + 1];
        for (int i = 1; i <= n2; i++) b[i] = b[i - 1] + a[i - 1];
        var ans = getAns(b, n, asum);
        Console.WriteLine(ans);
    }
    static long getAns(long[] a, int n, long asum)
    {
        var ok = 1L; var ng = long.MaxValue;
        while (ng - ok > 1L)
        {
            var mid = ok + ((ng - ok) >> 1);
            if (checkMin(a, asum, n, mid)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
    static bool checkMin(long[] a, long asum, int n, long t)
    {
        var nextp = 0;
        for (int i = 0; i < n; i++)
        {
            var p = LowerBound(a, i + 1, i + n, t + a[i]);
            var sum1 = a[p] - a[i];
            if (sum1 >= t) nextp = p + 1;
            else continue;
            var p2 = LowerBound(a, nextp, i + n, t + a[p]);
            var sum2 = a[p2] - a[p];
            if (sum2 < t) continue;
            if (asum - sum1 - sum2 >= t) return true;
        }
        return false;
    }
    public static int LowerBound(long[] arr, int start, int end, long value)
    {
        int low = start;
        int high = end;
        while (low < high)
        {
            var mid = ((high - low) >> 1) + low;
            if (arr[mid] - value < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}




Measured memory_bytes: 23912
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6
const lli MAX=1e9+7;
 
int main()
{
    fast;
    int n,d;
    cin>>n>>d;
    vector<lli> x(n), y(n);
    int cnt=0;
    for(int i=0; i<n; i++){
        cin>>x[i]>>y[i];
        lli r=(x[i]*x[i])+(y[i]*y[i]);
        long double dis=sqrtl(r);
        if(dis<=(long double)(d)){ cnt++;}
    }
    cout<<cnt<<"\n";
    return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[100005][4],a,b,c,n;
main () {
	cin>>n;
	for (ll i=1; i<=n; i++) {
		cin>>a>>b>>c;
		dp[i][3]=max(dp[i-1][1],dp[i-1][2])+c;
		dp[i][2]=max(dp[i-1][1],dp[i-1][3])+b;
		dp[i][1]=max(dp[i-1][3],dp[i-1][2])+a;
	}
	cout<<max(max(dp[n][1],dp[n][2]),dp[n][3])<<endl;
}

Measured memory_bytes: 3328
#include<stdio.h>
 
int main(){
  int g[101][101],a[101],f[101],n,i,j,k=1,m=0,num,sum=0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&g[i][j]);
    }
  }
   
  a[0]=0;
  f[0]=1;
   
  for(i=1;i<n;i++) f[i]=0;
   
  while(1){
    num=2000;
     
    for(i=0;i<k;i++){
      for(j=0;j<n;j++){
    if(g[a[i]][j]<num && g[a[i]][j]!=-1 && f[j]!=1){
      num=g[a[i]][j];
      m=j;
    }
      }
    }
     
    if(k!=n){
      a[k]=m;
      f[m]=1;
      sum+=num;
      k++;
    }
    else break;
  }
  printf("%d\n",sum);
   
  return 0;
}

Measured memory_bytes: 640