akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
      	Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
      	int k = Integer.parseInt(sc.next());
      
      	int[] arr = new int[n];
      	
      	for(int i = 0; i < n; i++) arr[i] = Integer.parseInt(sc.next());
      	Arrays.sort(arr);
      	int result = 0;
      	for(int i = 0; i < k; i++) result += arr[i];
      
      	System.out.println(result);
    }
}

Measured memory_bytes: 38060
n, m, s = map(int, input().split())
uvab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(n)]


import math

M = 50 * n + 1
s = min(s, M - 1)

dp = [[float('inf')] * M for _ in range(n)]

dp[0][s] = 0
c, d = cd[0][0], cd[0][1]
for jj in range(M):
    dp[0][jj] = min(dp[0][jj], dp[0][s] + max(math.ceil((jj - s) / c), 0) * d)

while True:
    flag = False

    for i in range(m):
        u1, v1, a, b = uvab[i][0] - 1, uvab[i][1] - 1, uvab[i][2], uvab[i][3]
        for u, v in [(u1, v1), (v1, u1)]:
            for j in range(M - a):
                tmp = dp[u][j + a] + b
                if tmp < dp[v][j]:
                    dp[v][j] = tmp
                    flag = True

            c, d = cd[v][0], cd[v][1]
            for jj in range(c, M):
                tmp = dp[v][jj - c] + d
                if tmp < dp[v][jj]:
                    dp[v][jj] = tmp
                    flag = True

    if flag == False:
        break

for t in range(1, n):
    print(min(dp[t]))


Measured memory_bytes: 79700
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

bool is_yes(char p, char n, const VI& cnt) {
    return (cnt[p] > 0 and cnt[n] > 0) or (cnt[p] == 0 and cnt[n] == 0);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string str;
    cin >> str;
    VI cnt(256, 0);
    REP(i, str.size()) cnt[str[i]]++;
    if(is_yes('N', 'S', cnt) and is_yes('W', 'E', cnt)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split(' '))
i = 0
A = []
while i < n:
    A.append(list(map(int, input().split(' '))))
    i += 1
j = 0
B = []
while j < m:
    B.append(list(map(int, input().split(' '))))
    j += 1
C = []
k = 0
while k < n:
    c0 = []
    p = 0
    while p < l:
        c1 = 0
        q = 0
        while q < m:
            c1 += A[k][q] * B[q][p]
            q += 1
        c0.append(c1)
        p += 1
    C.append(c0)
    k += 1
ans = ''
r = 0
while r < n:
    ans += ' '.join(map(str, C[r])) + '\n'
    r += 1
print(ans[:-1])


Measured memory_bytes: 7252
#include <stdio.h>

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

  scanf("%d %d %d",&a,&b,&c);
  if(a>b){
      tmp = b;
      b = a;
      a = tmp;
      };
      if(b>c){
      tmp = c;
      c = b;
      b = tmp;
  } if(a>b){
      tmp = b;
      b = a;
      a = tmp;
  }
  printf("%d %d %d\n",a,b,c);
  return 0;
}


Measured memory_bytes: 2044
count :: Eq a => a -> [a] -> Int
count x = length . filter (== x)

ofa :: [Int] -> [Int]
ofa xs = map (flip count xs) xs

impl :: Int -> [Int] -> [Int] -> (Int , [Int])
impl c xs ys
    | xs == ys = (c , xs)
    | otherwise = impl (succ c) (ofa xs) xs

solve :: [Int] -> IO ()
solve xs = print c >> (putStrLn $ unwords $ map show ys)
    where
        (c , ys) = impl (-1) xs []

main :: IO ()
main  = readLn >>= nyan
    where
        nyan :: Int -> IO ()
        nyan 0 = return ()
        nyan _ = getLine >>= solve . map read .words >> main

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)

int main(){

	lli n;
	cin>>n;
	vector<lli> h(n);
	REP(i,0,n)cin>>h[i];

	lli cnt=0;
	lli ans=0;
	lli now=h[0];
	for(lli i=1;i<n;i++){
		if(now>=h[i])cnt++;
		else{
			ans = max(ans,cnt);
			cnt=0;
		}
		now=h[i];
	}
	ans = max(ans,cnt);
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


long long calc(long long n, vector<pair<long long, long long>> rate) {
	if (rate.size() == 0) {
		return n;
	}
	if (rate.size() == 1) {
		long long k = n / rate[0].first;
		n -= k * rate[0].first;
		n += k * rate[0].second;
		return n;
	}
	else if(rate.size() == 2){
		long long ret = n;

		rep(i, INF) {
			long long rem = n - i * rate[0].first;
			if (rem < 0)break;
			long long k = rem / rate[1].first;
			rem += i* rate[0].second;
			rem -= k * rate[1].first;
			rem += k * rate[1].second;
			ret = max(ret, rem);
		}

		return ret;
	}
	else if (rate.size() == 3) {

		long long ret = n;

		rep(i, INF) {
			if (n - i * rate[0].first < 0)break;
			rep(j, INF) {
				long long rem = n - i * rate[0].first - j * rate[1].first;
				if (rem < 0)break;

				long long k = rem / rate[2].first;
				rem += i * rate[0].second;
				rem += j * rate[1].second;
				rem -= k * rate[2].first;
				rem += k * rate[2].second;
				ret = max(ret, rem);
			}
		}
		return ret;
	}

	return -1;
}


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

	long long n;
	int ga, sa, ba;
	int gb, sb, bb;
	cin >> n;
	cin >> ga >> sa >> ba;
	cin >> gb >> sb >> bb;

	
	vector<pair<long long, long long>> rate[2];
	if (ga <= gb) {
		rate[0].emplace_back(ga, gb);
	}
	else {
		rate[1].emplace_back(gb, ga);
	}

	if (sa <= sb) {
		rate[0].emplace_back(sa, sb);
	}
	else {
		rate[1].emplace_back(sb, sa);
	}

	if (ba <= bb) {
		rate[0].emplace_back(ba, bb);
	}
	else {
		rate[1].emplace_back(bb, ba);
	}

	n = calc(n, rate[0]);
	n = calc(n, rate[1]);


	cout << n << endl;

	return 0;
}

Measured memory_bytes: 384
import sys
a=[]
l=0
C0=0
C1=0
C2=0
C3=0
names=["AC","WA","TLE","RE"] 
for i in sys.stdin:
  a.append(i.rstrip('\n'))
  if a[l]==names[0]:
    C0+=1
  elif a[l]==names[1]:
    C1+=1
  elif a[l]==names[2]:
    C2+=1
  elif a[l]==names[3]:
    C3+=1
  l+=1
print("AC x "+str(C0))  
print("WA x "+str(C1))  
print("TLE x "+str(C2))  
print("RE x "+str(C3))  

Measured memory_bytes: 16136
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};



int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll q,h,s,d,n;cin>>q>>h>>s>>d>>n;
  h=min(h,2*q);
  s=min(s,2*h);
  d=min(d,2*s);
  cout<<n/2*d+n%2*s<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
	int n;
	cin>>n;
	vector<int>ans;
	if(n==0){
		cout<<'0'<<endl;
		return 0;
	}
	while(n!=0)
	if(n%2==0){
		ans.push_back(0);
		n=-n/2;
	}else{
		ans.push_back(1);
		n--;
		n=-n/2;
	}
	int l=ans.size();
	rep(i,l) cout<<ans[l-i-1];
	cout<<endl;
	return 0;
}

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

int main(){
    int A,B;
    cin>>A>>B;
    if(A>=13)       cout<<B<<endl;
    else if(A>=6)   cout<<B/2<<endl;
    else            cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
int ans=0;
int n;
const double eps=1e-9;
typedef vector<int> vi;
typedef long long ll;
int main(void)
{
  cin >> n;
  cout << n/3 << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
INF = float('inf')
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]

max_score = -INF
for init in range(1, N + 1):   # 初めの場所をiとする
    score = defaultdict(int)  # int/bool/list....
    visited = [-1] * (N + 1)
    visited[init] = 0  # 何回移動後に着いたか？
    i = init
    # max_init = -INF
    for k in range(1, K + 1):
        prev = i
        i = P[i]    # k回移動後に着くところ

        if visited[i] < 0:  # まだ訪れてなかった
            visited[i] = k
            score[i] = score[prev] + C[i]
            # max_init = max(max_init, score[i])
            max_score = max(max_score, score[i])
            continue

        loop_score = (score[prev] + C[i]) - score[i]
        loop_len = k - visited[i]

        score[i] = score[prev] + C[i]
        # max_init = max(max_init, score[i])
        max_score = max(max_score, score[i])

        if k == K:
            break # これ以上移動できない

        start = i   # ループを開始するノード
        loop_num = (K - k) // loop_len # ループをあと何回回れるか
        loop_rem = (K - k) % loop_len

        if loop_rem == 0:
            loop_num -= 1
            loop_rem = loop_len

        jj = start
        temp = 0
        temp_max = 0
        for l in range(loop_rem):
            jj = P[jj]
            temp += C[jj]
            temp_max = max(temp_max, temp)

        loop_max = temp_max + loop_num * loop_score
        # max_init = max(max_init, score[start] + loop_max)
        max_score = max(max_score, score[start] + loop_max)
        break

    # max_score = max(max_score, max_init)

if max_score == -INF:
    max_score = max(C[1:])

print(max_score)

Measured memory_bytes: 169232
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll h,w,n;
    cin >> h >> w >> n;
    ll x = (n/h);
    ll y = (n/w);
    if(n%h){
        x++;
    }
    if(n%w){
        y++;
    }
    cout << min(x,y) << endl;
}

Measured memory_bytes: 256
import numpy as np
MOD = 10**9 + 7
N,M = map(int,input().split())
S = np.array(input().split(), dtype=np.int32)
T = np.array(input().split(), dtype=np.int32)

# (n,m) 以前で作れている列
dp = np.ones(M+1, dtype = np.int64)

for n in range(N):
  dp[1:] = ((dp[:-1] * (T == S[n])).cumsum() + dp[1:]) % MOD # cumsumに直す

answer = dp[M]
print(answer)

Measured memory_bytes: 14424
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

// type alias
using ll = long long;
using ull = unsigned long long;

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline bool isPower2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll getMaxEffectiveBit(ull a)
{
	ll index = -1;
	for (; a != 0; a >>= 1)
	{
		++index;
	}
	return index;
}

inline ll getSpecifiedBit(ull a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull getGcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

template<class Integer>
inline Integer getPower(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

ll val(ll a, ll c, ll d)
{
	ll m = c / getGcd(c, d) * d;
	return a - a / c - a / d + a / m;
}

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

	ll N;
	cin >> N;

	vector<ll> ds(N);
	for (ll i = 0; i < ds.size(); ++i)
	{
		cin >> ds[i];
	}
	sort(ds.begin(), ds.end());

	ll res = 0;
	for (ll i = 1; i <= 100000; ++i)
	{
		auto abc_count = distance(ds.begin(), lower_bound(ds.begin(), ds.end(), i));
		if (abc_count == N / 2)
		{
			++res;
		}
		else if (abc_count > N / 2)
		{
			break;
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1024
import java.io._
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.reflect.ClassTag

object Main {
  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N, M = sc.nextInt()

    val S = Array.fill[ArrayBuffer[Int]](N)(ArrayBuffer())
    val E = Array.fill[ArrayBuffer[Int]](N)(ArrayBuffer())
    rep(M) { i =>
      val a, b = sc.nextInt() - 1
      S(a) += i
      E(b) += i
    }

    var cnt = 0
    val stack = mutable.Set[Int]()
    rep(N) { i =>
      val cut = E(i) exists stack.contains
      if (cut) {
        cnt += 1
        stack.clear()
      }
      stack ++= S(i)
    }

    out.println(cnt)
  }

  def main(args: Array[String]): Unit = {
    solve()
    out.flush()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  def rep(n: Int)(f: Int => Unit): Unit = {
    var i = 0
    while(i < n) { f(i); i += 1 }
  }
  def rep_r(n: Int)(f: Int => Unit): Unit = {
    var i = n - 1
    while(i >= 0) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  implicit class ArrayOpts[A](val as: Array[A]) extends AnyVal {
    // todo Orderingだとboxing発生するので自作Orderを用意したい
    def maxByOpt[B: Ordering](f: A => B): Option[A] = {
      if (as.nonEmpty) Some(as.maxBy(f)) else None
    }

    def grpBy[K](f: A => K): mutable.Map[K, ArrayBuffer[A]] = {
      val map = mutable.Map.empty[K, ArrayBuffer[A]]
      rep(as.length)(i => map.getOrElseUpdate(f(as(i)), ArrayBuffer()) += as(i))
      map
    }

    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      var sum = num.zero
      rep(as.length)(i => sum = num.plus(sum, f(as(i))))
      sum
    }

    def minByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.lt)
    }

    def maxByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.gt)
    }

    private def limit[B](f: A => B, ixRange: Range)(cmp: (B, B) => Boolean): (A, B) = {
      var limA = as(ixRange.head)
      var limB = f(limA)

      for (i <- ixRange.tail) {
        val a = as(i)
        val b = f(a)
        if (cmp(b, limB)) {
          limA = a
          limB = b
        }
      }
      (limA, limB)
    }
  }

  implicit class IterableOpts[A](val as: Iterable[A]) extends AnyVal {
    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      as.foldLeft(num.zero)((acc, a) => num.plus(acc, f(a)))
    }
  }
}


Measured memory_bytes: 83492
use std::io::Read;
use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: u64 = it.next().unwrap().parse().unwrap();
    let mut g = vec![std::collections::BTreeSet::new(); n + 1];
    for _ in 1..n {
        let x: usize = it.next().unwrap().parse().unwrap();
        let y: usize = it.next().unwrap().parse().unwrap();
        g[x].insert(y);
        g[y].insert(x);
    }
    let mut q = vec![];
    let mut stack = vec![(1, 1)];
    while let Some((v, p)) = stack.pop() {
        q.push(v);
        g[v].remove(&p);
        for &u in &g[v] {
            stack.push((u, v));
        }
    }
    let mut dp_down = vec![1; n + 1];
    for &v in q.iter().rev() {
        for &u in &g[v] {
            dp_down[v] = dp_down[v] * (dp_down[u] + 1) % m;
        }
    }
    let mut dp_up = vec![1; n + 1];
    for &v in q.iter() {
        let mut stack = vec![dp_up[v]];
        for &u in &g[v] {
            let val = *stack.last().unwrap() * (dp_down[u] + 1) % m;
            stack.push(val);
        }
        stack.pop();
        let mut mul = 1;
        for &u in g[v].iter().rev() {
            dp_up[u] = (mul * *stack.last().unwrap() + 1) % m;
            mul = mul * (dp_down[u] + 1) % m;
            stack.pop();
        }
    }
    for i in 1..(n + 1) {
        let ans = dp_down[i] * dp_up[i] % m;
        writeln!(out, "{}", ans).ok();
    }
}

fn main() {
    run();
}


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

dpa = [0] * (N+1)
dpb = [0] * (N+1)
dpc = [0] * (N+1)

for i in range(1, N+1):
    dpa[i] = max(dpb[i-1], dpc[i-1]) + A[i-1]
    dpb[i] = max(dpc[i-1], dpa[i-1]) + B[i-1]
    dpc[i] = max(dpa[i-1], dpb[i-1]) + C[i-1]

print(max(dpa[-1], dpb[-1], dpc[-1]))

Measured memory_bytes: 26740
#include<iostream>
using namespace std;
int main(){
    int D;
    cin >> D;
    string E;
if (D==25){
    E = "Christmas";
}
if (D==24){
    E = "Christmas Eve";
}
if (D==23){
    E = "Christmas Eve Eve";
}
if (D==22){
    E = "Christmas Eve Eve Eve";
}
cout << E;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int n, m, q;
vector<int> a, b, c, d;

vector<int> A;
ll r = 0;

void culc()
{
	ll t = 0;
	for (int i = 0; i < q; i++)
		if (A[b[i] - 1] - A[a[i] - 1] == c[i])
			t += d[i];
	if (t > r)
		r = t;
}

void func(int now, int bef)
{
	if (now == n)
	{
		culc();
		return;
	}
	for (int i = bef; i <= m; i++)
	{
		A[now] = i;
		func(now + 1, i);
	}
}

int main()
{
	ll a, b, n;
	cin >> a >> b >> n;
	double x = b - 1.0;
	if (n < b)
		x = n;
	double c = x / b;
	c *= a;

	printf("%lld", (ll)(c));

	return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    
    for(int i = 0;i<N ; ++i){
     cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    int JIN=99999999;
   for (int i= vec.at(0);i<=vec.at(N-1); i++){
        int MAXMAN=0;
       for(int j=0;j<N;j++){
           int MAX =0;
          MAX= ((vec.at(j))-i)*((vec.at(j))-i);
          MAXMAN += MAX;
          }
       if(JIN >= MAXMAN){
           JIN = MAXMAN;
          }
       }
        cout << JIN <<endl;
   }

Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()
    l1 = length = 0
    l2 = 1

    while (l2 + length < N):
        if S[l1:l2] in S[l2:]:
            length = l2 - l1
            l2 += 1
        else:
            l1 += 1
            l2 = l1 + length + 1
    print(length)

main()


Measured memory_bytes: 3060
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();
        /*
         * 配列に出現した数をsetに格納する
         * setに存在するならその時のiを算出してreturn
         * */

        int[] arr = new int[1000000];
        arr[0] = s;
        Set<Integer> set = new HashSet<>();
        set.add(s);

        for (int i = 1; i < 1000000000; i++) {
            if (arr[i - 1] % 2 == 0) {
                arr[i] = arr[i - 1] / 2;
            } else {
                arr[i] = arr[i - 1] * 3 + 1;
            }

            if (set.contains(arr[i])) {
                System.out.println(i + 1);
                return;
            } else {
                set.add(arr[i]);
            }

        }

    }
}




Measured memory_bytes: 27092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    ll n,k;cin >> n >>k;
    deque<ll> que;
    rep(i,n){
        ll a;cin >> a;que.push_back(a);
    }
    ll ans=0;
    rep(i,k){
        ll pick=i+1;
        rep(l,pick+1){
            deque<ll> deq=que;
            vl tmp;
            rep(j,l){
                if(deq.empty())break;
                tmp.pb(deq.front());
                deq.pop_front();
            }
            rep(j,pick-l){
                if(deq.empty())break;
                tmp.pb(deq.back());
                deq.pop_back();
            }
            sort(all(tmp));
            ll cast=k-pick;
            rep(i,cast){
                chmax(tmp[i],0LL);
            }
            ll res=0;
            rep(i,tmp.size()){
                res+=tmp[i];
            }
            //cout << res <<" " << pick <<" " <<l <<endl;
            chmax(ans,res);
        }
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int m=2019;
int main()
{
  int l,r,i,j,t,res=m-1;
  cin >> l >> r;
  if(l%m==0 || r%m==0 || r/m>l/m){
    cout << "0" << endl;
    return 0;
  }
  l=l%m;
  r=r%m;
  for(i=l;i<r;i++)
    for(j=i+1;j<=r;j++){
      t=i*j%m;
      if(res>t)
        res=t;
    }
  cout << res << endl;
  return 0;
}

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

typedef long long ll;
const int inf = 1e9;
int n, u;

int main(){
	cin>>n;
	u = 0;
	vector<int> vec(n + 1, 0);
	for(int i = 1; i <= n; ++i)cin>>vec[i];
	for(int i = 1; i <= n; ++i){
		if(i % 2 != 0 && vec[i] % 2 != 0)u++;
	}
	cout<<u<<endl;	
	return 0;
}


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

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

typedef long long ll;
typedef long double ld;
using namespace std;
int mod = 1000000007;

ld dist(double x1, double y1, double x2, double y2){
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int main(void){
    int N; cin >> N;
    ld ans = 2000.0;
    int X_int[N], Y_int[N];
    ld X[N], Y[N];
    rep(i, N) cin >> X_int[i] >> Y_int[i];
    rep(i, N){
        X[i] = (ld) X_int[i];
        Y[i] = (ld) Y_int[i];
    }

    //まずは2点を選ぶnC2通りについて考える
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            ld cx = (X[i]+X[j])/2;
            ld cy = (Y[i]+Y[j])/2;
            ld r = dist(cx, cy, X[j], Y[j]);
            bool ok = true;
            for(int k = 0; k < N; k++){
                if(k == i || k == j) continue;
                if(dist(cx, cy, X[k], Y[k]) > r) ok = false;
            }
            if(ok) ans = min(ans, r);
        }
    }

    //次に3点を選ぶnC3通りについて考える
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            for(int k = j+1; k < N; k++){
                //三角形は成立するか?
                ld x1, y1, x2, y2, x3, y3;
                x1 = X[i]; y1 = Y[i];
                x2 = X[j]; y2 = Y[j];
                x3 = X[k]; y3 = Y[k];
                //A:(x2-x1, y2-y1)とB:(x3-x1, y3-y1)が平行なら成立しない
                //外積A×Bの大きさはベクトルA,Bのつくる平行四辺形の面積
                //これが0なら平行
                //ただしこれはintで計算したい
                if((X_int[j]-X_int[i])*(Y_int[k]-Y_int[i]) == (X_int[k]-X_int[i])*(Y_int[j]-Y_int[i])){
                    //cout << "parallel: " << X_int[i] << " " << Y_int[i] << " " << X_int[j] << " " << Y_int[j] << " " << X_int[k] << " " << Y_int[k] << endl;
                    continue;
                }
                //外接円の中心,半径を求める
                ld cx, cy, r;
                cy = ((x3-x1)*(x1*x1 + y1*y1 - x2*x2 - y2*y2) - (x2-x1)*(x1*x1 + y1*y1 - x3*x3 - y3*y3))/((x3-x1)*(y1-y2)*2 - (x2-x1)*(y1-y3)*2);
                if(x1 == x2){
                    cx = ((y1-y3)*cy*2 - x1*x1 - y1*y1 + x3*x3 + y3*y3)/((x3-x1)*2);
                }
                else{
                    cx = ((y1-y2)*cy*2 - x1*x1 - y1*y1 + x2*x2 + y2*y2)/((x2-x1)*2);
                }
                r = dist(cx, cy, x3, y3);

                bool ok = true;
                for(int judge = 0; judge < N; judge++){
                    if(judge == i || judge == j || judge == k) continue;
                    if(dist(cx, cy, X[judge], Y[judge]) > r) ok = false;
                }
                if(ok) ans = min(ans, r);
            }
        }
    }
    double res = ans;
    printf("%.10f\n", res);
    return 0;
}

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

count = 0
lst = [0] * 10
for a in A:
    tmp = a // 400
    if tmp >= 8:
        count += 1
    else:
        lst[tmp] = 1

ans = sum(lst)
print (max(1, ans), ans + count)
    

Measured memory_bytes: 38384
#include<stdio.h>
#include<stdbool.h>

int main(void){
   int x,y;
   bool j=false;
   scanf("%d %d",&x,&y);

   if(y%2==0){
      if(y>=2*x&&y<=4*x){
         j=true;
      }
   }
   if(j){
      printf("Yes");
   }else{
      printf("No");
   }

   return 0;
}

Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b;
    cin >> a >> b;
    if ( a + b >= 24 ) {
        cout << ( a + b - 24 ) << endl;
    }
    else {
        cout << a + b << endl;
    }
    return 0;
}


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

typedef long long ll;
typedef long double ld;

using namespace std;



int main(){
	int n, ans = 0;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		int a;
		scanf("%d", &a);
		ans += __builtin_ctz(a);
	}	
	printf("%d\n", ans);
	return 0;
}

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

int main(){
int n;
string s;
cin >> n >> s;
int x=0,m=0;
for(int i=0;i<n;++i){
	if(s[i]=='I')x++;
	else x--;
	m=max(m,x);
}
cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.array;
import std.range;
import std.algorithm;
import std.conv;

void main(string[] args) {
  readln();
  string input = readln().chomp;

  int cur = 0;
  int min = 0;
  int e = 0;

  foreach(c; input){
    if(c == 'E'){e++; cur--;}
    else{cur++;}
    if(cur < min){min = cur;}
  }

  writeln(min+e);
}

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;
int main() {
	
	int A, B;
	int count=1;
	int i=0;
	cin >> A;
	cin >> B;

	for (i = 0; count < B; i++)
	{
		count += A - 1;
	}
	
	cout <<i ;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RSORT(x) sort(x.begin(), x.end(), std::greater<int>())
#define swap(a, b) \
  do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
#define vi vector<int>
using namespace std;

const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main() {
  
  int n;
  cin >> n;

  if(n < 2)
    cout << 0 << endl;
  else
    cout << n / 3 << endl;
  
  
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define pb push_back
#define F first
#define S second
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)

# define M_PIl          3.141592653589793238462643383279502884L /* pi */

const ll M=1e9+7;
const int MaxM=100005;


void SieveOfEratosthenes(int n)                                   //all prime <= n
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}


bool isPowerOfTwo (int x)
{
    return x && (!(x&(x-1)));
}



bool comp(pair<int,int> a,pair<int,int> b){
  if(a.F==b.F){
    return a.S>b.S;
  }
  return a.F<b.F;
}








void solve(){

  int n,k;
  cin>>n>>k;
  int a[n];
  int dp[n];
  dp[0]=0;

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

  for(int i=1;i<n;i++){
        dp[i]=INT_MAX;
        for(int j=1;j<=min(i,k);j++){

            dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
        }
  }
  cout<<dp[n-1]<<endl;

}

int main(){


   int t=1;
//  cin>>t;
   while(t--){
      solve();
       }

 }


Measured memory_bytes: 4308
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a[1000],ans=0;
  cin>>n;
  for(int i=0;i<n;i++){cin>>a[i];if(!a[i])ans=100000000;}
  bool f=1;
  int i=0;
  while(f){
    int k=1,idx=n-1;
    f=0;
    for(int j=n-1;j>=0;j--){
      if(a[j]==i/k%10){if(k==1)idx=j;k*=10;}
      else if(k!=1)j=idx,k=1;
      if(k>i)f=1;
    }
    i++;
  }
  cout<<min(ans,i-1)<<endl;
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
	  #define endl "\n"
	  #define ll long long int
	  #define mod 1000000007
	  #define inf 1000000000000000001;
	  using namespace std;
	  ll x, y, z, k, a[1009], b[1009], c[1009];
	  int main()
	  {
	    //  #ifndef ONLINE_JUDGE
	    //  // for getting input from input.txt
	    //  freopen("input.txt", "r", stdin);
	    //  // for writing output to output.txt
	    //  freopen("output.txt", "w", stdout);
	    // #endif
	    std::ios::sync_with_stdio(false);
	    cin.tie(NULL);
	    // ll x,y,z,k;
	    cin>>x>>y>>z>>k;
	   	// vector<ll> a;
	   	// vector<ll> b;
	   	// vector<ll> c;
	   	vector<ll> v;
	   	// cout<<x<<y<<z<<k;
	   	for (int i = 0; i < x; ++i)
	   	{
	   		cin>>a[i];
	   	}

	   	sort(a, a + x, greater<ll>());
	   
	   	for (int i = 0; i < y; ++i)
	   	{
	   		cin>>b[i];
	   	}

	   	sort(b, b + y, greater<ll>());
	   	for (int i = 0; i < z; ++i)
	   	{
	   		cin>>c[i];
	   	}

	   	sort(c, c + z, greater<ll>());
	   	// cout<<"Hi";
	   	// for (int i = 0; i < x; ++i)
	   	// {
	   	// 	cout<<c[i]<<" ";
	   	// }

	   	for (int i = 0; i < x; ++i)
	   	{
	   		for (int j = 0; j < y; ++j)
	   		{
	   			for (int l = 0; l < z; ++l)
	   			{
	   				if( (i+1)*(j+1)*(l+1) <= k){
	   					v.push_back(a[i]+b[j]+c[l]);
	   				}
	   				else{
	   					break;
	   				}
	   			}
	   		}
	   	}
	   	sort(v.begin(), v.end(), greater<ll>());
	   	for (int i = 0; i < k; ++i)
	   	{
	   		cout<<v[i]<<endl;
	   	}
	    return 0;
	  }


Measured memory_bytes: 4272
class priorityQueue {
  constructor() {
    this.keys = [];
    Number.prototype.parentIdx = function() { return Math.ceil(this/2 - 1); };
    Number.prototype.leftIdx = function() { return this * 2 + 1; };
    Number.prototype.rightIdx = function() { return this * 2 + 2; };
  }

  insert(key) { this.heapIncrease(this.keys.push(key) - 1); }

  heapIncrease(idx) {
    const keys = this.keys;
    for (let i=idx, p=idx.parentIdx(); i > 0 && keys[i] > keys[p]; i=p, p=i.parentIdx()) {
      keys[p] = [keys[i], keys[i] = keys[p]][0];
    }
  }

  extract() {
    const res = this.keys[0];
    this.keys[0] = this.keys.pop();
    this.maxHeapify(0);
    return res;
  }

  maxHeapify(idx) {
    const keys = this.keys, n = keys.length;
    const innerMaxHeapify = (i) => {
      let left, right, largest = i;
      left = i.leftIdx();
      right = i.rightIdx();
      if (left < n && Number(keys[left]) > Number(keys[largest])) largest = left;
      if (right < n && Number(keys[right]) > Number(keys[largest])) largest = right;
      if (largest != i) {
        keys[largest] = [keys[i], keys[i] = keys[largest]][0];
        innerMaxHeapify(largest);
      }
    };
    innerMaxHeapify(idx);
  }
}

(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  lines.pop();
  const queue = new priorityQueue();
  let str = '';
  lines.forEach(function(cmd) {
    switch(cmd.charAt(0)) {
      case 'i': queue.insert(Number(cmd.split(' ')[1])); break;
      case 'e': str += `${queue.extract()}\n`; break;
    }
  });
  process.stdout.write(str);
})();




Measured memory_bytes: 203960
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int N,Y;
	cin>>N>>Y;	
	int man,gosen,sen,x;
	for(man=0;man<=N;man++){
		for(gosen=0;gosen<=N;gosen++){
			//for(sen=0;sen<=N-gosen-man;sen++){
				if(N>=gosen+man){
					sen=N-gosen-man;
					x=man*10000+gosen*5000+sen*1000;
					if(x==Y){
						cout<<man<<" "<<gosen<<" "<<sen<<endl;
						return 0;
					}
				}
			//}
		}
	}
	cout<<"-1 -1 -1"<<endl;	
}


Measured memory_bytes: 256
import collections

blue = int(input())
blue_string = [input() for i in range(blue)]
blue_type = set(blue_string)
red = int(input())
red_string = [input() for i in range(red)]
red_type = set(red_string)
result = [0]

for i in blue_type:
    bulue_sort_count = blue_string.count(i)
    red_sort_count = red_string.count(i)
    result.append(bulue_sort_count - red_sort_count )
print(max(result))


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	int a = scan.nextInt();
    	int b = scan.nextInt();
    	double c = a; 
    	double d = b; 
    	System.out.printf("%d %d %f",a/b,a%b,c/d);
    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

bool debug = false;
int N;

string to_str(LL n){
    stringstream ss;
    ss << n;
    string s;
    ss >> s;
    return s;
}

bool query(LL n){
    if(debug){
        string s = to_str(n);
        string S = to_str(N);
        if(n <= N && s <= S)return true;
        if(n > N && s > S)return true;
        return false;
    }
    string ans;
    cout << "? " << n << endl;
    cin >> ans;
    return ans[0] == 'Y';
}

int solve(){
    if(query(1e9)){
        for(LL i=2; i<=1e10; i*=10){
            if(query(i))return i/2;
        }
        return -1;
    }
    for(LL len=1e9; len>1; len/=10){
        if(!query(len/10))continue;
        LL lb = len/10;
        LL ub = len-1;
        while(ub-lb>1){
            LL mid = (lb+ub)>>1;
            bool res = query(mid*10);
            cerr << lb << " " << ub << " " << mid << " " << res << endl;
            if(res){
                ub = mid;
            }else{
                lb = mid;
            }
        }
        return ub;
    }
    return -1;
}

int main(){
    if(debug){
        cin >> N;
    }
    int res = solve();
    cout << "! " << res << endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N; cin >> N;
  string a[N]; rep(i,N) cin >> a[i];
  vector<int> l[N]; rep(i,N) rep(j,N) if (a[i][j]=='#') l[i].push_back(j);
  vector<int> c[N]; rep(i,N) rep(j,N) if (a[j][i]=='#') c[i].push_back(j);
  int result = INF;
  rep(i,N) {
    int tr = 0;
    bool ok = true;
    rep(j,N) {
      if (a[i][j]=='.') {
        // cout << i << "-" << j << " " << c[j].size() << endl;
        if (i==j&&!c[j].size()) {
          if (l[i].size()) tr += 2;
          else { ok = false; break; }
        }
        else tr++;
      }
    }
    if (!ok) continue;
    rep(j,N) if (a[i][j]=='.'||c[j].size()!=N) tr++;
    result = min(result,tr);
    // cout << i << " " << tr << endl;
  }
  if (result==INF) result = -1;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(a)  (a).begin(),(a).end()
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i,n)
    cin >> v[i];
  sort(ALL(v));
  int ans = 1e9 + 1;
  rep(i,n-k+1)
    ans = min(ans, v[i + k - 1] - v[i]);
  cout << ans;
  return 0;
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (int i = 0; i < 3; i++)
    {
        if (s[i] == t[i])
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int ds[3] = {5,9,13};
int dx[13] = { 0,-1, 0, 1, 0,-1, 1,-1, 1, 0,-2, 2, 0};
int dy[13] = {-1, 0, 0, 0, 1,-1,-1, 1, 1,-2, 0, 0, 2};
 
int main() {
 
  int x,y,size;
  char c;
  int map[14][14] = {0};
 
  int cnt = 0;
  int map_max = 0;
 
  while( cin >> x >> c >> y >> c >> size ) {
 
    for ( int i = 0; i < ds[size-1]; i++ ) {
 
      map[ x+2 + dx[i] ][ y+2 + dy[i] ]++;
 
    }
 
  }
 
  for ( int i = 2; i < 12; i++ ) {
    for ( int j = 2; j < 12; j++ ) {
       
      if ( map[i][j] == 0 ) cnt++;
      map_max = max( map_max, map[i][j] );
       
    }
  }
 
  cout << cnt << endl << map_max << endl;
 
  return 0;
 
}


Measured memory_bytes: 1160
S = input()

candidates = {
    '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'
} - set(S)
if len(candidates) == 0:
    print('None')
    exit(0)
candidates = list(candidates)
candidates.sort()
print(candidates[0])


Measured memory_bytes: 3188
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

using namespace std;

int main(){
	int n;
	string str;
	string ans;
	while(cin >> str){
		for(int i=0;i<str.size();i++){
			if(str[i] == '@'){
				cout << ans.append(str[i+1]-'0',str[i+2]);
				i+=2;
				ans = "";
			}else{
				cout << str[i];
			}
		}
		cout << endl;
	}
	return 0;
}

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

class Main{
    public static void main(String[] a)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] b = new int[10];
        int i = 0;
        for(; i<b.length; i++){
            String s = br.readLine();
            b[i] = Integer.parseInt(s);
        }
        Arrays.sort(b);
        for(int d=9; d>6; d--){
            System.out.println(b[d]);
        }
        
    }
}

Measured memory_bytes: 16860
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  if(n%2) n*=2;
  pr(n);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int min=(h2*60+m2)-(h1*60+m1);
    cout<<min-k<<endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char s[100010];
int n,i,ans,ans2;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	ans=ans2=n;
	for(i=0;i<n;i++)
		if(s[i]=='1')ans=min(ans,max(i,n-i-1));
	for(i=0;i<n;i++)
		if(s[i]=='0')ans2=min(ans2,max(i,n-i-1));
	cout<<max(ans,ans2)<<endl;
}

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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

void Main(){
    double A,B,H,M; cin >> A >> B >> H >> M;
    double s = M*60 + H*3600;
    double t1 = 2*PI*s / 3600 / 12, t2 = 2*PI*s / 3600;

    pair<double, double> v1, v2;
    v1.first = -A*sin(t1); v1.second = A*cos(t1);
    v2.first = -B*sin(t2); v2.second = B*cos(t2);

    double ans = sqrt((v1.first-v2.first)*(v1.first-v2.first) + (v1.second-v2.second)*(v1.second-v2.second));
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t = 1; //cin >> t;
    REP(_,t){
        Main();
    }
    return 0;
}

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

d={}
for a in A:
    if a in d:
        d[a]+=1
    else:
        d[a]=1

double=0
ans=0

for D in d:
    if d[D]%2==0:
        double+=1
    if d[D]>2:
        ans+=(d[D]-1)//2
        d[D]=(d[D]-1)%2+1

ans+=double//2+double%2
print(N-2*ans)

Measured memory_bytes: 21572