akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int a,b;
    cin>>a>>b;

    int ans=0;
    
    if(a>b)swap(a,b);
    rep(i,b){
        ans*=10;
        ans+=a;
    }

    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, S);
    bool ok = S.size() % 2 == 0;
    REP(i, S.size())
    {
        ok &= (i & 1) == 0 and S[i] == 'h' or i & 1 and S[i] == 'i';
    }
    YES(ok);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
#define per(i,a,b) for(ll i =a ;i >= b;i--)
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
 
int main()
{
	//ifstream cin("input.txt");
	ll k;
	cin>>k;
	queue<ll> q;
	rep(i,1,9)
		q.push(i);

	rep(i, 1,k -1)
	{
		ll x = q.front();q.pop();

		if(x % 10 != 0)
			q.push((x*10 +(x%10) - 1));

		q.push(x*10+(x%10));
		if(x%10 != 9)
			q.push((x*10 + (x%10) + 1));
	}
	cout<<q.front();

}

Measured memory_bytes: 5104
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; ++i)
  {
    cin >> arr[i];
  }

  vector<pair<long long int, long long int > > vec(n);

  for (long long int i = 0; i < n; ++i)
  {
     vec[i].first = arr[i];
     vec[i].second = 0;
  }

  for (long long int len = 2; len <= n; ++len)
  {
     vector<pair<long long int, long long int > > vec1;
     
     for (long long int i = 0; i < n; ++i)
     {
        long long int sp = i;
        long long int en = i + len - 1;
        if(en >= n) break;

        if(vec[i].second + arr[en] > vec[i + 1].second + arr[sp])
        {
           pair<long long int, long long int> p;
           p.first = vec[i].second + arr[en];
           p.second = vec[i].first;
           vec1.push_back(p);
        }
        else
        {
           pair<long long int, long long int> p;
           p.first = vec[i + 1].second + arr[sp];
           p.second = vec[i + 1].first;
           vec1.push_back(p);
        }
     }

     vec = vec1;

  }

  cout << vec[0].first - vec[0].second;
  return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  map<int, int> mp;
  ll ans = 0;
  rep(i, n) {
    ans += mp[i - a[i]];
    mp[a[i] + i]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 20988
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define ll long long
#define mes(x,y) memset(x,y,sizeof(x))
using namespace std;
ll gar(ll a,ll b){//最大公约数 
return b==0?a:gar(b,a%b);
}
int main(){
	 int a,b;string c;
	 while(cin>>a>>c>>b){
	 	for(int i=0;i<c.length();i++){
	 		if(c[i]!=c[b-1]){
	 			c[i]='*';
			 }
		 }
		 cout<<c<<endl;
	 }
	return 0;
}


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

using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        vector<pair<int, pair<int, bool> > > v;
        for(int i=0; i< n; i++){
            int m, a, b;
            cin >> m >> a >> b;
            v.push_back(make_pair(a, make_pair(m, true)));
            v.push_back(make_pair(b, make_pair(m, false)));
        }
        sort(v.begin(), v.end());
        int weight = 0;
        bool is = true;
        for(int i=0; i < v.size(); i++){
            if(v[i].second.second) weight += v[i].second.first;
            else weight -= v[i].second.first;
            if(150 < weight && v[i].first != v[i+1].first){cout << "NG" << endl; is = false; break;}
        }
        if(is) cout << "OK" << endl;
    }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

int main() {
    static int N;
    cin >> N;
    static ll ans, dp[105][4][4][4];
    dp[0][0][0][0] = 1;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < 4; ++j) {
            for(int k = 0; k < 4; ++k) {
                for(int l = 0; l < 4; ++l) {
                    for(int m = 0; m < 4; ++m) {
                        if(k == 1 && l == 2 && m == 3)
                            continue;
                        if((j == 1 || k == 1) && l == 3 && m == 2)
                            continue;
                        if((j == 1 || l == 1) && k == 3 && m == 2)
                            continue;
                        dp[i + 1][k][l][m] += dp[i][j][k][l];
                        dp[i + 1][k][l][m] %= mod;
                    }
                }
            }
        }
    }
    for(int i = 0; i < 4; ++i) {
        for(int j = 0; j < 4; ++j) {
            for(int k = 0; k < 4; ++k) {
                ans += dp[N][i][j][k];
            }
        }
    }
    ans %= mod;
    cout << ans << endl;
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  int ave;
  ave = a + b;
  if(ave % 2 == 1) {
    ave++;
  }
  ave /= 2;
  
  cout << ave <<endl;
}

Measured memory_bytes: 256
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0])
    var K = Number(lines[0].split(" ")[1])

    var x = 1 / N; var ans = 0;
    for (var i = 1; i <= N; i++) {

        var j = 0;
        while (i * Math.pow(2, j) < K) {
            j++;
        }

        var y = Math.pow(1 / 2, j);
        ans += x * y;
    }

    console.log(ans);
});

Measured memory_bytes: 7884
#include <bits/stdc++.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(void){
    string S;
    cin >> S;
    int len = (int)S.length();
    int count = 0;
    for(int i=0;i<(len+1)/2;i++){
        if(S[i]!=S[len-1-i]){
            count += 1;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)	
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;	
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
bool solve(int lim,int n,int k){
	int cnt =0 ;
	fn{
		if(ar[i]>lim){
			cnt+=ar[i]/lim;
		}
		if(cnt>k)return 0;
	}
	return 1;
}
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n ,k;
		cin >> n >> k;
		fn{
			cin >> ar[i];
		}
		sort(ar,ar+n);
		int lo = 1, hi =ar[n-1];
		while(lo<=hi){
			int mid = lo + (hi-lo)/2;
			if(solve(mid,n,k)){
				hi = mid-1;
			}else
			lo=mid+1;
		}
		cout<<hi+1;

	
	
	}
	return 0;
}

Measured memory_bytes: 5160
(function(input) {
    var p = input.split('\n');
    var n = Number(p.shift());
    var s = p.shift().split(' ', n).map(Number);
    var q = Number(p.shift());
    var t = p.shift().split(' ', q).map(Number);

    var c = 0;
    for (var i = 0; i < t.length; i++) {
        if (s.indexOf(t[i]) !== -1) {
            c++;
        }
    }
    console.log(c);
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 8804
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q; cin >> N >> Q;
  vector<vector<int> > E(N, vector<int>());
  REP(i, N-1){
    int a, b; cin >> a >> b; a--; b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  vector<ll> X(N, 0);
  REP(i, Q){
    int p; ll x; cin >> p >> x; p--;
    X[p] += x;
  }
  vector<bool> d(N, false);
  vector<ll> ans(N, 0);
  queue<int> q;
  q.push(0);
  ans[0] = X[0];
  d[0] = true;
  while(!q.empty()){
    int i = q.front(); q.pop();
    for(auto j : E[i]){
      if(d[j]) continue;
      q.push(j);
      ans[j] = ans[i] + X[j];
      d[j] = true;
    }
  }
  REP(i, N){
    cout << ans[i];
    if(i != N-1){
      cout << " ";
    }else{
      cout << endl;
    }
  }
}

Measured memory_bytes: 17908
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

a,b,c=rl()

print(max(a*10+b+c,a+b*10+c,a+b+c*10))

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

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

using namespace std;

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

  std::map<char, int> map;
  rep(i, s.size()) { map[s[i]]++; }

  // 最大値と最小値の差が1であれば良い
  if (max(map['a'], max(map['b'], map['c'])) <=
      min(map['a'], min(map['b'], map['c'])) + 1) {
    std::cout << "YES" << std::endl;
    return 0;
  }
  std::cout << "NO" << std::endl;

  return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

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

int main(){
  string s, t;
  cin >> s >> t;
  ll ima = 0;
  ll tugi = 0;
  ll sl = s.length();
  ll tl = t.length();
  vector<ll> al[26];
  
  rep(i,sl){
    al[s[i]-'a'].push_back(i+1);
  }
  rep(i,sl){
    al[s[i]-'a'].push_back(i+sl+1);
  }
  
  rep(i,tl){
    if(al[t[i]-'a'].empty()){
      cout << -1 << endl;
      return 0;
    }
  }
  
  rep(i,tl){
    auto Iter1 = upper_bound(al[t[i]-'a'].begin(), al[t[i]-'a'].end(), ima);
    if(*Iter1>sl){
      ima=*Iter1-sl;
      tugi++;
    }else{
      ima=*Iter1;
    }
  }
    
  cout << tugi*sl+ima << endl;
}

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


int main(void) {
    string a, b;
    string s;
    cin >> a >> b >> s;
    regex reg(R"(^[0-9]{)" + a + R"(}-[0-9]{)" + b + R"(})");
    cout << (regex_match(s,reg) ? "Yes" : "No") << endl;
}


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

const int INF = 2e9;

int main(){
    int n;
    cin >> n;
    vector<int> a(n+2);
    ll sum = 0;
    a[0] = 0;
    a[n+1] = 0;
    rep(i,n){
        cin >> a[i+1];
        sum += abs(a[i+1] - a[i]);
    }
    sum += abs(a[n] - a[n+1]);
    for(int i = 1;i <= n;i++){
        ll ans = sum - abs(a[i] - a[i-1]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;

const int MAX_N = 2*1e5 + 5;

int main(){
    int N; cin >> N;
    vector<int> C(N+1, 0);
    rep(i, 1, N + 1) cin >> C[i];

    map<int, mint> SUM;
    mint dp[MAX_N];
    dp[0] = 1;
    rep(i, 1, N + 1){
        dp[i] = dp[i-1];
        if(i != N && C[i] == C[i+1]) continue;

        dp[i] += SUM[C[i]];
        SUM[C[i]] += dp[i-1];
    }
    mint ans = 1;
    //rep(i, 0, N + 1) cout << i << " " << dp[i] << endl;
    cout << dp[N] << endl;
}

Measured memory_bytes: 11136
#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;

int main(){
  long long s=0;
  int i,j,n;

  cin >> n;
  for(i=0;i<n;i++){
    cin >> j;
    s+=j;
  }
  cout << s/n << endl;

  return 0;


}

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

using namespace std;
using ll = unsigned long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;


const int CASES = 3;

vector<vector<int> > calcNext(const string &S) {
    int n = (int)S.size();
    vector<vector<int> > res(n+1, vector<int>(10, n));
    for (int i = n-1; i >= 0; --i) {
        for (int j = 0; j < 10; ++j) res[i][j] = res[i+1][j];
        res[i][S[i]-'0'] = i;
    }
    return res;
}


void solve() {
    int n; string s;
    cin >> n >> s;

    vector<set<char> > sumr(n);
    for (int i = n-1; i >= 0; --i) {
        sumr[0].insert(s[i]);
        sumr[i] = sumr[0];
    }

    int ans = 0;
    set<char> used1;
    for (int i = 0; i < n-2; ++i) {
        if(used1.count(s[i]) != 0) continue;

        set<char> used2;
        for (int j = i+1; j < n-1; ++j) {
            if(used2.count(s[j]) != 0) continue;
            ans += sumr[j+1].size();
            used2.insert(s[j]);
        }

        used1.insert(s[i]);
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}



Measured memory_bytes: 15744
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;
    
    cin >> n;
    for(int i = 0; i < n; i++) cin >> R[i];
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i = 1; i < n; i++){
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define deb(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
 
typedef long long int ll;
typedef string str;
 
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;     
  
    x = x % p;   
    while (y) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;  
        x = (x*x) % p; 
    } 
    return res; 
} 
 
ll nCrModP(ll n, ll r, ll p) 
{ 
    if (!r) 
      return 1; 
  
	ll fac[n+1]; 
   	fac[0] = 1; 
    for (ll i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* power(fac[r], p-2,p) % p * power(fac[n-r], p-2,p) % p) % p; 
}
 
ll gcd(ll a, ll b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);
}
 
void fast(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main ()
{
	
	ll n,m,k,i,j,a,b;
	// cin >> t;
    str st,s,t;
    cin >> s >> t;
    n=s.size();
    m=t.size();
    a=n;
    for(i=0;i<=n-m;i++)
    {
    	ll cnt=0;
    	for(j=0;j<m;j++)
    	{
    		if(s[i+j]!=t[j])
    			cnt++;
    	}
    	a=min(cnt,a);
    }
    cout << a << "\n";
    return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        long ans = 0;
        while (n-- > 0) {
            ans += sc.nextLong() - 1;
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 26068
N, X, Y = map(int, input().split())

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < N:
        g[u].append(v)
        g[v].append(u)

g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    #for j in g[i]:
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                #count[dis[k][i] - 1] += 1
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)


Measured memory_bytes: 205832
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000
#define MOD 1000000007LL
#define MAX 105
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef pair<double, double> doup;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef map<ll, ll> Map;


class Edge {
public:
    ll s, t, w;
    bool p;
    Edge(ll s, ll t, ll w, bool p): s(s), t(t), w(w), p(p) {}
};

ll N, M;
ll dist[100][100];
vector<Edge> edges;

int main(void) {
    cin >> N >> M;
    ll i, j, k;
    ll a, b, c;
    ll s, t;
    for(i=0; i<N; i++) {
        for(j=0; j<N; j++) {
            dist[i][j]=(i==j ? 0 : INF);
        }
    }
    
    for(i=0; i<M; i++) {
        cin >> a >> b >> c;
        a--; b--;
        edges.push_back(Edge(a, b, c, false));
        dist[a][b]=dist[b][a]=c;
    }
    
    for(k=0; k<N; k++) {
        for(i=0; i<N; i++) {
            for(j=0; j<N; j++) {
                dist[i][j]=min(dist[i][j], dist[i][k]+dist[k][j]);
            }
        }
    }
    
    for(s=0; s<N; s++) {
        for(t=0; t<N; t++) {
            for(i=0; i<M; i++) {
                if(dist[s][t]==dist[s][edges[i].s]+edges[i].w+dist[edges[i].t][t])
                    edges[i].p=true;
            }
        }
    }
    
    ll ans=0;
    
    for(i=0; i<edges.size(); i++) {
        if(!edges[i].p) ans++;
    }
    
    prin(ans);
    
}

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

using namespace std;

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

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

	for(int i = 0; i < N; i++){
		int min_a = a[i];
		int min_index = i;
		for(int j = i + 1; j < N; j++){
			if(min_a > a[j]){
				min_a = a[j];
				min_index = j;
			}
		}
		a[min_index] = a[i];
		a[i] = min_a;
	}

	int min_length = a[N-1] - a[0];

	cout << min_length << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int fukuri(int money,double rate,int te,int year){
	if(year==0)return money;
	return fukuri(money+money*rate-te,rate,te,year-1);
}

int tanri(int money,double rate,int te,int year){
	if(year==0)return money;
	return money*rate+tanri(money-te,rate,te,year-1);
}

int main() {
	int m;
	cin>>m;
	while(m--){
		int res=0;
		int money,year,n,type,te;
		double rate;
		cin>>money>>year>>n;
		rep(i,n){
			cin>>type>>rate>>te;
			if(type==0){
				chmax(res,tanri(money,rate,te,year));
			}else{
				chmax(res,fukuri(money,rate,te,year));
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    ll n; cin >>n;
    vector<ll> a(n); REP(i,n) cin >> a[i];

    sort(a.begin(), a.end(), greater<ll>());

    ll count = 0;
    ll res = 1;
    bool flag = false;
    for (ll i = 0; i < (ll)a.size()+1;) {
        if (count == 2) {
            flag = true;
            break;
        } 
        if (i < n-1 && a[i] == a[i+1]) {
            res *= a[i];
            count++; 
            i += 2;
        } else {
            i++;
        }
    }

    if (flag) {
        cout << res << endl;
    } else {
        cout << 0 << endl;
    } 
    return 0;
}



Measured memory_bytes: 1024
import sys
import math
import numpy as np
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a = []
for _ in range(5):
    a.append(ni())
a = np.array(a)

m = np.min((a-1)%10+1)
d = (a - 1) // 10 + 1
print(sum(d)*10 + m - 10)


Measured memory_bytes: 12508
import math

A, B, C, X, Y = map(int, input().split())
m = 10000000000

for c in range(max(X, Y) * 2 + 1):
    a = math.ceil(X - 0.5 * c) if X - 0.5 * c >= 0 else 0
    b = math.ceil(Y - 0.5 * c) if Y - 0.5 * c >= 0 else 0
    m = min(a * A + b * B + c * C, m)

print(m)

Measured memory_bytes: 41308
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
string s;
string s1, s2;
int q, t, f;
char c;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

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

	cin >> s >> q;

	int rvCnt = 0;
	REP(i, q) {
		cin >> t;
		if (t == 1) {
			rvCnt++;
			continue;
		}
		cin >> f >> c;
		if ((f + rvCnt)%2==0) {
			s2 += c;
		}
		else {
			s1 += c;
		}
	}
	if (rvCnt % 2 == 0) {
		reverse(All(s1));
		cout << s1 << s << s2 << endl;
	}
	else {
		reverse(All(s2));
		reverse(All(s));
		cout << s2 << s << s1 << endl;
	}
}

Measured memory_bytes: 1040
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt();Map<Long,Integer> m1=new HashMap<>();
		
		for(int i=0;i<n;i++)
		{
			long curr=sc.nextLong();
			
			m1.put(curr,m1.getOrDefault(curr,0)+1);
		}
		
		long max=0,curr=0;
		
		List<Long> list=new ArrayList<Long>();
		
		for(Map.Entry<Long,Integer> en:m1.entrySet())
		{
			if(en.getValue()>=4)
			{
				max=Math.max(max,en.getKey()*en.getKey());
			}
			
			if(en.getValue()>=2)
			{
				list.add(en.getKey());
			}
		}
		
		Collections.sort(list);
		
		if(list.size()>=2)
		{
			int s=list.size();
			
			max=Math.max(max,list.get(s-1)*list.get(s-2));
		}
		
		out.println(max);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 43336
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    for (auto e : s) {
        if (e == '?') {
            cout << "D";
        } else {
            cout << e;
        }
    }
    cout << newl;
}

Measured memory_bytes: 3784
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 10 20:52:06 2020

@author: Kanaru Sato
"""
import math

n = int(input())
cities = [list(map(int, input().split())) for i in range(0,n)]

sum_d = 0

for i in range(0,n):
    for j in range(0,n):
        d_sq = (cities[i][0]-cities[j][0])**2+(cities[i][1]-cities[j][1])**2
        sum_d = sum_d + math.sqrt(d_sq)

print(sum_d/n)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<math.h>
#include<vector>
using namespace std;
int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {

            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
    return 0;
}

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

void func_c(int N) {
	vector<int> A(N + 1);
	vector<int> B(N);
	vector<int> d(N +1);
	long long cnt = 0;
	for (int i= 0; i < N + 1; i++) {
		cin >> A[i];
	}
	for (int i= 0; i < N; i++) {
		cin >> B[i];
	}

	for (int i = 0; i < N; i++) {
		d[i] = min(B[i], A[i]-d[i]);
		d[i + 1] = min(B[i] - d[i], A[i + 1]);
		cnt += d[i + 1];
		cnt += d[i];
	}
	cout << cnt << endl;
}

int main()
{
	int N;
	cin >>N;
	func_c(N);
	return 0;
}


Measured memory_bytes: 1408
function main(input){
  var Gusu = 0;//偶数の個数
  var Kisu = 0;//奇数の個数
  var Out = 0;//出力
  if(input > 0){
  	if(input % 2 == 0){
      Gusu = input / 2;
      Kisu = Gusu;
      Out = Kisu/input;
  	}
    else if(input % 2 == 1){
      Gusu = parseInt(input / 2);
      Kisu = Gusu+1;
      Out = Kisu/input;
  	}
  }
  console.log(Out.toFixed(10));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;cin>>S;
    sort(ALL(S));
    cout<<((S=="abc")?"Yes":"No")<<endl;
}

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

ll gcd(ll a, ll b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return (a / g) * b;
}

int main() {
    int N = 0;
    cin >> N;
    vector<long long> T(N);

    rep(i, N) {
        cin >> T[i];
    }

    ll ans = 1;
    rep(i, N) {
        ans = lcm(ans, T[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;

int main(){
 long long  int n,d;
  cin>>n>>d;
  vector<int> x(n),y(n);
  rep(i,n)cin>>x[i]>>y[i];
  int ans =0;
  rep(i,n){
  long long  int l = pow(x[i],2)+pow(y[i],2);
    if(pow(l,0.5)<=d){
      ans++;
    }
  }
  
 cout<<ans;
  

}


Measured memory_bytes: 4848
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

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

    if((a+b) >= c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};

class UnionFind{
  public:
  vector<int> par;
  UnionFind(int size) : par(size,-1){}
  bool unite(int x,int y){
    x = root(x),y = root(y);
    if(x == y)return false;
    if(par[y] < par[x])swap(x,y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  bool find(int x,int y){
    return root(x) == root(y);
  }
  int root(int x){
    return par[x] < 0 ? x : par[x] = root(par[x]);
  }
  int size(int x){
    return -par[root(x)];
  }
};


int main(){

  int n,m,res = 0;
  cin >> n >> m;
  vector<pair<int,int>> v;
  REP(i,m){
    int x,y;cin >> x >> y;
    x--,y--;
    v.push_back({x,y});
  }

  REP(i,m){
    UnionFind uf(n);
    REP(j,m){
      if(i == j)continue;
      uf.unite(v[j].first,v[j].second);
    }
    set<int> s;
    REP(j,n){
      s.insert(uf.root(j));
    }
    if((int)s.size() == 2)res++;
  }

  cout << res;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
for i in range(N):
    a.append(a[i] - 1)
    a.append(a[i] + 1)
a.sort()
ans = 0
cnt = 1
for i in range(1, len(a)):
    if a[i] == a[i - 1]:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 1
if cnt > ans:
    ans = cnt
print(ans)


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

int f,y;
vector<string> ans;

void dfs(int p1,int p2,string str){
    if(p1 == f and p2 == y){
        ans.push_back(str);
        return;
    }

    if(p1 == 5 and p2 <= 3) return;
    if(p1 <= 3 and p2 == 5) return;
    if(p1 == 6 and p2 == 4) return;
    if(p1 == 4 and p2 == 6) return;
    if(p1 == 5 and p2 == 5) return;

    dfs(p1+1,p2,str+'A');
    dfs(p1,p2+1,str+'B');
}

void solve(){
    cin >> f >> y;

    dfs(0,0,"");
    for(const string& tmp:ans) cout << tmp << endl;
}

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

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

typedef long long ll;
using namespace std;

#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

int main(){
	ll n, x, t;	cin >> n >> x >> t;
	ll ans = 0;

	ans = t * (n / x);
	if( n % x != 0 )	ans += t;

	cout << ans << endl;

	return 0;
}


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

int main() {
	int N, X;
  	int m[110];
  	cin >> N >> X;
  	for (int i=0; i<N; i++) cin >> m[i];
  
  	int sum = 0;
  	int min = 2000;
  
  	for (int i=0; i<N; i++) {
    	sum += m[i];
      	if (min > m[i]) min = m[i];
    }
  	int num = N + (X - sum) / min;
  	cout << num << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

signed main(void)
{
  int num;
  int n;
  cin >> n;

  num = (n - 1) * n / 2;

  cout << num << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
  return b != 0 ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

int main(){
  int N;
  cin >> N;
  vector<ll> T(N);
  rep(i,N) cin >> T[i];
  ll ans = T[0];
  for(int i=1;i<N;i++){
    ans = lcm(ans,T[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> v(5);
  int sum = 0;
  for(int i=0;i<5;i++){
    cin >> v[i];
    sum += v[i];
    v[i] %= 10;
    if(v[i] != 0) v[i] = 10 - v[i];
  }
  
  sort(v.begin(),v.end());
  sum += v[0] + v[1] + v[2] + v[3];
  
  cout << sum << endl;
}


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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//std out
template<typename T>
void print_container(const vector<T> vals) {
    REPinit(i, 0, vals.size() - 1) cout << vals.at(i) << " ";
    cout << vals.back();
}


bool judge(int a, int b, int c) {
    if ((a > b && b > c) || (a < b && b < c)) return true;
    return false;
}

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

    int N;
    cin >> N;

    vector<int> B(N - 1);
    REPinit(i, 0, N - 1) cin >> B[i];

    vector<int> C(N, 0);
    C[0] = B.front();
    C[N - 1] = B.back();
    REPinit(i, 1, N - 1) C[i] = min(B[i - 1], B[i]);

    int ans = 0;
    REPinit(i, 0, N) ans += C[i];
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3596
using System;

public class Class1
{
	public static void Main()
	{
		string outPut = "F";
		while (true) {
			string scores = Console.ReadLine();
			string[] score = scores.Split();
			int m = int.Parse(score[0]);
			int f = int.Parse(score[1]);
			int r = int.Parse(score[2]);
			int s = m + f;
			if (m == -1 && f == -1 && r == -1) {
				break;
			}
				
			if (m == -1 | f == -1) {
				outPut = "F";
			} else if (s >= 80) {
				outPut = "A";
			} else if (s >= 65 && s < 80) {
				outPut = "B";
			} else if (s >= 30 && s < 65) {
				outPut = "D";		
				if (s >= 50 | r >= 50) {
					outPut = "C";
				}
								
			}
			Console.WriteLine(outPut);
			outPut = "F";
		}
	}
}

Measured memory_bytes: 8860
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int ans = B + Math.min(A + B + 1, C);
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 21204
import java.util.*;

public class Main {
 public static void main(String... args) {
   Scanner scan = new Scanner(System.in);
   int N = scan.nextInt();
   String S = scan.next();
   
   int max = 0;
   int tmp = 0;
   String target = "";
   for(int i=0; i<N; i++) {
     for(int j=max; i+j<N; j++) {
       target = S.substring(i, i+j+1);       
       tmp = S.lastIndexOf(target);
       if(tmp != i && tmp > i+j) {
         max = j+1;
       } else {
         break;
       }
     }
   }
   System.out.println(max);
 }
}

Measured memory_bytes: 40612
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;

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

  int hund_cnt = X/100;

  int lower_2_num = X % 100;

  int five_cnt = lower_2_num/5;
  lower_2_num -= five_cnt * 5;

  int four_cnt = lower_2_num/4;
  lower_2_num -= four_cnt * 4;

  int three_cnt = lower_2_num/3;
  lower_2_num -= three_cnt * 3;

  int two_cnt = lower_2_num/2;
  lower_2_num -= two_cnt * 2;

  int one_cnt = lower_2_num;

  if(hund_cnt >= five_cnt + four_cnt + three_cnt + two_cnt + one_cnt)cout << 1 << endl;
  else cout << 0 << endl;

}

Measured memory_bytes: 256
var
	L,R,ans,tmp,M,i,j:Longint;
begin
	read(L,R);
	M:=2019;
	ans:=M;
	if L+670<=R then begin
		writeln(0);
		exit;
	end;
	for i:=L to R do begin
		for j:=1 to 50 do begin
			if i+j>R then break;
			tmp:=i mod M*(i+j)mod M;
			if ans>tmp then ans:=tmp;
		end;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128