akhauriyash/Code-Regression huggingface dataset:
from itertools import combinations 
def powerset(string): 
    al=[]
    for i in range(0,len(string)+1): 
        sl=[]
        for element in combinations(string,i): 
            al.append(element)
    return al
import sys
def check(l,row,col,el,r,c):
    cc=0
    
    for i in range(r):
        for j in range(c):
            if(l[i][j]=="#" and i not in row and j not in col):
                cc+=1
    
    if cc==el:
        return True;
    return False



r,c,k=map(int,input().split())
l=[]
for i in range(r):
    tt=list(input())
    l.append(tt)
s1=[]
for i in range(r):
    s1.append(i)
s2=[]
for i in range(c):
    s2.append(i)
row=powerset(s1)
col=powerset(s2)
ans=0

for i in row:
    for j in col:
        if(check(l,i,j,k,r,c)):
            ans+=1
print(ans)







Measured memory_bytes: 68952
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {

	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		Set<Character> set = new HashSet<>();
		for (char s : S) {
			set.add(s);
		}

		for (char i = 'a'; i <= 'z'; i++) {
			if (!set.contains(i)) {
				System.out.println(i);
				return;
			}
		}

		System.out.println("None");
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b, int[] c) throws IOException {
			if (a.length != b.length || b.length != c.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
				c[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
const int inf = 1 << 30;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int K, N;
int A[200010];

int main(){
    cin >> K >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    A[N] = A[0] + K;
    int ans = 0;
    for(int i = 0; i < N; i++) chmax(ans, A[i + 1] - A[i]);
    cout << K - ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.bigint;

long P = 10^^9+7;

void main()
{
    auto nx = readln.split.to!(int[]);
    auto N = nx[0];
    auto X = nx[1];
    auto SS = readln.split.to!(int[]);
    sort!"a > b"(SS);

    long[][] DP;
    DP.length = 201;
    foreach (ref dp; DP) dp.length = 10^^5+1;
    DP[0][X] = 1;

    foreach (i; 0..N) {
        foreach (long x; 0..10^^5+1) {
            DP[i+1][x] = (DP[i+1][x] + DP[i][x] * (N-i-1)) % P;
            DP[i+1][x%SS[i]] = (DP[i+1][x%SS[i]] + DP[i][x]) % P;
        }
    }

    long r;
    foreach (long x; 0..10^^5+1) {
        r = (r + x * DP[N][x]) % P;
    }
    writeln(r);
}

Measured memory_bytes: 161148
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

vector<int> c(26);
vector<int> last(26,0);

int calc_down(int d){
  int ans=0;
  for(int i=0;i<26;i++){
    ans+=c.at(i)*(d-last.at(i));
  }
  return ans;
}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int D;
  cin >> D;
  for(int i=0;i<26;i++) cin >> c.at(i);
  vector<vector<int>> s(D,vector<int>(26));
  for(int i=0;i<D;i++){
    for(int j=0;j<26;j++) cin >> s.at(i).at(j);
  }
  vector<int> t(D);
  for(int i=0;i<D;i++){
    cin >> t.at(i);
    t.at(i)--;
  }

  vector<int> v(D+1,0);
  for(int i=1;i<D+1;i++){
    int ans=v.at(i-1);
    ans+=s.at(i-1).at(t.at(i-1));
    last.at(t.at(i-1))=i;
    ans-=calc_down(i);
    v.at(i)=ans;
  }
  for(int i=1;i<D+1;i++)  cout << v.at(i) << endl;

  return 0;
}

Measured memory_bytes: 3660
def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  n = get_int
  a_arr = get_ints
  a_arr = a_arr.map.with_index { |num, index| [num, index+1] }
  a_arr.sort_by! {|ele| ele[0] }
  puts a_arr.map {|ele| ele[1]}.join(" ")
end

if __FILE__ == $0
  main
end


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


public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        int[] a = new int[N];
        double av = 0;
        for(int i=0;i<N;i++){
            a[i] = sc.nextInt();
            av += a[i];
        }
        av /= N;
        
        double m = 100000;
        double ins = 0;
        int result = 0;
        for(int i=0;i<N;i++){
            if(a[i] > av){
                ins = a[i] - av;
                if(ins<m){
                    result=i;
                    m = ins;
                }
            }
            else{
                ins = av - a[i];
                if(ins<m){
                    result=i;
                    m = ins;
                }
            }
        }

        out.println(result);
        out.flush();
    }
    static int fact(int N){
        if(N==0) return 1;
        else return N*fact(N-1);
    }
        
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 22740
#include <algorithm>
#include <iostream>
#include <vector>

void print_array(const int a[], int n) {
  for (int i = 0; i < n; ++i) {
    if (i > 0)
      std::cout << " ";
    std::cout << a[i];
  }
  std::cout << std::endl;
}

int bubble_sort(int a[], int n) {
  bool flag = true;
  int count = 0;
  while (flag) {
    flag = false;
    for (int j = n - 1; j > 0; --j) {
      if (a[j] < a[j - 1]) {
        ++count;
        std::swap(a[j], a[j - 1]);
        flag = true;
      }
    }
  }
  return count;
}

int main() {
  int n;
  std::cin >> n;
  int a[101];
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  int count = bubble_sort(a, n);
  print_array(a, n);
  std::cout << count << std::endl;
}



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

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int gcd(int a, int b, int c) { return gcd(a, gcd(b, c)); }

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

	int k; cin >> k;
	int sum{ 0 };
	for (int a = 1; a <= k; a++)
	{
		for (int b = 1; b <= k; b++)
		{
			for (int c = 1; c <= k; c++)
			{
				sum += gcd(a, b, c);
			}
		}
	}

	cout << sum << '\n';
}

Measured memory_bytes: 3652
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
#include<bitset>
using namespace std;

int main() {
	int n; cin >> n;
	int d = n % 10; n /= 10; int c = n % 10; n /= 10; int b = n % 10; n /= 10;
	int a = n;
	for (int i = 0; i < (1 << 3); i++) {
		bitset<3>s(i);
		int sum = a;
		if (s.test(0))sum += b;
		else sum -= b;
		if (s.test(1))sum += c;
		else sum -= c;
		if (s.test(2))sum += d;
		else sum -= d;
		if (sum == 7) {
			cout << a;
			if (s.test(0))cout << '+';
			else cout << '-';
			cout << b;
			if (s.test(1))cout << '+';
			else cout << '-';
			cout << c;
			if (s.test(2))cout << '+';
			else cout << '-';
			cout << d << "=7" << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3620
#=
B:
- Julia version: 
- Author: abap
- Date: 2019-11-16
=#
N = parse(readline())
texts = readline()
if N%2 == 0
if texts[1:div(N,2)] == texts[div(N,2)+1:N]
    println("Yes")
else
    println("No")
end
else
    println("No")
end

Measured memory_bytes: 168048
extern crate proconio;

use proconio::*;

fn main() {
    input! {
        n: usize,
        a: [usize; n - 1],
    }

    let mut ans = vec![0; n + 1];
    for &v in a.iter() {
        ans[v] += 1;
    }
    for i in 1..=n {
        println!("{}", ans[i]);
    }
}


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

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

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

int main(void)
{
    int h, w;
    string s;
    cin >> h >> w;
    REP(i, h) cin >> map[i];
    
    REP(i, h) REP(j, w)
    {
        if (map[i][j] == '#') continue;
        int num = 0;
        REP(d, 8)
        {
            int nx = j + dx[d];
            int ny = i + dy[d];
            if (nx < 0 or nx >= w) continue;
            if (ny < 0 or ny >= h) continue;
            if (map[ny][nx] == '#') num++;
        }
        map[i][j] = '0' + num;
    }
    REP(i, h) cout << map[i] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,sn,sb;
  cin >> a >> b;
  sn = min(a,b);
  sb = max(a,b);
  for(int i = 0;i<sb;i++){
  		cout << sn;
	}
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	string s,t;
	cin>>s>>t;
	lli i,flag=0;
	fr(i,s.length())
	{
		if(s[i]!=t[i])
		{
			flag=1;
			break;
		}
	}
	if(flag==1)
	{
		cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
	
	return 0;
}

Measured memory_bytes: 3652
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int X; cin >> X;
	cout << (360 / gcd(360, X));

	return 0;
}

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

int main() {
	double r, area, circ;
	double pi = 3.141592653589;
	scanf("%lf", &r);
	area = pi*r*r;
	circ = 2*pi*r;
	printf("%f %f\n", area, circ);
	
	return 0;
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

int n;
PA a[3];

int main(){
	n=read();
	For(i,0,2) a[i].fi=read();
	For(i,0,2) a[i].se=read();
	sort(a,a+3,[](pa a,pa b){
		return a.fi-a.se<b.fi-b.se;
	});
	if (a[0].fi-a[0].se>0){
		ll ans=0;
		For(i,0,n/a[0].se){
			For(j,0,(n-a[0].se*i)/a[1].se){
				int k=(n-a[0].se*i-a[1].se*j)/a[2].se;
				int z=(n-a[0].se*i-a[1].se*j)%a[2].se;
				ans=max(ans,i*a[0].fi+j*a[1].fi+k*a[2].fi+z);
			}
		}
		printf("%lld\n",ans);
	} else if (a[2].fi-a[2].se<0){
		ll ans=0;
		For(i,0,n/a[0].fi){
			For(j,0,(n-a[0].fi*i)/a[1].fi){
				int k=(n-a[0].fi*i-a[1].fi*j)/a[2].fi;
				int z=(n-a[0].fi*i-a[1].fi*j)%a[2].fi;
				ans=max(ans,i*a[0].se+j*a[1].se+k*a[2].se+z);
			}
		}
		printf("%lld\n",ans);
	} else if (a[1].fi-a[1].se<0){
		ll ans=0;
		For(i,0,n/a[0].fi){
			int j=(n-a[0].fi*i)/a[1].fi;
			int m=(n-a[0].fi*i-a[1].fi*j)+a[0].se*i+a[1].se*j;
			int k=m/a[2].se;
			ans=max(ans,k*a[2].fi+m%a[2].se);
		}
		printf("%lld\n",ans);
	} else {
		ll ans=0;
		n=n%a[0].fi+(n/a[0].fi)*a[0].se;
		For(j,0,n/a[1].se){
			int k=(n-a[1].se*j)/a[2].se;
			int z=(n-a[1].se*j)%a[2].se;
			ans=max(ans,j*a[1].fi+k*a[2].fi+z); 
		}
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 3768
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

struct S
{
	int x;
	S() {}
	S(int x) : x(x) {}
	static S I() {
		return S(0);
	}
	void merge(S& a, S& b) {
		x = std::max(a.x,b.x);
	}
};

struct SegmentTree
{
	const int n;
	std::vector<S> data;
	SegmentTree(int n, std::vector<S>& a) : n(n), data(2*n) {
		for(int i=0;i<n;i++) {
			data[n+i] = a[i];
		}
		for(int i=n-1;i>0;i--) {
			data[i].merge(data[i<<1], data[i<<1|1]);
		}
	}
	void set(int i, S v) {
		data[n+i] = v;
		i+=n;
		while(i>0) {
			i>>=1;
			data[i].merge(data[i<<1], data[i<<1|1]);
		}
	}
	S get(int l, int r) {
		// 0-Indexed, [l, r)
		l+=n; r+=n;
		S sum = S::I();
		while(l<r) {
			if(l&1) sum.merge(sum,data[l++]);
			if(r&1) sum.merge(sum,data[--r]);
			l>>=1; r>>=1;
		}
		return sum;
	}
};


signed main() {
	int n;
	std::cin >> n;
	std::vector<std::pair<int,int> > a;
	std::vector<int> points;
	rep(i,n) {
		int x,l;
		std::cin >> x >> l;
		a.emplace_back(x-l,x+l);
		points.emplace_back(x-l);
		points.emplace_back(x+l);
	}
	std::sort(all(a));
	std::map<int,int> map;
	std::sort(all(points));
	int m = points.size();
	rep(i,points.size()) map[points[i]]=i;
	std::vector<S> dp(m,0);
	SegmentTree segtree(m,dp);
	int max = 0;
	rep(i,n) {
		auto cur = a[i];
		int l=cur.first;int r=cur.second;
		S xx = segtree.get(0,map[l]+1);
		segtree.set(map[r],S(std::max(segtree.get(map[r],map[r]+1).x,xx.x+1)));
		max = std::max(xx.x+1,max);
	}
	print(max);
	return 0;
}


Measured memory_bytes: 20580
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int c;

	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	if (a < b && b < c) {
		printf("%d %d %d\n", a, b, c);
	}
	if (a < b && c < b && a < c) {
		printf("%d %d %d\n", a, c, b);
	}
	if (b < a && b < c && c < a) {
		printf("%d %d %d\n", b, c, a);
	}
	if (b < a  && b < c && a < c){
		printf("%d %d %d\n", b, a, c);
	}
	if (b < a && c < b){
		printf("%d %d %d\n", c, b, a);
	}
	if (a < b && c < b && c < a) {
		printf("%d %d %d\n", c, a, b);
	}
	if (a < b && b == c) {
		printf("%d %d %d\n", a, b, c);
	}
	if (a == b && b < c) {
		printf("%d %d %d\n", a, b, c);
	}
	if(a == b && c < b){
		printf("%d %d %d\n", c, a, b);
	}
	if (b < a && b == c) {
		printf("%d %d %d\n", b, c, a);
	}
	if (a == b && b == c) {
		printf("%d %d %d\n", a, b, c);
	}
	if (a < b && c < b && a == c) {
		printf("%d %d %d\n", a, c, b);
	}

	return 0;
}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;cin>>s>>t;
    if(t.size()<s.size())cout<<"No";
    else{
        int c=0;
        for(int i=0;i<s.size();i++)
        {
            if(t[i]!=s[i]){cout<<"No";return 0;}
        }
        cout<<"Yes";
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define ppll pair<pll,ll>
#define vi vector <pll>
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define f(i,x,n) for(ll i=x;i<n;i++)
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;} 
const ll N = 2e5 + 5, M = 1e9 + 7;

int main(){
    FAST;
    ll n, x = 0, m, k, i, t, ans = 0, j, y = 0, z = 0, c = 0;
    cin >> n >> x >> y;
    if(y < x) swap(x, y);

    ll a[n] = { 0 };

    f(i, 1, n + 1){
        f(j, i + 1, n + 1){
            if(j <= x || i >= y){
                a[j - i] ++;
            }
            else if(i >= x && j <= y){
                z = min(j - i, y - j + i - x + 1);
                a[z] ++;
            }
            else if(i < x && j > y){
                z = x - i + j - y + 1;
                a[z] ++;
            }
            else if(i < x && j > x && j <= y){
                z = y - j + 1 + x - i;
                z = min(z, j - i);
                a[z] ++;
            }
            else{
                z = j - y + i - x + 1;
                z = min(z, j - i);
                a[z] ++;
            }
        }
    }
    f(i, 1, n) cout << a[i] << "\n";
}

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

int main() {
  string sN;
  cin >> sN;
  int total = stoi( sN );
  int addition = 0;
  
  //桁数
  int digit_number = sN.size();
  for( int i = 0; i < digit_number; ++i ){
    char cN = sN[i];
    int iN = cN - '0';
    addition += iN;
  }
  
  if( total % addition == 0 ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3616
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=2e5+10;
const int inf=1e9;
int n,a[N];
map<int,int>cnt;
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n;
	ll ans=0;
	rep(i,1,n){
		cin>>a[i];
		ans+=cnt[i-a[i]];
		cnt[i+a[i]]++;
	}
	cout<<ans<<endl;
	return 0;
}
//j+a[j]==i-a[i];

Measured memory_bytes: 21400
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x)
{
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=getchar();}
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=2e5+10;
char str[N];
int n;
int f[N],g[N];
int main() {
	rd(n);
	scanf("%s",str+1);
	for(int i=1;i<=n;++i) f[i]=f[i-1]+(str[i]=='#');
	for(int i=n;i>=1;--i) g[i]=g[i+1]+(str[i]=='.');
	int ans=n;
	for(int i=1;i<=n+1;++i) ans=min(ans,f[i-1]+g[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2048
n = int(input())
Rt1 =  int(input())
Rt2 =  int(input())

if Rt1 < Rt2:
    min_Rt = Rt1
    
else:
    min_Rt = Rt2
    
max_prf = Rt2 - Rt1


for i in range(2,n):
    Rt = int(input())
    tmp_prf = Rt - min_Rt

    if tmp_prf > max_prf:
        max_prf = tmp_prf
    
    if Rt < min_Rt:
        min_Rt = Rt
    
print(str(max_prf))   


Measured memory_bytes: 5612
import numpy as np
N = int(input())
number_list = list(map(int,input().split()))
Alice_sum = 0
Bob_sum = 0
for i in range(N):
    if(i%2==0):
        Alice_sum += max(number_list)
        number_list.remove(max(number_list))
    else:
        Bob_sum += max(number_list)
        number_list.remove(max(number_list))
print(Alice_sum-Bob_sum)

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

namespace ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var p1 = new Point(0, 0);
            var p2 = new Point(100, 0);
            Console.WriteLine(p1);
            KochCurve(p1, p2, n);
            Console.WriteLine(p2);
        }

        private static readonly double cth = Math.Cos(Math.PI / 3);
        private static readonly double sth = Math.Sin(Math.PI / 3);

        private static void KochCurve(Point start, Point end, int n)
        {
            if (n == 0) return;
            var m = n - 1;

            var s = new Point((start.X * 2 + end.X * 1) / 3, (start.Y * 2 + end.Y * 1) / 3);
            var t = new Point((start.X * 1 + end.X * 2) / 3, (start.Y * 1 + end.Y * 2) / 3);
            var ux = (t.X - s.X) * cth - (t.Y - s.Y) * sth + s.X;
            var uy = (t.X - s.X) * sth + (t.Y - s.Y) * cth + s.Y;
            var u = new Point(ux, uy);

            KochCurve(start, s, m);
            Console.WriteLine(s);
            KochCurve(s, u, m);
            Console.WriteLine(u);
            KochCurve(u, t, m);
            Console.WriteLine(t);
            KochCurve(t, end, m);
        }
        private class Point
        {
            public Point(double v1, double v2)
            {
                X = v1;
                Y = v2;
            }

            public double X { get; set; }
            public double Y { get; set; }

            public override string ToString()
            {
                return $"{X:0.000000000} {Y:0.000000000}";
            }
        }
    }
}



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

using namespace std;

long s[111111], t[111111];
int main() {
	int a, b, q;
	cin >> a >> b >> q;
	for (int i = 0; i < a; i++)
		scanf("%ld", s + i);
	for (int i = 0; i < b; i++)
		scanf("%ld", t + i);
	for (int i = 0; i < q; i++) {
		long x, r = 1e18;
		scanf("%ld", &x);
		int p = lower_bound(s, s + a, x) - s;
		int q = lower_bound(t, t + b, x) - t;
		if (p) {
			if (q) r = min(r, x - min(s[p - 1], t[q - 1]));
			if (q < b) r = min({ r,x + t[q] - s[p - 1] * 2,t[q] * 2 - x - s[p - 1] });
		}
		if (p < a) {
			if (q < b) r = min(r, max(s[p], t[q]) - x);
			if (q) r = min({ r,x + s[p] - t[q - 1] * 2,s[p] * 2 - x - t[q - 1] });
		}
		cout << r << '\n';
	}
	cout << flush;
	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename F>
i64 mongeDP(i64 N, F f) {
  vector<vector<i64>> dp(N, vector<i64>(N, 1e18));
  vector<vector<i64>> k(N, vector<i64>(N));
  rep(i, 0, N) {
    dp[i][i] = 0;
    k[i][i] = i;
  }

  rep(d, 1, N) {
    rep(i, 0, N - d) {
       i64 j = i + d;
       i64 l = k[i][j - 1];
       i64 r = k[i + 1][j];
       rep(s, l, r + 1) {
         if(s + 1 >= N) break;
         if(dp[i][s] + dp[s + 1][j] <= dp[i][j]) {
           dp[i][j] = dp[i][s] + dp[s + 1][j];
           k[i][j] = s;
         }
       }
       dp[i][j] += f(i, j);
    }
  }
  return dp[0][N - 1];
}

int main() {
  i64 N;
  cin >> N;

  vector<i64> W;
  W.push_back(0);
  rep(i,0, N) {
    i64 x;
    cin >> x;
    W.push_back(W.back() + x);
  }
  auto f = [&](i64 i, i64 j) { return W[j + 1] - W[i]; };
  cout << mongeDP<decltype(f)>(N, f) << endl;
}


Measured memory_bytes: 2816
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatoro {
    static void Main() {
        char[] s = Console.ReadLine().ToArray();
        int K = int.Parse(Console.ReadLine());
        Dictionary<char, int> D1 = new Dictionary<char, int>();
        D1.Add('a', 0);
        D1.Add('b', 1);
        D1.Add('c', 2);
        D1.Add('d', 3);
        D1.Add('e', 4);
        D1.Add('f', 5);
        D1.Add('g', 6);
        D1.Add('h', 7);
        D1.Add('i', 8);
        D1.Add('j', 9);
        D1.Add('k', 10);
        D1.Add('l', 11);
        D1.Add('m', 12);
        D1.Add('n', 13);
        D1.Add('o', 14);
        D1.Add('p', 15);
        D1.Add('q', 16);
        D1.Add('r', 17);
        D1.Add('s', 18);
        D1.Add('t', 19);
        D1.Add('u', 20);
        D1.Add('v', 21);
        D1.Add('w', 22);
        D1.Add('x', 23);
        D1.Add('y', 24);
        D1.Add('z', 25);
        int lengh = s.Length;
        int[] ans = new int[lengh];
        for(int i = 0; i < lengh; i++) {
            if (s[i] == 'a') {
                continue;
            }
            int integ = D1[s[i]];
            if (K >= 26-integ) {
                ans[i] = 0;
                K -= 26 - integ;
            }
            else {
                ans[i] = D1[s[i]];
                continue;
            }
        }
        ans[lengh - 1] = (ans[lengh - 1] + K)%26;
        char[] D = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
        for (int i = 0; i < lengh; i++) {
            Console.Write(D[ans[i]]);
        }
        Console.WriteLine();
        

      

    }
}

Measured memory_bytes: 4568
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, l, sum=0, mx=0;
    cin >> n;
    while (n--) {
        cin >> l;
        sum += l;
        mx = max(mx, l);
    }
    if (mx < sum-mx) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n, m := scanInt(), scanInt()
	h := scanInts(n)
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		a, b := scanInt(), scanInt()
		a--
		b--
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}

	var cnt int
	for i := 0; i < n; i++ {
		ok := true
		for _, v := range g[i] {
			if h[i] <= h[v] {
				ok = false
			}
		}
		if ok {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 11972
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll r;cin>>r;
    cout<<3*r*r<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;

class SegmentTree{
public:
    ll N, unit; 
    vector<ll> data, tree;
    SegmentTree(vector<ll> v, ll u){
        unit = u;
        data = v;
        ll n = data.size();
        N = 1;
        while(N<n)N*=2;
        tree = vector<ll>(N*2,u);
        build();
    }
    void build(){rep(i,N)update(i,data[i]);}
    void update(ll i, ll x){
        i += N-1;
        tree[i]+=x;
        while(i){
            i = (i-1)/2;
            tree[i]=merge(tree[i*2+1],tree[i*2+2]);
        }
    }
    ll query(ll start, ll end){return query(start, end, 0, 0, N);}
private:
    ll query(ll a, ll b, ll k, ll l, ll r){
        if(r<=a||b<=l)return unit;
        if(a<=l&&r<=b)return tree[k];
        else{
            ll lv = query(a,b,2*k+1,l,(l+r)/2);
            ll rb = query(a,b,2*k+2,(l+r)/2,r);
            return merge(lv,rb);
        }
    }
    ll merge(ll l, ll r){
        return l+r;
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,q;cin>>n>>q;
    SegmentTree st(vector<ll>(n,0), 0);
    rep(i,q){
        ll c,x,y;cin>>c>>x>>y;
        if(!c) st.update(x-1,y);
        else cout<<st.query(x-1,y)<<endl;
    }
    return 0;
}


Measured memory_bytes: 6520
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
    int n,i,p=0,q,j=0,k=0;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        p=p+a[i];
    }
    p=p/n;
    q=p+1;
    for(i=0;i<n;i++)
    {
        k=k+pow(a[i]-p,2);
        j=j+pow(a[i]-q,2);
    }
    if(j>k)
        cout<<k;
    else
        cout<<j;
}


Measured memory_bytes: 256
#include<stdio.h>

int chNum(char);

int main(){
	
	char ch[1001];
	
while(1){
	
	int cnt=0,i;
	
	for(i=0;;i++){
	scanf("%c",&ch[i]);
	if(ch[i]=='\n')break;
	int a=chNum(ch[i]);
	cnt+=a;
	}
	if(cnt==0)break;
	printf("%d\n",cnt);
	
}
return 0;
}

int chNum(char ch){	
	return ch-'0';
}

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

int main(){
    int n;
    cin >> n;
    int count1 = 0;
    int count2 = 0;
    
    for(int i = 1; i <= n; i++) {
         if(i % 2 != 0){
             count1 = 0;
     for(int j = 1; j <= i; j++){
      if(i % j == 0) {
       count1++;
      }
     } 
     if (count1 == 8) {
         count2++;
     }
         }
    }
    cout << count2;
}

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

using namespace std;

int main(void) {
  int N;
  int *a;
  int d4 = 0, d2 = 0, df = 0;
  
  scanf("%d", &N);
  a = new int[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 4 == 0) {
      d4++;
    } else if (a[i] % 2 == 0) {
      d2++;
    } else {
      df++;
    }
  }
  //printf("%d, %d, %d\n", d4, d2, df);
  if (d4 >= N / 2 || (d4 + d2) / 2 >= df) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cstdio>
#include<cstdint>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<vector>
#include<string>
#include<list>
#include<deque>
#include<stack>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
const int MOD = 1e9+7;
#define NIL -1
const int INF = 1 << 29;
int n;
int a[101];
int b[15];
int main(){
    int cnt=0;
    cin>>n;
    memset(b,0,sizeof(b));

    rep(i,n){
        cin>>a[i];
        if(a[i]>=3200){cnt++;continue;}
        rep(j,13){
        if(a[i]<(j+1)*400){
            b[j]++;
            break;
        }
    }
    }
    int count=0;
    rep(i,8){
        if(b[i] && i<8)count++;
    }
    int mini,maxi;

    maxi=count+cnt;
    if(count)mini=count;
    else mini=1;
    cout<<mini<<" "<<maxi<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
#define MOD 1000000007
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
int main(void){
    ll n,m,num=0,ans=0;cin>>n>>m;
    vector<pair<ll,ll>> drink(n);
    For(i,n){
        cin>>drink.at(i).first>>drink.at(i).second;
    }
    sort(drink.begin(),drink.end());
    ll i=0;
    while(num<m){
        num++;ans+=drink.at(i).first;drink.at(i).second--;
        if(drink.at(i).second==0)i++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
double a, b, r, __r2, SS, ans, SS2, R, R2;
double Get(double r) { return r * 180 / 3.1415926535898; }
int main() {
	cin >> a >> b >> r;
	__r2 = a*a, SS = __r2*b, SS2 = SS/2;
	if(r > SS2) R = (r-b*a*a/2)*2/a/a, R2 = atan(fabs(R-b)/a), ans = Get(R2);
	else if(r < SS2) R = 2*r/a/b, R2 = atan(b/R), ans = Get(R2);
	else ans = 45;
	printf("%.10lf\n", ans);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n==0){
    cout<<0;
    return 0;
  }
  vector<char> c;
  while(n!=0){
    if(n%2!=0){
      c.push_back('1');
      n-=1;
    }else{
      c.push_back('0');
    }
    n/=(-2);
  }
  reverse(c.begin(),c.end());
  bool f=true;
  for(int i=0;i<c.size();i++){
    if(f&&c[i]=='0')
      continue;
    if(c[i]=='1')
      f=false;
    cout<<c[i];
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    if (c == 1) {
        cout << n << endl;
        return;
    }
    SORT(a);
    int ans = 0;
    int b = -1;
    int p = 0;
    REP(i, n) {
        if (b == -1) {
            b = a[i];
            p = 1;
            continue;
        }
        if (a[i] - b <= k) {
            p++;
            if (p == c) {
                ans++;
                b = -1;
                p = 0;
            }
        } else {
            ans++;
            b = a[i];
            p = 1;
        }
    }
    if (p > 0) ans++;
    cout << ans << endl;

}



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

int main(){
    while (1){
        int n, m, t, p;
        cin >> n >> m >> t >> p;
        if (n == 0) break;
        vector<vector<int>> paper(m, vector<int>(n, 1));
        for (int i = 0; i < t; i++){
            int d, c;
            cin >> d >> c;
            if (d == 1){
                int nn = max(c, n - c);
                vector<vector<int>> newpaper(m, vector<int>(nn, 0));
                for (int x = 0; x < m; x++){
                    for (int y = 0; y < nn; y++){
                        if (0 <= y+c && y+c < n) newpaper[x][y] += paper[x][y+c];
                        if (0 <= c-y-1 && c-y-1 < n) newpaper[x][y] += paper[x][c-y-1];
                    }
                }
                paper = newpaper;
                n = nn;

            }
            else{
                int nm = max(c, m - c);
                vector<vector<int>> newpaper(nm, vector<int>(n, 0));
                for (int x = 0; x < nm; x++){
                    for (int y = 0; y < n; y++){
                        if (0 <= x+c && x+c < m) newpaper[x][y] += paper[x+c][y];
                        if (0 <= c-x-1 && c-x-1 < m) newpaper[x][y] += paper[c-x-1][y];
                    }
                }
                paper = newpaper;
                m = nm;
            }
        }
        for (int i = 0; i < p; i++){
            int x, y;
            cin >> x >> y;
            cout << paper[y][x] << endl;
        }
    }
}


Measured memory_bytes: 3188
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>


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


int main (void)
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    while(1)
    {   
        c -= b;
        if(c<=0)
        {
            cout<<"Yes"<<endl;
            return 0;
        }

        a -= d;

        if(a<=0) 
        {
            cout<<"No"<<endl;
            return 0;
        }



    }
}

Measured memory_bytes: 3136
#include <iostream>
#include <algorithm>
#include <vector>
#include <limits.h>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;
using ll=long long;
using P=pair<int,int>;
long long modpow(long long a, long long n, long long mod=1e9+7) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main(){
    const int MOD=1e9+7;
    string s;
    cin>>s;
    int n=s.size();
    vector<vector<vector<int>>> dp(n,vector<vector<int>>(3,vector<int>(4,0)));
    if(s[0]=='A')dp[0][0][0]=1;
    else if(s[0]=='?')dp[0][0][1]=1;
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<4;k++){
                dp[i][j][k]=dp[i-1][j][k];                
            }
        }
        if(s[i]=='A')dp[i][0][0]++;
        else if(s[i]=='B'){
            dp[i][1][0]+=dp[i-1][0][0];
            dp[i][1][1]+=dp[i-1][0][1];
        }else if(s[i]=='C'){
            dp[i][2][0]+=dp[i-1][1][0];
            dp[i][2][1]+=dp[i-1][1][1];
            dp[i][2][2]+=dp[i-1][1][2];
        }else{
            dp[i][0][1]++;
            for(int j=1;j<3;j++){
                for(int k=1;k<=j+1;k++){
                    dp[i][j][k]+=dp[i-1][j-1][k-1];
                }
            }
        }
        for(int j=0;j<3;j++){
            for(int k=0;k<4;k++){
                dp[i][j][k]%=MOD;
            }
        }
    }
    int q=0;
    for(int i=0;i<n;i++){
        if(s[i]=='?')q++;
    }
    int ret=0;
    for(int i=0;i<=3;i++){
        ret+=(ll)dp[n-1][2][i]*modpow(3,q-i)%MOD;
        ret%=MOD;
    }
    cout<<ret<<endl;
}



Measured memory_bytes: 19840
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m, f, r;
		for(;;) {
			m = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			
			if(m == -1 && f == -1 && r == -1) {
				break;
			} else if(m == -1 || f == -1) {
				System.out.println("F");
			} else if((m+f) >= 80) {
				System.out.println("A");
			} else if((m+f) >= 65) {
				System.out.println("B");
			} else if((m+f) >= 50) {
				System.out.println("C");
			} else if((m+f) >= 30) {
				if(r >= 50) {
					System.out.println("C");
				} else {
					System.out.println("D");
				}
			} else {
				System.out.println("F");
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 26260
#include <iostream>
#include <string>

int main() {
  int n;
  std::string s, s_shift = "";
  std::cin >> n >> s;
  for (int i = 0; i < s.length(); ++i) {
    if (isupper(s[i])) {
      s_shift += char(int(s[i]+n-65)%26+65); 
    }
    else {
      s_shift += char(int(s[i]+n-96)%26+96);
    } 
  }
  std::cout << s_shift; 
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <initializer_list>

using lli=long long int;

int M;

class mat3{
  public:
  lli m[3][3] = {};
  mat3(){}
  mat3(std::initializer_list<lli> init){
    auto it = init.begin();
    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
        m[i][j] = (((*it)%M)+M)%M;
        ++it;
      }
    }
  }
};

const mat3 operator*(const mat3& lhs, const mat3& rhs){
  mat3 ans;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        ans.m[i][j] += lhs.m[i][k]*rhs.m[k][j];
      }
      ans.m[i][j] %= M;
    }
  }
  return ans;
}

int main(){
  lli L,A,B;
  std::cin >> L >> A >> B >> M;

  std::vector<lli> ns_d(1);
  lli tmp = 9;
  while(A+B*(L-1)>tmp){
    if(A>tmp){
      ns_d.push_back(0);
    }else{
      ns_d.push_back((tmp-A)/B+1);
    }
    tmp = tmp*10+9;
  }
  ns_d.push_back(L);

  mat3 mat_total = {1,0,0,0,1,0,0,0,1};
  for(int i = 1; i < ns_d.size(); i++){
    lli ipow = 1;
    for(int j = 0; j < i; j++){
      ipow = (ipow*10)%M;
    }
    lli isize = ns_d[i]-ns_d[i-1];
    mat3 mat_last = {ipow,1,0,0,1,B,0,0,1};
    int nb = 0;
    while((isize>>nb)!=0){
      if((isize>>nb)&1){
        mat_total = mat_last*mat_total;
      }
      mat_last = mat_last*mat_last;
      nb++;
    }
  }

  lli ans = ((mat_total.m[0][1]*(A%M))%M+mat_total.m[0][2])%M;
  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 256
#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    n = int(input())
    al = list(map(int, input().split()))
    for i in range(n):
        al[i] = al[i] - (i + 1)
    al.sort()

    if n % 2 == 0:
        b = (al[(n-1)//2] + al[n//2])//2
    else:
        b = al[(n-1)//2]
    ans = sum([abs(a - b) for a in al])
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 97872