akhauriyash/Code-Regression huggingface dataset:
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
using ll = long long;
#define mod  1000000007

#define whole(a) (a).begin(),(a).end()
#define rwhole(a) (a).rbegin(),(a).rend()

#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(ll i=(a);i>=(b);i--)
#define each(itr,ds) for(auto itr=(ds).begin();itr!=(ds).end();itr++)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";each(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";each(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm,char t){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,char t,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);if(t=='\n') cerr<<"  "<<name<<"\t: "<<x<<t;else cerr << name<<": "<<x<<","<<t;dump_f(nx,t,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,char t,Ts&&... ts){cerr<<"[ln: "<<ln<<"]"<<t;dump_f(nm,t,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\n',__VA_ARGS__)
#define dl(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\t',__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(whole(V),c))

int main() {
    ios::sync_with_stdio(false);//stdout<=>cout
    cin.tie(nullptr);//cin<=>cout


    ll N;
    cin >>N;
    


    //-----------------------------------
    ll ans=0;
    repd(i,1,N+1){
        if(i%3==0||i%5==0)continue;
        ans+=i;
    }

    cout << ans <<endl;


    return (0);
}

Measured memory_bytes: 3648
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class AACOrWA {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N, M;
        cin >> N >> M;
        cout << (N == M ? "Yes" : "No") << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    AACOrWA solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int d[];
        d=new int[6];
        for(int i=0;i<6;i++){
            d[i]=sc.nextInt();
        }
        Dice D1=new Dice(d[0],d[1],d[2],d[3],d[4],d[5]);
        String str=sc.next();
        char order[]=str.toCharArray();
        for(char c:order){
            D1.roll(c);
        }
        System.out.println(D1.d1);
    }
}

class Dice{
    int d1,d2,d3,d4,d5,d6,db;
    Dice(int a,int b,int c,int d,int e,int f){
        this.d1=a;
        this.d2=b;
        this.d3=c;
        this.d4=d;
        this.d5=e;
        this.d6=f;
    }
    void roll(char c){
        switch (c){
            case 'N':
                db=d1;
                d1=d2;
                d2=d6;
                d6=d5;
                d5=db;
                break;
            case 'S':
                db=d1;
                d1=d5;
                d5=d6;
                d6=d2;
                d2=db;
                break;
            case 'E':
                db=d1;
                d1=d4;
                d4=d6;
                d6=d3;
                d3=db;
                break;
            case 'W':
                db=d1;
                d1=d3;
                d3=d6;
                d6=d4;
                d4=db;
                break;
        }
    }
}


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

int main(){
  int n;
  cin >> n;
  vector<int> h(n);

  int count=0;
  bool t=0;
  for(int i=0;i<n;i++){
    cin >> h.at(i);
    for(int j=0;j<i;j++){
      if(h.at(j) > h.at(i)){
        t=1;
      }
    }
    if(t == 0) ++count;
    t=0;
  }

  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	int x,t; cin >> x >> t;
	cout << (x > t? x-t : 0) << endl;
}

Measured memory_bytes: 256
package main

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

const Mod = int(1e9) + 7

func main() {
	K := ReadInt()
	S := ReadString()
	n := len(S)
	InitModCombi(K + n)

	ans := 0
	for i := 0; i <= K; i++ {
		now := ModPow(26, K-i)
		now = now * ModPow(25, i) % Mod
		now = now * ModCombi(i+n-1, n-1) % Mod
		ans = (ans + now) % Mod
	}
	fmt.Println(ans)
}

func ModPow(a, b int) int {
	x := 1
	for b > 0 {
		if b&1 == 1 {
			x = x * a % Mod
		}
		a = a * a % Mod
		b >>= 1
	}
	return x
}

// https://drken1215.hatenablog.com/entry/2018/06/08/210000
func ModCombi(n, k int) int {
	if n < k || n < 0 || k < 0 {
		return 0
	}
	return fact[n] * (finv[k] * finv[n-k] % Mod) % Mod
}

var fact, finv, inv []int

func InitModCombi(max int) {
	fact, finv, inv = make([]int, max), make([]int, max), make([]int, max)
	fact[0], fact[1], finv[0], finv[1], inv[1] = 1, 1, 1, 1, 1
	for i := 2; i < max; i++ {
		fact[i] = fact[i-1] * i % Mod
		inv[i] = Mod - inv[Mod%i]*(Mod/i)%Mod
		finv[i] = finv[i-1] * inv[i] % Mod
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 55468
#include <iostream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  int A,N;
  cin >> N;
  cin >> A;
  if ((N%500) <= A) {
    cout << "Yes" << "\n";
  } else {
    cout << "No" << "\n";
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  	int N, R, x;

  	cin >> N >> R;
	if (N >= 10) {
      cout << R << endl;
      return 0;
    }
	x = R + (100 * (10 - N));
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * 二分木の表現
 * @author nobu
 * @see <a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_7_B&lang=ja">ALDS1_7_B</a>
 */
public class Main {
	private static int sibling[] = new int[100005];
	private static int degree[] = new int[100005];
	private static int depth[] = new int[100005];
	private static int height[] = new int[100005];
	private static Node t[] = new Node[100005];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			t[i] = new Node();
		}

		for (int i = 0; i < n; i++) {
			int id = sc.nextInt();
			t[id].left = sc.nextInt();
			t[id].right = sc.nextInt();
			if (t[id].left != -1) {
				t[t[id].left].parent = id;
			}
			if (t[id].right != -1) {
				t[t[id].right].parent = id;
			}
		}

		for (int i = 0; i < n; i++) {
			sibling[i] = getSibling(i);
			degree[i] = getDegree(i);
			depth[i] = getDepth(i);
			setHeight(i);
		}

		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < n; i++) {
			ans.append("node ").append(Integer.toString(i)).append(": parent = ").append(Integer.toString(t[i].parent))
				.append( ", sibling = ").append(Integer.toString(sibling[i]))
				.append(", degree = ").append(Integer.toString(degree[i]))
				.append(", depth = ").append(Integer.toString(depth[i]))
				.append(", height = ").append(Integer.toString(height[i]));
			if (depth[i] == 0) {
				ans.append(", root");
			} else if (t[i].left == -1 && t[i].right == -1) {
				ans.append(", leaf");
			} else {
				ans.append(", internal node");
			}
			ans.append("\n");
		}

		System.out.print(ans.toString());

		sc.close();
	}

	private static int getSibling(int i) {
		if (t[i].parent == -1) return -1;
		int p = t[i].parent;
		return t[p].left + t[p].right - i;
	}

	private static int getDegree(int i) {
		int count = 0;
		if (t[i].left != -1) count++;
		if (t[i].right != -1) count++;
		return count;
	}

	private static int getDepth(int i) {
		int d = 0;
		while (t[i].parent != -1) {
			i = t[i].parent;
			d++;
		}
		return d;
	}

	private static void setHeight(int i) {
		if (t[i].left != -1) return;
		if (t[i].right != -1) return;
		int p = t[i].parent;
		int h = 0;
		while (p != -1) {
			height[p] = Math.max(height[p], ++h);
			p = t[p].parent;
		}
	}

}


class Node {
	int parent;
	int left;
	int right;

	Node() {
		this.parent = -1;
		this.left = -1;
		this.right = -1;
	}
}


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

typedef long long int lli;
typedef pair<int, int> ii;
typedef vector<int> vi;
#define mkpr make_pair

const int N = 1e5 + 5;
const int M = 2e5 + 5;

int n, m;

vector<vector<ii>> edgeList(M);
vector<bool> vis(N, false);
vector<bool> inStack(N, false);
vector<bool> groupVis(M, false);

vector<vector<int>> vsGroups(N); 
vector<vector<int>> groupsVs(M);

map<int, int> colorReindexer; //colorReindexer[oldInd] gives newInd
int minUnusedIndex;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;

	minUnusedIndex = 0;
	int p, q, c;
	for(int i=0; i<m; i++) {
		cin >> p >> q >> c;
		p--; q--; c--;
		if(colorReindexer.find(c) == colorReindexer.end()) {
			colorReindexer.insert(mkpr(c, minUnusedIndex++));
		}
		int cIndex = colorReindexer[c];
		edgeList[cIndex].push_back(mkpr(p, q));
		edgeList[cIndex].push_back(mkpr(q, p));
	}

	//Process by color
	int nGroup = 0;
	for(int i = 0; i < minUnusedIndex; i++) {
		vector<ii> companyProperty;
		companyProperty.reserve(edgeList[i].size());
		
		for(ii e: edgeList[i]) {
			companyProperty.push_back(e);
			vis[e.first] = inStack[e.first] = false;
			vis[e.second] = inStack[e.second] = false;
		}

		sort(companyProperty.begin(), companyProperty.end());
		int unusedEdge = 0;
		stack<int> st;
		
		while(unusedEdge < companyProperty.size()) {
            st.push(companyProperty[unusedEdge].first);
	st.push(companyProperty[unusedEdge].second);
		inStack[companyProperty[unusedEdge].first] = true;
		inStack[companyProperty[unusedEdge].second] = true;

			while(!st.empty()) {
				int u = st.top(); st.pop();
				if(vis[u]) continue;
				vis[u] = true;

				vsGroups[u].push_back(nGroup);
				groupsVs[nGroup].push_back(u);

				int starter = lower_bound(companyProperty.begin(), companyProperty.end(), mkpr(u, 0)) - companyProperty.begin();
				int ender = upper_bound(companyProperty.begin(), companyProperty.end(), mkpr(u, N)) - companyProperty.begin();
				for(int i = starter; i != ender; i++) {
					ii v = companyProperty[i];
					if(inStack[v.second]) continue;
					st.push(v.second);
					inStack[v.second] = true;
				}
			}
			nGroup++;

			while(unusedEdge < companyProperty.size() && vis[companyProperty[unusedEdge].first]) unusedEdge++;
		}
	}

	for(int i = 0; i < n; i++) vis[i] = false;
	for(int i = 0; i < m; i++) groupVis[i] = false;

	int ans = 0;
	stack<int> st;
	stack<int> newSt;
	st.push(0);
	vis[0] = true;
	
	bool nReached = false;

	while(!st.empty() && !nReached) {
		stack<int> groupStack;
		while(!st.empty()) {
			int u = st.top(); st.pop();
			for(int g: vsGroups[u]) {
				if(!groupVis[g]) {
					groupStack.push(g);
					groupVis[g] = true;
				}
			}
		}

		while(!groupStack.empty()) {
			int g = groupStack.top(); groupStack.pop();
			for(int u: groupsVs[g]) {
				if(!vis[u]) {
					if(u == n-1) nReached = true;
					newSt.push(u);
					vis[u] = true;
				}
			}
		}

		ans++;
		while(!newSt.empty()) {
			st.push(newSt.top()); newSt.pop();
		}
	}

	cout << (nReached? ans:-1) << endl;

	return 0;
}


Measured memory_bytes: 36864
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
#include<functional>
#include<numeric>
using namespace std;

int main(void)
{
	int N;
	long long W;
	cin >> N >> W;

	vector<long long> w(N), v(N);
	for(int i=0; i<N; i++)
		cin >> w[i] >> v[i];

	vector<vector<long long>> wv(4, vector<long long>());
	for(int i=0; i<N; i++)
	{
		wv[w[i]-w[0]].push_back(v[i]);
	}
	for(int i=0; i<4; i++)
	{
		sort(wv[i].begin(), wv[i].end(), greater<long long>());
		
		for(int j=1; j<wv[i].size(); j++)
			wv[i][j] += wv[i][j-1];
	}

	long long ret = 0;
	for(int n=1; n<=N; n++)
	{
		for(int i=min(n, (int)wv[0].size()); i>=0; i--)
		{
			if(i*w[0] > W)
				continue;

			for(int j=min(n-i, (int)wv[1].size()); j>=0; j--)
			{
				if((i+j)*w[0]+j > W)
					continue;

				for(int k=min(n-i-j, (int)wv[2].size()); k>=0; k--)
				{
					if((i+j+k)*w[0]+j+k > W)
						continue;

					for(int l=min(n-i-j-k, (int)wv[3].size()); l>=0; l--)
					{
						long long weight = (i+j+k+l)*w[0] + j + 2*k + 3*l;
						if(weight > W)
							continue;

						long long value = 0;
						if(i != 0)
							value += wv[0][i-1];
						if(j != 0)
							value += wv[1][j-1];
						if(k != 0)
							value += wv[2][k-1];
						if(l != 0)
							value += wv[3][l-1];

						ret = max(ret, value);
					}
				}
			}
		}
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
n=gets.to_i
as=gets.split.map(&:to_i)
b=[0]*n
if n.odd?
  b[n/2]=as[0]
  i=1
  ((n-1)/2).downto(1) do |j|
    b[-j]=as[i]
    b[j-1]=as[i+1]
    i+=2
  end
else
  i=0
  (n/2).downto(1) do |j|
    b[-j]=as[i]
    b[j-1]=as[i+1]
    i+=2
  end
end
puts b.join(" ")


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

#define ALL(obj) (obj).begin(),(obj).end()
template<class T> using priority_queue_reverse = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = 1'000'000'000LL + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
vector<string> split(const string &str, const char delemiter) {vector<string> res;stringstream ss(str);string buffer; while( getline(ss, buffer, delemiter) ) res.push_back(buffer); return res;}
int msb(int x) {return x?31-__builtin_clz(x):-1;}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    ll D,T,S; cin >> D >> T >> S;
    Yn(T*S>=D);
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,k;
    cin>>n;
    string s;
    cin>>s;
    i=0 , j=n-1;
    while(i<j)
    {
        if(s[i]=='W' && s[j]=='R') ++p , ++i , --j;
        if(s[i]=='R') ++i;
        if(s[j]=='W') --j;
    }
    cout<<p;
    return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  string s,t;
  cin >> s;
  string ans;
  reverse(s.begin(),s.end());
  ll i=0;
  while(1){
    string u;
    bool is=false;
    if(i>=s.size()){
      break;
    }
    u=s.substr(i,5);
    if(u=="maerd" || u=="esare"){
      is=true;
      i+=5;
      continue;
    }
    u=s.substr(i,6);
    if(u=="resare"){
      is=true;
      i+=6;
      continue;
    }
    u=s.substr(i,7);
    if(u=="remaerd"){
      is=true;
      i+=7;
      continue;
    }
    if(!is){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
    

Measured memory_bytes: 3716
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var an = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
            var max = an.Max();
            var dic = new int[max + 10];
            var value = 1;
            foreach (var item in an)
            {
                dic[item]++;
            }
            for (int i = 0; i <= max; i++)
            {
                var num = dic[i] + dic[i + 1] + dic[i + 2];
                if (value <= num)
                    value = num;
            }
            Console.WriteLine(value);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 20192
#include <stdio.h>
int main(void)
{
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  if(abs(a-c)<=d)
    printf("Yes");
  else if(abs(a-b)<=d&&abs(b-c)<=d)
    printf("Yes");
  else 
    printf("No");
}
  

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
	int n, i, a, cnt=0;
	char s[10];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		sprintf(s,"%d",i);
		a=strlen(s);
		if(a==1||a==3||a==5)
			cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.length()-1] == b[0] 
    && b[b.length()-1] == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int main() {
	ll n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; ++i) {
        cin >> p[i]; p[i]--;
    }
    ll c[n];
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }

    ll ans = -1e18;
    for (int st = 0; st < n; ++st) {
        ll rep = 0, cur = st;
        ll score = 0;
        while(true) {
            rep++;
            cur = p[cur];
            score += c[cur];
            if(cur == st) break;
        }
        if(k >= rep)
            ans = max(ans, k / rep * score);

        ll stp = 0;
        ll running = 0;
        while(true) {
            cur = p[cur];
            running += c[cur];
            stp++;
            if(k >= stp) {
                ans = max({ans, running, running + (k-stp)/rep * score});
            }
            if(cur == st) break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3688
using System;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        Stack<int> d = new Stack<int>();
        while (N != 0)
        {
            if (N % 2 != 0)
            {
                d.Push(1);
                N--;
            }
            else
                d.Push(0);
            N /= 2;
            N = -N;
        }
        if (d.Count == 0)
            Console.WriteLine(0);
        else
        {
            while (d.Count != 0)
                Console.Write(d.Pop());
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, val;
    cin >> n;
    vector<int> arr(n+1, 0);
    for(int i = 0; i < n-1; i++) {
        cin >> val;
        arr[val] += 1;
    }
    for(int i = 1; i <= n; i++)
        cout << arr[i] << endl;
    return 0;
}



Measured memory_bytes: 3992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		long a = Long.parseLong(str[0]);
		long b = Long.parseLong(str[1]);
		long c = Long.parseLong(str[2]);
		long d = Long.parseLong(str[3]);

		System.out.println(num(b, c, d) - num(a - 1, c, d));
	}

	static long num(long n, long c, long d) {
		long G = gcd(c, d);
		long L = c / G * d;
		return n - n / c - n / d + n / L;
	}

	static long gcd(long a, long b) {
		return b > 0 ? gcd(b, a % b) : a;
	}

	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}
}


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



int main() {
string S;
cin >> S;
int lo = S.size();
int n = 0;
int w= 0;
int s = 0;
int e = 0;
for(int i = 0; i < lo; i++){
if(S[i] == 'N') n++;
else if(S[i] =='W')w++;
else if(S[i] == 'S')s++;
else e++;
}
bool TZ, NB;
TZ = 0;
NB = 0;
if(n == 0 && s == 0)NB = 1;
if(w == 0 && e == 0)TZ = 1;
if(n > 0 && s > 0)NB = 1;
if(w > 0 && e > 0)TZ = 1;
if(TZ == 1 && NB == 1) cout << "Yes" << endl;
else cout << "No" << endl;





}



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

using namespace std;


bool isSmaller(string str1, string str2) 
{ 
    int n1 = str1.length(), n2 = str2.length(); 
  
    if (n1 < n2) 
    return true; 
    if (n2 < n1) 
    return false; 
  
    for (int i=0; i<n1; i++) 
    if (str1[i] < str2[i]) 
        return true; 
    else if (str1[i] > str2[i]) 
        return false; 
  
    return false; 
} 
  
string findDiff(string str1, string str2) 
{ 

    if (isSmaller(str1, str2)) 
        swap(str1, str2); 
  
    string str = ""; 
  
    int n1 = str1.length(), n2 = str2.length(); 
  
    reverse(str1.begin(), str1.end()); 
    reverse(str2.begin(), str2.end()); 
      
    int carry = 0; 
  
    for (int i=0; i<n2; i++) 
    { 
          
        int sub = ((str1[i]-'0')-(str2[i]-'0')-carry); 
    
        if (sub < 0) 
        { 
            sub = sub + 10; 
            carry = 1; 
        } 
        else
            carry = 0; 
  
        str.push_back(sub + '0'); 
    } 
  

    for (int i=n2; i<n1; i++) 
    { 
        int sub = ((str1[i]-'0') - carry); 
          
        if (sub < 0) 
        { 
            sub = sub + 10; 
            carry = 1; 
        } 
        else
            carry = 0; 
              
        str.push_back(sub + '0'); 
    } 
  
    reverse(str.begin(), str.end()); 
  
    return str; 
} 

int main(int argc, char const *argv[])
{
	long long int a, b, k;
	cin >> a >> b >> k;


	if(k <= a){
		cout << a-k << ' ' << b << endl;
	}
	else {
		cout << 0 << ' ';

		k = k -a;

		if(b <= k){
			cout << 0 << endl;
		}

		else{
			cout << b - k << endl;
		}
	}

	return 0;
}

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

ans = float('inf')
for a in range(1<<N):
    at = []
    for i in range(N):
        if a&(1<<i):
            at.append(L[i])
    if not at: continue
    ap = 10*(len(at)-1) + abs(A - sum(at))
    for b in range(1<<N):
        if a&b: continue
        bt = []
        for i in range(N):
            if b&(1<<i):
                bt.append(L[i])
        if not bt: continue
        bp = 10*(len(bt)-1) + abs(B - sum(bt))
        for c in range(1<<N):
            if (a&c) or (b&c): continue
            ct = []
            for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
            if not ct: continue
            cp = 10*(len(ct)-1) + abs(C - sum(ct))
            ans = min(ans, ap+bp+cp)
print(ans)

Measured memory_bytes: 9296
#include<stdio.h>

int i,x=0;
int a[10000];

int main(){  

    while(x<3){
        scanf("%d", &a[x]);
        if(x==1){
            if(a[x] < a[x-1]){
                i = a[x];
                a[x] = a[x-1];
                a[x-1] = i;
            }
        } else if(x==2) {
            if(a[0] > a[x]){
                i = a[x-1];
                a[x-1] = a[x];
                a[x] = i;
                i = a[0];
                a[0] = a[x-1];
                a[x-1] = i;
            } else if(a[x] < a[x-1]){
                i = a[x];
                a[x] = a[x-1];
                a[x-1] = i;
            }
        }
        x++;
    }
    printf("%d %d %d\n", a[0], a[1], a[2]);
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef pair<int, int> P;
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while(n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main()
{
    int N;
    cin >> N;
    if (N == 1) {
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = mod_pow(10, N, MOD);
    ans += mod_pow(8, N, MOD);
    ans %= MOD;
    ans -= 2 * mod_pow(9, N, MOD);
    ans %= MOD;
    if (ans < 0) ans += MOD;
    cout << ans % MOD << endl;
    return 0;
}

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

using namespace std;
using ll = long long;


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

    for(int i = 0; i < q; i++) {
        ll x; cin >> x;
        ll sum = 0;
        ll ans = 0;
        int rig = 0;
        for(int lef = 0; lef < n;) {
            for(; rig < n && sum + a[rig] <= x; sum += a[rig++]);
            ans += rig - lef;
            if(lef == rig)lef++,rig++;
            else sum -= a[lef++];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
const int N=1e4;
int a[N],c[N],sum[N],n,k;
int add(int x)
{
	for(int i=k;i;i--)
	{if(x>i)break;
		c[i]|=c[i-x];
	}
	for(int i=1;i<=k;i++)sum[i]=sum[i-1]+c[i];
}
int main()
{
	int s=0,j=0;c[0]=1;
	cin>>n>>k;for(int i=1;i<=n;i++)scanf("%d",&a[i]);sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{if(s+a[i]<k)s+=a[i],j=i;
	}
	if(s==0)
	{
		cout<<0;return 0;
	}
	for(int i=n;i>j;i--)
	{
		add(a[i]);
	}
	for(int i=j;i;i--)
	{
		int l=k-s-1,r=k-1;
		if(sum[r]-sum[l]==0)
		{
			cout<<i;return 0;
		}
		s-=a[i];
		add(a[i]);
	}cout<<0;
}


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

// #define MOD 1000000007

using namespace std;
// typedef unsigned long long ull;

// void p() {
//     cout << "\n";
// }
// template<class Head, class... Body>
// void p(Head head, Body... body) {
//     cout << head << ",";
//     p(body...);
// }

int main(int argc, char const *argv[]) {
    char a, b;
    cin >> a >> b;
    if ((a == 'H' && b == 'H') || (a == 'D' && b == 'D')) {
        cout << 'H' << endl;
    } else {
        cout << 'D' << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

template<class T> class rollinghash {
	const ull mask30 = (1LL << 30) - 1;
	const ull mask31 = (1LL << 31) - 1;
	const ull mod61 = (1LL << 61) - 1;
	const ull base = 2048383;
	vector<ull> hashvalue, basepower;
	int length;
	ull multiply(ull a, ull b) {
		ull au = a >> 31; ull ad = a & mask31;
		ull bu = b >> 31; ull bd = b & mask31;
		ull mid = ad * bu + au * bd;
		ull midu = mid >> 30; ull midd = mid & mask30;
		return au * bu * 2 + midu + (midd << 31) + ad * bd;
	}
	ull modulo(ull a) {
		ull au = a >> 61; ull ad = a & mod61;
		ull res = au + ad; if (res >= mod61) res -= mod61;
		return res;
	}
public:
	rollinghash(T s) {
		length = s.size();
		hashvalue = vector<ull>(length + 1);
		for (int i = 0; i < length; i++) {
			hashvalue[i + 1] = modulo(multiply(hashvalue[i], base) + s[i] + 1);
		}
		basepower = vector<ull>(length + 1);
		basepower[0] = 1;
		for (int i = 1; i <= length; i++) {
			basepower[i] = modulo(multiply(basepower[i - 1], base));
		}
	}
	ull hash(ll l, ll r) { // hash of [l, r)
		assert(l < r && 0 <= l && l < length && 0 < r && r <= length);
		return modulo(hashvalue[r] + mod61 * 3 - multiply(hashvalue[l], basepower[r - l]));
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	a.push_back(a[0]);
	b.push_back(b[0]);
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++) x[i] = a[i] ^ a[i + 1];
	for (int i = 0; i < n; i++) y[i] = b[i] ^ b[i + 1];
	for (int i = 0; i < n; i++) x.pb(x[i]);
	rollinghash<vector<int>> rolx(x), roly(y);
	for (int i = 0; i < n; i++) {
		if (rolx.hash(i, n + i) == roly.hash(0, n)) {
			ll val = a[0] ^ b[(n - i) % n];
			if (val == (a[1 % n] ^ b[(n + 1 - i) % n]) && val == (a[2 % n] ^ b[(n + 2 - i) % n])) {
				cout << i << ' ' << val << '\n';
			}
		}
	}
}

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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = A;i <= A * B;i += A) {
		if (i % B == C) { // 余りがCになるAの倍数が存在した
			cout << "YES";
			return 0;
		}
	} // 余りがCになるAの倍数が無かった
	cout << "NO";
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

今、ある数xを任意のAの倍数の総和であるとする
その時、xはAの倍数である
よってそれは1個のAの倍数を用いて表すことができる
つまり、総和をBで割った余りなぞ使わなくても、あるAの倍数をBで割った余りがCであれば良い
また、x>=ABであった時、x-ABをBで割った余りはxをBで割った余りに等しい
よって、A<=x<=ABであると言える
後は全部検証すればすぐ終わる、O(B)
*/

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));

		String line = "";
		int c = 0, d = 0, sum = 0;
		while ((line = br.readLine()) != null) {
			String[] str = line.split(",");
			int price = Integer.parseInt(str[0]);
			int cnt = Integer.parseInt(str[1]);
			c += cnt;
			sum += price * cnt;
			d++;
		}
		System.out.printf("%d\n%.0f\n", sum, (double)c / d);

	}

}

Measured memory_bytes: 17104
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){int n,i,ans=0,k,a,c;
      map<int,int>mp;
      cin>>n;
      for(i=1;i<=n;i++){
          cin>>c;
          k=i-c;
          ans+=mp[k];
          a=i+c;
          mp[a]++;
      }cout<<ans;
    return 0;}

Measured memory_bytes: 26236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265358979323846264338327950L
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
const ll L = 1e6 + 10;
ll lp[L];
ll mark[L];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	for (ll i = 2; i < L; i++) {
		if (lp[i] == 0) {
	 		for (ll j = i; j < L; j += i) {
	 			if (lp[j] == 0) {
	 				lp[j] = i;
	 			}
	 		}
		}
 	}
 	ll n;
 	cin >> n;
 	vector <ll> vec(n);
 	ll f = 0;
 	for (ll i = 0; i < n; i++) {
 		cin >> vec[i];
 		ll temp = vec[i];
 		while (temp > 1) {
 			ll pri = lp[temp];
 			if (mark[pri] == 1) f = 1;
 			mark[pri] = 1;
 			while (lp[temp] == pri) temp /= pri;
 		}
 	}   
 	if (f == 0) {
 		cout << "pairwise coprime" << endl;
 		return 0;
 	}
 	for (ll i = 1; i < n; i++) {
 		vec[i] = __gcd(vec[i], vec[i - 1]);
 	}
 	if (vec[n - 1] == 1) {
 		cout << "setwise coprime" << endl;
 	}
 	else {
 		cout << "not coprime" << endl;
 	}
	return 0;
}

Measured memory_bytes: 26704
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
#include<numeric>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 n;
cin >> n;
i64 a[n];
rep(i,n)cin >> a[i];
i64 k = a[0];
rep(i,n)k = lcm(k,a[i]);
cout << k << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define X first
#define Y second
typedef long long int ll;
typedef pair<ll,ll> pp;

#define debug(x) cout << #x << " :: "<< x <<"\n";
#define debug2(x,y) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\n";
#define debug3(x,y,z) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\t" << #z << " :: " << z << "\n";
#define boost 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<ll,ll> , null_type,less< pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    boost
    vector<ll> v(32);
    v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll n;
    cin >> n;
    cout << v[n-1] ;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=(ll)1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    ll Q;
    cin >> Q;
    vector<ll> A(N,0);
    for(ll i=0;i<N;++i)cin>>A[i];
    ll ans=INF;
    //最小がA[i]の時
    for(ll i=0;i<N;++i){
        vector<vector<ll>> vec(0, vector<ll>(0));
        vector<ll> list(0);
        list.emplace_back(-1);
        for(ll j=0;j<N;++j){
            if(A[j]<A[i])list.emplace_back(j);
        }
        list.emplace_back(N);
        for(ll j=0;j<list.size()-1;++j){
            if(list[j+1]-list[j]==1)continue;
            vl G={};
            for(ll k=list[j]+1;k<=list[j+1]-1;++k)G.emplace_back(A[k]);
            vec.emplace_back(G);
        }
        vl F={};
        for(ll j=0;j<vec.size();++j){
            sort(vec[j].rbegin(), vec[j].rend());
            for(ll k=K-1;k<vec[j].size();++k){
                F.emplace_back(vec[j][k]);
            }
        }
        sort(F.begin(), F.end());
        if(F.size()<Q)continue;
        chmin(ans,F[Q-1]-F[0]);
    }

    prt(ans);

    return 0;
}



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

int main(void){
    char ans[11],line[21],*temp;
    int num,sum,i;
    for(sum=0,scanf("%s\n%d",ans,&num);i=-1,num;num--){
        scanf("%s",line);
        while(++i!=11)
            line[10+i]=line[i];
        line[20]=0;
        if((temp=strstr(line,ans))!=NULL && temp-line<10)
                sum++;
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ff first
#define ss second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define loopf(i,a,b) for(int i = a;i < b;i++)
#define loopb(i,a,b) for(int i = a;i >= b;i--)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;



int32_t main()
{
    fast

   int test=1;
   //cin>>test;
  
  while(test--)
  {
    
   int n,m,ans=0;
   cin>>n>>m;
   vi adj[n+1],h(n+1,0);
   for(int i=1;i<=n;i++)cin>>h[i];
   for(int i=0;i<m;i++)
   {
    int x,y;
    cin>>x>>y;
    adj[x].pb(y);
    adj[y].pb(x);
   }

   for(int i=1;i<=n;i++)
   {
    bool chk=true;
    for(int j=0;j<adj[i].size();j++)
    {
        if(h[i]<=h[adj[i][j]])
        {
            chk=false;
            break;
        }
    }
    if(chk)ans++;
   }

   cout<<ans;

  // while loop ending
   }
  

return 0;
}

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

signed main(void)
{
	string s;
	stack<char> st;
	int n;

	cin >> s;
	n = s.size();
	rep(i, n)
	{
		if (st.size() == 0)
			st.push(s[i]);
		else if (s[i] == 'T')
		{
			if (st.top() == 'S')
				st.pop();
			else
				st.push(s[i]);
		}
		else if (s[i] == 'S')
		{
			st.push(s[i]);
		}
	}
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 644
A, B, C = [int(i) for i in input().split()]
num = 0
apperedNum = []
ans = "NO"

while(True):
    num += A
    remain = num % B
    if remain == C:
        ans = "YES"
        break
    elif remain in apperedNum:
        break
    apperedNum.append(remain)

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <bitset>
#include <functional>
#include <set>
#include <map>
#include <array>

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
//#define int long long int
const int MOD = 1000000007;
const int INF = 1001001000;
const double EPS = 0.000000001;

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

bool pairCompare(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  bool flag1 = false;
  bool flag2 = false;
  string ans;
  cin >> s;
  if(s[2] == '0'){
    if(s[3] != '0') flag1 = true;
  }
  if(s[2] == '1'){
    if(s[3] == '0' || s[3] == '1' || s[3] == '2') flag1=true;
  }
  if(s[0] == '0'){
    if(s[1] != '0') flag2 = true;
  }
  if(s[0] == '1'){
    if(s[1] == '0' || s[1] == '1' || s[1] == '2') flag2=true;
  }

  if(flag1){
    if(flag2) ans = "AMBIGUOUS";
    else ans = "YYMM";
  }
  else{
    if(flag2) ans = "MMYY";
    else ans = "NA";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll l = 0,r = 0 ;
    string str ;
    cin >> str ;
    ll len = str.length() ;
    for(ll i = 0 ; i < len ; i++)
    {
        if(str[i] == 'A')
        {
            l = i ;
            break;
        }
    }
    r = len-1 ;
    for(int i = r ; i >= 0 ; i--)
    {
        if(str[i] == 'Z')
        {
            r = i ;
            break;
        }
    }
    ll ans = r-l+1 ;
    cout << ans  << endl;
    return 0;
}


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

int main(){
	int a,b;
	char op;
	
	while(1){
		cin>>a>>op>>b;
		
		if(op == '+')
		cout<<a+b<<endl;
		
		if(op == '-')
		cout<<a-b<<endl;
		
		if(op == '*')
		cout<<a*b<<endl;
		
		if(op == '/')
		cout<<a/b<<endl;
		
		if(op == '?')
		break;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k, s;
  cin >> k >> s;


  int ans = 0;

  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= k; j++) {
      int z = s - i - j;
      if((0 <= z ) & (z <= k)) ans++;   
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main(){
  int n;
  ll x;
  cin >> n >> x;
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  ll cnt = 0;
  for(int i=0;i<n-1;i++){
    if(a[i]+a[i+1] > x){
      ll diff = a[i]+a[i+1]-x;
      if(diff <= a[i+1]){
        a[i+1] -= diff;
      }else{
        a[i+1] = 0;
        a[i] -= diff-a[i+1];
      }
      cnt += diff;
    }
  }

  cout << cnt << endl;
}


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

int main(void)
{
	string str;
	

	
	while( cin >> str, !cin.eof() ){
		int JOI = 0, IOI = 0;
		for(int i = 1; i < str.length() -1; i++){
			if(str[i] == 'O' && str[i+1] == 'I'){
				if(str[i-1] == 'J')
					JOI++;
				else if(str[i-1] == 'I')
					IOI++;
			}
		}

		cout << JOI << endl << IOI << endl;

	}


	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  int N;
  int A;
  cin>>N;
  LL cnt=0;
  LL ans=1;
  FOR(i,0,N){
    cin>>A;
    ans*=3;
    if(A%2==1){
      cnt++;
    }
  }
  LL num=1;
  FOR(i,0,N-cnt){
    num*=2;
  }
  cout<<ans-num<<endl;
  return 0;
}


Measured memory_bytes: 256