akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int64_t kRem = 1000000007;


int64_t factorial(int64_t i, int64_t rem)
{
	int64_t ans = 1;
	FOR_LE(k, 1, i) {
		ans *= k;
		ans %= rem;
	}
	return ans;
}


int64_t pow_rem(int64_t x, int64_t m, int64_t rem)
{
	if (m == 0) {
		return 1;
	}
	if (m == 1) {
		return x;
	}

	if (m & 1) {
		int64_t val = pow_rem(x, m / 2, rem);
		val = val * val;
		val %= rem;
		val *= x;
		val %= rem;
		return val;
	}
	else {
		int64_t val = pow_rem(x, m / 2, rem);
		val = val * val;
		val %= rem;
		return val;
	}
}

int64_t pow_remdiv(int64_t val, int64_t rem)
{
	return pow_rem(val, rem - 2, rem);
}

int64_t divide_rem(int64_t divident, int64_t dividor, int64_t rem)
{
	int64_t ret = pow_remdiv(dividor, rem);
	ret *= divident;
	ret %= rem;

	return ret;
}

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

	vector<int64_t> xs(n);
	for (auto& x : xs) {
		cin >> x;
	}

	vector<int64_t> ds(n - 1);
	FOR_LT(i, 0, n - 1) {
		ds[i] = xs[i + 1] - xs[i];
	}


	int64_t val = factorial(n - 1, kRem);
	int64_t val2 = val;
	int64_t ans = 0;

	int64_t a = 1, b = 2;
	FOR_LT(i, 0, n - 1) {
		int64_t c = val * ds[i];
		c %= kRem;
		ans += c;
		ans %= kRem;

		val2 = divide_rem(val2, b, kRem);
		val2 *= a;
		val2 %= kRem;
		val += val2;
		val %= kRem;
		a++;
		b++;
	}

	cout << ans << endl;

	return 0;
}


/*
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	vector<int> ps({ 1,2,3,4,5 });

	vector<int> counts(6);
	do {
		vector<bool> on(6);

		cout << ps[0] << " " << ps[1] << " " << ps[2] << " "  << ps[3] << " : ";

		FOR_LT(i, 0, 5) {
			int v = ps[i];
			on[ps[i]] = true;
			while(v <= 5) {
				if (!on[v]) break;
				cout << v << " ";
				counts[v]++;
				v++;
			}
		}
		cout << endl;
	} while (next_permutation(ps.begin(), ps.end()));

	cout << counts[1] << " " << counts[2] << " " << counts[3] << " " << counts[4] << " " << counts[5] << endl;
	return 0;
}
*/

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

int main() {
    int a,b,k;
    cin>>a>>b>>k;

    for(int i=a;i<=min(b,a+k-1);i++){
        cout<<i<<endl;
    }
    for(int i=max(a+k,b-k+1);i<=b;i++){
        cout<<i<<endl;
    }

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MOD 1000003
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

inline ll fastpow(ll bas, ll ex){
	register ll res = 1; bas %= MOD;
	for(; ex; ex >>= 1, bas = bas * bas % MOD) if(ex & 1) res = res * bas % MOD;
	return res;
}

int Q, fac[1000005] = {1, 1}, ifac[1000005] = {1, 1}, inv[1000005] = {1, 1};

int main(){
	getint(Q);
	for(register int i = 2; i < MOD; i++){
		fac[i] = fac[i - 1] * (ll)i % MOD;
		inv[i] = (MOD - MOD / i) * (ll)inv[MOD % i] % MOD;
		ifac[i] = ifac[i - 1] * (ll)inv[i] % MOD;
	}
	while(Q--){
		int x, d, n; getint(x), getint(d), getint(n);
		if(d == 0) printf("%lld\n", fastpow(x, n));
		else{
			x = x * (ll)inv[d] % MOD;
			if(x == 0 || x + n - 1 >= MOD) puts("0");
			else printf("%lld\n", fac[x + n - 1] * (ll)ifac[x - 1] % MOD * fastpow(d, n) % MOD);
		}
	}
	return 0;
}

Measured memory_bytes: 12544
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		ArrayList<Integer> p = new ArrayList<Integer>();
		int sum=0;
      
		for(int i=0; i<N; i++){
			p.add(sc.nextInt());
        }
		p.sort(null);
		for(int i=0; i<K; i++){
			sum += p.get(i);
        }
		System.out.println(sum);
    }
}


Measured memory_bytes: 38664
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	ll a, b;
	cin >> a >> b;
	
	if(b == 1){
		cout << 0 << endl;
	}
	else{
		ll cnt = a, ans = 1;
		while(cnt < b){
			ans++;
			cnt += a - 1;
		}
		
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using P = pair<int,int>;

struct unionfind {
    vector<long long> par;
    vector<long long> _size;

    // コンストラクタ
    explicit unionfind(long n) : par(n), _size(n,1) {
        for(long long i=0; i<n; i++) par[i]=i;
    }

    void init(long long n) {
        par = vector<long long>(n);
        _size = vector<long long>(n,1);
        for(long long i=0; i<n; i++) par[i]=i;
    }

    long long root(long long x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool merge(long long x, long long y) {
        x = root(x);
        y = root(y);
        if (x==y) return false;

        if(_size[x]<_size[y]) swap(x,y);

        _size[x] += _size[y];
        par[y] = x;
        return true;
    }

    bool issame(long long x, long long y) {
        return root(x) == root(y);
    }

    long long size(long long x) {
        return _size[root(x)];
    }
};

int main() {
    int n,k,l;
    cin >> n >> k >> l;
    unionfind load(n+1);
    unionfind train(n+1);
    load.init(n+1);
    train.init(n+1);

    for (int i=0; i<k; i++) {
        int64 p,q;
        cin >> p >> q;
        load.merge(p,q);
    }

    for (int i=0; i<l; i++) {
        int r,s;
        cin >> r >> s;
        train.merge(r,s);
    }

    map<P, int> ans;
    for (int i=1; i<=n; i++) ans[P(load.root(i), train.root(i))]++;

    for (int i=1; i<=n; i++) {
        P key = P(load.root(i), train.root(i));
        cout << ans[key] << (i==n? "\n" : " ");
    }
}

Measured memory_bytes: 15248
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

block1 = 0
block2 = 0
block3 = 0
block4 = 0

pathes = [a1,a2,a3,b1,b2,b3]

for i in pathes:
    if (i == 1):
        block1 += 1
    if (i == 2):
        block2 += 1
    if (i == 3):
        block3 += 1
    if (i == 4):
        block4 += 1

if (block1 == 3 or block2 == 3 or block3 == 3 or block4 == 3):
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word
// also tink all answers possible for a question
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
#define sz 100005
ll inf = 1e9;
ll power(ll x, ll n, ll mod)
{
  ll res = 1;
  x %= mod;
  while (n)
  {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res%mod;
}
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  ll n,x,t;
  cin>>n>>x>>t;
  ll z=n/x;
  ll r=n%x;
  if(r>0)
    z=z+1;
  cout<<z*t<<'\n';
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  bool ok = false;
  if((N/10)%111==0){
    ok = true;
  }
  else if((N%1000)%111==0){
    ok = true;
  }
  if(ok){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int dp[3010][6010];
P x[3010];
signed main(){
	int n,m,ans=0;
	cin>>n>>m;
	f(i,n)cin>>x[i].F>>x[i].S;
	sort(x,x+n);
	f(i,n){
		f(j,m){
			dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
			dp[i+1][j+x[i].F]=max({dp[i][j]+x[i].S,dp[i][j+x[i].F],dp[i+1][j+x[i].F]});
		}
	}
	f(i,6010){
		f(j,n+1){
			ans=max(ans,dp[j][i]);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 141440
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int num;
		int a, b, c;

		num = scanner.nextInt();
		for (int i = 0; i < num; i++){
			a = scanner.nextInt();
			b = scanner.nextInt();
			c = scanner.nextInt();
			if (((Math.abs(a*a - b*b) - c*c) == 0) || (Math.abs(a*a - c*c) - b*b) == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

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

int main() {
  ll int h;
  cin >> h;
  
  int attack = 0;
  while(h > 1) {
    h /= 2;
    ++attack;
  }
  
//  cout << h << endl << attack << endl;
  
  ll int sum = -1 * (1 - pow(2, attack+1));
  cout << sum << endl;
    
  return 0;
}


Measured memory_bytes: 384
N, P=map(int,input().split())
def factorization(n):
  primen = []
  degree = []
  primend = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      primen.append(i)
      degree.append(cnt)
      primend.append([i,cnt])
  if temp!=1:
    primen.append(temp)
    degree.append(1)
    primend.append([temp,1])
  if primen==[]:
    primen.append(n)
    degree.append(1)
    primend.append([n,1])
  return primend

ret = factorization(P)
ans = 1
for pn in ret:
  ans *= pn[0]**(pn[1]//N)
print(ans)

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

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

using namespace std;

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  if(abs(a-c)<=d || abs(a-b)<=d && abs(c-b)<=d){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  
  return 0;
}

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

int main()
{
	int L, N;

	std::cin >> N >> L;

	std::vector<std::string> S(N);

	for (int i = 0; i < N; i++)
		std::cin >> S[i];

	std::sort(S.begin(), S.end());

	std::string ans;

	for (int i = 0; i < N; i++)
		ans += S[i];

	std::cout << ans << "\n";

	return 0;
}

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

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"
#define MOD 1000000000+7

#define forit(v) for(auto it = v.begin(); it != v.end(); ++it)

using namespace std;

int f(int n, int x) {
  if (n == -1) return 0;
  else return n / x + 1;
}

signed main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  // flag = true;

  string a; cin >> a;
  string b; cin >> b;

  if (a.length() > b.length()) {
    cout << "GREATER";
  } else if (a.length() < b.length()) {
    cout << "LESS";
  } else {
    int l = a.length();
    for (int i = 0; i < l; ++i) {
      if (a[i] > b[i]) {
        cout << "GREATER"; break;
      } else if (a[i] < b[i]) {
        cout << "LESS"; break;
      }
      if (i == l - 1) cout << "EQUAL";
    }
  }
    
  // cout << num << endl;
  // cout << (flag ? YES : NO) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    int ans=0;
    vector<int>s(n);
    rep(i,n) cin >> s[i];
    sort(s.begin(),s.end());

    rep(i,n) ans += s[i];

    if(ans %2 != 0){
        cout << ans << endl;
        return 0;
    }
    else{
        rep(i,n){
            if(s[i] %2 != 0){
                ans -= s[i];
                cout << ans << endl;
                return 0;
            }
        }
        cout << 0 <<endl;
    }
}

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

using namespace std;

int main() {
  long long N, K;
  
  cin >> N >> K;
  
  vector<long long> seq;
  
  seq.push_back(N);
  
  long long next = N;
  long long _min = N;
  
  if (next > K) {
      next = next % K;
  }
  
  while (true) {
      next = abs(next - K);
      
      if (find(seq.begin(), seq.end(), next) != seq.end()) {
          break;
      } else {
          _min = min(_min, next);
          seq.push_back(next);
      }
  }
  
  cout << _min << endl;
  
  return 0;
}

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int n;


int cnt[2];

int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x; cin >> x;
    cnt[x&1]++;
  }              
  cnt[0] += cnt[1]>>1;
        
  if ((cnt[0] > 0) ^ (cnt[1] & 1))
    cout << "YES";
  else
    cout << "NO";

  return 0;
}






// Coded by Z..



Measured memory_bytes: 256
import numpy as np
N , K = map( int , input().split())
lst = list(map(int, input().split()))
ans = 10 ** 9

for i in range(N - K + 1):
    # 全て正（先頭がゼロ以上）であれば、最大の正数（一番右の数）が最小時間となる
    if lst[i] >= 0:
        ans = min(ans, lst[i + K -1])
    # 全て負（一番右がゼロ以下）であれば、最小の整数（一番左の数）が最小時間となる
    elif lst[i + K -1] <= 0:
        ans = min(ans, abs(lst[i]))
    # 上記以外は、正負混在のケース    
    else:
        #  一番右の方が大きいとき
        if abs(lst[i]) < lst[i + K -1]:
            # 負の方向から折り返してくる方が最小なので
            ans = min(ans , abs(lst[i]) * 2 + lst[i + K -1])
        else:
            # 正の方向から折り返してくる方が最小なので
            ans = min(ans , abs(lst[i]) + lst[i + K -1] * 2)

print(ans)


Measured memory_bytes: 23132
use std::io;
use std::str::FromStr;
use std::collections::HashMap;

struct City {
    idx: usize,
    year: u64
}

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (n, m) = input_tuple();
    let mut cities: Vec<Vec<City>> = Vec::new();
    for _ in 0..n {
        cities.push(Vec::new());
    }

    for i in 0..(m as usize) {
        let (p, y) = input_tuple();
        cities[(p - 1) as usize].push(City {idx: i, year: y});
    }

    let mut result = vec![String::new(); m as usize];
    for i in 0..(n as usize) {
        cities[i].sort_by(|a, b| a.year.cmp(&b.year));

        let mut n = 1;
        for c in &cities[i] {
            result[c.idx] = format!("{:06}{:06}", i + 1, n);
            n += 1;
        }
    }
    
    for r in &result {
        println!("{}", r);
    }

}


Measured memory_bytes: 19960
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define INF 2147483647
#define nl '\n'
#define si(i) scanf("%d", &i)
typedef long long ll;

ll n, p, ans = 1;
vector<ll> primes;

void get_prime(){
    bool used[1000005];
    memset( used, 0, sizeof used );
    for( ll i = 2 ; i < 1000000 ; i++ ){
        if( used[i] == 1 ) continue;
        primes.pb(i);
        for( ll j = i ; j < 1000000 ; j += i  ) used[j] = 1;
    }
}

int main(){
    get_prime();
    cin >> n >> p;
    if( n == 1 ){
        cout << p << nl;
        exit(0);
    }
    ll ind = 0;
    while( p >= pow(primes[ind], n)){
        ll num = primes[ind];
        if( p % (ll)pow(primes[ind], n) == 0 ){
            ans *= primes[ind];
            p /= (ll)pow(primes[ind], n);
        } 
        else ind++;
    }
    cout << ans << nl;
}

Measured memory_bytes: 2424
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, d[100005];
struct edge{int to, cost;};
vector<edge> g[100005];
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    rep(i, 0, n) {
        int u, k;
        cin >> u >> k;
        rep(j, 0, k) {
            int v, c;
            cin >> v >> c;
            edge e;
            e.to = v, e.cost = c;
            g[u].pb(e);
        }
    }

    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+n, INF);
    d[0] = 0;
    que.push({d[0], 0});
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < g[v].size(); i++) {
            edge e = g[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
    rep(i, 0, n) {
        cout << i << " " << d[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 5556
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
 
int main() {
	
int N;
vector<int> A;
cin>>N;
fx(N){
	int a;
	cin>>a;
	A.push_back(a);
}

int mini=10000000;

fyg(101,-100){
	int sub=0;
	fx(N){
		sub+=(A.at(x)-y)*(A.at(x)-y);
	}
	mini=min(sub,mini);
}

ce(mini)

}

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

const int MAXN = 100005;

int A, B, M, a[MAXN], b[MAXN], xi, yi, ci;

int main(){
	scanf("%d %d %d", &A, &B, &M);
	
	for(int i = 0; i < A; i++)
		scanf("%d", &a[i]);
	for(int i = 0; i < B; i++)
		scanf("%d", &b[i]);
	
	int res = (*min_element(a, a + A)) + (*min_element(b, b + B));
	
	while(M--){
		scanf("%d %d %d", &xi, &yi, &ci);
		xi--, yi--;
		
		res = min(res, a[xi] + b[yi] - ci);
	}
	printf("%d\n", res);
	
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>

#define Min(a,b) ((a)<(b)?(a):(b))
#define Max(a,b) ((a)>(b)?(a):(b))
#define Mabs(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define Abs(a) (a)>0?(a):(-(a))
template <typename QvQ> inline QvQ Min2(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max2(QvQ a,QvQ b){if(a>b) return a;return b;}
template <typename QvQ> inline QvQ Abs2(QvQ a){if(a>0) return a;return -a;}

#define n1kw 10000000
#define inf 0x7f7f7f7f
#define dinf 0x3f3f3f3f
#define llinf 0x7f7f7f7f7f7f7f7f
#define lldinf 0x3f3f3f3f3f3f3f3f

#define ll long long
#define rei register int
#define inv inline void
#define inb inline bool
#define ini inline int

#define bl putchar(' ')
#define ed putchar('\n')
#define test std::cout<<"this:"
#define card system("pause")

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

//char buf[1<<23],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)

template <typename QvQ>inv read(QvQ &x)
{
    x=0;int f=1;
    char c=getchar();
    for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
    for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
    x=x*f;
}
template <typename QvQ>inv write(QvQ x)
{
    if(x<0) x=-x,putchar('-');
    if(x>9) write(x/10);
    putchar(x%10+48);
}
using namespace std;
int n,d;
int main()
{
    read2(n,d);d=d*2+1;
    if(n%d==0) write(n/d);
    else write(n/d+1);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
  int cnt[10] = {0};
  int x;
  for (int i = 0; i < 3; ++i) {
    scanf("%d", &x);
    ++cnt[x];
  }
  if (cnt[5] == 2 and cnt[7] == 1) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}


Measured memory_bytes: 128
def gcd(a, b):
    a, b = sorted([a, b], reverse=True)
    while(b != 0):
        a, b = (b, a%b)
    return a

def getMultiCount(start, end, times):
    if end < times: return 0
    s = start-(start%times)
    if s != start: s += times
    e = end-(end%times)
    if s > e: return 0
    return ((e-s)//times)+1
    
def answer(a, b, c, d):
    cCount = getMultiCount(a, b, c)
    dCount = getMultiCount(a, b, d)
    cdCount = getMultiCount(a, b, c*d//gcd(c,d))
    return (b-a+1)-(cCount + dCount - cdCount)

a, b, c, d = map(int, input().split())
print(answer(a, b, c, d))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	map<string, int> cord;
	REP(i, n){
		string s;
		cin >> s;
		cord[s]++;
	}

	int m;
	cin >> m;
	REP(i, m){
		string s;
		cin >> s;
		cord[s]--;
	}
	
	int max = -INF;

	for (auto itr = cord.begin(); itr != cord.end(); ++itr){
		if (itr->second > max) max = itr->second;
	}

	cout << (max > 0 ? max : 0) << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        double r = sc.nextDouble();
        double x = (2*r)*Math.PI;
        double y = r*r*Math.PI;
        
        System.out.printf("%.6f %.6f\n",y,x);
        sc.close();
    }
}


Measured memory_bytes: 28332
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int P=200003, G=2;
const int LOG=19, MAXN=(1<<LOG);
typedef complex<ld> cd;
const double PI = acos(-1);

void fft(vector<cd> & a, bool invert) {
    int n = a.size();
 
    for (int i = 1, j = 0; i < n; i++) {
        int bit = n >> 1;
        for (; j & bit; bit >>= 1)
            j ^= bit;
        j ^= bit;
 
        if (i < j)
            swap(a[i], a[j]);
    }
 
    for (int len = 2; len <= n; len <<= 1) {
        double ang = 2 * PI / len * (invert ? -1 : 1);
        cd wlen(cos(ang), sin(ang));
        for (int i = 0; i < n; i += len) {
            cd w(1);
            for (int j = 0; j < len / 2; j++) {
                cd u = a[i+j], v = a[i+j+len/2] * w;
                a[i+j] = u + v;
                a[i+j+len/2] = u - v;
                w *= wlen;
            }
        }
    }
 
    if (invert) {
        for (cd & x : a)
            x /= n;
    }
}
 
vector<ll> multiply(vector<ll> const& a, vector<ll> const& b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    int n = 1;
    while (n < a.size() + b.size()) 
        n <<= 1;
    fa.resize(n);
    fb.resize(n);
 
    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);
 
    vector<ll> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}

ll n, m, k, u, v, x, y, t, a, b, ans, sum;
int lg[P];
ll A[MAXN];
vector<ll> X(P, 0), Y, Z;

ll powmod(ll a, ll b){
	ll res=1;
	for (; b; b>>=1, a=a*a%P) if (b&1) res=res*a%P;
	return res;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll tmp=1;
	for (int i=0; i<P-1; i++){
		lg[tmp]=i;
		tmp=tmp*G%P;
	}
	cin>>n;
	for (int i=1; i<=n; i++){
		cin>>A[i];
		if (A[i]==0){
			n--;
			i--;
			continue ;
		}
		sum+=A[i]*A[i]%P;
		X[lg[A[i]]]++;
	}/*
	for (int i=1; i<=n; i++) for (int j=1; j<=n; j++){
		ans+=powmod(G, lg[A[i]]+lg[A[j]]);
//		ans+=A[i]*A[j]%P;
		if (A[i]*A[j]%P!=powmod(G, lg[A[i]]+lg[A[j]])) debug2(A[i], A[j])
	}*/
	
	Y=X;
	Z=multiply(X, Y);
	for (int i=0; i<Z.size(); i++) ans+=Z[i]*powmod(G, i);
	
	ans-=sum;
	ans/=2;
	cout<<ans<<"\n";
	
	return 0;
}


Measured memory_bytes: 47856
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int number = sc.nextInt();
    int train = sc.nextInt();
    int taxi = sc.nextInt();

    int caseTrain = number * train;

    if(caseTrain < taxi) {
      System.out.println(caseTrain);
    } else {
      System.out.println(taxi);
    }
  }
}

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

int N, R;
void solve(){
    if(N >= 10){
        cout << R;
    }
    else {
        cout << R + 100 * (10 - N);
    }
}
int main(){
    cin >> N >> R;
    solve();
    return 0;
}

Measured memory_bytes: 256
n = int(input())
w = input()
words=[]

ans = "Yes"

words.append(w)

for i in range(1,n):
    w = input()
    if w not in words:
        if words[-1][-1]==w[0]:
            words.append(w)
            continue
        else:
            ans = "No"
            break
    else:
        ans = "No"
        break
print(ans)



Measured memory_bytes: 9108
# D - 2017-like Number
from itertools import accumulate
from math import sqrt


def get_primes(n: int) -> set:
    """Return a list of prime numbers < n in O(N)."""
    if n < 2:
        return set()

    sieve = [1] * n
    for i in range(3, int(sqrt(n)) + 1, 2):
        if sieve[i]:
            sieve[i * i:: 2 * i] = [0] * ((n - i ** 2 - 1) // (2 * i) + 1)
    return {2} | {i for i in range(3, n, 2) if sieve[i]}


def main():
    Q, *LR = map(int, open(0).read().split())
    primes = get_primes(10 ** 5 + 1)
    is_2017_like = [1 if i in primes and (i + 1) // 2 in primes else 0 for i in range(10 ** 5 + 1)]
    cumsum = tuple(accumulate(is_2017_like))
    ans = []
    for l, r in zip(*[iter(LR)] * 2):
        ans.append(cumsum[r] - cumsum[l - 1])
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 25588
count = 0
n = gets.chomp.to_i
array = gets.split(" ").map{|x| x.to_i}
 
i = 0
while i<n
  j = i+1
  k = i
  while j<n
    if array[k] > array[j]
      k = j
    end  
    j = j+1
  end
  if k != i
  array[k],array[i] = array[i],array[k]
  count = count + 1
  end
  i=i+1
end
 
i = 0
while i < n 
  print array[i] 
  if i+1 != n
  print " "
  end
  i = i+1
end
print "\n"
print count
print "\n"

Measured memory_bytes: 6112
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    ll t, i, j, k, p, q,l,r, x, y, u, v, n, m;
	cin>>n>>k;
	vc a(n);
	Ff(i,0,n)
	cin>>a[i];

	vc dp(n,INT_MAX);
	dp[0]=0;
	Ff(i,1,n)
	{	
		Ff(j,1,k+1)
		{
			if(i-j>=0)
			{
				dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
			}
		}
	}

	cout<<dp[n-1];
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 11884
n = int(input())
h = list(map(int, input().split()))

ans = "Yes"
for i in range(n - 1, 0, -1):
    if h[i - 1] - 1 == h[i]:
       h[i - 1] -= 1
    elif h[i - 1] > h[i]:
       ans = "No"
       break
print(ans)

Measured memory_bytes: 63984
import java.util.*;
import java.util.Map.Entry;
 
 
 
public class Main{
	
	public int num;
	public int vol;
 
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}
 
 
 
	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
 
 
	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}
 
 
	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}
 
 
	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	int N=sc.nextInt();
	Map<Integer,Integer> map = new TreeMap<>(); //numpeople,stunum;
	for(int i=1;i<=N;i++) {
		int temp=sc.nextInt();
		map.put(temp,i);
	}
	
	for (Integer nKey : map.keySet())
    {
        System.out.println(map.get(nKey));
    }
 }
}


Measured memory_bytes: 73704
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

#define NUM_MAX   100000
int N = 55555;
int K;
int M;
int cnt = 0;
int ans[100];
bool flag[NUM_MAX];
vector< int >prm;


void eratosthenes(){
	if( N < 2 ) return;
	fill( flag, flag+NUM_MAX, 0 );
	int idx = 2;
	while( idx <= K ){
		while( flag[idx] ) idx++;
		if( idx > N ) break;
		prm.push_back( idx );
		for( int i = idx; i <= N; i += idx ) flag[i] = 1;
	}
	while( idx < N ){
		idx++;
		if( !flag[idx] ){
			prm.push_back( idx );
		}
	}
}


int main(){
	cin>>M;
	
	K= sqrt( N );
	K++;
	
	eratosthenes();
	
	REP( i, prm.size() ){
		if( prm[i] % 5 == 2 ){
			ans[cnt++] = prm[i];
		}
		if( cnt == M )break;
	}
	
	REP( i, M ){
		if( i ) printf(" ");
		cout<<ans[i];
	}
	cout<<endl;
	
	
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
const ll INF = 9223372036854775807;
const ll mod = 1000000007;

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<ll> St(M);
  rep(i, M) cin >> St[i];
  if (M == 0)
    St = {100100};

  ll j = 0;
  vector<ll> dp(100100, 0);
  dp[0] = 1;
  dp[1] = 1;
  rep(i, N)
  {
    if (i == St[j] - 1)
    {
      dp[i] = 0;
      j++;
    }
    dp[i + 1] += dp[i] % mod;
    dp[i + 2] += dp[i] % mod;
  }
  cout << dp[N - 1] % mod << endl;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
  int N, ans=-1, cnt=0;
  cin >> N;
  long long int H[N];
  for(int i=0; i<N; i++) cin >> H[i];
  for(int i=0; i<N; i++){
    if(H[i] < H[i+1]){
      if(ans < cnt) ans = cnt;
      cnt=0;
    }
    else cnt++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>

int main(int,char**){
	std::string str;
	std::cin >> str;
	for(int i(str.size()-1);i>=0;--i){
		std::cout << str[i];
	}
	std::cout <<std::endl;
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int D,N;
    cin >>D>>N;
    long long ans = 0;
    if(N != 100)ans = pow(100,D)*N;
    if(N == 100 )ans = pow(100,D)*101;
    cout << ans << endl;;
}
 

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: i32 = iter.next().unwrap().parse().unwrap();
    let m: i32 = iter.next().unwrap().parse().unwrap();
    println!("{}", if n == m { "Yes" } else { "No "});
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a,n) a, a + n
#define prtarr(n,len) {for(int i=0;i<len;i++) cout<<n[i]<<" ";}

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
using namespace std;

string s1,s2;
int main() {
    //freopen("input.txt", "r", stdin) ;
    //freopen("output.txt", "w", stdout) ;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    cin>>s1>>s2;
    int ans=1000;
    for(int i=0;i<=s1.length()-s2.length();i++){
        int sub=0;
        int sub2=0;
        for(int j=i;j<i+s2.length();j++){
            if(s1[j]!=s2[sub2]) sub++;
            sub2++;
        }
    if(sub<ans) ans=sub;
    }
    cout<<ans;
    return 0;
}




Measured memory_bytes: 3636
from sys import stdin
import sys
# sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]


m=10**9+7
def s2(n):
	v=(n*(n+1)//2)*(2*n+1)//3
	v%=m
	return v

def s(n):
	v= n*(n+1)//2
	v%=m
	return v 

def main():
	n,k=nextIntList()
	
	ss=-(s2(n)-s2(k-2))+(n-1)*(s(n)-s(k-2))+(((n+1)*(n-(k-2)))%m)
	ss%=m
	print(ss)

# 	ss=0
# 	for i in range(k-1,n+1):
# 		si=(i+1)*(2*n-i)//2-(i*(i+1)//2)+1
# 		print(i, si, (i+1)*(2*n-i)//2, (i*(i+1)//2))
# 		ss+=si
# 	print(ss)
		
	
if __name__=="__main__":
	main()


Measured memory_bytes: 9220
n, k = map(int, input().split())
a = []
for i in range(k):
  d = int(input())
  a[len(a):len(a)] = list(map(int, input().split()))
list(set(a))
ans = 0
for i in range(1, n+1):
  if i not in a:
    ans += 1
print(ans)

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

using namespace std;

int main()
{
	string S, T;
	cin >> S;
	cin >> T;

	int changeMin = INT_MAX;
	for (size_t i = 0; i <= S.size() - T.size(); i++) {
		int change = 0;
		for (size_t j = 0; j < T.size(); j++) {
			if (S[i + j] != T[j]) {
				change++;
			}
		}
		changeMin = min(change, changeMin);
	}
	cout << changeMin << endl;
	return 0;
}


Measured memory_bytes: 3616
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

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

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, M, C = get_ints
B = get_ints
A = []

count = 0
N.times do |i|
  A[i] = get_ints
  point = C
  B.zip(A[i]) do |b, a|
    point += a * b
  end
  count += 1 if point > 0
end

puts count


Measured memory_bytes: 14444
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int x,y;
  cin >> x >> y;
  cout << (x+y/2) << endl;


return 0;
}
///....


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

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

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}


pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: i64 = 1_000_000_007;
const INF: i64 = std::i64::MAX/3;

fn solve() {
	let (a,b,c,d,k) = read!(i64,i64,i64,i64,i64);
	let val = c*60+d - (a*60+b) - k;
	println!("{}",val);
}

fn run() {
    solve();
}


Measured memory_bytes: 2272
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int p[n];
    int q[n];

    for (int i=0;i < n;i++) {
        cin >> p[i];
        q[i]  =p [i];
    }
    sort(p, p+n);
    int res = 0;
    for (int j=0;j< n;j++) {
        if (p[j] != q[j]) {
            res++;
        }
    }
    if (res == 0 || res == 2) {
        cout << "YES";
    }else {
        cout << "NO";
    }
    cout<< endl;
}


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

int main() {
    string n;
   
 
   cin >> n;
  
  int ans = 0;
  
  int si = n.size();
   
  for(int i = 0;i<si;i++){
    
    for(int j = 0;j<si;j++){
      
      if(n[i]==n[j]){
        
        
         ans=ans+1;
      }
      
    }
     
    
  }
  
  if(ans != si){
    cout << "no" << endl;
  }else{
    cout << "yes" << endl;
  }
  
    
   
  
 
  
  return 0;
}

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

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
inline void chmin(int &x, int v) {if (x>v) x=v; }
inline void chmax(int &x, int v) {if (x<v) x=v; }
//inline void chmin(double &x, double v) {if (x>v) x=v; }

int N;
int T[100], V[100];
int lim[40010];
int dp[40010][300];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) cin >> T[i], T[i] *= 2;
  rep(i, N) cin >> V[i], V[i] *= 2;
  rep(i, 40000) lim[i] = INF;
  chmin(lim[0], 0);
  int total = 0;
  rep(i, N) {
    for (int t=total; t<=total+T[i]; t++) chmin(lim[t], V[i]);
    total += T[i];
  }
  chmin(lim[total], 0);

  rep(i, total+1) rep(j, 300) dp[i][j] = -INF;
  dp[0][0] = 0;
  rep(i, total) {
    rep(j, 300) {
      if (dp[i][j] == -INF) continue;
      if (j > 0 && j-1 <= lim[i+1]) chmax(dp[i+1][j-1], dp[i][j] + (j-1));
      if (j <= lim[i+1]) chmax(dp[i+1][j], dp[i][j] + j);
      if (j+1 <= lim[i+1]) chmax(dp[i+1][j+1], dp[i][j] + (j+1));
    }
  }
  cout << fixed << setprecision(20) << dp[total][0]/4.0<<"\n";
  return 0;
}


Measured memory_bytes: 47360
#include <stdio.h>
#include <string.h>
int main(void)
{
  char passwd[1000];
  char passwd2[1000];
  int len=0;
  int i;

  while(scanf("%s",passwd) != EOF)
    {
      len = strlen(passwd);

      for(i = 0 ; i < len ; i++)
	{
	  if(passwd[i] == 'A') passwd2[i] = 'X';
	  else if(passwd[i] == 'B') passwd2[i] = 'Y';
	  else if(passwd[i] == 'C') passwd2[i] = 'Z';
	  else passwd2[i] = passwd[i] - 3;
	}
      printf("%s\n",passwd2);
    }
  return 0;
}

Measured memory_bytes: 0