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

using namespace std;

string s;

int main(void)
{
	ios::sync_with_stdio(false);
	cin >> s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

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

int main(){
    int a,b;cin>>a>>b;
    if (a==1)
    {
        /* code */
        a=100;
    }
    if (b==1)
    {
        /* code */
        b=100;
    }

    if (a>b)
    {
        /* code */
        cout<<"Alice"<<endl;
    }
    else if(b>a)
    {
        cout<<"Bob"<<endl;
    }
    else
    {
        cout<<"Draw"<<endl;
    }
    }

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

void CountTriangles(vector <int> A){ 

	int n=A.size(); 

	sort(A.begin(), A.end()); 

	int count = 0; 
	
	for( int i = n-1; i >= 1; i--){ 
		int l = 0, r = i-1; 
		while( l < r){ 
			if( A[l] + A[r] > A[i]){ 

				count += r - l ; 

			
				r--; 
			} 
			else

			
				l++; 
		} 
	} 
	cout<<count<<endl;
} 
int main(){ 

int n;
  vector<int>A;
  int x,i;
  
  cin>>n;
  
  for(i=0;i<n;i++){
  cin>>x;
    A.push_back(x);}
  

	CountTriangles(A); 
	
}	 


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll pos1 = 0, pos2 = n/2, pos3 = n/2;
  string s1, s2, s3;

  cout << pos1 << endl;
  cin >> s1;

  cout << pos2 << endl;
  cin >> s2;
  if(s1 == "Vacant" || s2 == "Vacant") {
    return 0;
  }

  if(s1 == s2) {
    if((pos2-pos1)%2 == 1) {
      pos3 = (pos2+pos1+1)/2;
    } else {
      pos1 += n;
      swap(pos1, pos2);
      s1.swap(s2);
      pos3 = (pos1+pos2) / 2;
    }
  } else {
    if((pos2-pos1)%2 == 0) {
      pos3 = (pos1+pos2+1)/2;
    } else {
      pos1 += n;
      swap(pos1, pos2);
      s1.swap(s2);
      pos3 = (pos1 + pos2) / 2;
    }
  }
  cout << pos3 << endl;
  cin >> s3;


  if(s1 == "Vacant" || s2 == "Vacant" || s3 == "Vacant") {
    return 0;
  }

  while(true) {
    if(s3 == s1) {
      if((pos3-pos1) % 2 == 1) {
        pos2 = pos3;
        s2 = s3;
      }
    } else {
      if((pos3-pos1)%2 == 0) {
        pos2 = pos3;
        s2 = s3;
      }
    }

    if(s3 == s2) {
      if((pos2 - pos3) % 2 == 1) {
        pos1 = pos3;
        s1 = s3;
      }
    } else {
      if((pos2-pos3) %2 == 0) {
        pos1 = pos3;
        s1 = s3;
      }
    }

    pos3 = (pos1 + pos2 + 1) / 2;
    //cout << "pos1: " << pos1 << " pos2: " << pos2 << endl;
    //cout << "s1: " << s1 << " s2: " << s2 << endl;
    cout << pos3 << endl;
    //cout << endl;
    cin >> s3;
    if(s3 == "Vacant")
      return 0;
  }
}


Measured memory_bytes: 852
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n;
  scanf("%d",&n);
  int a=0;
  int b=0;
  int tt=0;
  int i;
  for(i=0;i<n;i++){
    int t,x,y;
    scanf("%d%d%d",&t,&x,&y);
    int d=ABS(x-a)+(y-b);
    if(t-tt<d || (t-tt-d)%2!=0){
      printf("No\n");
      return;
    }
    a=x;
    b=y;
    tt=t;
  }
  printf("Yes\n");
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int mm(int, int);

int main(int argc, char const *argv[])
{
    char s[4];
    int i = 0;

    scanf("%s", s);

    for (i = 0; i < 4; i++)
        s[i] -= 48;

    if (mm(s[0], s[1]) == 0 && mm(s[2], s[3]) == 1)
        printf("YYMM\n");
    else if (mm(s[0], s[1]) == 1 && mm(s[2], s[3]) == 0)
        printf("MMYY\n");
    else if (mm(s[0], s[1]) == 1 && mm(s[2], s[3]) == 1)
        printf("AMBIGUOUS\n");
    else
        printf("NA\n");

    return 0;
}

int mm(int sf, int sr)
{
    if (sf == 0 && sr > 0 || sf == 1 && sr < 3)
        return 1;
    else
        return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i;
    cin>>n;
    int a[n],m[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]*=2;
    }
    int an=0;
    for(i=0;i<n;i++)
    {
        if(i%2==0)
        an+=a[i];
        else
        an-=a[i];
    }
    an/=2;
    m[0]=an;
    for(i=1;i<n-1;i++)
    {
        m[i]=a[i-1]-m[i-1];
    }
    m[i]=a[i]-m[0];
    for(i=0;i<n;i++)
    cout<<m[i]<<" ";
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int main(){
	int l, r; cin >> l >> r;
	vector<int> a;
	for(int i = l; i <= r; i++){
		int r = i % 2019;
		if(r == 0) return cout << 0 << endl, 0;
		a.push_back(r);
	}
	int ans = 2019, len = a.size();
	for(int i = 0; i < len; i++) for(int j = i + 1; j < len; j++) ans = min(ans, (a[i] * a[j])%2019);
	cout << ans << endl;
	return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int i, j;
	/*
	vector<bool> prime(2020, true);
	prime[0] = prime[1] = true;
	for (i = 2; i <= 2010; i++) {
		if (prime[i]) {
			for (j = 2; i*j <= 2010; j++) {
				prime[i*j] = false;
			}
		}
	}
	for (int n = 1000; n <= 2000; n++) {
		for (int b = 1; b*b <= 4*n+10; b++) {
			if (b*b == 4 * n - 3) {
				int a = 1 + b;
				if (a % 2 == 0) {
					int k = a / 2;
					if (prime[k - 1]) {
						cout << k << " " << n << endl;
						return 0;
					}
				}
				else {
					break;
				}

			}
		}
	}
	*/
	//int n = 1333, k = 37;
	int n = 1407, k = 38;
	//int n = 381, k = 20;
	cout << n << " " << k << endl;
	vii hyou(n, vi(k));
	vii dp(k, vi(k));
	int now = 2;
	for (int i = 0; i < k; i++) {
		for (int j = 0; j < k - 1; j++) {
			dp[i][j] = now;
			now++;
		}
	}
	for (i = 0; i < k; i++) {
		//cout << 1 << " ";
		hyou[i][0] = 1;
		for (j = 0; j < k - 1; j++) {
			//cout << dp[i][j] << " ";
			hyou[i][j + 1] = dp[i][j];
		}
		//cout << endl;
	}
	/*
	cout << endl;
	for (i = 0; i < k; i++) {
		for (j = 0; j < k - 1; j++) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
	*/
	int tobashi = 0;
	for (j = 2; j <= k; j++) {
		for (int l = 0; l < k - 1; l++) {
			//cout << j << " ";
			hyou[k + (j - 2)*(k - 1) + l][0] = j;
			int pre = l - tobashi;
			for (int m = 1; m < k; m++) {
				//cout << dp[m][(pre + tobashi) % (k - 1)] << " ";
				hyou[k + (j - 2)*(k - 1) + l][m] = dp[m][(pre + tobashi) % (k - 1)];
				pre += tobashi;
				pre %= (k - 1);
			}
			//cout << endl;
		}
		tobashi++;
	}
	
	for (i = 0; i < n; i++) {
		for (j = 0; j < k; j++) {
			cout << hyou[i][j] << " ";
		}
		cout << endl;
	}
	/*
	cout << endl << endl;
	for (i = 0; i < n; i++) {
		for (j = 0; j < i; j++) {
			printf("(%d,%d)  ", i, j);
			int cnt = 0;
			for (int l1 = 0; l1 < k; l1++) {
				for (int l2 = 0; l2 < k; l2++) {
					if (hyou[i][l1] == hyou[j][l2]) {
						cnt++;
					}
				}
			}
			cout << cnt << endl;
		}
	}
	*/
}

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

int main(void){
    int a, b, cnt=0;
    cin >> a >> b;
    for(int i=a;i<=b;++i){
        stringstream s;
        s << i;
        string tmp, rev;
        tmp = s.str();
        rev = tmp;
        reverse(rev.begin(), rev.end());
        if(tmp==rev) ++cnt;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}
    
    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end
using mint = ModInt<1000000007>;
 
int main() {
    int N, K; cin >> N >> K;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    mint ans(0);
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            if(A[i] == A[j]) continue;
            if(A[i] < A[j]) ans += mint(K) * mint(K-1) / mint(2);
            if(A[i] > A[j]) ans += mint(K) * mint(K+1) / mint(2);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
bool check1;
ld xpow(ld n, ll m){if(m==0){return 1;}else{ld x = xpow(n, m/2);if(m&1){ld res = x*x*n;if(res>1e7){check1=1;};return res;}else{ld res = x*x;if(res>1e7){check1=1;}return res;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    inp(n);
    out(n*n);
}

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

using namespace std;

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

    int cnt[10][10];
    memset(cnt, 0, sizeof(cnt));

    for (int i = 1; i <= n; ++i) {
        int first = i, end = i % 10;
        while (first >= 10) first /= 10;
        cnt[first][end]++;
    }

    int an = 0;
    for (int i = 1; i <= n; ++i) {
        int first = i, end = i % 10;
        while (first >= 10) first /= 10;
        an += cnt[end][first];
    }
    cout << an << '\n';

    return 0;
}


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

typedef long long ll;
int n, m;

int main() {
	cin >> n >> m;
	int eq = 0, hf = 0;
	for(int i=1; i<=n; ++i) {
		if(i%m == 0) ++eq;
		if(i%m == m/2 && m%2 == 0) ++hf; 
	}
	cout << (ll)eq * eq * eq + (ll)hf * hf * hf << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  int mini = INF;
  int maxi = -1000000;
  ll sum = 0;
  int a;
  rep(i, n){
    cin >> a;
    sum += a;
    mini = min(mini, a);
    maxi = max(maxi, a); 
  }
  cout << mini << " " << maxi << " " << sum << endl;
  return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string s,t;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> s >> t;
}

bool solve(){
    map<char, set<char> > trans;
    map<char, set<char> > trans_rev;
    int n = s.length();
    for (int i = 0; i < n; i++)
    {
        trans[s[i]].insert(t[i]);
        trans_rev[t[i]].insert(s[i]);
    }
    for (char c = 'a'; c <= 'z'; c++)
    {
        if(trans[c].empty()) continue;
        if(trans[c].size()>=2) return false;
        if(trans_rev[c].size()>=2) return false;
        // char x;
        // while(x!=c){
        //     x = *trans[c].begin();
        //     if(trans[x].empty()) continue;
        //     if(trans[x].size()>=2) return false;
        //     // if(*trans[x].begin()!=c) return false;
        // }
    }
    return true;        
}   

int main()
{
    input();
    cout << (solve()?"Yes":"No") << endl;
    return 0;
}


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

using namespace std;

/*helpfull*/
using vl  = vector<long long>;
using vpl = vector<pair<long long, long long>>;
using vs = vector<string>;
using pl  = pair<long long, long long>;
using ll  = long long int;
using vb  = vector<bool>;


struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1> {}(p.first);
        auto hash2 = hash<T2> {}(p.second);
        return hash1 ^ hash2;
    }
};
// #ifndef ONLINE_JUDGE
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);
// #endif

// shortcut macros
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp              make_pair
#define fi              first
#define se              second
// #define mt              make_tuple
#define pb              push_back
#define all(x)          (x).begin(), (x).end()
#define ini(a, v)       memset(a, v, sizeof(a))
#define rep(i, a, n)    for(ll i=a ; i<n ; ++i)
#define For(i, n)       rep(i, 0, n)
#define sz(x)           (int((x).size()))
#define ump(x,y)        unordered_map<x,y>
#define umpr(x,y,z)     unordered_map<x,y,z>
void printcase(ll &x) {
    cout << "Case #" << x << ": ";
}
void read(vector<ll>&v, ll &n) {
    For(i, n)
    cin >> v[i];
}
void read(ll &x) {
    cin >> x;
}
void read(string &s) {
    cin >> s;
}
void read(int &x) {
    cin >> x;
}
void read(ll a[], ll &n) {
    For(i, n)
    cin >> a[i];
}
void print() {
    cout << endl;
}
void write(vector<ll>&v, ll &n) {
    For(i, n)
    cout << v[i] << " ";
    cout << endl;
}
void write(vector<ll>&v) {
    ll n = v.size();
    For(i, n)
    cout << v[i] << " ";
    cout << endl;
}
void write(ll x) {
    cout << x << endl;
}
void write(string &s) {
    cout << s << endl;
}
void write(int &x) {
    cout << x << endl;
}
void write(ll a[], ll &n) {
    For(i, n)
    cout << a[i] << " ";
    cout << endl;
}
const ll inf = 1e10;

ll frogB(ll i, ll &k, ll &n, vl &h, vl &dp) {
    if (i == n - 1)
        return 0;
    if (dp[i] != -1) return dp[i];

    // ll j2;
    // ll j1 = abs(h[i] - h[i + 1]) + frogA(i + 1, h, dp, n);

    // if (i + 2 <= n - 1)
    //     j2 = abs(h[i] - h[i + 2]) + frogA(i + 2, h, dp, n);
    // else {
    //     dp[i] = j1;
    //     return dp[i];
    // }


    // dp[i] = min(j1, j2);
    // return dp[i];

    ll mincost = inf;

    for (int j = i + 1; j <= min(i + k, n - 1); j++) {
        mincost = min(mincost, abs(h[j] - h[i]) + frogB(j, k, n, h, dp));
    }
    dp[i] = mincost;
    return dp[i];
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll n, k;
    cin >> n >> k;
    vl h(n), dp(n, -1);
    For(i, n)
    cin >> h[i];
    cout << frogB(0, k, n, h, dp) << endl;
    return 0;
}




Measured memory_bytes: 14212
import math
import sys

n = int(input())
l = [0] * n
if n < 6:
    for i in range(n):
        print(0)
    sys.exit()
y = int(math.sqrt(n-3))
if n <= 5:
    for i in range(n):
        print(0)
for i in range(1,y):
    for j in range(1, y):
        for k in range(1, y):
            x = i ** 2 + j ** 2 + k ** 2 + i*j + i*k + j*k
            if x % 1 == 0 and x <= n:
                l[x-1] += 1
for i in l:
    print(i)

Measured memory_bytes: 9224
N = int(input())
st = []
for i in range(N):
  x,l=map(int,input().split())
  s = max(x-l,0)
  t = min(x+l,10**9)
  st.append([t,s])
st.sort()

count = 0
lastT=0
for i in range(N):
  if st[i][1]>=lastT:
    count+=1
    lastT = st[i][0]
    
print(count)

Measured memory_bytes: 20104
/*input
2119
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=2e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b,ll mod){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    string s;
    cin>>s;
    int pref=0;
    ll ans=0;
    map<int,int> mp;
    mp[0]++;
    for(int i=sz(s)-1;i>=0;i--){
        pref+=(s[i]-'0')*mypow(10,sz(s)-i-1,2019);
        pref%=2019;
        ans+=mp[pref];
        mp[pref]++;
    }
    cout<<ans;
}


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

int main(){
    int m, n;
    cin >> n >> m;
    int a[n], b[n], c[m], d[m];
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for(int i = 0; i < m; i++) cin >> c[i] >> d[i];

    for(int i = 0; i < n; i++){
        long long min = 1000000000;
        int ans = 1;
        for(int j = 0; j < m; j++){
            int ab = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            // cout << ab << endl;
            if(ab < min){
                ans = j + 1;
                min = ab;
            }
        }
        cout << ans << endl;
    }
    return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char s[112];
int tmp = -1, flag = -1;

int main() {
	scanf("%s", &s);
	for (int i = 0; i < strlen(s); ++i) {
		if (s[i] == 'C'&&tmp == -1) { tmp = 1; }
		else if (s[i] == 'F'&&tmp == 1) { flag = 0; break; }
	}
	if (flag == 0) { printf("Yes\n"); }
	else { printf("No\n"); }

	return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	std::string a, b, c;
	std::cin >> a >> b >> c;
	std::cout << (a.back() == b[0] && b.back() == c[0] ? "YES" : "NO") << std::endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_171
{
    class D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            long[] vals = new long[100000 + 100];
            for(int i = 0; i < n; i++)
            {
                vals[array[i]]++;
            }

            long res = 0;
            for(int i = 0; i < vals.Length; i++)
            {
                res += vals[i] * i;
            }

            int q = ReadInt();
            for (int i = 0; i < q; i++)
            {
                int[] bc = ReadInts();
                int b = bc[0];
                int c = bc[1];

                res -= b * vals[b];
                res += c * vals[b];
                vals[c] += vals[b];
                vals[b] = 0;

                WriteLine(res);
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 50048
_ = input()
S = input().lstrip('.').rstrip('#')
n = len(S)

x = 0
y = S.count('.')
c = min(n-y, y)
for i in range(n):
  t = S[i]=='#'
  x += t
  y -= 1-t
  c = min(c, x+y)
print(c)

Measured memory_bytes: 9324
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

struct Node {
	int key;
	Node *prev, *next;
};

Node *head;

void init() {
	head = new Node;
	head->next = head;
	head->prev = head;
}

void insertNode(Node *x) {
	Node *tmp = head->next;
	x->next = tmp;
	tmp->prev = x;
	head->next = x;
	x->prev = head;
}

void insertKey(int key) {
	Node *x = new Node;
	x->key = key;
	insertNode(x);
}

Node* searchKey(int key) {
	Node *cur = head->next;
	while (cur != head && cur->key != key) {
		cur = cur->next;
	}
	return cur;
}

void deleteNode(Node *x) {
	if (x == head) return;
	x->prev->next = x->next;
	x->next->prev = x->prev;
	delete x;
}

void deleteKey(int key) {
	deleteNode(searchKey(key));
}

void deleteFirst() {
	deleteNode(head->next);
}

void deleteLast() {
	deleteNode(head->prev);
}

void printKey() {
	Node *cur = head->next;
	while (cur != head->prev) {
		cout << cur->key << ' ';
		cur = cur->next;
	}
	if (cur != head) cout << cur->key << endl;
}

int main() {
	int n;
	cin >> n;
	char com[20];
	int key;
	init();
	for (int i = 0; i < n; i++) {
		scanf("%s%d", com, &key);
		if (com[0] == 'i') {
			insertKey(key);
		}
		else if (com[0] == 'd' && strlen(com) <= 6) {
			deleteKey(key);
		}
		else if (com[6] == 'F') {
			deleteFirst();
		}
		else if (com[6] == 'L') {
			deleteLast();
		}
	}
	printKey();
}



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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, l;
	cin >> n >> l;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	sort(s.begin(), s.end());
	rep(i,n) cout << s[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>

int main() {
  int n = 0;
  std::cin >> n;
  int maxi = 0, mini = 100000;
  int buf = 0;
  for (int i=0; i<n; i++) {
    std::cin >> buf;
    if (buf > maxi) maxi = buf;
    if (buf < mini) mini = buf;
  }
  std::cout << maxi - mini << std::endl;
  return 0;
}


Measured memory_bytes: 256
# D
n,k = map(int, input().split())

def ruijo(n, l, mod):
    a = n
    tmp = n-1
    while(tmp >= l):
        a = a*tmp%mod
        tmp -= 1
    return a

def cmb(n, r, mod):
    if r == 1:
        return n
    elif (n == r or r == 0):
        return 1
    else:
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return ruijo(n, n-r+1, mod) * g2[r] % mod

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
for i in range(1,k+1):
    print((cmb(k-1,i-1,mod) * cmb(n-k+1,i,mod))%mod)

Measured memory_bytes: 57840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    cout << a + b + c + max({a,b,c}) * (pow((double)2, (double)k) - 1) << endl;
    return 0;
}


Measured memory_bytes: 384
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall

N, M, L = map(int, input().split())
G = np.zeros((N, N))
for i in range(M):
    a, b, c = map(int, input().split())
    G[a-1, b-1] = c
    G[b-1, a-1] = c
Q = int(input())    
queries = [ list(map(int, input().split())) for _ in range(Q)]
    
G1 = floyd_warshall(G)
G2 = np.where((G1 <= L) & (G1 > 0), 1, 0)
G3 = floyd_warshall(G2) - np.ones((N, N))

for q in queries:
    ans = G3[q[0]-1, q[1]-1]
    if ans == float('inf'):
        print(-1)
    else:
        print(int(ans))

Measured memory_bytes: 36812
package main

import "fmt"

func main() {

	var a int
	fmt.Scan(&a)

	result := "No"
	for i := 1; i < 10; i++ {
		for j := 1; j < 10; j++ {
			if i*j == a {
				result = "Yes"
			}
		}
	}
	fmt.Println(result)

}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 2e5 + 5, inf = 2e9;

ii a[maxn];
ll res = 1e18;
int N;
int Min = inf, Max;
multiset<int> ms;

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if(fopen("A.INP", "r")){
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  }
  cin >> N;
  for(int i = 1; i <= N; ++i){
    cin >> a[i].fi >> a[i].se;
    if(a[i].fi > a[i].se) swap(a[i].fi, a[i].se);
    Min = min(Min, a[i].fi);
    Max = max(Max, a[i].se);
    ms.insert(a[i].fi);
  }
  int mi = inf, ma = 0;
  for(int i = 1; i <= N; ++i){
    ma = max(ma, a[i].fi);
    mi = min(mi, a[i].se);
  }
  res = 1ll * (ma - Min) * (Max - mi);
  sort(a + 1, a + 1 + N);
  res = min(res, 1ll * (*ms.rbegin() - *ms.begin()) * (Max - Min));
  for(int i = 1; i <= N; ++i){
    ms.erase(ms.find(a[i].fi));
    ms.insert(a[i].se);
    res = min(res, 1ll * (*ms.rbegin() - *ms.begin()) * (Max - Min));
  }
  cout << res;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(h, H) cin >> S[h];

  vector<vector<int>> U(H, vector<int>(W, -1));
  vector<vector<int>> D(H, vector<int>(W, -1));
  vector<vector<int>> L(H, vector<int>(W, -1));
  vector<vector<int>> R(H, vector<int>(W, -1));
  int y, x;

  // Up and Left
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      if (S[h][w] == '#') continue;
      // Up
      if (U[h][w] == -1) {
        U[h][w] = 0;
        y = h + 1;
        while (y < H && S[y][w] == '.') {
          U[y][w] = U[y - 1][w] + 1;
          y++;
        }
      }
      // Left
      if (L[h][w] == -1) {
        L[h][w] = 0;
        x = w + 1;
        while (x < W && S[h][x] == '.') {
          L[h][x] = L[h][x - 1] + 1;
          x++;
        }
      }
    }
  }

  // Down and Right
  for (int h = H - 1; 0 <= h; h--) {
    for (int w = W - 1; 0 <= w; w--) {
      if (S[h][w] == '#') continue;
      // Down
      if (D[h][w] == -1) {
        D[h][w] = 0;
        y = h - 1;
        while (0 <= y && S[y][w] == '.') {
          D[y][w] = D[y + 1][w] + 1;
          y--;
        }
      }
      // Right
      if (R[h][w] == -1) {
        R[h][w] = 0;
        x = w - 1;
        while (0 <= x && S[h][x] == '.') {
          R[h][x] = R[h][x + 1] + 1;
          x--;
        }
      }
    }
  }

  int ans = 0, cnt;
  rep(h, H) rep(w, W) {
    cnt = U[h][w] + D[h][w] + L[h][w] + R[h][w] + 1;
    ans = max(ans, cnt);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 73716
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<ll> a(N); for(auto& in:a) cin >> in;
    bool ok = false;
    for(auto v:a){
        if(v%2==1) ok = true;
    }
    if(ok) res = "first";
    else res = "second";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll H; std::cin >> H;

  ll a = 1;
  while(H >= a) a *= 2;
  std::cout << a-1 << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.io.Serializable;

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

        String s = sc.next();
        String t = sc.next();
        int count = 0;

        char[] work1 = new char[s.length()];
        char[] work2 = new char[t.length()];

        for(int i = 0; i < s.length(); i++){
            work1[i] = s.charAt(i);

            }

        for(int i = 0; i < t.length(); i++){
                work2[i] = t.charAt(i);
        
            }
        
        for(int i = 0; i < s.length(); i++){
            if(work1[i] == work2[i]){
            }else{
                count++;
            }
        }
        if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        


    }
}

Measured memory_bytes: 35592
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

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

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

int main () {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (a.at(i)%2 == 1) count++;
  }
  if (count%2 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

using namespace std;

typedef long long ll;


const int INF = 1e9;
const ll MOD = 1e9 + 7;  

int main(){
    int N,M;
    cin >> N >> M;
    ll ans = 1;
    if(abs(N-M) >= 2){
        ans = 0;
    }
    else if(N == M){
        for(ll l = N; l >= 1; l--){
            ans = ans * l % MOD;
            ans = ans * l % MOD;
        }
        ans = ans * 2 % MOD;
    }
    else if(abs(N-M) == 1){
        for(ll l = N; l >= 1; l--){
            ans = ans * l % MOD;
        }
        for(ll l = M; l >= 1; l--){
            ans = ans * l % MOD;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<int64_t> L(N);
  for (int64_t i = 0; i < N; ++i) {
    cin >> L[i];
  }
  sort(L.begin(), L.end());

  int64_t result = 0;
  for (int64_t a = 0; a < N; ++a) {
    for (int64_t b = a + 1; b < N; ++b) {
      const int64_t end = static_cast<int64_t>(lower_bound(L.begin(), L.end(), L[a] + L[b]) - L.begin());
      const int64_t begin = max(static_cast<int64_t>(lower_bound(L.begin(), L.end(), L[b]) - L.begin()), b+1);
      const int64_t c_count = (end - begin);
      result += c_count;
      // cerr << L[a] << ", " << L[b] << ", count=" << c_count << endl;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;
long long n;
long long x;
const long long MAXN=1e5 +10;
long long maxd=0;
long long usen[MAXN];
long long i;


int main() {
	cin>>n;
	fill(usen,usen+MAXN,0);
	for(i=0;i<n;i++)
	{
		cin>>x;
		if(x>0)
		{
			usen[x-1]++;
			if(usen[x-1]>maxd)
				maxd=usen[x-1];
		}
		usen[x+1]++;
					if(usen[x+1]>maxd)
				maxd=usen[x+1];
		usen[x]++;
		if(usen[x]>maxd)
				maxd=usen[x];
	}
	cout<<maxd;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{
  ll n, m, x;
  cin >> n >> m >> x;
  vector<ll> c(n, 0);
  vector<vector<ll>> as(n, vector<ll>(m));

  for (auto i = 0; i < n; i++)
  {
    ll cc;
    cin >> cc;
    c[i] = cc;
    for (auto j = 0; j < m; j++)
    {
      ll a;
      cin >> a;
      as[i][j] = a;
    }
  }

  ll p = 1 << n;
  ll min_cost = -1;
  for (auto i = 0; i < p; i++)
  {
    vector<ll> totals(12, 0);
    ll cost = 0;
    for (auto j = 0; j < n; j++)
    {
      if ((i >> j) & 1)
      {
        cost += c[j];
        vector<ll> a = as[j];
        for (auto k = 0; k < m; k++)
        {
          totals[k] += a[k];
        }
      }
    }

    bool is_all = true;
    for (auto j = 0; j < m; j++)
    {
      if (totals[j] < x)
      {
        is_all = false;
      }
    }

    if (is_all)
    {
      if (min_cost == -1)
      {
        min_cost = cost;
      }
      else
      {
        min_cost = min(min_cost, cost);
      }
    }
  }

  cout << min_cost << endl;
  return 0;
}


Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, a;
  cin >> n >> a;
  long long dp[55][3300] = {};
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int j = n; j > 0; j--) {
      for (int k = 3000; k - x >= 0; k--) {
        dp[j][k] += dp[j - 1][k - x];
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[i][i * a];
  }
  cout << ans << endl;
  return 0;	
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define for1(i, a, b) for(i = a; i <= b; ++i)
#define for0(i, a, b) for(i = a; i < b; ++i)
#define forw1(i, a, b) for(i = a; i >= b; --i)
#define forw0(i, a, b) for(i = a - 1; i >= b; --i)
#define fora(v, a) for(auto v : a)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

using namespace std;
using cd = complex<double>;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<cd> vcd;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int modd1 = 1e9 + 7, modd2 = 998244353, maxn = 1e5 + 3, K = 26;
const double pi = acos(-1);
int n, m, q;
int cnt[maxn], a[maxn], sum = 0;

void solve(){
	int i, j, k, l, r;
	cin >> n ;
	for1(i, 1, n){
		cin >> a[i];
		sum += a[i];
		cnt[a[i]]++;
	}
	cin >> q;
	while(q--){
		int b, c; cin >> b >> c;
		sum += (c - b) * cnt[b];
		cnt[c] += cnt[b]; cnt[b] = 0;
		cout << sum << '\n'; 
	}
}

signed main() {
    //freopen(".INP", "r", stdin);
    //freopen(".OUT", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}


Measured memory_bytes: 5220
import java.util.*;
class Main{
    public static void main(String[] args){
        int d,t,s;
        Scanner sc =new Scanner(System.in);

        d=sc.nextInt();
        t=sc.nextInt();
        s=sc.nextInt();

        if(t*s>=d){
            System.out.println("Yes");
        }
        else
        { 
            System.out.println("No");
        }
    }

}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string a, b, c; cin >> a >> b >> c;
  queue<char> aque, bque, cque;
  for(char x: a) aque.push(x);
  for(char x: b) bque.push(x);
  for(char x: c) cque.push(x);
  char next = aque.front(); aque.pop();
  while(1){
    if(next=='a'){
      if(aque.empty()) break;
      next = aque.front();
      aque.pop();
    }else if(next=='b'){
      if(bque.empty()) break;
      next = bque.front();
      bque.pop();
    }else{
      if(cque.empty()) break;
      next = cque.front();
      cque.pop();
    }
  }
  printf("%c\n", next-'a'+'A');
  
}


Measured memory_bytes: 384
//{{{
#include <bits/stdc++.h>
using namespace std;
//types
typedef long long ll;
typedef pair<int,int> pii;
//input
bool SR(int &_x){return scanf("%d",&_x)==1;}bool SR(ll &_x){return scanf("%lld",&_x)==1;}
bool SR(double &_x){return scanf("%lf",&_x)==1;}bool SR(char *_s){return scanf("%s",_s)==1;}
bool RI(){return true;}
template<typename I,typename... T>bool RI(I &_x,T&... _tail){return SR(_x) && RI(_tail...);}
//output
void SP(const int _x){printf("%d",_x);}void SP(const ll _x){printf("%lld",_x);}
void SP(const double _x){printf("%.16lf",_x);}void SP(const char *s){printf("%s",s);}
void PL(){puts("");}
template<typename I,typename... T>void PL(const I _x,const T... _tail)
{SP(_x);if(sizeof...(_tail)) putchar(' ');PL(_tail...);}
//macro
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<int(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=int(b);i++)
#define PER1(i,a,b) for(int i=(a);i>=int(b);i--)
#define pb push_back
#define mkp make_pair
#define F first
#define S second
//debug
#ifdef darry140
template<typename A,typename B>
ostream& operator <<(ostream&_s, const pair<A,B> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It>
ostream& _OUTC(ostream &_s,It _b,It _e)//container
{
    _s<<"{";
    for(auto _it=_b;_it!=_e;_it++) _s<<(_it==_b?"":" ")<<*_it;
    _s<<"}";
    return _s;
}
template<typename A,typename B>
ostream& operator <<(ostream&_s, const map<A,B> &_c){return _OUTC(_s,ALL(_c));}
template<typename T>
ostream& operator <<(ostream&_s, const set<T> &_c){return _OUTC(_s,ALL(_c));}
template<typename T>
ostream& operator <<(ostream&_s, const vector<T> &_c){return _OUTC(_s,ALL(_c));}
template<typename I>
void _DOING(const char *_s,I&& _x){cerr<<_s<<"="<<_x<<endl;}//without ','
template<typename I,typename... T>
void _DOING(const char *_s,I&& _x,T&&... _tail)//with ','
{
    int _c=0;
    static const char _bra[]="({[";
    static const char _ket[]=")}]";
    while(*_s!=',' || _c!=0)//eg. mkp(a,b)
    {
        if(strchr(_bra,*_s)) _c++;
        if(strchr(_ket,*_s)) _c--;
        cerr<<*_s++;
    }
    cerr<<"="<<_x<<", ";
    _DOING(_s+1,_tail...);
}
#define debug(...) do{\
    fprintf(stderr,"%s:%d - ",__PRETTY_FUNCTION__,__LINE__);\
    _DOING(#__VA_ARGS__,__VA_ARGS__);\
}while(0)
#else
#define debug(...)
#endif
//}}}

int main()
{
    int n;RI(n);
    vector<ll> x(n),y(n);
    REP(i,n) RI(x[i],y[i]);
    x.pb(x[0]),y.pb(y[0]);
    ll ans=0;
    REP(i,n) ans+=x[i]*y[i+1]-x[i+1]*y[i];
    ans=abs(ans);
    printf("%lld.%c\n",ans/2,"05"[ans%2]);
    return 0;
}




































/*End Of File*/

Measured memory_bytes: 3264