akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <climits>
#include <math.h>
#include <utility>
#include <ctime>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) a.begin(),a.end()

int myMin(vi& v) {
	sort(all(v));
	return v.at(0);
}

int main() {
	int n; cin >> n;
	map<char, vi> mp;
	rep(i, n) {
		string s; cin >> s;
		int len = s.size();
		rep(k, 26) {
			mp['a' + k].push_back(0);
		}
		rep(j, len) {
			mp[s.at(j)].at(i)++;
		}
	}
	rep(i, 26) {
		int m = myMin(mp[(char)('a' + i)]);
		rep(j, m) {
			cout << (char)('a' + i);
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
prime = [False] * (10 ** 6)
prime[0] = True
prime[1] = True

for i in range(2, 10 ** 6):
    if prime[i] == False:
        for j in range(i * 2, 10 ** 6, i):
            prime[j] = True

while True:
    a, d, n = map(int, raw_input().split())

    if a == 0:
        break

    cnt = 0
    for i in range(a, 10 ** 6, d):
        if prime[i] == False:
            cnt += 1
        if cnt == n:
            print i
            break

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

ll dp[61][61][5501];//i個目までの選択肢でｊ個を選んで合計がｋの個数
int main()
{
	int n,a;
	cin >> n >> a;
	vector<ll>x(n);for(int i =0;i<n;i++)cin >> x[i];
	dp[0][0][0] = 1;
	for(int i = 0;i<n;i++)
	{
		for(int j = 0;j<n;j++)
		{
			for(int k = 0;k<2501;k++)
			{
				if(dp[i][j][k])
				{
					dp[i+1][j][k] += dp[i][j][k];
					dp[i+1][j+1][k+x[i]] += dp[i][j][k];
				}
			}
		}
	}
	ll cnt =0;

	for(int i = 1;i*a<=(2500)&&i<=60;i++)
	{
		cnt += dp[n][i][a*i];
	}

	cout << cnt << endl;
}


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

#define ll long long int
#define pb push_back
#define FastIO cin.sync_with_stdio(false),cin.tie(NULL)

ll max(ll a, ll b){
    if(a>b) return a;
    return b;}

ll min(ll a, ll b){
    if(a<b) return a;
    return b;}

const ll MOD = 1e9 + 7, N = sqrt(1e13) + 1, INF = INT_MAX, M = 1e6;
#define val first
#define lst second
bool b[N];
std::vector<ll> pr;

int main(){
	//FastIO;
	

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

	cout << min(n*a, b) << "\n";

	return 0;
}



Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
const ll mod=1e9+7;
const ll inv=(mod+1)/2;
int main()
{
    int n;
    scanf("%d",&n);
    ll sum=0,extra=0;
    for(int i=1;i<=n;i++)
    {
        ll a;
        scanf("%lld",&a);
        sum=(sum+a)%mod;
        extra=(extra+a*a%mod)%mod;
    }
    ll ans=(sum*sum%mod-extra+mod)%mod*inv%mod;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

vector<int> a = {100,101,102,103,104,105};

signed main(){

  static int dp[1000001];
  dp[0] = 1;
  for(int i = 0; i < 100000; i++){
    for(int p : a){
      dp[i + p] |= dp[i];
    }
  }
  int x; cin >> x;
  cout << (dp[x] == 1) << endl;

  return 0;
}


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

int main() {
  int N, x;
  cin >> N >> x;
  int a[110];
  for (int i = 0; i < N; i++) cin >> a[i];

  sort(a, a + N);

  for (int i = 0; i < N; i++) {
    if (a[i] > x) break;
    x -= a[i];
    a[i] = 0;
  }

  int ans = 0;
  for (int i = 0; i < N; i++) if (a[i] == 0) ans++;
  if (N - ans == 0 && x > 0) ans--;

  cout << ans << endl;
}

Measured memory_bytes: 256
import math
N = int(input())
ans = [0]*(N+1)
Nruto = math.floor(math.sqrt(N))
for x in range(1, Nruto):
    a = x**2
    for y in range(1, Nruto):
        b = y**2
        c = x*y
        for z in range(1, Nruto):
            keisan = a+b+c+z*(z+y+x)
            if keisan > N:
                break
            ans[keisan] += 1
for i in range(1, N+1):
    print(ans[i])


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

#define ll long long
#define d long double

#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%Lf",&n)
#define pri(n) printf("%d ",(int)n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%Lf ",n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define dprin(n) printf("%Lf\n",n)

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define all(x) x.begin(),x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define bitcount(n) __builtin_popcount(n)
#define tc   int tt; scf(tt); while(tt--)
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265358979323846264

const ll M =1e9+7;
const int N = 1e6+7;

string s,t;
int ans=inf,coun;

int main()
{
    fast();
    cin>>s>>t;

    rep(i,0,s.size()-t.size()+1)
    {   
        coun=0;
        rep(j,0,t.size())
        {
            if(t[j]!=s[i+j])
            coun++;
        }
        ans=min(ans,coun);
    }
    cout<<ans;
return 0;
}

Measured memory_bytes: 3628
import java.util.Arrays;
import java.util.Scanner;

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

		int sum=0;
		int minaji=0;
		int temp=0;
		for(int i=1;i<=N;i++) {
			int aji=L+i-1;
			sum+=aji;
			if(i==1) {
				minaji=aji;
				temp=Math.abs(sum-(sum-aji));
				
			}
			else if(Math.abs(sum-(sum-aji))<temp) {
				temp=Math.abs(sum-(sum-aji));
				minaji=aji;
			}
			
	    }
		System.out.println(sum-minaji);
		
		
		
		
		
		
		
		
	
		
		
}
}

Measured memory_bytes: 21844
import java.math.BigDecimal;
import java.util.Scanner;
class Main {
    public static final BigDecimal DEPT = new BigDecimal(100000);
    public static final BigDecimal INTEREST = new BigDecimal("0.05");
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int week = Integer.parseInt(s.next());
        BigDecimal repay = DEPT;
        for (int i = 0; i < week; ++i) {
            repay = repay.add(repay.multiply(INTEREST)).setScale(-3,
                    BigDecimal.ROUND_CEILING);
        }
        s.close();
        System.out.println(repay.toPlainString());
    }
}

Measured memory_bytes: 17176
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#include<stack>
#include<set>
#define int long long
#define MAX 1000000000000000000LL
int inf=100000000000007;
using namespace std;
typedef pair<int,int> P;
string alph="abcdefghijklmnopqrstuvwxyz";

signed main(){
    int n; cin>>n;
    int road[305][305];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            road[i][j]=inf;
            cin>>road[i][j];
        }
    }
    int count=0;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            int mini=inf;
            for(int k=1;k<=n;k++){
                if(k==i||k==j)continue;
                mini=min(mini,road[i][k]+road[k][j]);
            }
            if(mini>road[i][j])count+=road[i][j];
            else if(mini<road[i][j]){
                cout<<-1<<endl;
                return 0;
            }
    }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

func hyoka(A, B int) int {
	i := 0
	if A > 0 {
		if A > B {
			for A > B {
				B *= 4
				i += 2
			}
		} else {
			A *= 4
			for A <= B {
				i -= 2
				A *= 4
			}
		}
	} else {
		if A > B {
			for A > B {
				A *= 4
				i += 2
			}
		} else {
			B *= 4
			for A <= B {
				i -= 2
				B *= 4
			}
		}
	}
	return i
}

func main() {
	var N int
	fmt.Scanf("%d", &N)
	A := make([]int, N)
	ps := make([]int, N)
	pt := make([]int, N)
	ns := make([]int, N)
	nt := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}
	for i := N - 1; i >= 1; i-- {
		h := hyoka(A[i-1], A[i])
		h *= N - i
		pt[i-1] = pt[i] + h
		if pt[i-1] >= ps[i] {
			ps[i-1] = pt[i-1]
		} else {
			ps[i-1] = ps[i]
			if h > 0 {
				ps[i-1] += h / (N - i)
			}
		}
	}
	for i := 0; i < N-1; i++ {
		h := hyoka(-2*A[i], -2*A[i+1])
		h *= i + 1
		nt[i+1] = nt[i] + h
		if nt[i+1] >= ns[i] {
			ns[i+1] = nt[i+1]
		} else {
			ns[i+1] = ns[i]
			if h > 0 {
				ns[i+1] += h / (i + 1)
			}
		}
	}
	ans := ps[0]
	for i := 1; i < N; i++ {
		t := ps[i] + ns[i-1] + i
		if t < ans {
			ans = t
		}
	}
	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 16000
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main() {
int N;
cin>>N;
int prex=0,prey=0,pret=0;
bool judge=true;
rep(i,N){
  int t,x,y;
  cin>>t>>x>>y;
  if(((abs(x-prex)+abs(y-prey))%2==(t-pret)%2)&&(abs(x-prex)+abs(y-prey)<=(t-pret))){
    

  }
  else{
    judge=false;

  }
  pret=t;
    prex=x;
    prey=y;
}
if(judge){
  cout<<"Yes"<<endl;
}
else{
  cout<<"No"<<endl;
}
return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <stdio.h>
#include <queue>

using namespace std;

int** gmtrx;
int* v;
int total, n;

std::queue<int> que;

void operation(){
	int tmp = que.front();
	for(int i=0; i<n; ++i){
		if(gmtrx[tmp][i]){
			if(v[i]==-1){
				v[i]=v[tmp]+1;
				++total;
				que.push(i);
			}else{
				continue;
			}
		}
	}
	que.pop();
}

int main()
{
	scanf("%d",&n);

	gmtrx = new int*[n];
	v = new int [n]; //discovery

	for(int i=0; i<n; ++i){
		gmtrx[i] = new int[n];
		for(int j=0; j<n; ++j){
			gmtrx[i][j] = 0;
		}
		v[i] = -1;
	}

	for(int i=0; i<n; ++i){
		int v, num, a;
		scanf("%d %d",&v,&num);
		--v;
		for(int j=0; j<num; ++j){
			scanf("%d",&a);
			--a;
			gmtrx[v][a] = 1;
		}
	}

	que.push(0);
	v[0]=0;
	++total;
	while(que.size() && total!=n){
		operation();
	}

	for(int i=0; i<n; ++i){
		cout << i+1 << " " << v[i] << endl;
	}

	for(int i=0; i<n; ++i){
		delete[] gmtrx[i];
	}
	delete[] gmtrx;
	delete[] v;

	return 0;
}


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

#define hell                         1000000007
#define __lcm(a,b)                   (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cerr << #x << " is " << x << endl;
#define endl                           '\n'

#define MAX 1005
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll x,y;
    cin >> x >> y;
    cout << x+y/2;
}

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


int main()
{
   ios_base::sync_with_stdio(false);

   double a,b,c,d,n,m;
   cin>>n;
   vector <pair<double,double>> v1;
   for(int i=0;i<n;i++)
   {
       cin>>a>>b;
       v1.push_back(make_pair(a,b));
   }
   c=0;
   for(int i=0;i<n-1;i++)
   {
       for(int j=i+1;j<n;j++)
       {
           a=sqrt(pow((v1[i].first-v1[j].first),2)+pow((v1[i].second-v1[j].second),2));
           c+=a;
       }
   }
   printf("%.10lf\n",(c/n)*2);
   return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 1;
	while (kkt--) {
		int n; scanf("%d", &n);
		vector<string> vs(n); for (int i = 0; i < n; i++) cin >> vs[i];
		sort(vs.begin(), vs.end());
		int m; scanf("%d", &m);
		int cnt = 0;
		for (int i = 0; i < m; i++) {
			string s; cin >> s;
			if (binary_search(vs.begin(), vs.end(), s)) {
				if (cnt % 2 == 0) cout << "Opened by " << s << "\n";
				else cout << "Closed by " << s << "\n";
				cnt++;
			}else{
				cout << "Unknown " << s << "\n";
			}
		}
	}
	return 0;

}


Measured memory_bytes: 3280
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <set>
#include <numeric>
using namespace std;
using ll = long long;

#define no "no"
#define No "No"
#define NO "NO"
#define yes "yes"
#define Yes "Yes"
#define YES "YES"
#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define INF 1e+9
#define PI acos(-1)
#define TAU PI * 2
#define EPS 0.00000001
const ll MOD = 1000000007;

int main(){
    FAST;

    int n, y;
    cin >> n >> y;

    for(int i = 0; i <= n; ++i){
        for (int j = 0; i + j <= n; ++j){
            int k = n - i - j;
            int tmp = 10000 * i + 5000 * j + 1000 * k;
            if(tmp == y){
                cout << i << sp << j << sp << k << endl;
                stop;
            }
        }
    }

    cout << -1 << sp << -1 << sp << -1 << next;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = int;
using ULL = unsigned long long;
const long long MOD = 1000000000 + 7;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = 1LL << 60;//numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
set<LL>st;
map<Pll, LL>ma;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
string str, ss;
bool f;
LL n, m, s, t, h, w, k, q, p, ans, sum, cnt, a[5100];
vector<vector<bool>> dpl,dpr;
int main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
	}
	dpl.resize(n + 1);
	rep(i, n + 1)	dpl[i].resize(k + 1);
	vector<vector<LL>>L(n + 1), R(n + 1);
	dpl[0][0] = 1;
	// dpl[i][j]: [0,i)
	rep(i, n) {
		rep(j, k + 1) {
			dpl[i + 1][j] = (dpl[i + 1][j] | dpl[i][j]);
			if (j + a[i] <= k) {
				dpl[i + 1][j + a[i]] = (dpl[i + 1][j + a[i]] | dpl[i][j]);
			}
		}
	}
	rep(i, n + 1)
		rep(j, k + 1) {
		if (dpl[i][j])
			L[i].push_back(j);
	}
	dpl.clear();
	dpr.resize(n + 1);
	rep(i, n + 1)	dpr[i].resize(k + 1);
	dpr[n][0] = 1;
	// dpr[i][j]: [i,n)
	Rrep(i, n) {
		rep(j, k + 1) {
			dpr[i][j]=(dpr[i][j] | dpr[i + 1][j]);
			if (j + a[i] <= k) {
				dpr[i][j + a[i]] = (dpr[i][j + a[i]] | dpr[i + 1][j]);
			}
		}
	}
	rep(i, n + 1)
		rep(j, k + 1) {
		if (dpr[i][j])
			R[i].push_back(j);
	}
	dpr.clear();
	rep(i, n) {
		LL mx = 0;
		rep(j, L[i].size()) {
			if (k - L[i][j] > 0) {
				auto it = upper_bound(R[i + 1].begin(), R[i + 1].end(), k - L[i][j] - 1) - R[i + 1].begin();
				it--;
				mx = max(mx, L[i][j] + R[i + 1][it]);
			}
		}
		//cout << i << " " << mx << endl;
		if (a[i] >= k - mx)ans++;
	}
	cout << n - ans << endl;
	return 0;
}

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

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

    int cnt = 0;
    int i=0, j=n-1;
    while(i<j){
        if(s[i]=='W' && s[j]=='R'){
            cnt++;
            i++;
            j--;
        }else{
            if(s[j]=='W'){
                j--;
            }
            if(s[i]=='R'){
                i++;
            }
        }
    }
    cout << cnt << endl;
}

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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	int k, n;
	cin>>k>>n;
	vi a(n);
	forn(i, n) cin>>a[i];
	sort(a.begin(), a.end());
	int l1 = a[n-1] - a[0];
	forne(i, n-1)
		l1 = min(l1, k + a[i-1] - a[i]);
	cout<<l1<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 1024
//
//  main.cpp
//  ABC093
//
//  Created by hiroaki on 2019/03/18.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

//~~A~~
/*int main(){
    string s;
    cin >> s;
    if(s=="abc"||s=="acb"||s=="bac"||s=="bca"||s=="cab"||s=="cba"){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}*/

//~~B~~
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    
    if (b-a+1>2*k) {
        for (int i=0; i<k; i++) {
            cout<<a+i<<endl;
        }
        for (int i=k; i>0; i--) {
            cout<<b-i+1<<endl;
        }
    }else{
        for (int i=0; i<b-a+1; i++) {
            cout<<a+i<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools

# 標準入力の取得
X = int(input())

# 求解処理


def get_value(A: int, B: int) -> int:
    return A**5 - B**5


A_min, A_max = -118, 119
B_min, B_max = -119, 118
result = ""
for A, B in itertools.product(range(A_min, A_max+1), range(B_min, B_max+1)):
    value = get_value(A, B)
    if value == X:
        result = f"{A} {B}"
        break

# 結果出力
print(result)


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

void fnInput(vector<int>& rvnStage)
{
  int nStageSiz;
  cin >> nStageSiz;
  rvnStage.resize(nStageSiz);

  for(int& rnStage : rvnStage)
    cin >> rnStage;
}
  
int fnDPCost(const vector<int>& cnrvnStage)
{
  vector<int> vnDPCost(cnrvnStage.size(), INT_MAX);
  vnDPCost[0] = 0;

  for (int i = 1; i < cnrvnStage.size(); i++)
  {
    vnDPCost[i] = min(vnDPCost[i], vnDPCost[i - 1] + abs(cnrvnStage[i] - cnrvnStage[i - 1]));
    if (i > 1)
      vnDPCost[i] = min(vnDPCost[i], vnDPCost[i - 2] + abs(cnrvnStage[i] - cnrvnStage[i - 2]));
  }

  return vnDPCost[cnrvnStage.size() - 1];
}
  
int main()
{
  vector<int> vnStage;

  fnInput(vnStage);
  cout << fnDPCost(vnStage) << endl;

  return 0;
}

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

#define int long long
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}
int R,C,K,r,c,v,d[3123][3123],memo[3123][3123][5];
int f(int y,int x,int cnt){
  if(y<0||x<0)return 0;
  if(~memo[y][x][cnt])return memo[y][x][cnt];
  int res=0;
  for(int i=0;i<=3;i++)chmax(res,f(y-1,x,i));
  for(int i=0;i<=cnt;i++)chmax(res,f(y,x-1,i));
  if(cnt)for(int i=0;i<=3;i++)chmax(res,f(y-1,x,i)+d[y][x]);
  if(cnt)chmax(res,f(y,x-1,cnt-1)+d[y][x]);
  return memo[y][x][cnt]=res;
}

signed main(){
  memset(memo,-1,sizeof(memo));
  cin>>R>>C>>K;
  while(K--){
    cin>>r>>c>>v;
    d[r][c]=v;
  }
  cout<<f(R+1,C+1,0)<<endl;
}


Measured memory_bytes: 458224
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
void solve()
{  ll n;
cin>>n;
string s[n];
map<string,ll> m;
f(i,0,n)
{
    cin>>s[i];
    sort(s[i].begin(),s[i].end());
    m[s[i]]++;
}
map<string,ll> :: iterator p=m.begin();
ll ans=0;
while(p!=m.end())
{  ans+=((p->se)*(p->se-1))/2;
    p++;
}
c(ans);
}
int main()
{
    ios::sync_with_stdio(true);
   //freopen ("input.txt","r",stdin);
   //freopen ("output.txt","w",stdout);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {

        solve();
    }
return 0;
}


Measured memory_bytes: 18176
#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>;
const int INF = 1000000007;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(p.begin(), p.end());
  ll total = 0;
  rep(i, k) total += p[i];
  cout << total << endl;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<lint,lint> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    lint n, m;
    cin >> n >> m;
    vector<P> v(n);
    rep(i,n){
        cin >> v[i].first >> v[i].second;
    }
    sort(all(v));
    lint res = 0;
    int i = 0;
    while (m > 0)
    {
        int cc=min(m, v[i].second);
        res += v[i].first * cc;
        m -= cc;
        i++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define L long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n,m,f[600000],g[600000],p,q;
pi x[200010];
inline void add(int i,int j,int k,int l,int r)
{
	if(l<=j && k<=r)
	  {
	   f[i]++;
	   g[i]++;
	  }
	else
	  {
	   f[i<<1]+=g[i];
	   g[i<<1]+=g[i];
	   f[i<<1|1]+=g[i];
	   g[i<<1|1]+=g[i];
	   g[i]=0;
	   if(l<=(j+k>>1))
	     add(i<<1,j,j+k>>1,l,r);
	   if(r>(j+k>>1))
	     add(i<<1|1,(j+k>>1)+1,k,l,r);
	   f[i]=max(f[i<<1],f[i<<1|1]);
	  }
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	  scanf("%d%d",&x[i].aa,&x[i].bb);
	sort(x+1,x+n+1);
	for(p=1;p<m+1;p<<=1);
	for(i=1;i<=m;i++)
	  f[p+i-1]=-(m-i+1);
	for(i++;i<=p;i++)
	  f[p+i-1]=-1e9;
	for(i=p-1;i>0;i--)
	  f[i]=max(f[i<<1],f[i<<1|1]);
	for(i=1;i<=n;i++)
	  {
	   add(1,1,p,1,x[i].bb);
	   q=max(q,f[1]-x[i].aa);
	  }
	q=max(q,n-m);
	printf("%d\n",q);
	return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
 
int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;

    int cnt_r = 0, cnt_b = 0;
    for(int i=0;i<N;i++){
        if(S[i] == 'R'){
            cnt_r++;
        }else{
            cnt_b++;
        }
    }
    if(cnt_r > cnt_b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;
ll mod9 = 1000000009;

signed main(){
    ll x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<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 P = pair<int, int>;

int main() {
    ll a;
    double b;
    cin >> a >> b;
    ll bn = b * 100 + 0.1;
    a *= bn;
    a /= 100;
    cout << a << endl;
}

Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
using namespace std;

typedef long long ll;



int main() {
	int n, a, b; cin >> n >> a >> b;
	vector<ll> v(n), cnt(n + 1), sum(n + 1);
	for (int i = 0; i < n; i++) cin >> v[i];
	sort(v.begin(), v.end());
	for (int t = a; t <= b; t++) {
		ll s = 0;
		for (int i = 0; i < t; i++) {
			s += v[n - 1 - i];
		}
		sum[t] = s;
		ll l = 0, r = 0;
		for (int i = 0; i < n; i++) {
			l += v[n - 1 - i] == v[n - t];
			r += i < t && v[n - 1 - i] == v[n - t];
		}
		double c = 1;
		for (ll i = 1; i <= r; i++) {
			c *= (double)(l - i + 1) / (double)i;
		}
		cnt[t] = (ll)(c + 1e-1);
	}
	ll m = 0; double ma = 0;
	for (int i = a; i <= b; i++) {
		if ((double)sum[i] / (double)i >= ma) {
			ma = (double)sum[i] / (double)i;
			m = i;
		}
	}
	cout << fixed << setprecision(10) << ma << endl;
	ll ans = 0;
	for (ll i = a; i <= b; i++) {
		if (m*sum[i] != i*sum[m]) continue;
		ans += cnt[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
require 'prime'
loop do
  m, a, b = gets.split.map(&:to_i)
  break if m == 0
  ans = [0, 0]
  prod = 0
  max_p = Math.sqrt(100000).to_i
  Prime.each do |p|
    break if p > max_p || p * p > m
    q = Prime.each.take_while{ |q| a * q <= b * p && p * q <= m }
                  .drop_while{ |q| q < p  }.to_a.last
    if q && prod < p * q
      ans = [p, q]
      prod = p * q
    end
  end
  puts ans * ' '
end

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int N;
void input(){
    cin>>N;
    cout<<N*N*N<<endl;
    return;
}

void solve(){

    return;
}

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

Measured memory_bytes: 256
s = input()
t = input()
dp = [0]
lcs = ['']
for b in t:
    search_idx = 0
    ncs = lcs[:]
    for i, curr_idx in enumerate(dp):
        char_idx = s.find(b, search_idx)
        if char_idx == -1:
            break
        next_idx = char_idx + 1
        if next_idx < curr_idx:
            dp[i] = next_idx
            ncs[i] = lcs[i - 1] + b
        search_idx = curr_idx
    else:
        char_idx = s.find(b, search_idx)
        if char_idx > -1:
            dp.append(char_idx + 1)
            ncs.append(lcs[-1] + b)
    lcs = ncs
print(lcs[-1])


Measured memory_bytes: 158768
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    map<int, int> m;
    for (int& i : A) {
        cin >> i;
        if (m.find(i) == m.end()) m[i] = 1;
        else m[i]++;
    }
    long long ans = 1, cnt = 0;
    for (auto ritr = m.rbegin(); ritr != m.rend() && cnt < 2; ++ritr) {
        if (ritr->second < 2) continue;
        if (!cnt && ritr->second >= 4) {
            ans *= ritr->first;
            cnt++;
        }
        ans *= ritr->first;
        cnt++;
    }
    cout << (cnt < 2 ? 0 : ans) << endl;
}

Measured memory_bytes: 5376
let read f = stdin.ReadLine() |> f
let reads f =  stdin.ReadLine().Split() |> Array.map f

let n = read int
let hs = reads int
let mutable tmp = 0
let mutable max = 0
for i = 0 to n - 2 do
    if hs.[i] >= hs.[i+1] then 
        tmp <- tmp + 1
        if tmp >= max then 
            max <- tmp;
    else tmp <- 0
printfn "%d" max

Measured memory_bytes: 28120
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,K;
int A[200011];
int main(){
    cin>>N>>K;
    REP(i,N+1)A[i]=0;
    REP(i,N){
        int a;
        cin>>a;
        A[a]++;
    }
    
    vector<int>v;
    REP(i,N+1){
        v.push_back(A[i]);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    int ans=0;
    REP(i,K)ans+=v[i];
    //cout<<ans<<endl;
    cout<<N-ans<<endl;
	return(0);
}

Measured memory_bytes: 2168
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;
  int a=N/1000;
  N%=1000;
  int b=N/100;
  N%=100;
  int c=N/10;
  int d=N%10;

  for(int i=0; i<2; i++){
    for(int j=0; j<2; j++){
      for(int k=0; k<2; k++){
        if(a+b+c+d==7){
         std::cout << a ;
         if(b>=0) std::cout << "+" << b;
         else std::cout << b ;
         if(c>=0) std::cout << "+" << c;
         else std::cout << c ;
         if(d>=0) std::cout << "+" << d;
         else std::cout << d ;
         std::cout << "=7" << '\n';
         return 0;
        }
        d*=-1;
      }
      c*=-1;
    }
   b*=-1;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>
#include <tuple>

using namespace std;

//最大公約数
template<class T>
inline T GCD(T m, T n)
{
	T temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
template<class T>
inline T LCM(T m, T n)
{
	return m * n / GCD(m, n);
}



int main()
{
	int n, m; cin >> n >> m;
	vector<tuple<int,int,int>> address;
	for (int i = 0; i < m; i++)
	{
		int p, m; cin >> p >> m;
		address.emplace_back(make_tuple(m, p, i));
	}
	sort(address.begin(), address.end());

	vector<int> count(n,1);
	std::vector<pair<int,int>> ans(m);

	for (int i = 0; i < m; i++)
	{
		ans[get<2>(address[i])] = make_pair(get<1>(address[i]),count[get<1>(address[i])-1]);
		count[get<1>(address[i])-1]++;
	}
	
	for (int i = 0; i < m; i++)
	{
		cout << setw(6) << setfill('0') << ans[i].first;
		cout << setw(6) << setfill('0') << ans[i].second << endl;
	}

	return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

void add(ll& a, ll b){a = (a+b) % MOD;}

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

ll num[8][8];
ll dp[101][8];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W,K;
    cin>>H>>W>>K;
    for(int bits=0;bits<(1<<(W-1));bits++){
        bool ok=true;
        for(int i=0;i<W-2;i++){
            if((bits>>i)&1 && (bits>>i+1)&1){
                ok=false;
                break;
            }
        }
        if(!ok) continue;

        vector<int>P(W);
        for(int i=0;i<W;i++) P[i]=i;
        for(int i=0;i<W-1;i++){
            if((bits>>i)&1) swap(P[i],P[i+1]);
        }
        for(int i=0;i<W;i++) num[i][P[i]]++;
    }
    dp[0][0]=1;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            for(int k=0;k<W;k++){
                add(dp[i+1][k],dp[i][j]*num[j][k]%MOD);
            }
        }
    }
    cout<<dp[H][K-1]<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include <iomanip>
#include <limits>
#include <thread>
#include <map>
#include <stack>
#include <numeric>
#include <cassert>
#include <random>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <list>
#include <functional>
#include <bitset>
#include <tuple>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)

#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const int inf = numeric_limits<int>::max();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;





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

  int x,k;
  cin >> k >> x;
  int k2 = k/2;

  for (int i = x-k+1; i < x+k-1; i++){
    cout << i << ' ';
  }
  cout << x+k-1 << endl;

  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int n,W;
int weight[110],value[110];
int dp[110][10010];


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

    for(int i=0;i<n;i++){
        cin >> value[i] >> weight[i];
    }
    //dp[0][w]=0
    for(int i=0;i<W;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<n;i++){
        for(int w=0;w<=W;w++){
            if(w>=weight[i]){
                dp[i+1][w]=max(dp[i][w-weight[i]]+value[i],dp[i][w]);
            }
            else dp[i+1][w]=dp[i][w];
        }
    }
   
    cout << dp[n][W] << endl;
}



Measured memory_bytes: 7032
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main(void){
  char w[10]={},text[1000]={};
  int count=0;
  int i;
  
  scanf("%s",w);
  i=0;
  while(w[i]!=0){
    if(w[i]>='A'&&w[i]<='Z') w[i] = tolower(w[i]);
    i++;
  }
  
  while(1){
    scanf("%s",text);
    i=0;
    if(!strcmp(text,"END_OF_TEXT")){
      printf("%d\n",count);
      return(0);
    }
    while(text[i]!=0){
      if(text[i]>='A'&&text[i]<='Z')text[i] = tolower(text[i]);
      i++;
    }
    if(!strcmp(text,w)) count++;
  }
  return(0);
}

Measured memory_bytes: 1848
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using psi = pair<string, int>;
using vpsi = vector<psi>;
bool compare_psi(psi a, psi b)
{
    if (a.first != b.first)
    {
        return a.first < b.first;
    }
    else
    {
        return a.second > b.second;
    }
}
int main()
{
    int n;
    cin >> n;
    vpsi gb(n), cp(n);
    rep(i, n)
    {
        string s;
        int p;
        cin >> s >> p;
        gb[i] = make_pair(s, p);
        cp[i] = gb[i];
    }
    sort(cp.begin(), cp.end(), compare_psi);
    // rep(i, n)
    // {
    //     cout << cp[i].first << " " << cp[i].second << endl;
    // }
    rep(i, n)
    {
        rep(j, n)
        {
            if (cp[i] == gb[j])
                cout << j + 1 << endl;
        }
    }
}


Measured memory_bytes: 3656
import collections

num_of_numbers = int(input())
numbers = list(map(int, input().split()))
num_of_operation = int(input())

# intで初期化するため0が返る
cnt = collections.defaultdict(int)
# numbersに含まれる各数字の出現回数を保持
for i in numbers:
    cnt[i] += 1

# 初期状態の和を算出
ans = sum(numbers)

for i in range(num_of_operation):
    B, C = map(int, input().split())

    # 置換対象の数字が存在する場合
    if B in cnt:
        tmpB = cnt[B]
        tmpC = cnt[C]
        ans = ans - (B * tmpB) + (C * tmpB)

        cnt[C] = tmpC + tmpB
        cnt.pop(B)

    print(ans)




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

/*
lcm(a, b) = ab / gcd(a, b)
*/

int gcd(int a, int b) {
	while (b != 0) {
		int t = b;
		b = a % b;
		a = t;
	}
	return a;
}

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

int main() {
	int n, i;
	cin >> n;
	long temp = 1;

	int a;

	for (i = 0; i < n; i++) {
		cin >> a;
		temp = lcm(temp, a);
	}

	cout << temp << endl;
	return 0;
}

Measured memory_bytes: 3132
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#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;}

void solve();

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

void solve(){
    ll N,K;cin>>N>>K;
    vl a(N);rep(i,N)cin>>a[i];

    rep(i,N-K){
        if(a[i]<a[i+K]){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 4736
#include<cstdio>
#define MAX 10000
#define NIL -1

struct Node { int parent, left, right; };

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
    if(u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d + 1);
    setDepth(T[u].right, d + 1);
}

int setHight(int u) {
    int h1 = 0, h2 = 0;
    if(T[u].left != NIL)
        h1 = setHight(T[u].left) + 1;
    if(T[u].right != NIL)
        h2 = setHight(T[u].right) + 1;
    return H[u] = (h1 > h2 ? h1 : h2);
}

//節点uの兄弟を返す
int getSibling(int u) {
    if(T[u].parent == NIL) return NIL;
    if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
        return T[T[u].parent].left;
    if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
        return T[T[u].parent].right;
    return NIL;
}

void print(int u) {
    printf("node %d: ", u);
    printf("parent = %d, ", T[u].parent);
    printf("sibling = %d, ", getSibling(u));
    int deg = 0;
    if(T[u].left != NIL) deg++;
    if(T[u].right != NIL) deg++;
    printf("degree = %d, ",deg);
    printf("depth = %d, ",D[u]);
    printf("height = %d, ",H[u]);

    if(T[u].parent == NIL) {
        printf("root\n");
    }else if(T[u].left == NIL && T[u].right == NIL) {
        printf("leaf\n");
    }else {
        printf("internal node\n");
    }
}

int main() {
    int v, l, r, root = 0;
    scanf("%d",&n);

    for(int i = 0; i < n; i++) T[i].parent = NIL;

    for(int i = 0; i < n; i++) {
        scanf("%d %d %d",&v,&l,&r); //vは節点番号,lは左の子,rは右の子
        T[v].left = l;
        T[v].right = r;
        if(l != NIL) T[l].parent = v; //lは子供やけん、親はvになる
        if(r != NIL) T[r].parent = v; //同様
    }

    for(int i = 0; i < n; i++) if(T[i].parent == NIL) root = i; //root(根)は一つだけ

    setDepth(root, 0);
    setHight(root);

    for(int i = 0; i < n; i++) print(i);

    return 0;
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template<class A, class B>
inline bool chmax(A &a, const B &b) { return b > a ? a = b, 1 : 0; }

template<class A, class B>
inline bool chmin(A &a, const B &b) { return b < a ? a = b, 1 : 0; }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

//IN
void IN() {}
template<class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

//OUTS
template<size_t> struct int_{};
template<class Tuple, size_t Pos>
ostream& print_tuple(ostream& out, const Tuple& t, int_<Pos>) {
  out << get<tuple_size<Tuple>::value-Pos>(t) << " ";
  return print_tuple(out, t, int_<Pos-1>());
}

template <class Tuple>
ostream& print_tuple(ostream& out, const Tuple& t, int_<1>) {
  return out << get<tuple_size<Tuple>::value-1>(t);
}

template<class... Args>
ostream& operator<<(ostream& out, const tuple<Args...>& t) {
  return print_tuple(out, t, int_<sizeof...(Args)>());
}

#define OUTS(...) cout << make_tuple(__VA_ARGS__) << "\n";

//OUTL
void OUTL() {}
template<class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  VAR(int, a, b);
  cout << ((a%2==0 || b%2==0) ? "No" : "Yes") << "\n";
  return 0;
}


Measured memory_bytes: 256
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    ll x;cin>>x;
    ll ans = x/500LL;
    ans*=1000LL;
    x=x%500LL;
    ans += x-(x%5LL);
    cout<<ans<<"\n";
}


Measured memory_bytes: 256