akhauriyash/Code-Regression huggingface dataset:
const KEYWORD: &'static str = "keyence";
fn main() {
    let mut s = String::with_capacity(100);
    let _ = std::io::stdin().read_line(&mut s);
    println!("{}", if solve(&s.trim()) { "YES" } else { "NO" });
}

fn solve(s: &str) -> bool {
    if s.starts_with(KEYWORD) || s.ends_with(KEYWORD) {
        return true;
    }
    for head_l in 0..(KEYWORD.len()) {
        if [
            &s[0..head_l],
            &s[s.len() - (KEYWORD.len() - head_l)..s.len()],
        ]
        .join("")
            == KEYWORD
        {
            return true;
        }
    }
    false
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
long long myRecur(vector<long long> p, vector<long long> c, long long G, int f);

long long myDriver(vector<long long> p, vector<long long> c, long long G){
    long long best = LLONG_MAX, innerbest;
    for (int i=0; i< p.size(); i++) {
        innerbest = myRecur(p, c, G, i);
        best = min(best, innerbest);
    }
    return best;
}

long long myRecur(vector<long long> p, vector<long long> c, long long G, int f){
    // base cases
    if (G<=0) return 0;
    if (p[f] > 0 ){
        if ((p[f]-1) * (f+1) >= G) return  (long long) ceil(((double) G)/(f+1.));
        else if (p[f]*(f+1)+c[f] >= G ) return p[f];
    }
    // recursive
    long long best = LLONG_MAX, used;
    used = p[f];
    G -= p[f]*(f+1)+c[f];
    p[f] = 0;
    for (int i=0; i< p.size(); i++) {
        long long innerbest;
        if (i==f) continue;
        else if (p[i] == 0) continue;
        else {
            innerbest = myRecur(p, c, G, i);
            best = min(best, innerbest);
        }
    }
    return best+used;
}

void solve(long long D, long long G, std::vector<long long> p, std::vector<long long> c){
    cout << myDriver(p, c, G) << endl;
}

int main(){
    long long D;
    scanf("%lld",&D);
    long long G;
    scanf("%lld",&G);
    std::vector<long long> p(D);
    std::vector<long long> c(D);
    for(int i = 0 ; i < D ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&c[i]);
    }
    for(int i = 0 ; i < D ; i++){
        c[i] /= 100;
    }
    G /= 100;
    solve(D, G, std::move(p), std::move(c));
    return 0;
}


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

int main() {
  ll N;
  ll sum=0;
  cin >> N;
  for(ll i=1;i<=N;i++){
    if(i%3!=0 && i%5!=0)sum+=i;
  }
  cout << sum << endl;

}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>

int main(void) {
    long A, B, X;
    
    std::cin >> X;
    
    for(A = -118; A < 120; A++) {
        for(B = -119; B < 119; B++) {
            if(X == (std::pow(A, 5) - std::pow(B, 5))) {
                std::cout << A << " " << B << std::endl;
                A = 119;
                B = 118;
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 4032
#include<iostream>
#include<cmath>
#include<map>

using namespace std;

int main(){

	int L;
	int R;

	int A;
	int B;
	int C;
	int D;

	cin >> A >> B >> C >> D;

	L = A + B;
	R = C + D;

	if(L == R){
		cout << "Balanced";
	}else if(L > R){
		cout << "Left";
	}else if(R > L){
		cout << "Right";
	}


    return 0;

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

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

int main(void){
	int X,i=1,sum=0;
	cin>>X;

	while(1){
		sum=(i*(i+1))/2;
		if(sum>=X) break;
		else i++;
	}

	printf("%d\n",i);
	return 0;
}



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


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

	int n , k ; 
	cin >> n >> k  ;
	vector<int> a(n) ; 
	for(int i = 0; i < n ;++i)
		cin >> a[i]; 
	int lo = 1, hi = 1e10 ;
	while(lo < hi)
	{
	 	int mid = (lo +hi)/2 , r = 0 ; 
	 	for(int i = 0 ; i < n ; ++i)
	 	{
	 		r += a[i]/mid ; 
	 		if(a[i]%mid != 0)
	 			r++ ;
	 	}
	 	if(r <= n + k )
	 	{
	 		hi = mid ;	
	 	}
	 	else 
	 		lo = mid +1 ; 
	}
	cout << hi ; 
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  int64_t buka[n] = {};
  int64_t b;
  for(int i=1;i<n;i++){
    cin >> b;
    buka[b-1]++;
  }
  for(int i=0;i<n;i++){
    cout << buka[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 5216
use std::io::{stderr, stdin, stdout, BufReader, BufWriter, Cursor, Read, Write};
use std::iter::Iterator;
use std::str::FromStr;

fn read<F: FromStr, R: Read>(reader: &mut R) -> F {
  let str = reader
    .by_ref()
    .bytes()
    .map(|c| c.unwrap() as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect::<String>();
  str.parse::<F>().ok().unwrap()
}

macro_rules! r {
  ($stream: expr) => (read::<String, _>($stream));
  ($stream: expr, ) => (r!($stream));
  ($stream: expr; ) => (r!($stream));
  ($stream: expr; $t: ty) => (read::<$t,  _>($stream));
  ($stream: expr; $($t: ty),*) => (($(r!($stream; $t)),*));
  ($stream: expr; $t: ty; $n: expr) => ((0..$n).map(|_| r!($stream; $t)).collect::<Vec<_>>());
}

macro_rules! args {
  ($($arg: expr),*) => ({
    let mut s = String::new();
    $(s += &format!("{} ", $arg);)*
    s.pop().unwrap();
    s
  });
}

macro_rules! _writes {
  ($stream: expr; $($arg: expr),*) => ({
    let mut f = false;
    $(
      if f { write!($stream, " "); } else { f = true; }
      write!($stream, "{}", $arg);

    )*
  });
}

macro_rules! w {
  ($stream: expr) => (write!($stream, " "));
  ($stream: expr; ) => (w!($stream));
  ($stream: expr, ) => (w!($stream));
  ($stream: expr; $arg: expr) => (write!($stream, "{}", $arg));
  ($stream: expr; $($arg: expr),*) => (_writes!($stream; $($arg),*));
  ($stream: expr, $($arg: tt)*) => (write!($stream, $($arg)*));
}

macro_rules! wl {
  ($stream: expr) => (writeln!($stream));
  ($stream: expr, ) => (wl!($stream));
  ($stream: expr; ) => (wl!($stream));
  ($stream: expr; $arg: expr) => (writeln!($stream, "{}", $arg));
  ($stream: expr; $($arg: expr),*) => (_writes!($stream; $($arg),*); wl!($stream));
  ($stream: expr, $($arg: tt)*) => (writeln!($stream, $($arg)*));
}

fn test(input: &str, output: &str,
        f: impl FnOnce(&mut Cursor<Vec<u8>>, &mut Vec<u8>, &mut Vec<u8>)) {
  let r = &mut Cursor::new(input.as_bytes().to_vec());
  let w: &mut Vec<u8> = &mut Vec::new();
  let err: &mut Vec<u8> = &mut Vec::new();
  f(r, w, err);
  writeln!(stderr(), "{}", String::from_utf8(err.to_vec()).unwrap()).unwrap();
  assert_eq!(String::from_utf8(w.to_vec()).unwrap(), output)
}

macro_rules! t {
  ($f: ident => $input: expr, $output: expr) => (
    #[test]
    fn $f() { test($input, $output, run); }
  );
}

fn main() {
  let stdin = stdin();
  let r = &mut BufReader::new(stdin.lock());
  let stdout = stdout();
  let w = &mut BufWriter::new(stdout.lock());
  let stderr = stderr();
  let err = &mut BufWriter::new(stderr.lock());
  run(r, w, err);
  w.flush().unwrap();
  err.flush().unwrap();
}

fn run<R: Read, W: Write, E: Write>(r: &mut R, w: &mut W, err: &mut E) {
  let s = r!(r);
  let a = s.chars().filter(|&c| c == '1').count();
  w!(w; a);
}

t!(ta1 => "101", "2");
t!(ta2 => "000", "0");


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

int main(void) {
    string s, t;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    cin >> t;
    sort (s.begin(), s.end());
    sort (t.begin(), t.end());
    reverse (t.begin(), t.end());
    cout << (s < t? "Yes" : "No") << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define PI acos(-1LL)


#ifdef LOCAL
string to_string(const string& s){
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v){
    bool first = true;
    string res = "{";
    for(const auto& x: v){
        if(!first) res+=", ";
        first = false;
        res+=to_string(x);
    }
    res+="}";
    return res;
}
void bug() { cerr << endl; }
template<typename Head, typename... Tail>
void bug(Head H, Tail... T) {
    cerr << " " << to_string(H);
    bug(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__);
#else
#define debug(...) 11;
#endif

const int M = 1000000007;
const int N = 2e6 + 5;
const long long INF = 2e18 + 12;
int powmod(int x,int n , int mod = M)
{
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result%mod* x%mod)%mod;
        x=(x%mod*x%mod)%mod;
        n=n/2;
    }
    return result;
}
void solve(){
    int n;
    cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return;
    }
    int ans = (powmod(10, n) - (2*powmod(9 , n))%M + powmod(8 , n) +  M)%M;
    ans = (ans + M)%M;
    cout << ans << endl;

}
signed main(){
    FAST
#ifdef TIMER
    clock_t start;
    double duration;
    start = clock();
#endif
    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int tt = 1; tt <= tc; tt++) {
        solve();
    }
#ifdef TIMER
    duration = (clock() - start) / (double) CLOCKS_PER_SEC;
    cerr <<"\n\nTotal time elapsed: "<< duration <<"sec\n";
#endif
}


Measured memory_bytes: 3640
M=10**9+7
*F=I=[r=1,t=1]
R=*I,*(2..N=gets.to_i).map{|i|I<<z=M/i*-I[M%i]%M;F<<r=r*i%M;t=t*z%M}
(-~N/2...N).map{|i|r-=F[i-1]*R[2*i-N]*F[i]%M}
p r%M

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

int N, K, i;
pair<long, int> h[100000 + 10];

int main(void) {
    cin >> N >> K;
    for (i=0; i<N; i++) {
        h[i].second = i;
        cin >> h[i].first;
    }
    
    sort(h, h+N);
    
    long min_diff = h[K - 1].first - h[0].first;
    
    for (i=1; i<=N-K; i++) {
        if (min_diff > h[i+K-1].first - h[i].first) {
            min_diff = h[i+K-1].first - h[i].first;
        }
    }
    
    cout << min_diff << endl;
    
    return 0;
}

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;


class Weight implements Comparable<Weight> {

	int num, prev;

	public Weight(int num, int prev) {
		super();
		this.num = num;
		this.prev = prev;
	}

	@Override
	public int compareTo(Weight o) {

		if (this.num < o.num) {
			return -1;
		}
		if (this.num > o.num) {
			return 1;
		}
		return 0;
	}
}

public class Main {


	public static Set<Weight> checked = new HashSet<>();

	public static int minCostChange(Weight[] arr, int i) {
		int useMin = 0, useOnlyRange = 0;

		Weight w = arr[i];
		int min = arr[0].num;
		List<Weight> list = new ArrayList<>();
		list.add(w);
		useMin += min + w.num;
		useOnlyRange += w.num;
		checked.add(w);
		while(i != w.prev) {
			w = arr[w.prev];
			list.add(w);
			useMin += min + w.num;
			useOnlyRange += w.num;
			checked.add(w);
		}
		Collections.sort(list);
		useMin += min + list.get(0).num;
		useOnlyRange += list.get(0).num * (list.size() - 2);
		return Math.min(useMin, useOnlyRange);
	}


	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		Weight[] arr = new Weight[n];
		for (int i = 0; i < n; i++) {
			arr[i] = new Weight(sc.nextInt(), i);
		}
		Arrays.sort(arr);

		int min = arr[0].num;
		int sum = 0;

		for (int i = 0; i < n; i++) {
			if (arr[i].prev != i && !checked.contains(arr[i])) {
				sum += minCostChange(arr, i);
			}
		}

		System.out.println(sum);
	}
}



Measured memory_bytes: 31176
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
struct edge {
	int to, next;
} e[N * 2];
int head[N], ecnt, mark[N];
inline void adde(int from, int to) {
	e[++ecnt] = (edge){to, head[from]}, head[from] = ecnt;
	e[++ecnt] = (edge){from, head[to]}, head[to] = ecnt;
}
void dfs(int u, int f) {
	mark[u] = 1; int ct = 0;
	for (int i = head[u]; i; i = e[i].next)
		if (e[i].to != f) dfs(e[i].to, u), ct += mark[e[i].to];
	if (ct > 1 || (u == 1 && ct == 0)) puts("First"), exit(0);
	if (ct == 1) mark[u] = 0;
}
int main() {
	int n; scanf("%d", &n);
	for (int i = 1, a, b; i < n; i++) scanf("%d%d", &a, &b), adde(a, b);
	dfs(1, 0), puts("Second");
}//

Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>
#include <cmath>

int prime(int n);
int main (void){
	int n;
	while(~scanf("%d",&n)){
		std::cout << prime(n) << std::endl;
	}

	return 0;
}

int prime(int n){
	bool *flag = new bool[n];
	int res=0,i=0;
	for(i=0;i<=n;flag[i++]=0);
	for(i=2;i<=n;){
		for(int j=2;i*j<=n;j++)
			flag[i*j]=1;
		for(i++;flag[i]==1 ;i++);

	}
	for(i=0;i<=n;i++)
		res += flag[i]?0:1;
	delete [] flag;
	return res-2;
}

Measured memory_bytes: 2028
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> l(m),r(m);
	cu(i,0,m)cin >> l[i] >> r[i];
	sort(all(l));
	sort(all(r));

	int ans = 0;
	int lind=0,rind=0;
	int cnt = 0;
	fu(i,1,n){
		while(lind < m && l[lind] == i){
			++cnt;
			++lind;
		}
		if(cnt == m)++ans;
		while(rind < m && r[rind] == i){
			--cnt;
			++rind;
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 1024
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll sum = 0;
    ll n;
    cin >> n;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= n; j++)
        {
            for (ll k = 1; k <= n; k++)
            {
                sum += gcd(gcd(i, j), k);
            }
        }
    }
    cout << sum << "\n";
}


Measured memory_bytes: 3584
#!/usr/bin/env python3

def main():
    S = input()
    S_o = [S[i] for i in range(0, len(S)) if i % 2 == 0]
    S_e = [S[i] for i in range(0, len(S)) if not i % 2 == 0]
    if S_o.count('L') > 0:
        print('No')
    elif S_e.count('R') > 0:
        print('No')
    else:
        print('Yes')


main()

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N;
    	long ans = 0;
    	long[] A, B;
    	
        void solve(InputReader in, PrintWriter out) {
            // write your code here
        	N = in.nextInt();
        	A = new long[N];
        	B = new long[N];
        	for (int i = 0; i < N; ++i) {
        		A[i] = in.nextLong();
        		B[i] = in.nextLong();
        	}
        	
        	for (int i = N - 1; i >= 0; --i) {
        		long mul = (long) Math.ceil((A[i] + ans) / (double)B[i]);
        		ans += B[i]*mul - (A[i] + ans);
        	}
        	
        	out.print(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


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

int main() {
  int N;
  std::string S;
  std::cin >> N;
  std::cin >> S;

  size_t i = 1;
  auto now = S[0];
  uint64_t count = 1;

  while (i < N) {
    if (S[i] != now) {
      ++count;
      now = S[i];
    }
    ++i;
  }

  std::cout << count << std::endl;
  return 0;
}

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

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            var result = "Odd";

            if ((a[0] * a[1]) % 2 == 0) {
                result = "Even";
            }


            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 11348
#include <bits/stdc++.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<ll> a(n+1),b(n);
 ll ans=0;
 rep(i,n+1)cin >> a[i]; rep(i,n)cin >> b[i];

 rep(i,n){
   if(a[i]>=b[i])ans+=b[i];
   else if( a[i]<b[i]){
     ans+=a[i];
     b[i]-=a[i];
       if( a[i+1]>=b[i]){
       ans+=b[i];
       a[i+1]-=b[i];
       }
       else if(a[i+1]<b[i]){
       ans+=a[i+1];
       a[i+1]=0;
       }
   }
 }
 cout << ans << endl;

}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <memory>
#include <bitset>
#include <algorithm>
#include <sstream>

using namespace std;    

int main(void){
    int n, k;
    string elem;
    vector<int> a;
    stringstream st;
    string line;

    getline(cin, line);
    st.str(line);
    st >> n >> k;
    
    getline(cin, line);
    st.str(line);
    st.clear();
    st.seekg(0);
    
    while(getline(st, elem, ' ')) {
        a.push_back(atoi(elem.c_str()));
    }

    sort(a.begin(), a.end());
    auto l = lower_bound(a.begin(), a.end(), k);

    int len = l - a.begin();
    if (len == 0) {
	cout << 0 << endl;
	exit(0);
    }
    
    vector<bitset<5000>> stf(len, bitset<5000>(0));
    vector<bitset<5000>> stb(len, bitset<5000>(0));
    
    stf[0][a[0]] = true;
    stf[0][0] = true;
    for (int i = 1; i < len; i++) {
	for (int x = 0; x < k; x++) {
	    if (x - a[i] >= 0) {
		stf[i][x] = stf[i - 1][x] || stf[i - 1][x - a[i]];
	    } else {
		stf[i][x] = stf[i - 1][x];
	    }
	}
    }

    stb[len - 1][a[len - 1]] = 1;
    stb[len - 1][0] = 1;
    for (int i = len - 2; i >= 0; i--) {
	for (int x = 0; x < k; x++) {
	    if (x - a[i] >= 0) {
		stb[i][x] = stb[i + 1][x] || stb[i + 1][x - a[i]];
	    } else {
		stb[i][x] = stb[i + 1][x];
	    }
	}
    }

    int cc = 0;
    for (int i = 0; i < len; i++) {
	bool found = false;
	for (int x = k - a[i]; x < k; x++) {
	    if (i == 0) {
		if (stb[1][x]) {
		    found = true;
		    break;
		}
	    } else if (i == len - 1) {
		if (stf[len - 2][x]) {
		    found = true;
		    break;
		}
	    } else {
		for (int y = 0; y <= x; y++) {
		    if (stf[i - 1][y] && stb[i + 1][x - y]) {
			found = true;
			break;
		    }
		}
		if (found) {
		    break;
		}
	    }
	}
	if (!found) {
	    cc += 1;
	} else {
	    break;
	}
    }
        
    cout << cc << endl;

    return 0;

    
}


Measured memory_bytes: 6528
#include<stdio.h>

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

  for(int i=n-1; i >= 0; i--){
    printf("%d", a[i]);
    if(i)printf(" ");
  }
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 2664
L, R = map(int, input().split())
ama=[]
for i in  range(L,R+1):
    amari = i%2019
    if amari ==0:
        print(amari)
        exit()
minimi = 2019
for j in range(L,R+1):
    for s in range(j+1,R+1):
        waka = (j*s)%2019
        minimi = min(minimi,waka)
print(minimi)

Measured memory_bytes: 66264
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N=ii()
    d = [0] * (N+1)
    ans = 0
    for i in range(1, N+1):
        for j in range(i, N+1, i):
            d[j] += 1
        ans += i * d[i]
    print(ans)


main()



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

int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 0; i < n + 1; i++) {
		cin >> a.at(i);
	}
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b.at(i);
	}

	long long result = 0;
	for (int i = 0, d; i < n; i++) {
		d = min(a[i], b[i]);
		result += d;
		b[i] -= d;

		d = min(a[i + 1], b[i]);
		result += d;
		a[i + 1] -= d;
		b[i] -= d;

	}
	cout << result << endl;

}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
    int a,b;cin>>a>>b;
    if(a>b){
        if(b!=1){
        cout<<"Alice";
        }
        else{
            cout<<"Bob";
        }
    }
    else if(b>a){
        if(a!=1){
        cout<<"Bob";
        }
        else{
            cout<<"Alice";
        }
    }
    else{
        cout<<"Draw";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  static final int MOD = 1_000_000_007;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    sc.close();
    if(k % 2 == 0 || k % 5 == 0) {
      System.out.println(-1);
      return;
    }
    if(k % 7 == 0) {
      k /= 7;
    }
    k = 9 * k;

    int mod = 1;
    int n = 1;
    while(n <= k){
      mod = mod * 10;
      mod = mod % k;
      if(mod == 1){
        break;
      } else {
        n++;
      }
    }
    System.out.println(n);
  }
}


Measured memory_bytes: 35700
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void){
  int x,y,i;
  ll fac[2000005]={},inv[2000005]={},finv[2000005]={};
  const int mod=1e9+7;
  
  cin >> x >> y;
  
  if ((x+y)%3>0){
    cout << 0 << endl;
    return 0;
  }
  
  int a,b;
  a=x-(x+y)/3;
  b=y-(x+y)/3;
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (i=2;i<=a+b;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
  
  cout << fac[a+b]*finv[a]%mod*finv[b]%mod << endl;
  
  return 0;
}

Measured memory_bytes: 47232
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	vll v(n);
	rep(i,n) cin>>v[i];
	ll ans = 0;
	while(1){
		ll cnt = 0;
		rep(i,n){
			cnt += v[i]/n;
		}
		if(cnt==0) break;
		rep(i,n){
			v[i] += -v[i]/n * (n+1) + cnt; 
		}
		ans += cnt;
	}
	cout<<ans<<endl;
}


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

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

template <class T, class Op = multiplies<T>>
T power(T a, long long n, Op op = multiplies<T>(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  unsigned v;
  modular(long long a = 0) : v((a %= M) < 0 ? a + M : a) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m r) { if ((v += r.v) >= M) v -= M; return *this; }
  m& operator-=(m r) { if (v < r.v) v += M; v -= r.v; return *this; }
  m& operator*=(m r) { v = (uint64_t)v * r.v % M; return *this; }
  m& operator/=(m r) { return *this *= power(r, M - 2); }
  friend m operator+(m l, m r) { return l += r; }
  friend m operator-(m l, m r) { return l -= r; }
  friend m operator*(m l, m r) { return l *= r; }
  friend m operator/(m l, m r) { return l /= r; }
  friend bool operator==(m l, m r) { return l.v == r.v; }
  friend string to_string(m a) { return to_string(a.v); }
};

constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;

constexpr int lim = 1e5;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, t;
  cin >> n >> t;
  vector<int> d(n), c(lim + 1);
  for (auto&& e : d) {
    cin >> e;
    --e;
    ++c[e];
  }
  for (int i = lim; i--; ) {
    c[i] += c[i + 1];
  }
  sort(begin(d), end(d));
  mint res = 1;
  int cur = 0;
  for (int e : d) {
    res *= cur - (c[0] - c[max(e - t, 0)]) + 1;
    ++cur;
  }
  cout << res.v << '\n';
}



Measured memory_bytes: 3636
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        aa: [usize; n],
    }
    let mut ans = 0;
    for i in 0..aa.len() {
        let mut a = aa[i];
        while a % 2 == 0 {
            ans += 1;
            a = a / 2;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

vector<P>p;
vector<int> G[10010];
vector<int>c;
bool visited[10010];
bool leaf[10010];
void dfs(int n) {
	int cnt = 0;
	visited[n] = true;
	for (auto x : G[n]) {
		cnt++;
	}
	p.push_back(make_pair(cnt, n));
	for (auto x : G[n]) {
		if (!visited[x]) {
			dfs(x);
		}
	}
}
int ans[10010];
int res = 0;
void dfs2(int n) {
	visited[n] = true;
	for (auto x : G[n]) {
		if (!visited[x]) {
			res += min(ans[n], ans[x]);
			dfs2(x);
		}
	}
}
set<int>rem;
vector<int>v;
void dfs3(int n) {
	visited[n] = true;
	bool found = 0;
	for (auto x : G[n]) {
		if (!visited[x]) {
			if (!leaf[x]) {
				found = true;
				dfs3(x);
			}
		}
	}
	if (!found) {
		v.pb(n);
		leaf[n] = true;
		auto itr = rem.erase(n);
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	REP(i, N - 1) {
		int a, b; cin >> a >> b;
		a--, b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	REP(i, N) {
		rem.insert(i);
		int C; cin >> C;
		c.pb(C);
	}
	VSORT(c);
	m0(visited);
	bool ok = false;
	while (rem.size() != 0) {
		m0(visited);
		auto itr = rem.begin();
		dfs3(*itr);
	}
	REP(i, N) {
		ans[v[i]] = c[i];
	}

	//VSORT(c);// VREVERSE(c);
	//m0(visited);
	//dfs(0);
	//VSORT(p);
	//REP(i, N) {
	//	ans[p[i].second] = c[i];
	//}
	m0(visited);
	dfs2(0);
	print(res);
	REP(i, N) {
		pe(ans[i]);
	}cout << endl;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,m,k; cin>>n>>m>>k;
	for (int a=0; a<=n; a++)
		for (int b=0; b<=m; b++)
			if((n-a)*b+(m-b)*a==k) {
				cout<<"Yes\n";
				return 0;
			}
	cout<<"No\n";
	return 0;
}

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

int main(){
    map<char,char> A;
    char s;
    A['A'] = 'T';
    A['T'] = 'A';
    A['G'] = 'C';
    A['C'] = 'G';
    cin >> s;
    cout << A[s] << endl;
}

Measured memory_bytes: 256
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
    n = II()
    res = 0
    for i in range(1,n+1):
        y = n//i
        res += y*(y+1)*i//2
    print(res)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9176
# 数直線上に N 人の人が住んでいます。i 番目の人が住んでいるのは座標 Xi です。
# あなたは N 人全員が参加する集会を開くことを考えています。
# 集会は数直線上の任意の 整数値の座標 で開くことができ、座標 P で集会を開くとき、
# i 番目の人は集会に参加するために (Xi−P)2 の体力を消費します。
# N 人が消費する体力の総和としてありえる値の最小値を求めてください。

n = gets.to_i
x = gets.chomp.split
n.times do |i|
    x[i] = x[i].to_i
end

staminas = Array.new
(1..(x.max)).each do |coordinate|
    stamina = 0
    n.times do |i|
        stamina += (x[i] - coordinate) ** 2
    end
    staminas << stamina
end

puts staminas.min

Measured memory_bytes: 3836
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  cin >> S;
  const size_t N = S.size();

  vec<string> xss;
  for (int i = 0; i < (1 << (N - 1)); i++) {
    string xs;
    for (int j = 0; j < N; j++) {
      xs.push_back(S[j]);
      if ((i >> j) & 0x01) {
        xs.push_back('+');
      }
    }
    xss.emplace_back(xs);
  }

  vec<string> res;
  ll answer = 0;
  for (auto&& xs : xss) {
    boost::algorithm::split(res, xs, boost::is_any_of("+"));
    vec<ll> ts;
    transform(ALL(res), back_inserter(ts), [](const string& s){ return stoll(s); });
    answer += accumulate(ALL(ts), 0ll);
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    string s;
    cin >> s;

    if (s.size() == 2)
    {
        cout << s << endl;
    }
    else
    {
        reverse(s.begin(), s.end());
        cout << s << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll n;
  cin >> n;
  vll a(n);
  rep(i,n) cin >> a.at(i);
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans = 1;
  int cnt = 0;
  rep(i,n-1) {
    if(a[i]==a[i+1]) {
      ans *= a[i];
      cnt++;
      i++;
      if(cnt==2) {
        cout << ans << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ms(x, a) memset(x, a, sizeof(x))
#define oo 100000000
#define ll  long long int
#define MOD 1000000007
using namespace std;
int main()
{
    int n,m;string d=" ";
    cin>>n>>m;
    string a="",b="";d[0]=n+'0';
    for(int i=0;i<m;i++){

            a+=d;
    }
    d[0]=m+'0';
    for(int i=0;i<n;i++){

            b+=d;
    }
    (a<b)?cout<<a:cout<<b;
    return 0;
}


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

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long[][] dp = new long[18][301];
		dp[0][0] = 1;
		for(int i = 0; i < 18; i++) {
			for(int j = 0; j < 301; j++) {
				if(dp[i][j] == 0) continue;
				if(i != 17) {
					dp[i+1][j] += dp[i][j];
				}
				int tmp = j + (i+1)*(i+1);
				if(tmp < 301) {
					dp[i][tmp] += dp[i][j]; 
				}
			}
		}
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			System.out.println(dp[17][n]);
		}
		
	}
}

Measured memory_bytes: 17212
package main

import (
	"fmt"
)

func main() {
	//存在するものが1になる
	a := make([]int, 100)

	var x, n int
	fmt.Scanf("%d", &x)
	fmt.Scanf("%d", &n)

	var p int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &p)
		a[p - 1] = 1
	}

	if n == 0 {
		fmt.Println(x)
	}else{
		i := 0
		for {
			c := x - 1 - i
			if c < 0 {
				fmt.Println(c + 1)
				break;
			}else{
				if a[c] == 0 {
					fmt.Println(c + 1)
					break;
				}
			}

			c = x - 1 + i
			if c > 99 {
				fmt.Println(c + 1)
				break;
			}else{
				if a[c] == 0 {
					fmt.Println(c + 1)
					break;
				}
			}

			i = i + 1
		}
	}
}


Measured memory_bytes: 1836
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	sort(v.begin(), v.end());
	vector<long long int>w(N - 1);
	for (int i = 0; i < N - 1; i++) {
		w[i] = v[i + 1] - v[i];
	}
	long long int ans = 0;
	for (int i = 0; i < N - 1; i++) {
		long long int box = min(i, (int)N - 2 - i) + 1;
		ans += box*2 * w[i];
	}
	if (N % 2) {
		ans -= min(w[N / 2 - 1], w[N / 2]);
	}
	else {
		ans -= w[N / 2 - 1];
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
 string s;
 char m;
 int n,k;

 cin>>n>>s>>k;

 m=s[k-1];

for(int i=0;i<n;i++){
    if(s[i]==m){
        cout<<s[i];
    }
    else{
        cout<<"*";
    }
}

}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)

	nums := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scanln(&nums[i])
	}

	fmt.Println(logic(nums))
}

func logic(nums []int) int {
	m := make(map[int]int)

	for _, n := range nums {
		m[n]++
	}
	return len(m)
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	string o,e;cin>>o>>e;
  for(int i=0;i<min(o.size(),e.size());i++){
  	cout<<o[i]<<e[i];
  }
  if(o.size()>e.size())cout<<o.back();
  cout<<endl;
}

Measured memory_bytes: 256
import Control.Monad

main :: IO ()
main = do
  [n,d] <- map (read :: String -> Int) . words <$> getLine
  xnd <- map (map (read :: String -> Int) . words) <$> getNLine_ n
  print $ (\x -> div (x-n) 2) . length . filter id $ distance <$> xnd <*> xnd

distance :: [Int] -> [Int] -> Bool
distance xs ys = isSquare . sum $ zipWith (\x y -> (x-y)^2) xs ys
  where isSquare n = ((^2) . floor . sqrt . fromIntegral) n == n

getNLine_ :: Int -> IO [String]
getNLine_ n = replicateM n getLine


Measured memory_bytes: 1020
#include <bits/stdc++.h>
  
using namespace std;
  
struct State{
    string s;
    int d;
};
  
int N,size[10];
string a[10],b[10],src,dst,str;
  
int solve(){
    queue<State> Q;
    Q.push((State){src,0});
    set<string> visited;
    visited.insert(src);
  
    while(!Q.empty()){
	State now = Q.front(); Q.pop();
	string s = now.s;
	if(s == dst) return now.d;
      
	for(int i = 0 ; i < N ; i++){
	    string next;
	    for(int j = 0 ; j < (int)s.size() ; j++){
		string sub = s.substr(j,size[i]);
		if(sub == a[i]){
		    next += b[i];
		    j += size[i]-1;
		}else{
		    next += s[j];
		}
	    }
	    if(next.size() > dst.size()) continue;
	    if(!visited.count(next)){
		visited.insert(next);
		Q.push((State){next,now.d+1});
	    }
	}
    }
    return -1;
}
  
int main(){
    while(cin >> N, N){
	for(int i = 0 ; i < N ; i++){
	    cin >> a[i] >> b[i];
	    size[i] = a[i].size();
	}
	cin >> src >> dst;
	cout << solve() << endl;
    }
    return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
ll INF = 1ll << 60;

int main(){
  int n, Q;
  string s;
  vector<set<int>> st(26);
  cin >> n;
  getchar();
  rep(i, 0, n){
    char c = getchar();
    s.push_back(c);
    st[c-'a'].insert(i);
  }
  getchar();
  
  cin >> Q;
  rep(tmp, 0, Q){
    int q;
    cin >> q;
    q--;
    if(q){
      int l, r;
      cin >> l >> r;
      l--;r--;
      int ans = 0;
      rep(i, 0, 26){
        auto itr = st[i].lower_bound(l);
        if(itr != st[i].end() && *itr <= r)
          ans++;
      }
      cout << ans << "\n";
    }
    else{
      int i;
      char c;
      cin >> i >> c;
      i--;
      if(s[i] == c)
        continue;
      st[s[i]-'a'].erase(i);
      s[i] = c;
      st[c-'a'].insert(i);
    }
  }
  
  return 0;
  
}

Measured memory_bytes: 27320
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    long n, l, o = 0, mm = 0;
    cin >> n;
    long m[1000002] = {0};
    for(int i = 0; i < n; i++){
        cin >> l;
        if(l != 0) m[l-1]++;
        m[l+1]++;
        m[l]++;
        mm = max(mm, l);
    }
    for(int i = 0; i < mm+2; i++){
        o = max(o, m[i]);
    }
    cout << o << endl;
    return 0;
}

Measured memory_bytes: 8064