akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetNumber();
            var nums = GetNumbersInt(N);
            for (int i = 0; i < N; i++)
            {
                nums = nums.Take(i + 1).OrderBy(x => x).Concat(nums.Skip(i + 1)).ToArray();
                System.Console.WriteLine(string.Join(" ", nums.Select(x => x.ToString()).ToArray()));
            }
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

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

int main()
{
  char a,b;
  cin >> a >> b;
  
  string ans = "";
  if(a <= b){
    int tmp = b - '0';
    while(tmp-- > 0){
      ans += a;
    }
  }else{
    int tmp = a - '0';
    while(tmp-- > 0){
      ans += b;
    }
  }
  
  cout << ans << endl;
}

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

#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	ll ans = (n * (n - 1)) / 2;
	cout << ans << endl;
}

Measured memory_bytes: 256
def solve(N, XL):
    XL_re = [[xl[0] - xl[1], xl[0] + xl[1]] for xl in XL]
    XL_re = sorted(XL_re, key=lambda x: x[1])

    cnt = 0
    for i, xl in enumerate(XL_re):
        if i == 0:
            tmp = xl[1]
            cnt += 1
        else:
            if tmp <= xl[0]:
                tmp = xl[1]
                cnt += 1
    return cnt

def test():
    assert solve(4, [[2, 4], [4, 3], [9, 3], [100, 5]]) == 3

def main():
    N = int(input())
    XL = [list(map(int, input().split())) for _ in range(N)]
    ans = solve(N, XL)
    print(ans)

if __name__ == "__main__":
    # test()
    main()


Measured memory_bytes: 76376
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int n;
        String s;
        try (Scanner cin = new Scanner(System.in)) {
            n = cin.nextInt();
            s = cin.next();
        }

        long changer = s.subSequence(1, n).chars()
                .filter(c -> c == 'E')
                .count();
        long minChanger = changer;
        for (int i = 1; i < n; i++) {
            if (s.charAt(i - 1) == 'W') changer++;
            if (s.charAt(i) == 'E') changer--;
            minChanger = Math.min(changer, minChanger);
        }

        System.out.println(minChanger);
    }

}


Measured memory_bytes: 31412
n,m = map(int,input().split())
stu_pos = [[i for i in map(int,input().split())] for j in range(n)]
check_pos = [[i for i in map(int,input().split())] for j in range(m)]

for i in range(n):
    count = m+1
    dis = 10**9+7
    for j in range(m):
        a  = abs(stu_pos[i][0] - check_pos[j][0]) + abs(stu_pos[i][1] - check_pos[j][1])
        if dis > a : 
            dis = a 
            count = j + 1 
    print("{}".format(count))

     

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    // Your code here!
    int N, X, L, D=0, count;
    scanf("%d %d", &N, &X);
    
    for(count = 0; count <= N && D <= X; count++)
    {
        scanf("%d", &L);
        D = D + L;
    }
    
    printf("%d\n", count);
}


Measured memory_bytes: 128
s=input()
s=s[:-1]
def Evenstring(str):
    if len(str)%2==0 and str[:len(str)//2]==str[len(str)//2:]:
        return True
    else:
        return False

counter=0

while True:
    if Evenstring(s)==True:
        print(len(s))
        break
    else:
        s=s[:-1]
        #末尾の一文字を削除
    counter+=1    
    if counter>300:
        break

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int mod=1e9+7;
int a[N],s[N];
inline int qpow(int x,int y)
{int A=1;for(;y;y>>=1,x=(ll)x*x%mod)if(y&1)A=(ll)A*x%mod;return A;}
int main()
{	int n,fac=1,ans=0; cin>>n;
	for(rint i=1;i<=n;i++) scanf("%d",&a[i]);
	for(rint i=1;i<=n;i++) fac=(ll)fac*i%mod;
	for(rint i=1;i<n;i++) s[i]=(s[i-1]+(ll)fac*qpow(i+1,mod-2)%mod)%mod;
	for(rint i=1;i<=n;i++) (ans+=(ll)a[i]*((ll)fac+s[i-1]+s[n-i])%mod)%=mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<stdio.h>
using namespace std;
using ll=long long;
#include<algorithm>
#include<set>
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;
const int mod=1000000007;

int main(){
  int n;
  string s;
cin>>n;
cin>>s;
int ans=0;
for(int i=0;i<=n-3;i++){
  if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
}
cout<<ans<<endl;
return 0;
}




Measured memory_bytes: 3196
def is_prime(num:int):
    if num == 1:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False

    r_num = int(num ** 0.5)
    for i in range(3, r_num + 1, 2):
        if num % i == 0:
            return False
    return True


def main():
    n = int(input())

    if n == 1:
        print(0)
        return

    cnt = 0
    r_n = int(n ** 0.5)
    divided = []
    for i in range(2, n):
        if n < i:
            break
        elif cnt == 0 and r_n+1 < i:
            break
        if n % i == 0 and is_prime(i):
            n = int(n/i)
            divided.append(i)
            cnt += 1
            x = 2
            while True:
                q = i ** x
                if q > n:
                    break

                if n % q == 0:
                    n = int(n/q)
                    x += 1
                    cnt += 1
                else:
                    break
            if is_prime(n) and n not in divided:
                n = 1
                cnt += 1
                break

    if cnt == 0:
        cnt = 1
    print(cnt)


main()


Measured memory_bytes: 9472
import scala.io.StdIn.{readLine,readInt}

object Main extends App {
  val seq1 = for(i<-1 to 9) yield List(i,i,i)
  val seq2 = (1 to 9).iterator.sliding(3).toList

  def check(m:List[Int], count:Int,u:Int):Boolean =  {
    if(m.length != count) false
    else if(count==2) { if(m.head==m.last) true else false }
    else {
      if((u to 8).exists( i=> check(m diff seq1(i),count-3,i) )) true
      else (0 to 6).exists(i=> check(m diff seq2(i),count-3,u))
    }
  }

  Iterator.continually(readLine).takeWhile ( _!=null ).foreach { line =>
    val l = line.map(_.asDigit).toList
    val m = (1 to 9).filter { i=> if(l.count( _==i ) >= 4) false else check(i::l,14,0) }
    if(m.length>0) println(m.mkString(" ")) else println(0)
  }
}

Measured memory_bytes: 87180
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int *c = (int *)malloc(sizeof(int)*(n+1));
    c[1]=1;
    long long i, j;
    long long sum=1;
    for(i=2;i<=n;i++){
        j=i;
        while(j<=n){
            c[j]++;
            j+=i;
        }
        sum+=i*(c[i]+1);
    }
    cout << sum << endl;
    return 0;
}

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

int main() {
    vector<int> train;
    int n;
    while(cin >> n){
        if(n){
            train.push_back(n);
        }else{
            cout << train.back() << endl;
            train.pop_back();
        }
    }
    return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    int o = (k + 1) / 2;
    int e = k / 2;
    cout << o * e << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
namespace QiFeng233{
	int n,r,i;
	void solve(){
		scanf("%d%d",&n,&r);
		if(n>=10)i=r;
		else i=r+1000-100*n;
		printf("%d\n",i);
	}
}
signed main(){
	QiFeng233::solve();
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define INF = 1001001001
#define pi = acos(-1)
using namespace std;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int n, k; cin>>n>>k;
    vector<double> p(n+1);
    double ans = 0.0;

    for (int i = 1; i < n+1; ++i) {
        int tmp; cin >> tmp;
        for (int j = 1; j <= tmp; ++j) {
            p[i] += (double)j/tmp;
        }
        p[i] += p[i-1];
    }

    for (int l = k; l < n+1; ++l) {
        if(p[l] - p[l-k] > ans) ans = p[l] - p[l-k];
    }

    cout << fixed << setprecision(6) << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		if(p[0] == p[1])
		{
			Console.WriteLine(p[2]);
		}
		else if(p[1] == p[2])
		{
			Console.WriteLine(p[0]);
		}
		else
		{
			Console.WriteLine(p[1]);
		}
	}
	

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, m, a, b, c, d, e, f, x[N], y[N];
pair < double , pair < int , int > > ans;

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("outt.txt", "w", stdout);
	scanf("%d %d %d %d %d %d",&a ,&b ,&c ,&d ,&e ,&f);
	for(int i = 0; i <= 30; i++)
		for(int j = 0; j <= 30; j++)
			if(i*100*a + j*100*b <= f)
				x[++n] = i*100*a + j*100*b;
	for(int i = 0; i <= 3000; i++)
		for(int j = 0; j <= 3000; j++)
			if(i*c + j*d <= f)
				y[++m] = i*c + j*d;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(y[j]*100 <= x[i]*e and y[j] + x[i] <= f)
				ans = max(ans, mp((y[j]*1.0)/(x[i]*1.0+y[j]*1.0), mp(x[i], y[j])) );
	printf("%d %d\n", ans.nd.st + ans.nd.nd, ans.nd.nd);
	return 0;
}

Measured memory_bytes: 3328
n,c,k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

T = 0
cnt = 0
ans = 0
for i in range(n):
  if cnt == 0: #誰も待っていない
    T = t[i] + k
    cnt += 1
  elif t[i] <= T:
    cnt += 1
  elif t[i] > T:
    ans += 1
    cnt = 1
    T = t[i] + k
  if cnt == c:
    ans += 1
    T = 0
    cnt = 0
if cnt != 0: ans += 1
print(ans)

Measured memory_bytes: 7384
/*
██████╗  ███████╗  
██╔══██╗ ██╔════╝ 
██████╔╝ ███████╗ 
██╔══██╗ ╚════██║  
██║  ██║ ███████║      
╚═╝  ╚═╝ ╚══════╝                                                                                                             
*/

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define haha(j,a,n) for(int j=a;j<n;j++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bc(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define why 1000000007
#define NUM 100005
#define F first
#define S second
#define bhar(a) rep(i,a.size()) cin>>a[i];
#define show(a) rep(i,a.size()) cout<<a[i]<<" ";
#define sott(a) sort(bc(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define mapp map<ll,ll>
#define dkac cout<<fixed<<setprecision(15);
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
ll gcd(int a, int b){if(b==0) return a; else return gcd(b,a%b);}
ll bitfun(ll x){
  return (x&(-x));
}
void solve(){
  ll n; cin>>n;
  vl a(n); bhar(a);
  map<ll,ll> ma;
  rep(i,n) ma[a[i]]++;
  ll ans=0;
  for(auto x:ma) ans+=x.S*(x.S-1)/2;
   //cout<<x.S<<endl; }
    //cout<<ans;
    ll tmp=ans;
  rep(i,n){
    ans=ans-ma[a[i]]*(ma[a[i]]-1)/2+(ma[a[i]]-1)*(ma[a[i]]-2)/2;
    cout<<ans<<endl;
    ans=tmp;
  } 
}
int main(){
    ios
    int t=1; 
    //cin>>t;
    yeah(t){
      solve();
    }
}

Measured memory_bytes: 11136
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int l=sc.nextInt();
        int n=Math.min(a, b);
        int q=Math.max(a, b);
        if(n<=l&&l<=q)System.out.println("Yes");
        else System.out.println("No");
    }
}


Measured memory_bytes: 21972
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF = 1LL << 50;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> X(N), L(N);
    rep(i, 0, N) cin >> X[i] >> L[i];
    vector<P> interval(N);
    rep(i, 0, N) {
        interval[i] = {X[i] + L[i], X[i] - L[i]};
    }
    sort(all(interval));
    int ans = N;
    ll prev = -INF;
    rep(i, 0, N) {
        if (prev <= interval[i].second) {
            prev = interval[i].first;
        }
        else {
            --ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3456
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}


//main関数
int main() {
	char T[200000];
	scanf("%s",T);
	
	int longth = strlen(T);
	int dp[longth][3];
	
	
	for( int i=0; i < longth ; i++ ) {
		if( T[i] == '?' ) {
			T[i] = 'D';
		}
	}
	
	printf("%s",T);
	return 0;
				
}


Measured memory_bytes: 1924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

void solve(){
	int h, w;
	cin >> h >> w;
	char maze[h][w];
	int dp[h+1][w+1];
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> maze[i][j];
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;

	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(i!=h-1)chmin(dp[i+1][j], dp[i][j]+(maze[i+1][j]!=maze[i][j]));
			if(j!=w-1)chmin(dp[i][j+1], dp[i][j]+(maze[i][j+1]!=maze[i][j]));
		}
	}

	int ans = dp[h-1][w-1]+(maze[0][0]=='#')+(maze[h-1][w-1]=='#');
	cout << ans/2 << endl;

}

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

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        a: f64,
        b: f64,
        x: f64,
    }
    let h;
    let ans;
    if x / a >= (a * b) / 2. {
        h = 2. * (a * b - x / a) / a;
        ans = h.atan2(a) * 2. / std::f64::consts::PI * 90.;
    } else {
        h = 2. * x / (a * b);
        ans = b.atan2(h) * 2. / std::f64::consts::PI * 90.;
    };
    println!("{:.10}", ans);
}


Measured memory_bytes: 4352
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    d,t,s = i_map()
    if s*t < d:
        print("No")
    else:
        print("Yes")

if __name__=="__main__":
    main()


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

typedef long long ll;

int main()
{
    ll ans=0, cnt = 0;
    string s;
    cin>>s;
    for(char c:s){
        if(c=='B') cnt++;
        else if(c=='W') ans += cnt;
    }
    cout<<ans;

}


Measured memory_bytes: 3748
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i=0;i<N;i++) {
			d[i] = Integer.parseInt(sc.next());
		}
		Arrays.sort(d);
		if(d[N/2-1]==d[N/2]) {
			System.out.println("0");
		} else {
			System.out.println(d[N/2]-d[N/2-1]);
		}
	}
}

Measured memory_bytes: 50592
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000009
#define sz(a) ((int)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-10
typedef pair<int, int> II;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI 2 * acos(0)

#define maxn 100005

int n;

ll cal(ll x){
	ll res = 0;
	while(x){
		res += (x % 10);
		x /= 10;
	}
	return res;
}

int main(){
	srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//	freopen("in.txt", "r", stdin);
    ll run = 1, add = 1;
    cin >> n;
    Rep(i, n){
    	cout << run << endl;
    	run += add;
    	while(1){
    		ll x = run + add;
			if(run * cal(x) <= x * cal(run)){
//				cout << run << endl;
				break;
			} else {
				run += add * 9;
				add *= 10;
			}
    	}
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main() {
	int N,A[N];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	set<int> values;
	for (int i = 0; i < N; i++) {
		values.insert(A[i]);
	}

	cout << values.size() << endl;


}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
bool huiwen(string s)
{
	int len=s.size();
	for(int i=0;i<len/2;i++){
		if(s[i]!=s[len-i-1]) return false;
	}
	return true;
}
int main()
{
	string s;
	cin>>s;
	int n=s.size();
	int l1=(n-1)/2,l2=n-(n+3)/2+1;
	if(huiwen(s.substr(0,l1))&&huiwen(s.substr((n+3)/2-1,l2))&&huiwen(s)){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
int main(){
    ll n, k, ans=0, h;
    cin >> n >> k;
    vector<ll> H;
    for(ll i=0;i<n;i++){
        cin >> h;
        H.push_back(h);
    }
    sort(H.begin(), H.end());
    if(n>k){
        for(ll i=0;i<k;i++){
            H.pop_back();
        }
        for(auto itr=H.begin();itr!=H.end();itr++){
            ans += *itr;
        }
    }
    
    cout << ans << endl;
    return 0;
 
}


Measured memory_bytes: 3444
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
s = [0] * 4
for i in range(n):
	s[0] += abs(x[i] - y[i])
	s[1] += abs(x[i] - y[i])**2
	s[2] += abs(x[i] - y[i])**3
	s[3] = max(s[3], abs(x[i] - y[i]))
s[1] = s[1]**(1/2)
s[2] = s[2]**(1/3)
for i in range(4):
	print('%f' % s[i])



Measured memory_bytes: 5648
h,w,k=map(int,input().split())
c=[]
for i in range(h):
    temp=input()
    c.append(temp)
ans=0
for i in range(2**h):
    temp=[0]*h
    for m in range(h):
        temp[m]=i&1
        i>>=1
    for j in range(2**w):
        temp2=[0]*w
        for m in range(w):
            temp2[m]=j&1
            j>>=1
        cnt=0
        for g in range(h):
            for t in range(w):
                if temp[g]==0 and temp2[t]==0 and c[g][t]=="#":
                    cnt+=1
        if cnt==k: ans+=1
print(ans)

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

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

    ll w,h,n;
    cin >> w >> h >> n;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> a(n);
    for (ll i = 0;i < n;i++){
        cin >> x[i] >> y[i] >> a[i];
    }

    vector<vector<bool>> mp(h, vector<bool>(w, true));
    
    for (ll i = 0; i < n; i++){
        if (a[i] == 1){
            for (ll j = 0; j < h; j++){
                for (ll k = 0; k < x[i]; k++){
                    mp[j][k] = false;
                }
            }
            continue;
        }
        if (a[i] == 2){
            for (ll j = 0; j < h; j++){
                for (ll k = x[i]; k < w; k++){
                    mp[j][k] = false;
                }
            }
            continue;
        }
        if (a[i] == 3){
            for (ll j = 0; j < w; j++){
                for (ll k = 0; k < y[i]; k++){
                    mp[k][j] = false;
                }
            }
            continue;
        }
        if (a[i] == 4){
            for (ll j = 0; j < w; j++){
                for (ll k = y[i]; k < h; k++){
                    mp[k][j] = false;
                }
            }
            continue;
        }
    }

    ll ans = 0;

    for (ll i = 0; i < h; i++){
        for (ll j = 0; j < w; j++){
            if (mp[i][j]){
                ans++;
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3668
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a;
	cin>>a;
	if(a==25){
		cout<<"Christmas"<<endl;
	}else if(a==24){
		cout<<"Christmas Eve"<<endl;
	}else if(a==23){
		cout<<"Christmas Eve Eve"<<endl;
	}else if (a==22){
		cout<<"Christmas Eve Eve Eve"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
N, *A = map(int, open(0).read().split())
pre = A[-1]
for i in range(N-1, -1, -1):
    a = A[i]
    if pre < a-1:
        print('No')
        exit()
    elif pre < a:
        pre = a-1
    else:
        pre = a
print('Yes')

Measured memory_bytes: 20108
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

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

	int min = 1000000;
	for (int i = 0; i < N; i++ ) {
		int c, t;
		cin >> c >> t;
		if (t <= T) {
			if (c < min) {
				min = c;
			}
		}
	}
	if (min == 1000000) {
		cout << "TLE";
	}
	else{
		cout << min;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int N, T, A;
	cin >> N >> T >> A;
	vector<double>temp(N);
	for (int i = 0;i < N;++i) {
		int a;
		cin >> a;
		temp[i] = T - a * 0.006;
	}
	int ans = 1;
	double diff = abs(A - temp[0]);
	for (int i = 0;i < N;++i) {
		double diff_2 = abs(A - temp[i]);
		if (diff > diff_2) {
			diff = diff_2;
			ans = i + 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#ABC042C
N,K=map(int,input().split())
D=list(map(int,input().split()))
E=[0]*10
for d in D:
    E[d]=1

while(1):
    for n in str(N):
        if E[int(n)]==1:
            N+=1
            break
    else:
        break

print(N)
    

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class F
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<int>();
            var LR = new (int L, int R)[N];
            var answer = true;
            for (var i = 0; i < N; i++)
            {
                var S = Scanner.Scan<string>();
                var l = 0;
                var r = 0;
                for (var j = 0; j < S.Length; j++)
                {
                    if (S[j] == '(') l++;
                    else { if (l > 0) l--; else r++; }
                }
                LR[i] = (l, r);
            }

            var left = 0;
            var right = 0;
            foreach (var item in LR.Where(x => x.L - x.R > 0).OrderBy(x => x.R))
            {
                if (item.R <= left) left += item.L - item.R;
                else answer = false;
            }

            foreach (var item in LR.Where(x => x.R - x.L > 0).OrderBy(x => x.L))
            {
                if (item.L <= right) right += item.R - item.L;
                else answer = false;
            }

            var max = 0L;
            var tmp = LR.Where(x => x.L == x.R);
            if (tmp.Any()) max = tmp.Max(x => x.L);
            if (left != right) answer = false;
            if (left < max) answer = false;

            Console.WriteLine(answer ? "Yes" : "No");
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 78136
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int a[3][3];
int n;
bool f[3][3];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  REP(i, 3) REP(j, 3) {
    cin >> a[i][j];
    f[i][j] = false;
  }

  cin >> n;
  REP(i, n) {
    int aa;
    cin >> aa;

    REP(j, 3) REP(k, 3) {
      if(aa == a[j][k]) f[j][k] = true;
    }
  }

  bool ans = false;
  REP(i, 3) {
    bool fi = true;
    bool fj = true;
    REP(j, 3) {
      if(!f[i][j]) fi = false;
      if(!f[j][i]) fj = false;
    }

    if(fi || fj) ans = true;
  }

  if((f[0][0] && f[1][1] && f[2][2]) || (f[0][2] && f[1][1] && f[2][0])) ans = true;

  cout << (ans ? "Yes" : "No") << endl;
}


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

int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int N;
  cin>>N;
  int X[N],Y[N];
  for (int i=0; i<N; i++) {
    cin>>X[i];
    Y[i]=X[i];
  }
  sort(Y,Y+N);
  for (int i=0; i<N; i++) {
    if (Y[N/2]<=X[i]) {
      cout<<Y[N/2-1]<<endl;
    } else {
      cout<<Y[N/2]<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
import java.util.*;
import java.util.function.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    int[][] A = new int[H][W];
    int[][] B = new int[H][W];
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) A[i][j] = sc.nextInt();
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) B[i][j] = sc.nextInt();
    sc.close();
    
    int m = (H + W) * 80;
    boolean[][][] dp = new boolean[H][W][m * 2 + 1];
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        int c = Math.abs(A[i][j] - B[i][j]);
        boolean[] d = dp[i][j];
        if (i == 0 && j == 0) {
          d[m - c] = true;
          d[m + c] = true;
          continue;
        }
        for (int k = 0; k < d.length; k++) {
          if (0 < i && dp[i - 1][j][k]) {
            if (-1 < k - c) d[k - c] = true;
            if (k + c < d.length) d[k + c] = true;
          }
          if (0 < j && dp[i][j - 1][k]) {
            if (-1 < k - c) d[k - c] = true;
            if (k + c < d.length) d[k + c] = true;
          }
        }
      }
    }
    boolean[] d = dp[H - 1][W - 1];
    int ans = d.length;
    for (int k = 0; k < d.length; k++)
      if (d[k])
        ans = Math.min(ans, Math.abs(m - k));
//    System.out.println(Arrays.toString(dp[H - 1][W - 1]));
    System.out.println(ans);
  }
}


Measured memory_bytes: 240372
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int count = 0;
class edge;

class vertex{
    public:
        int member;
        vector<edge*> edges;
        int label;
        vertex(){
            member = -1;
        }
        void add_member(int n){
            member = n;
        }
};

class edge{
    public:
        vertex *to,*from;
        edge(vertex *_to){
            to = _to;
        }
};

void check_member_dfs(vertex *v){
    v->member = count;
    for(int i = 0; i < v->edges.size(); i++){
        vertex *to = v->edges[i]->to;
        if (to->member >= 0){
            continue;
        }else{
            check_member_dfs(to);
        }
    }
    return;
}

int main(){
    int n,m,temp1,temp2,q;
    cin >> n >> m;
    vertex *V[n];
    for(int i = 0; i < n ; i++) V[i] = new vertex();
    for(int i = 0; i < m; i++){
        cin >> temp1 >> temp2;
        V[temp1]->edges.push_back(new edge(V[temp2]));
        V[temp2]->edges.push_back(new edge(V[temp1]));
    }
    for(int i = 0; i < n; i++){
        if(V[i]->member >= 0){
            continue;
        }else{
            check_member_dfs(V[i]);
            count++;
        }
    }
    cin >> q;
    string result[q];
    for(int i = 0; i < q; i++){
        cin >> temp1 >> temp2;
        if(V[temp1]->member == V[temp2]->member){
            result[i] = "yes";
        }else{
            result[i] = "no";
        }
    }
    for(int i = 0; i < q; i++) cout << result[i] << endl;
}


Measured memory_bytes: 21456
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
 
const int maxN = 1 << 19;

int T[maxN];

void solve()
{
	int n;
	scanf ("%d", &n);
	
	printf("%lld\n", 1ll*n*n);
}
 
int main()
{
	int t;
	t=1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int arr[105];
int a;

void solve() {
  scanf("%d",&a);
  for(int i = 1; i <= a; i = i + 1) {
    scanf("%d", &arr[i]);
    if(arr[i] % 2 ==0) {
        if(arr[i] % 3 != 0 && arr[i] % 5 != 0) {
          printf("DENIED\n");
          return;
        }
    }
  }
  printf("APPROVED\n");
  return;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 1652
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    for(int i=0; ;i++){
        int H=sc.nextInt();
        int W=sc.nextInt();
        if(H==0 && W==0) break;
            for(int j=0;j<W;j++){
        System.out.print("#");
        }
                System.out.println("");
        for(int j=1;j<H-1;j++){
        System.out.print("#");
        for(int k=1;k<W-1;k++){
            System.out.print(".");
        }
        System.out.println("#");
        }
        for(int j=0;j<W;j++){
        System.out.print("#");
        }
        System.out.println("");
        System.out.println("");
    }
    }
}



Measured memory_bytes: 34544
#include <bits/stdc++.h>
#define pb push_back

using namespace std;
using ll = long long int;
const int MOD = 998244353;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	string s; cin >> s;
	string t = s; reverse(begin(t), end(t));
	bool good = s == t;
	int n = s.size();
	t = s.substr(0, n/2); reverse(begin(t), end(t));
	good &= (t == s.substr(0, n/2));
	t = s.substr(n/2+1); reverse(begin(t), end(t));
	good &= (t == s.substr(n/2 + 1));
	if (good) cout << "Yes\n";
	else cout << "No\n";
}

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


int main() {
    
    int now = 0;
    int a, b;
    cin >> a >> b;
    
    if (b == 1) { cout << 0 << endl; return 0; }
    
    while (1) {
        int tmp = a * now - (now - 1);
        if (tmp >= b) {
            cout << now << endl;
            return 0;
        }
        now++;
    }
    
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i, x, y;
  
  for(i = 1; i < 10001; i++){
    scanf("%d %d\n", &x, &y);
    if(x == 0 && y == 0)
      break;
    if(x < y)
      printf("%d %d\n", x, y);
    else
      printf("%d %d\n", y, x);
  }

  return 0;
}

Measured memory_bytes: 604
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            # divisors.append(i)
            if i != n // i and i != (n // i - 1) :
                divisors.append(n//i - 1)
    return divisors

n = int(input())
print(sum(make_divisors(n)))

Measured memory_bytes: 3060
#include <stdio.h>

#define T 1
#define F 0

int n,num[2000];

int cul(int i,int sum){
  int res;
  if(sum == 0) return T;
  if(i>=n) return F;
  
  res = cul(i+1,sum) || cul(i+1,sum-num[i]);
  return res;
  

}

int main(){
  int i,sum,n2;

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

  scanf("%d",&n2);
  for(i=0;i<n2;i++){
    scanf("%d",&sum);
    if(cul(0,sum)==T) printf("yes\n");
    else printf("no\n");
  }
  

  return 0;
}

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

const int N = 100005, INF = int(2e9);

int n, k, h[N], d[N];

int main(){
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; i++){
        scanf("%d", h + i);
        if(i > 1) d[i] = INF;
        for(int j = 1; j <= k; j++){
            if(i - j < 1) break;
            d[i] = min(d[i], d[i - j] + abs(h[i] - h[i - j]));
        }
    }
    printf("%d\n", d[n]);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
typedef pair<int,int> pi;

const int MAXN = 200005;
int N,A[MAXN];

int main() {
	ios_base::sync_with_stdio(0); 
	cin.tie(0);	
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	int ans = 0, cur = 1;
	for (int i = 1; i <= N; i++) {
		if (A[i] == cur) cur++;
		else ans++;	
	}
	if (ans == N) cout << -1;
	else cout << ans;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
L = [[int(v) for v in input().split()] for i in range(N)]
L = sorted(L, key=lambda x: x[0] + x[1], reverse=True)
ans = 0
for i, (a, b) in enumerate(L):
    if i % 2: ans -= b
    else: ans += a
print(ans)

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W; cin >> H >> W;
    int A[H][W]; rep(i, H) rep(j, W) cin >> A[i][j];
    
    int ans = 0;
    vector<pair<P, P>> op;
    rep(i, H){
        rep(j, W-1){
            if(A[i][j] & 1){
                ans++;
                A[i][j+1]++;
                op.push_back(make_pair(P(i+1, j+1), P(i+1, j+2)));
            }
        }
    }

    for(int i = 0; i < H-1; i++){
        if(A[i][W-1] & 1){
            ans++;
            A[i+1][W-1]++;
            op.push_back(make_pair(P(i+1, W), P(i+2, W)));
        }
    }

    cout << ans << endl;
    rep(i, ans){
        cout << op[i].first.first << " " << op[i].first.second << " " << op[i].second.first << " " << op[i].second.second << endl;
    }

    return 0;
}

Measured memory_bytes: 5232
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], C = l[1], K = l[2];
            var T = new int[N];
            for (var i = 0; i < N; i++) T[i] = int.Parse(Console.ReadLine());
            Array.Sort(T);

            var humansCount = 0;
            var ridesCount = 0;
            var longest = 0;
            for (var i = 0; i < N; i++)
            {
                if (humansCount == C)
                {
                    ridesCount++;
                    longest += C;
                    humansCount = 0;
                }
                else if (T[i] - T[longest] > K)
                {
                    ridesCount++;
                    longest += humansCount;
                    humansCount = Math.Max(0, humansCount - C);
                }
                humansCount++;
            }

            Console.WriteLine(humansCount > 0 ? ridesCount + 1 : ridesCount);
        }
    }
}


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


int main(){
	int n;
	double a,sum=0,ans=0;
	string s;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a >> s;
		if(s=="JPY") ans+=a;
		else sum+=a;
	}
	printf("%lf\n", ans+sum*380000);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long N,A,B;cin>>N>>A>>B;
    long long ans=0;
    if(A==B){
        ans=1;
        cout<<ans<<endl;
        return 0;        
    }
    if(N==1){
        cout<<ans<<endl;
        return 0;
    }
    ans=B*(N-2)-A*(N-2)+1;
    if(ans<0){
        ans=0;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//typedef LL int;
bool isprime(LL x){
    if(x == 2) return true;
    if(x < 2 || x % 2 == 0) return false;
    LL i = 3;
    LL sqrtx = sqrt(x);
    while(i <= sqrtx){
        if(x % i == 0) return false;
        i += 2;
    }
    return true;
}
// max?????§????´???°???vector?????\????????????
vector<LL> eratos(LL max){
    vector<LL> primeVec;
    vector<bool> isprime;
    double sqrtmax = sqrt(max);
    isprime.resize(max + 1);
    isprime[0] = false; isprime[1] = false;
    FOR(i, 2, max + 1){
        isprime[i] = true;
    }
    FOR(i, 2, sqrtmax){
        if(isprime[i]){
            for(int j = 0; i * (j + 2) < max + 1; ++j){
                isprime[i * (j + 2)] = false;
            }
        }
    }
    REP(i, max + 1){
        if(isprime[i])  primeVec.pb(i);
    }
    return primeVec;
} 
int main(){
    int n;
    int ans = 0;
    cin >> n;
    while(n--){
        LL x;
        cin >> x;
        if(isprime(x)) ans++;
    }
    cout << ans << endl;
}

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

// 参考：https://ykmaku.hatenablog.com/entry/2019/09/09/233033

int main()
{
	int n;
	cin>>n;
	vector<int> p(n),pos(n+1);
	for(int k=0;k<n;k++) cin>>p[k];
  // pos[p[k]] p[k]の位置を記録(1-origin)
  // p={2,3,1} -> pos={(0),3,1,2}
	for(int k=0;k<n;k++) pos[p[k]] = k+1;

	long ans = 0;
  //インデックスを格納するための集合
	multiset<int> s;
  //境界条件のために番兵を追加
	s.insert(0);
	s.insert(0);
	s.insert(n+1);
	s.insert(n+1);
  // Pi=XLRを固定してΣPi*CiのCiを求める
  // pの要素が大きい順にみていく
  //
	for (int pi = n; pi >= 1; pi--){
    // i:Piの位置(インデックス)
    long i=pos[pi];
    // it:sの中でi以上の値を持つ最初のインデックスを返す
		auto it = s.lower_bound(i);
    // y: j>iかつp[i]<p[j]を満たすインデックスjの中で最小のもの
		long y = *it;
    // z: j>iかつp[i]<p[j]を満たすインデックスjの中で二番目に小さいもの
		it++;
		long z = *it;
    // x: j<iかつp[i]<p[j]を満たすインデックスjの中で最大のもの
		it--;
		it--;
		long x = *it;
    // w: j<iかつp[i]<p[j]を満たすインデックスjの中で二番目に大きいもの
		it--;
		long w = *it;
    //cout<<w<<" "<<x<<" "<<i<<" "<<y<<" "<<z<<endl;
    long ci =(y-i)*(x-w) + (z-y)*(i-x);
		ans += pi *ci;
    // iをsに追加
    // sは自動で昇順にソートされる
		s.insert(i);
	}
  // p={2,3,1}のとき
  // s={0,0,4,4}
  // pi=3 -> i=2 *it=y=4 z=4 x=0 w=0 ci=0
  // s={0,0,2,4,4}
  // pi=2 -> i=1 y=2 z=4 x=0 w=0 ci=2
  // s={0,0,1,2,4,4}
  // pi=1 -> i=3 y=4 z=4 x=2 w=1 ci=1
  // s={0,0,1,2,3,4,4}
  // と遷移する
	cout<<ans<<endl;

	return 0;
}


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

int main( int argc, char *argv[] )
{
int X;
int A;
int B;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> X;
	cin >> A;
	cin >> B;
	if( A >= B )
		cout << "delicious" << endl;
	else if( X >= B - A )
		cout << "safe" << endl;
	else
		cout << "dangerous" << endl;

	return 0;
}




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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
int check(int x) {
  int c = 0;
  while(x>0) {
    x/=10; c++;
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  preprocess();
  int n; cin>>n;
  int cnt = 0;
  rep(i,0,n+1) {
    if(check(i)%2) cnt++;
  }
  cout<<cnt<<endl;
}



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

int main(){
  long n,i,j,sum=0;
  cin >> n;
  vector<long> a(n),b(n);
  for(i=0; i<n; i++){
    cin >> a[i] >> b[i];
    b[i]=-a[i]-b[i];
    sum+=a[i];
  }
  i=0;
  sort(b.begin(), b.end());
  while(i<n-1){
    sum+=b[i+1];
    i+=2;
  }
  cout << sum;
}

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

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

Measured memory_bytes: 256