akhauriyash/Code-Regression huggingface dataset:
///////////////////////////////
// Template By: Agus Sentosa //
//       17 - 5 - 2014       //
///////////////////////////////
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <climits>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <utility>

//I/O
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <istream>
#include <ostream>

//Data Type
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <bitset>

//Data Type
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define LL long long
#define ULL unsigned long long

//Data Type Properties
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define popb pop_back

//Macro
#define sqr(x) ((x) * (x))
#define all(v) (v).begin(),(v).end()
#define sortv(v) sort(all(v))
#define num(x) ((x)-'0')
#define ch(x) ((x)+'0')
#define bit_count __builtin_popcount
#define bit_countll __builtin_popcountll
#define THIS (*this)

//Output
#define endl '\n'

//Compiling & Debugging
#ifdef DEBUG
#define DO_IF_DEBUG_FLAG_IS_ON 1
#else
#define DO_IF_DEBUG_FLAG_IS_ON 0
#endif
#define DoDebug if(DO_IF_DEBUG_FLAG_IS_ON)

//???????????????????
#define Fokus using
#define Tahun_Terakhir namespace std;

Fokus Tahun_Terakhir;

#ifdef _WIN32
#define getchar_unlocked getchar
#endif
#define g getchar_unlocked
template<class T>
bool io(T &res){
    static char c=' ';
    while(c == ' ' || c == '\n')c = g();
    if(c == -1)return 0;
    res = num(c);
    while((c=g()) && c != ' ' && c != '\n' && c!=-1){ res = (res << 3) + (res << 1) + num(c); }
    return 1;
}

template<class T>
string inttostr(T x){
    string res="";
    while(x){
        char t=ch(x%10); x/=10; res=t+res;
    }
    return res;
}

template<class T>
T strtoint(string x){
    T res=0;
    for(int i=0;i<x.size();i++){
        res=(res<<3)+(res<<1)+num(x[i]);
    }
    return res;
}
void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}
void close(){
    fclose(stdin);
    fclose(stdout);
}

//Constant
#define INF 1000000007
#define LINF 1000000000000000007ll
#define DINF 1000000000000000007.00
#define INV (-INF)
#define LINV (-LINF)
#define DINV (-DINF)
#define EPS 1e-9
#define MOD 1000000007
///////////////////////////////
//      End of Template      //
///////////////////////////////

LL arr[2005]; 

int main(){
	ios::sync_with_stdio(0);
	
	int n; cin >> n;
	LL x; cin >> x;
	
	for(int i = 1 ; i <= n ; i ++)
		cin >> arr[i];
		
	LL ret = LINF;
	for(int t = 0 ; t < n ; t ++){
		priority_queue<pii> pq;
		LL res = (LL)t * x;
		
		for(int i = 0 ; i < t ; i ++){
			pq.push({-arr[n-i], -i});
		}
		
		for(int i = 1 ; i <= n ; i ++){
			pq.push({-arr[i], i});
			while(pq.top().s < i - t)pq.pop();
			res -= pq.top().f;
		}
		ret = min(ret, res);
	}
	
	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
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>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=1e5+5;
const int M=1e9+7;
void solve()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int sum=min(a,k);
	k-=a;
	if(k>0)
	{
		k-=b;
		if(k>0)
		{
			sum-=k;
		}
	}
	cout<<sum;
}

signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}




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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int t1 = A/D;
  int t2 = C/B;
  if(A%D){
    ++t1;
  }
  if(C%B){
    ++t2;
  }
  if(t1>=t2){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3676
/*Lower_Rating*/
/*AGC035 degree*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;

#define LL long long
#define DB double
#define MAXN 800000
#define MOD 998244353
#define Pr pair<LL,int>
#define X first
#define Y second
#define INF 2000000000
#define mem(x,p) memset(x,p,sizeof(x))


LL read(){
  LL 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<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}
int add(int x,int y){return (x+y>=MOD)?x+y-MOD:x+y;}
int dec(int x,int y){return (x-y<0)?x-y+MOD:x-y;}
int mul(int x,int y){return 1LL*x*y%MOD;}

int n,m,du[MAXN+5],F;
vector<Pr> G[MAXN+5],ans;
int dir[MAXN+5],vis[MAXN+5];
void dfs(int x){
    vis[x]=1;
    for(int i=0;i<G[x].size();i++){
        int nxt=G[x][i].X;
        if(vis[nxt])continue;
        dfs(nxt);
    }
    int R=du[x]%2;
    for(int i=0;i<G[x].size();i++)
    if(!dir[G[x][i].Y]){
        if(R){ans.push_back(Pr(G[x][i].X,x));dir[G[x][i].Y]=1,R--;}
        else {ans.push_back(Pr(x,G[x][i].X));dir[G[x][i].Y]=1,du[G[x][i].X]--;}
    }
    if(R)F=1;
}
int main()
{
    n=read(),m=read();
    for(int i=1;i<=m;i++){
        int u=read(),v=read();
        G[u].push_back(Pr(v,i));
        G[v].push_back(Pr(u,i));
        du[u]++,du[v]++;
    }
    dfs(1);
    if(F)printf("-1\n");
    else{
        for(int i=0;i<ans.size();i++)
        printf("%d %d\n",ans[i].X,ans[i].Y);
    }
}


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

using namespace std;

int main() {
    int n, q, op, t, x;
    cin>>n>>q;
    priority_queue<int> pq[n];
    while (q--) {
        cin>>op>>t;
        if (op == 0)
        {
            cin>>x;
            pq[t].push(x);
        }
        else if (op == 1)
            {
                if (!pq[t].empty()) cout<<pq[t].top()<<endl;
            }
        else {
            if (!pq[t].empty()) pq[t].pop();
            }
        }
    return 0;
}



Measured memory_bytes: 4024
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }
int N;
bool check(const vector<P> &v)
{
    ll times = 0;
    for(int i = 0; i < v.size(); i++)
    {
        times += v[i].second;
        if(times > v[i].first) return false;
    }
    return true;
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<P> v;
    for(int i = 0; i < N; i++)
    {
        ll a, b; cin >> a >> b;
        v.push_back(P(b, a));
    }
    sort(v.begin(), v.end());
    if(check(v)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 6384
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N=0,M=0,C=0;
  int i=0,j=0,k=0,count=0;
  int index;
  cin >> N >> M >> C;
  vector <vector <int> > a(N,vector<int>(M,0));
  vector <int> b(M,0);
  vector <int> sum(N,0);
  for(i = 0;i < M;i++){
    cin >> b[i];
  }
  
  for(i=0;i<N;i++){
    for(j=0;j<M;j++){
      cin >> a[i][j];
      sum[i] = sum[i]+a[i][j]*b[j];
    }
  }
  for(i=0;i<N;i++){
    if(sum[i] + C > 0){
      count = count+1;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  int n;
  cin>>n;
  long long int ans=1;
  vector<long long int> sum(1001,1);
  for(int i=1; i<=n; i++){
    long long int count=0;
    int pre=i;
    for(int j=2; j<=n; j++){
      if(pre%j==0){
        count++;
        pre/=j;
        j--;
      }else{
        sum.at(j)+=count;
        count=0;
      }
    }
  }
  for(int i=0; i<=n; i++){
    ans*=sum.at(i);
    ans%=1000000007;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		String a = sc.next();
		int count = 0;

		for (int i = 0; i < 4; i++) {
			if (a.charAt(i) == '+')
				count++;
			else
				count--;
		}

		System.out.println(count);

	}
}

Measured memory_bytes: 21588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedHashMap;
import java.util.Map;

public class Main {
	private static enum GRADE_POINT_AVERAGE {
		A, B, C, D, F;
	}

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String[] inputData = null;
		int sum = 0;
		int testConductor = 0;
		Map<Integer, GRADE_POINT_AVERAGE> grades = new LinkedHashMap<>();

		while (true) {
			inputData = (input.readLine()).split("\\s");
			if(judgeEnd(inputData)) {
				break;
			}
			testConductor++;
			sum = Integer.parseInt(inputData[0]) + Integer.parseInt(inputData[1]);
			if (sum < 30 || (Integer.parseInt(inputData[0]) == -1 || Integer.parseInt(inputData[1]) == -1)) {
			    grades.put(testConductor, GRADE_POINT_AVERAGE.F);
			} else if (sum >= 80) {
			    grades.put(testConductor, GRADE_POINT_AVERAGE.A);
			} else if (sum >= 65 && sum < 80) {
			    grades.put(testConductor, GRADE_POINT_AVERAGE.B);
			} else if (sum >= 50 && sum < 65) {
			    grades.put(testConductor, GRADE_POINT_AVERAGE.C);
			} else if (sum >= 30 && sum < 50) {
				if (Integer.parseInt(inputData[2]) >= 50) {
				  grades.put(testConductor, GRADE_POINT_AVERAGE.C);
				} else {
				  grades.put(testConductor, GRADE_POINT_AVERAGE.D);
				}
			}
		}
		// 表示
		for (Map.Entry<Integer, GRADE_POINT_AVERAGE> grade : grades.entrySet()) {
			System.out.println(grade.getValue());
		}
	}

	public static boolean judgeEnd (String[] inputData) {
		boolean judgeEnd = false;
		int countEnd = 0;
		for (String input : inputData) {
			if(("-1").equals(input)) {
				countEnd++;
			}
		}
		if (countEnd == inputData.length) {
			judgeEnd = true;
		}
		return judgeEnd;
	}

}



Measured memory_bytes: 24536
l=list(map(int,input().split()))
l.sort()
a=l[0]
b=l[1]
c=l[2]

ans=0
while a<c-1:
  a+=2
  ans+=1
while b<c-1:
  b+=2
  ans+=1
  
if a==c and b==c:
  print(ans)
elif a!=c and b!=c:
  print(ans+1)
else:
  print(ans+2)


Measured memory_bytes: 3060
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    public static IO IO = new IO();
    static void Main(string[] args)
    {
        int n = IO.INT();
        int[] m = IO.INT(' ');
        int c = 0;

        for (int i = n; i > 0; i--)
        {
            for (int j = 1; j < i; j++)
            {
                if (m[j - 1] > m[j])
                {
                    int buf = m[j];
                    m[j] = m[j - 1];
                    m[j - 1] = buf;
                    c++;
                }
            }
        }
        IO.WRITE(string.Join(" ", m.Select(s => s.ToString()).ToArray()));
        IO.WRITE(c);
        IO.FLUSH();
    }
}

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private StringBuilder S = new StringBuilder();
        private T R<T>(Func<string, T> f) { return f(Console.ReadLine()); }
        private T[] R<T>(Func<string, T> f, char c) { return STRING().Split(c).Select(f).ToArray(); }
        private T[] R<T>(Func<string, T> f, int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R(f); } return r; }
        private T[][] R<T>(Func<string, T> f, int l, char c) { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R<T>(f, c); } return r; }
        private void W<T>(Func<T, string> f, T v, bool lf = true) { S.Append(f(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { FLUSH(); } }
        public string STRING() { return R(s => s); }
        public string[] STRING(char c) { return R(s => s, c); }
        public string[] STRING(int l) { return R(s => s, l); }
        public string[][] STRING(int l, char c) { return R(s => s, l, c); }
        public int INT() { return R(int.Parse); }
        public int[] INT(char c) { return R(int.Parse, c); }
        public int[] INT(int l) { return R(int.Parse, l); }
        public int[][] INT(int l, char c) { return R(int.Parse, l, c); }
        public long LONG() { return R(long.Parse); }
        public long[] LONG(char c) { return R(long.Parse, c); }
        public long[] LONG(int l) { return R(long.Parse, l); }
        public long[][] LONG(int l, char c) { return R(long.Parse, l, c); }
        public double DOUBLE() { return R(double.Parse); }
        public double[] DOUBLE(char c) { return R(double.Parse, c); }
        public double[] DOUBLE(int l) { return R(double.Parse, l); }
        public double[][] DOUBLE(int l, char c) { return R(double.Parse, l, c); }
        public void WRITE(string s, bool lf = true) { W(v => v, s, lf); }
        public void WRITE(int s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void WRITE(long s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void WRITE(double s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void FLUSH() { Console.Write(S); S.Length = 0; }
    }
}

Measured memory_bytes: 9700
input()
pp = list(map(int, input().split()))
sorted_pp = sorted(pp)
flag = False
if pp == sorted_pp:
    print('YES')
else:
    for i in range(len(pp) - 1):
        for j in range(len(pp) - 1 - i):
            ppp = pp.copy()
            ppp[i] = pp[j + 1 + i]
            ppp[j + 1 + i] = pp[i]
            if ppp == sorted_pp:
                flag = True
                break
    if flag:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
struct edge{int to;ll cost;};
typedef pair<ll,int> P;
const ll INF=1000000000000LL;
const ll MOD=1000000007LL;
const ll MAX=100010;
int main(){
	int v,e;
	cin>>v>>e;
	ll d[110][110];
	for(int i=0;i<=v;i++){
		for(int j=0;j<=v;j++){
			if(i==j){
				d[i][j]=0;
			}else{
				d[i][j]=INF;
			}
		}
	}
	for(int i=0;i<e;i++){
		int s,t;
		ll dd;
		cin>>s>>t>>dd;
		d[s][t]=min(d[s][t],dd);
	}
	for(int k=0;k<v;k++){
		for(int i=0;i<v;i++){
			for(int j=0;j<v;j++){
				if(d[i][k]!=INF&&d[k][j]!=INF){
					d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
				}
			}
		}
	}
	for(int i=0;i<v;i++){
			if(d[i][i]<0){
				cout<<"NEGATIVE CYCLE"<<endl;
				return 0;
			}
	}
	for(int i=0;i<v;i++){
		for(int j=0;j<v;j++){
			if(d[i][j]==INF){
				cout<<"INF";
			}else{
				cout<<d[i][j];
			}
			if(j!=v-1){
				cout<<" ";
			}
		}
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3200
#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));}

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 = 200010;
vector<int> events[limit];

template <int depth>  struct Segment_tree {
const static int h = depth;
const static int n = 1 << h;

using T = long long;
T data[2 * n], lazy[2 * n];
const T out = 0;

inline T vmerge(T l, T r) {return max(l, r);}

void init() {
	fill_n(data, 2 * n, out);
	fill_n(lazy, 2 * n, out);
}

	// lazy_evaluation
void apply(T v, int p, int l, int r) {
	data[p] += v;
	lazy[p] += v;
}

void push(int p, int l, int r) {
	const int m = (l + r) / 2;
	if (lazy[p] == out) return;
	apply(lazy[p], 2 * p + 1, l, m);
	apply(lazy[p], 2 * p + 2, m, r);
	lazy[p] = out;
}

void range_update(int a, int b, T x, int k = 0, int l = 0, int r = n) {
	if (r <= a or b <= l) return;
	if (a <= l and r <= b) return apply(x, k, l, r);
	push(k, l, r);
	const int m = (l + r) / 2;
	range_update(a, b, x, k * 2 + 1, l, m);
	range_update(a, b, x, k * 2 + 2, m, r);
	data[k] = vmerge(data[k * 2 + 1], data[k * 2 + 2]);
}

T range_query(int a, int b, int k = 0, int l = 0, int r = n) {
	if (r <= a or b <= l) return out;
	if (a <= l and r <= b) return data[k];
	push(k, l, r);
	const int m = (l + r) / 2;
	T vl = range_query(a, b, k * 2 + 1, l, m);
	T vr = range_query(a, b, k * 2 + 2, m, r);
	return vmerge(vl, vr);
}
};

Segment_tree<18> seg;

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

	int ans = max(0,n - m);

	rep(i,n){
		int l,r;
		cin >> l >> r;
		events[l].push_back(r);
	}

	rep(l,1,m+1){
		const int cur = m + 1 - l;
		seg.range_update(l,l + 1, -cur);
	}

	for(auto &r:events[0]){
		seg.range_update(0, r + 1, 1);
	}

	chmax<int>(ans, seg.range_query(1, m + 2));	

	rep(l,1,m+1){
		for(auto &r:events[l]){
			seg.range_update(0, r + 1, 1);
		}

		chmax<int>(ans, seg.range_query(l + 1 ,m + 2) - l);
	}

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

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N);
  vector< int > a(N);
  vector< int > b(N);
  vector< int > c(N);
  REP(i, N) {
    cin >> a[i];
  }
  REP(i, N) {
    cin >> b[i];
  }
  REP(i, N) {
    cin >> c[i];
  }

  sort(ALL(a));
  sort(ALL(b));
  sort(ALL(c));

  ll ans = 0ll;
  REP(bi, N) {
    ll tmp = 0ll;
    tmp += N - (upper_bound(ALL(c), b[bi]) - c.begin());
    // debug(b[bi]);
    // debug(tmp);
    tmp *= (lower_bound(ALL(a), b[bi]) - a.begin());

    // debug(bi);
    // debug(tmp);
    ans += max(tmp, 0ll);
  }
  cout << ans << endl;

  

  return 0;
}



Measured memory_bytes: 1408
#include<iostream>
#include<climits>
#include<cstring>
using namespace std;

int helper(int arr[], int n, int i,int dp[]) {
	if (i == n - 1)
		return 0;
	if (i >= n)
		return INT_MAX;
	
	if(dp[i]!=-1)
	  return dp[i];

	int ansFromJump2 = INT_MAX;
	int ansFromJump1 = abs(arr[i] - arr[i + 1]) + helper(arr, n, i + 1,dp);
	if (i + 2 < n)
		ansFromJump2 = abs(arr[i] - arr[i + 2]) + helper(arr, n, i + 2,dp);

	return dp[i] = min(ansFromJump1, ansFromJump2);

}

int main() {
	int n;
	cin >> n;
	int arr[100005];
	for (int i = 0; i < n; i++)
		cin >> arr[i];

    int dp[100005];
    memset(dp,-1,sizeof dp);
	cout << helper(arr, n, 0,dp) << endl;

	return 0;
}

Measured memory_bytes: 12184
use core::cmp::max;
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: usize,
        k: usize,
        r: usize,
        s: usize,
        p: usize,
        mut t: Chars,
    }

    
    let mut sub_strs: Vec<Vec<char>> = vec![vec![]; k];
    
    let mut index = 0;
    'outer: loop {
        for i in 0..k {
            sub_strs[i].push(t[index]);
            if index == n-1 {
                break 'outer;
            }
            index+=1;
        }
    }

    let mut point = 0;
    for sub_str in &sub_strs {
        let sub_len = sub_str.len();
        let mut dp = vec![vec![0; sub_len]; 3];

        match sub_str[0] {
            'r' => dp[2][0] = p,
            's' => dp[0][0] = r,
            'p' => dp[1][0] = s,
            _ => {}
        }
        for i in 1..sub_len {
                dp[0][i] = max(dp[1][i-1], dp[2][i-1]) + if sub_str[i] == 's' {
                    r
                } else {
                    0
                };
                dp[1][i] = max(dp[2][i-1], dp[0][i-1]) + if sub_str[i] == 'p' {
                    s
                } else {
                    0
                };
                dp[2][i] = max(dp[0][i-1], dp[1][i-1]) + if sub_str[i] == 'r' {
                    p
                } else {
                    0
                };
        }

        //println!("sub point {}",max(max(dp[0][sub_len-1], dp[1][sub_len-1]), dp[2][sub_len-1]));
        point += max(max(dp[0][sub_len-1], dp[1][sub_len-1]), dp[2][sub_len-1]);
    }
  
    println!("{}", point);
}


Measured memory_bytes: 7104
a, b = map(int, input().split())

if b == 1 :
    print(0)
elif b <= a :
    print(1)
else :
    cnt = b
    ans = 0
    cnt -= a
    ans = 1
    while cnt > 0 :
        cnt -= (a-1)
        ans += 1
    print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC168A()
{
	int N;
	cin >> N;
	int M = N % 10;
	if (M == 3)
	{
		cout << "bon" << endl;
		return;
	}
	if (M == 0 || M == 1 || M == 6 || M == 8)
	{
		cout << "pon" << endl;
	}
	else
	{
		cout << "hon" << endl;
	}
}
int main()
{
	ABC168A();
	return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        final String S = scan.next();
        scan.close();
        if(S.equals("Sunny")){
            System.out.println("Cloudy");
        }else if (S.equals("Cloudy")){
            System.out.println("Rainy");
        }else{
            System.out.println("Sunny");
        }
        

    }
        
    
}


Measured memory_bytes: 21588
N = int(input())
A = sorted(list(map(int,input().split())))

if N%2==0:
  B = [2*(i//2)+1 for i in range(N)]
else:
  B = [2*(i//2) for i in range(1,N+1)]

if A==B:
  print(pow(2,N//2,10**9+7))
else:
  print(0)


Measured memory_bytes: 14008
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author ??\???
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int[] ary = new int[3];
		
		Scanner scanner = new Scanner(System.in);
		for (int i = 0; i < ary.length; i++) {
			ary[i] = scanner.nextInt();
		}
		scanner.close();
		
		Arrays.sort(ary);
		
		for (int i = 0; i < ary.length - 1; i++) {
			System.out.print(ary[i] + " ");
		}
		System.out.println(ary[ary.length - 1]);
	}

}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    int v[n], c[n];
    rep(i, n) cin >> v[i];
    rep(i, n) cin >> c[i];

    int ans = -10000;

    rep(bit, (1 << n))
    {
        int x = 0, y = 0;
        rep(i, n)
        {
            if (bit & (1 << i))
            {
                x += v[i];
                y += c[i];
            }
        }
        ans = max(ans, x - y);
    }

    OP(ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
int main(void){

	int i,j;
	char str[256];	

	while(fgets(str,sizeof(str),stdin)!=NULL){				
		
		while(1){
			for(i=0;i<sizeof(str);i++){
				
				if(str[i]=='\0'){
					break;
				}
				
				if(isalpha(str[i])){
					if(islower(str[i])){
						if(str[i]=='z'){
							str[i]='a';
						}else{
							str[i]=str[i]+1;
						}
					}
					else if(isupper(str[i])){
						if(str[i]=='Z'){
							str[i]='A';
						}else{
							str[i]=str[i]+1;
						}
					}
				}
			}
			if(strstr(str,"the")!=NULL || strstr(str,"this")!=NULL || strstr(str,"that")!=NULL){
				printf("%s",str);
				break;
			}
			
		}
		
	}
	return 0;
	
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(LL)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50


int main(){
    int N;
    cin>>N;
    LL a[200004];
    REP(i,N)cin>>a[i];
    vector<LL>res;
    int cnt=(N-(N%2))/2;
    while(cnt>0){
        res.PB(a[(2*cnt-1)]);
        cnt--;
    }
    cnt=0;
    while(cnt<N/2){
        res.PB(a[2*cnt]);
        cnt++;
    }
    if(N%2){
        res.PB(a[N-1]);
        reverse(ALL(res));        
    }
    REP(i,N){
        cout<<res[i];
        if(i!=N-1)cout<<" ";
        else cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 5488
#include<iostream>


int main(void){
  int H,W,N;
  std::cin >> H;
  std::cin >> W;
  std::cin >> N;
  int max=W;
  if(H>W){
    max = H;
  }
  int num = (int)(N/max);
  if(N%max != 0)
    num = num + 1;
  std::cout << num << std::endl;
}


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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(int n,m,w,t;cin>>n>>m>>w>>t && n|m|w|t;){
		map<string,int> f;
		vi ws(m),ps(m);
		rep(i,m){
			string s; cin>>s>>ws[i]>>ps[i];
			f.insert(mp(s,f.size()));
		}
		vi xs(n),ys(n);
		vvi is(n),qs(n);
		rep(i,n){
			int l; cin>>l>>xs[i]>>ys[i];
			is[i].resize(l),qs[i].resize(l);
			rep(j,l){
				string s; cin>>s>>qs[i][j];
				is[i][j]=f[s];
			}
			vector<pii> ps(l);
			rep(j,l) ps[j]=mp(is[i][j],qs[i][j]);
			sort(all(ps));
			rep(j,l) tie(is[i][j],qs[i][j])=ps[j];
		}
		
		vl dp(t+1);
		repi(i,1,1<<n){
			int elapsed=INF; // 全て訪問して帰ってくるのにかかる最小の時間
			vi js;
			rep(j,n) if(i>>j&1) js.push_back(j);
			do{
				int x=0,y=0,tmp=0;
				for(int j:js){
					tmp+=abs(xs[j]-x)+abs(ys[j]-y);
					tie(x,y)=mp(xs[j],ys[j]);
				}
				tmp+=abs(x)+abs(y);
				elapsed=min(elapsed,tmp);
			}while(next_permutation(all(js)));
			
			vl dp2(w+1);
			rep(j,n) if(i>>j&1){
				rep(k,is[j].size()){
					int earn=ps[is[j][k]]-qs[j][k];
					int weight=ws[is[j][k]];
					if(earn<=0) continue;
					repi(l,weight,w+1){
						dp2[l]=max(dp2[l],dp2[l-weight]+earn);
					}
				}
			}
			int earn=*max_element(all(dp2));
			repi(j,elapsed,t+1)
				dp[j]=max(dp[j],dp[j-elapsed]+earn);
		}
		
		cout<<*max_element(all(dp))<<endl;
	}
}

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

int main(){
    string s; cin >> s;
    int m = s[6] - '0';
    int m1 = s[5] - '0';
    if(m <=  4 && m1 == 0)cout << "Heisei" << endl;
    else cout << "TBD" << endl;
    return 0;
}


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

const int N = 410;
typedef long long ll;

ll dp[N][N];
ll sum[N];
ll arr[N];
int n;

ll rec(int l,int r)
{
    if(l==r) return 0;
    ll &ret=dp[l][r];
    if(ret!=-1) return ret;
    ret=1e16;
    for(int i=l; i<r; i++) ret=min(ret,sum[r]-sum[l-1]+rec(l,i)+rec(i+1,r));
    return ret;
}

int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++) scanf("%lld",&arr[i]);
    for(int i=1; i<=n; i++) sum[i]=sum[i-1]+arr[i];
    memset(dp,-1,sizeof dp);
    printf("%lld\n",rec(1,n));

}


Measured memory_bytes: 1536
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	h := make([]int, n)

	for i := 0; i < n; i++ {
		h[i] = nextInt()
	}

	dp := make([]int, n)
	dp[0] = 0
	for i := 1; i < n; i++ {
		if i == 1 {
			dp[i] = abs(h[i] - h[i-1])
			continue
		}
		b1 := dp[i-1] + abs(h[i]-h[i-1])
		b2 := dp[i-2] + abs(h[i]-h[i-2])
		dp[i] = min(b2, b1)
	}

	fmt.Println(dp[n-1])

}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 3980
/*  ex4_3
    potter0723sw  */

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

int add (int factorial);
int dif (int minuend,int subtrahend);

int main(void) {
    int diff, heighta, heightb, ans, addition;
    scanf("%d %d", &heighta, &heightb);
    diff = dif(heightb,heighta);//塔の差を計算
    addition = add(diff);//東の塔の高さを出す
    ans = dif(addition,heightb);//積雪の高さを本来の塔の高さと見えてる高さの差で出す
    printf("%d\n", ans);
    return 0;
}

int add (int factorial){//1から入力された値までをすべて足した和を返す関数
    if(factorial>1){
        factorial = factorial + add (factorial - 1);
    }else if(factorial == 1){
        factorial = 1;
    }
    return factorial;
}

int dif (int minuend,int subtrahend){//ただの引き算
    return (minuend - subtrahend);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
// greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x%y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;

int main() {
	int N;
	string S, T;
	cin >> N >> S >> T;

	for (int i = 0; i < N; i++)
	{
		
			cout << S[i] << T[i];

	
	}
	



}


Measured memory_bytes: 256
package main

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

func main() {
	a, b := readInt(), readInt()

	fmt.Println(max(a+b, max(a-b, a*b)))
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;
ll n,t,m,c1,c2,c,x,y,sum,mn=999999999,avg,pos,dif,j,dis,mx,xi,yi,q;
vector<ll>v;
set<int>s;
map<ll , ll >mp;
bool PE(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}
bool PR(string s)
{
int n=s.length();
for(int i=0;i<n/2;i++)
if(s[i]!=s[n-i-1])
return false;
return true;
}

int main(void) 
{ SpeeD;
long double p =6.28318530717958623200/2.0;
cin>>n;
ll a[n-1];
for (int i = 1 ; i < n;i++){
cin>>a[i];
mp[a[i]]++;}
for (int i = 1;i<=n;i++)
cout<<mp[i]<<endl;


}

Measured memory_bytes: 17728
#include<iostream>

using namespace std;

int main(){
    int n; cin >> n;
    long long cnt = 0;
    for(int i = 0; i < n; i++){
        int a, b; char c;
        cin >> a >> c >> b;
        c == '('?cnt += b:cnt -=b;
        !cnt?cout << "Yes" << endl:cout << "No" << endl;
    }

    return 0;
}


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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */



int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}


int main(){
  vector<int> a(3);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  sort(a.begin(),a.end());
  if(a.at(0) == 5 && a.at(1) == 5 && a.at(2) == 7){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

int main(){
    char x, y;
    cin >> x >> y;
    int ans = x - y;
    if(ans < 0) cout << '<' << endl;
    else if(ans > 0) cout << '>' << endl;
    else cout << '=' << endl;
}

Measured memory_bytes: 256
def slime(string: str) -> int:
    prev = string[0]
    count = 1
    for s in string[1:]:
        if s != prev:
            count += 1
        prev = s
    return count


if __name__ == '__main__':
    N = int(input())
    S = input()
    result = slime(S)
    print(result)



Measured memory_bytes: 3316
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n);
    REP(i, n) cin >> a[i];
    set<ll> as;
    REP(i, n) {
        if (as.find(a[i]) != as.end()) {
            cout << "NO\n";
            return 0;
        }
        as.insert(a[i]);
    }
    cout << "YES\n";
    return 0;
}


Measured memory_bytes: 11264
#include<stdio.h>

int main(void)
{
	int N, i,count=0;
	scanf("%d", &N);
	int a[200010];

	for (i = 0; i < N; i++)
	{
		scanf("%d", &a[i]);
		if (a[i] == 1)count = 1;
	}

	if (count == 0)
	{
		printf("-1");
		return 0;
	}
	count = 0;
	int pibot=1;
	for (i = 0; i < N; i++)
	{
		if (a[i] == pibot)
		{
			pibot++;
		}else {
			count++;
		}
	}
	printf("%d", count);
}

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

using namespace std;

int main(){

int k;

cin>>k;

int a,b;

cin>>a>>b;

for(int i=a;i<=b;i++){

  if(i%k==0){

    cout<<"OK"<<endl;

    return 0;

   }

}

cout<<"NG"<<endl;

}

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

int n,m,ans;
vector<int>sw[100];
int p[100],temp[100];
bool vis[100];

void dfs(int x)
{
    if(x==n+1)
    {
        memset(temp,0,sizeof(temp));
        for(int i=1;i<=n;i++)
        {
            if(!vis[i]) continue;
            for(int j=0;j<sw[i].size();j++)
            {
                int b=sw[i][j];
                temp[b]++;
            }
        }
        for(int i=1;i<=m;i++) if(temp[i]%2!=p[i]) return ;
        ans++;
        return ;
    }
    dfs(x+1);
    vis[x]=true;
    dfs(x+1);
    vis[x]=false;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int k;
        scanf("%d",&k);
        for(int j=0;j<k;j++)
        {
            int t;
            scanf("%d",&t);
            sw[t].push_back(i);
        }
    }
    for(int i=1;i<=m;i++) 
		scanf("%d",&p[i]);
    dfs(1);
    printf("%d\n",ans);
    return 0;
}

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

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int n, int g){
	for( int i = g; i < n; i++){
		int v = A[i];
		int j = i - g;
		while( j >= 0 && A[j] > v ){
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void shellSort(int A[], int n){
	for(int h = 1; ;){
		if( h > n ) break;
		G.push_back(h);
		h = 3*h + 1;
	}

	for(int i = G.size() - 1; i >= 0; i-- ){
		insertionSort( A, n, G[i]);
	}
}

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) scanf("%d", &A[i]);
	cnt = 0;
	
	shellSort(A, n);

	cout << G.size() << endl;
	for(int i = G.size() - 1; i >= 0; i-- ){
		printf("%d", G[i]);
		if(i) printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for(int i = 0; i < n; i++ ) printf("%d\n", A[i]);

	return 0;

}

Measured memory_bytes: 5196
#include<stdio.h>
int main(void){
  int n,d;
  int i;
  int ba1,ba2;
  int j=1;
  scanf("%d %d",&n,&d);
  for(i=d+1;i<n;i++){
    ba2=i+d;
    if(ba2>=n)break;
    j++;
    i=ba2+d;
  }
  printf("%d",j);
  
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main{
  public static void main(String[] args) {
    int a,b;
    Scanner sc=new Scanner(System.in);
    a=sc.nextInt();
    b=sc.nextInt();
    if(a!=1&&b!=1){
      System.out.println(1);
    }
    if(a!=2&&b!=2){
      System.out.println(2);
    }
    if(a!=3&&b!=3){
      System.out.println(3);
    }
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
const ll mod=1e9+7;

int main(){
  int n,d;
  cin>>n>>d;
  int x[n],y[n];
  rep(i,0,n) cin>>x[i]>>y[i];
  int ans=0;
  rep(i,0,n){
    if((ll)x[i]*x[i]+(ll)y[i]*y[i]<=(ll)d*d) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5100
#include<bits/stdc++.h>
using namespace std;
template<class T>void gi(T &x){
	int f;char c;
	for(f=1,c=getchar();c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(x=0;c<='9'&&c>='0';c=getchar())x=x*10+(c&15);x*=f;
}
const int N=2e5+10;
int n,a[N],f[N],ans=0;
int main(){
  cin>>n;
  for(int i=1;i<=n;i++)gi(a[i]),f[a[i]]=f[a[i]-1]+1,ans=max(ans,f[a[i]]);
  cout<<n-ans<<endl;
  return 0;
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int H,W,K;

bool erase_block(vector< vector<int> >& A,deque< deque<bool> >& d)
{
	bool res = false;
	FOR(i,0,A.size()){
		vector<int> v(count(ALL(d [i]),true),0);
		FOR(j,0,A [i].size()){
			if(d [i] [j] == true){
				d [i] [j] = false;
				res = true;
			}
			else{
				v.push_back(A [i] [j]);
			}
		}
		A [i] = v;
	}

	return res;
}

int solve(int x,int y,vector< vector<int> > A)
{
	deque< deque<bool> > d(W,deque<bool>(H));
	d [x] [y] = true;

	erase_block(A,d);
	int res = 0,cnt = 0;
	do{
		FOR(i,0,A.size()) FOR(j,0,A [i].size()) if(A [i] [j] && i + K <= A.size()){
			bool flag = true;
			FOR(k,0,K){
				flag &= A [i] [j] == A [i + k] [j];
			}
			if(flag){
				FOR(k,0,K) if(d [i + k] [j] == false){
					d [i + k] [j] = true;
					res += A [i + k] [j] * (1 << cnt);
				}
			}
		}
		cnt++;
	}while(erase_block(A,d));

	return res;
}

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

	cin >> H >> W >> K;
	vector< vector<int> > A(W,vector<int>(H));
	FOR(i,0,H) FOR(j,0,W){
		char c;
		cin >> c;
		A [j] [i] = c - '0';
	}
	if(K > 3){
		cout << 0 << endl;
		return 0;
	}

	int ans = 0;
	FOR(i,0,W) FOR(j,0,H){
		chmax(ans,solve(i,j,A));
	}

	cout << ans << endl;

	return 0;
}


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

void dfs(int node, auto& g, auto& dp) {
    dp[node] = 0;
    int best = -1;

    for (auto v : g[node]) {
        if (dp[v] < 0) 
            dfs(v, g, dp);
        best = max(best, dp[v]);
    }

    dp[node] = best + 1;
}

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> g(n);

    for (int i = 0; i < m; i += 1) {
        int a, b; cin >> a >> b;
        a -= 1;
        b -= 1;
        g[a].push_back(b);
    }
    
    vector<int> dp(n, -1);

    for (int i = 0; i < n; i += 1)
        if (dp[i] < 0) 
            dfs(i, g, dp);

    int ans = *max_element(dp.begin(), dp.end());
    cout << ans << "\n";
}

Measured memory_bytes: 10240
#include <stdio.h>

int main(void){
    int n;
    int l[100];
    int count = 0;

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

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(l[j] > l[i]){
                int temp = l[j];
                l[j] = l[i];
                l[i] = temp;
            }
        }
    }

    for(int i = 0; i < n - 2; i++){
        for(int j = i + 1; j < n - 1; j++){
            for(int k = j + 1; k < n; k++){
                if(l[k] < (l[i] + l[j]) && l[i] != l[k] && l[k] != l[j] && l[i] != l[j]){
                    count++;
                }
            }
        }
    }

    printf("%d", count);

    return 0;
}

Measured memory_bytes: 2156
#include <stdio.h>
 
int main(void){
	
	int a,b,c,x;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a > c || a + b < c){
		printf("NO\n");
	} else {
		printf("YES\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
//the java file I wrote is a disaster. 
// so I rewrite it in cpp

#include <iostream>
#include <unordered_map>

using namespace std;


template<typename T> void show(T a){
  for(auto i : a){}
  cout << endl;
}

int main(int argc, char *argv[]){
  int n, m;
  char t1, t2;
  scanf("%d\n", &n);
  while(n != 0){
    unordered_map<char, char> nummap;
    for(int i = 0; i < n; i++){
      scanf("%c %c\n", &t1, &t2);
      nummap.insert({t1, t2});
    }
    scanf("%d\n", &m);
    for(int i = 0; i < m ; i++){
      scanf("%c\n", &t1);
      if(nummap.count(t1) != 0)
        printf("%c", nummap[t1]);
      else
        printf("%c", t1);
    }
    printf("\n");
    scanf("%d\n", &n);
  }
  return 0;
}





Measured memory_bytes: 3056