akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;

int main() {

    cin.sync_with_stdio(0); cin.tie(0); 
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int n;cin>>n;
        int a[n];
        rep(i,n)cin>>a[i];
        int mi=INT_MAX,ans=0;
        for(int i=0;i<n;i++){
            mi=min(mi,a[i]);
            if(mi==a[i])ans++;
        }
        cout<<ans;
    }
    return 0;   
}

Measured memory_bytes: 1024
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, K = map(int, rl().split())
    MOD = 10 ** 9 + 7
    
    acc = [0] * (N + 1)
    for i in range(1, N + 1):
        acc[i] = (acc[i - 1] + i) % MOD
    
    ans = 0
    for i in range(K, N + 1):
        ans = (ans + acc[N] - acc[N - i] - acc[i - 1] + 1) % MOD
    ans = (ans + 1) % MOD
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 16816
A,B,K=map(int,input().split())
for i in range(1,K+1):
	if (i%2==1):
		if (A%2==1):
			A=A-1
		A=int(A/2)
		B=B+A
	else:
		if(B%2==1):
			B=B-1
		B=int(B/2)
		A=A+B
print(A,B)

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

//最終形は
//あるところから右は全て黒、左は白という形にしかならない
//問題はどこを境界にするか
//したがって、N個の境界(1個めの左から)について、その左側の黒と右側の黒の個数の合計を調べる=その境界を基準としたとき色変えする個数
//全ての白の個数をあらかじめもっておけば、for文1回で各境界でのchange回数がわかる。あとは保存するなり毎回比較するなりすればOK
using namespace std;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  
  int now_white = 0;
  for (int i=0; i<n; i++) if (s.at(i) == '.') now_white++;
  int now_white_right=now_white, now_black_left=0, min_change=now_white;
  for (int i=0; i<n; i++) {
    if (s.at(i) == '.') now_white_right--;
    else now_black_left++;
    min_change = min(now_white_right+now_black_left, min_change);
  }
  cout << min_change << endl;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> nums;
    int now = 1; // 今見ている数
    int cnt = 0; // nowがいくつ並んでいるか
    rep(i, N) {
        if (S[i] == (char) ('0' + now)) cnt++;
        else {
            nums.push_back(cnt);
            now = 1 - now; // 0と1を切り替える計算
            cnt = 1; // 新しくカウントする
        }
    }
    if (cnt != 0) nums.push_back(cnt);

    // 1110001100111 のような配列が欲しい
    // 1110001100 のように０で終わっていたら一つ足す
    if (nums.size() % 2 == 0) nums.push_back(0);

    int add = 2 * K + 1;
    int ans = 0;

    // 累積和を作る
    vector<int> sum(nums.size() + 1);
    rep(i, nums.size()) sum[i + 1] = sum[i] + nums[i];

    // 1110001100111 の1からカウントするので偶数番目から始める
    for (int i = 0; i < nums.size(); i += 2) {
        // 次のleft, rightを計算する
        int left = i;
        int right = min(i + add, (int) nums.size());
        int tmp = sum[right] - sum[left];
        ans = max(tmp, ans);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1272
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<array>
#include<cstdlib>
#include<ctime>
#include<climits>
using namespace std;

int f(int n){
	if(n % 2 == 0){
		return n / 2;
	}
	else{
		return 3 * n + 1;
	}
}

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

	//int a[1000000];
	vector<int> a;
	//vector<int> a(1000000);
	a.push_back(s);
	int ans = 0;
	for(int i = 1;; i++){
		a.push_back(f(a[i - 1]));

		for(int j = i - 1; j >= 0; j--){
			if(a[i] == a[j]){
				ans = i + 1;
				goto Exit;
			}
		}
	}

Exit:
	cout << ans << endl;
}

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

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

int main(void){
	int N;
	cin >> N;
	string a, b, c;
	cin >> a >> b;
	c = a[0];
	c += b[0];
	for (int i = 1; i < N; i++){
		c += a[i]; c += b[i];
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
N, M = tuple(map(int, input().split()))

lights = []
for m in range(M):
  lights.append(list(map(int, input().split()))[1:])
  
ps = list(map(int, input().split()))

num = 0
for i in range(2 ** N):
  bins = list(str(bin(i + 2 ** (N + 1)))[3:])
  for j, light in enumerate(lights):
    if ps[j] == sum([int(bins[l]) for l in light]) % 2:
      if j == M - 1:
        num += 1
    else:
      break
  
print(num)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	int n, m;
	int cards[1000] = {};

	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		cards[i] = a;
	}
	sort(begin(cards), end(cards), greater<int>());

	int ans = 0;
	for (int i = 0; i < m - 1; i++)
	{
		if (cards[i] >= n) continue;
		ans += (n - cards[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3136
// Problem : C - Ubiquity
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define vll vector<ll>
#define pll pair<ll,ll>
// #define M (ll)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005

ll fu(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result%M;
}
int main()
{
	FAST
    int t=1;
    ll M=1e9+7;
    while(t--)
    {
		ll n;
		cin>>n;
		if(n==1) cout<<0; else if(n==2) cout<<2;
		else
		{
			ll ans=((fu(10,n,M)+fu(8,n,M))%M-(2*fu(9,n,M))%M+M)%M;
			// ll s=(n*(n-1))%M;
			// ll ans1=(s*ans)%M;
			cout<<ans;
		}
    }
    return 0;
} 


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
int main() {
    int N, M;
    cin >> N >> M;
    list<int> list[N+1];
    int A, B;
    rep(i, M) {
        cin >> A >> B;
        list[A].push_back(B);
        list[B].push_back(A);
    }
    
    int guide[N+1];
    rep(i, N+1) guide[i] = 0;
    int count = 0;
    queue<int> q;
    q.push(1);
    while(!q.empty()) {
        int r = q.front();
        q.pop();
        for(auto l : list[r]) {
            if(guide[l] == 0) {
                guide[l] = r;
                q.push(l);
                count++;
            }
        }
    }
    if(count == N) {
        cout << "Yes" << endl;
        for(int i = 2; i < N+1; i++) {
            cout << guide[i] << endl;
        }
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 18876
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 10004
#define D 102
using namespace std;
typedef long long ll;
const ll Mod = 1e9 + 7;

int n, d;
ll f[N][D];
char s[N];

ll DP(int len, int now, int op) {
    if (len == 0) return !now;
    if (!op && f[len][now] != -1) return f[len][now];
    int num = s[n - len + 1] - '0';
    ll res = 0;
    for (int i = 0; i <= (op ? num : 9); ++i)
        (res += DP(len - 1, (now - i + d) % d, op & (i == num))) %= Mod;
    if (!op) f[len][now] = res;
    return res;
}

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    memset(f, -1, sizeof f);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    cin >> d;
    cout << ((DP(n, 0, 1) - 1) % Mod + Mod) % Mod;
    return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll a,b,c,d,ans=-1e18;
    cin>>a>>b>>c>>d;
    ans=max(ans,a*c);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    if ((a<=0&&0<=b)||(c<=0&&0<=d))
        ans=max(ans,0);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int min = Integer.MAX_VALUE;
		min = Math.min(min, getMax(h / 3, w, (h - h / 3) / 2 , w, h - h / 3 - (h - h / 3) / 2, w));
		min = Math.min(min, getMax(h / 3 + 1, w, (h - h / 3 - 1) / 2 , w, h - h / 3 - 1 - (h - h / 3 - 1) / 2, w));
		min = Math.min(min, getMax(h / 3, w, h - h / 3 , w / 2, h - h / 3, w - w / 2));
		min = Math.min(min, getMax(h / 3 + 1, w, h - h / 3 - 1, w / 2, h - h / 3 - 1, w - w / 2));
		min = Math.min(min, getMax(h, w / 3, h, (w - w / 3) / 2, h, w - w / 3 - (w - w / 3) / 2));
		min = Math.min(min, getMax(h, w / 3 + 1, h, (w - w / 3 - 1) / 2, h, w - w / 3 - 1 - (w - w / 3 - 1) / 2));
		min = Math.min(min, getMax(h, w / 3, h / 2, w - w / 3, h - h / 2, w - w / 3));
		min = Math.min(min, getMax(h, w / 3 + 1, h / 2, w - w / 3 - 1, h - h / 2, w - w / 3 - 1));
		System.out.println(min);
	}
	
	static int getMax(int ax, int ay, int bx, int by, int cx, int cy) {
		return Math.max(Math.max(ax * ay, bx * by), cx * cy) - Math.min(Math.min(ax * ay, bx * by), cx * cy);
	}
}


Measured memory_bytes: 22608
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli N,A,C=0,B,D=0;
  cin >> A >> B;
  vector<int>P(A);
  rep(i,A)cin >> P[i];
  rep(i,A)B-=P[i];
  Sort(P);
  C=B/P[0];
  Out(A+C);
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

int main(int argc, char const* argv[])
{
    string s;
    cin >> s;

    cout << s[0] << sz(s)-2 << s[sz(s)-1] << endl;

    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int a[200000];
map<int, ll> m[200004];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = gi();
    for (int i = 0; i < n; i++)
        a[i] = gi();

    m[0][0] = 0;
    m[1][0] = 0;
    m[1][1] = a[0];
    for (int i = 2; i <= n; i++) {
        int mx = (i+1)/2;
        int mn = n/2 - (n-i+1)/2;
        for (int h = mn; h <= mx; h++) {
            ll c = a[i-1] + m[i-2][h-1];
            if (m[i-1].find(h) != m[i-1].end()) {
                ll d = m[i-1][h];
                c = MAX(c, d);
            }
            m[i][h] = c;
        }
    }

    cout << m[n][n/2] << endl;

    return 0;
}


Measured memory_bytes: 38868
#include <bits/stdc++.h>
#define ls (o << 1)
#define rs (o << 1 | 1)
#define mid ((L + R) >> 1)
using namespace std;
const int MAXN = 100100;
const int mod = 998244353;
typedef long long LL;
typedef pair<int, int> PII;
int n, ll[MAXN], rr[MAXN];
priority_queue<LL> L;
priority_queue<LL, vector<LL>, greater<LL> > R;
int main() {
#ifdef TEST
	freopen("input.txt", "r", stdin);
#endif
	scanf("%d", &n);
	long long ans = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d%d", &ll[i], &rr[i]);
		ll[i] = rr[i] - ll[i];
	}
	L.push(rr[0]);
	R.push(rr[0]);
	LL l = 0, r = 0;
	for (int i = 1; i < n; ++i) {
		l += ll[i - 1];
		r += ll[i];
		LL topl = L.top() - l;
		LL topr = R.top() + r;
		if (rr[i] >= topl && rr[i] <= topr) {
			L.push(rr[i] + l);
			R.push(rr[i] - r);
		} else if (rr[i] > topr) {
			ans += rr[i] - topr;
			L.push(topr + l);
			R.pop();
			R.push(rr[i] - r);
			R.push(rr[i] - r);
		} else {
			ans += topl - rr[i];
			L.pop();
			R.push(topl - r);
			L.push(rr[i] + l);
			L.push(rr[i] + l);
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int N,T;
    cin >> N >>T;
    vector<pair<int, int>> vp(N);
    REP(n,0,N){
        cin >> vp[n].first >> vp[n].second;
    }
    
    int dp1[N+2][T+2];
    int dp2[N+2][T+2];
    //初期化
    REP(n,0,N+2){
        REP(t,0,T+2){
            dp1[n][t]=0;
            dp2[n][t]=0;
        }
    }

    //DP実行
    REP(n,1,N+1){
        REP(t,1,T+1){
            if(t-vp[n-1].first>=0){
                dp1[n][t] = max(dp1[n][t-1], dp1[n-1][t]);
                dp1[n][t] = max(dp1[n][t], dp1[n-1][t-vp[n-1].first] + vp[n-1].second);
            }else{
                dp1[n][t] = max(dp1[n][t-1], dp1[n-1][t]);
            }
        }
    }

    RREP(n,1,N+1){
        REP(t,1,T+1){
            if(t-vp[n-1].first>=0){
                dp2[n][t] = max(dp2[n][t-1], dp2[n+1][t]);
                dp2[n][t] = max(dp2[n][t], dp2[n+1][t-vp[n-1].first] + vp[n-1].second);
            }else{
                dp2[n][t] = max(dp2[n][t-1], dp2[n+1][t]);
            }
        }
    }

    // REP(i,1,N+1){
    //     REP(j,1,T+1){
    //         cout << dp1[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;
    // REP(i,1,N+1){
    //     REP(j,1,T+1){
    //         cout << dp2[i][j] << " ";
    //     }
    //     cout << endl;
    // }


    //n番目の要素を最後の1秒に持ってくる
    int ans=0;
    REP(n,1,N+1){
        REP(t,0,T){
            ans = max(ans, dp1[n-1][t]+vp[n-1].second+dp2[n+1][T-1-t]);
        }
    }
    P(ans);
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
long long dp[100010];

int main()
{
	int N,K;
	int h[100015];

	cin>>N>>K;

	for(int i=0;i<N;i++) cin>>h[i];

	for (int i = 0; i < 100010; ++i) dp[i] = LLONG_MAX;	
  
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for (int i = 2; i < N; ++i) {
		for(int j=1;j<K+1;++j){
                   if(i-j<0)continue;
			dp[i]=min(dp[i],dp[i - j] + abs(h[i] - h[i - j]));
		}
	}
	cout << dp[N-1] << endl;
}


Measured memory_bytes: 4808
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    //中心だお
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    double ans=w*h/2;
    int malt=(w==2*x&&h==2*y?1:0);
    printf("%.7f %d\n",ans,malt);
}

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

int main(){
	int N;
	cin >> N;
	int p[100001];
	rep(i,100001) p[i] = 0;
	rep(i,N) {
		int a;
		cin >> a;
		p[a]++;
	}
	int ans = 0;
	for (int i = 1; i < 100000; i++) {
		int psum = p[i-1] + p[i] + p[i+1];
		ans = max(ans, psum);
	}
	cout << ans << endl;
	return 0;
}


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

public class Main {
	static boolean p[];
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		Scanner sc=new Scanner(System.in);
		int n,i;

		while(true){
			n=sc.nextInt();
			if(n==0) break;
			p=new boolean[n+1];
			Arrays.fill(p, true);
			for(i=0;i<=n;i++){
				p[i]=prime(i);
			}
			for(i=n;1<i-2;i--){
				if(p[i] && p[i-2]){
					System.out.println((i-2)+" "+i);
					break;
				}
			}
		}
	}
	static boolean prime(int n){
		int i;
		if(n<=1 || n%2==0) return false;

		for(i=3;i*i<=n;i+=2){
			if(n%i==0){
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 12000
#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 n;
    cin >> n;
    int ans = 1;
    vector<string> s(n);
    rep(i, n) cin >> s.at(i);
    sort(s.begin(), s.end());
    rep(i, n-1){
        if(s.at(i+1) != s.at(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string a, b;
  cin >> a;
  cin >> b;
  int flag = 0;
  if (a.size() > b.size()) {
    flag = 1;
  }
  else if (a.size() < b.size()) {
    flag = 2;
  }
  else {
    for (int i = 0; i < a.size(); i++) {
      if (a[i] > b[i]) {
        flag = 1;
        break;
      }
      else if (a[i] < b[i]) {
        flag = 2;
        break;
      }
    }
  }

  if (flag == 0) {
    cout << "EQUAL" << endl;
  }
  else if (flag == 1) {
    cout << "GREATER" << endl;
  }
  else {
    cout << "LESS" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
def m(s):
    if 1 <= int(s) and int(s) <= 12:
        return True
    return False

S = input()
c1 = S[:2]
c2 = S[-2:]

if m(c1) and m(c2):
    ans = 'AMBIGUOUS'
elif m(c1):
    ans = 'MMYY'
elif m(c2):
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)


Measured memory_bytes: 3060
#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;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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

ll dp[3030][3030];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<int> a(N);
    REP(i,N){
        cin>>a[i];
        dp[i][i]=0;
    }

    for(int len=1;len<=N;len++){
        for(int i=0;i+len<=N;i++){
            int j = i+len;
            if((N-len) % 2 == 0) dp[i][j] = max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1]);
            else dp[i][j] = min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1]);
        }
    }
    cout<<dp[0][N]<<endl;
}

Measured memory_bytes: 71936
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		List<Integer> listSum = new ArrayList<Integer>();
		List<Integer> listAve = new ArrayList<Integer>();
		List<Integer> listTotal = new ArrayList<Integer>();

		int cnt = 0;
		int total = 0;
		double ave = 0;

		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str;
		while((str=br.readLine())!=null){
			String[] sp = str.split(",");

			listSum.add(Integer.parseInt(sp[0]));
			listAve.add(Integer.parseInt(sp[1]));
			listTotal.add(listSum.get(cnt) * listAve.get(cnt));
			cnt++;

			//if(cnt == 3)
				//break;
		}

		for(int i = 0; i < cnt; i++){
			total += listTotal.get(i);
			ave += listAve.get(i);
		}

		System.out.println(total);
		System.out.println(Math.round(ave / cnt));

	}

}

Measured memory_bytes: 24320
import math
n=int(input())
z=[list(map(int,input().split())) for i in range(n)]
a=math.factorial(n)
b=0
for i in range(n):
  for j in range(n):
    b=b+((z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2)**0.5
print((math.factorial(n)/n)*b/a)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 110

int N, M;
int T[MAX_N];
int P[MAX_N];
int X[MAX_N];

signed main()
{
    cin >> N;
    int sum = 0;
    REP(i, N) {
        cin >> T[i];
        sum += T[i];
    }
    cin >> M;
    REP(i, M) {
        cin >> P[i] >> X[i];
        P[i]--;
    }
    REP(i, M) {
        printf("%lld\n", sum - T[P[i]] + X[i]);
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define ld long double 
#define For(i, a, n) for(long long i = a; (a < n) ? (i < n) : (i > n); (a < n) ? (i++) : (i--))
#define ee 1000000007
#define pb push_back
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

void solve() {
	ll n, W;
	cin >> n >> W;
	ll w[n], v[n];
	For(i, 0, n) {
		cin >> w[i] >> v[i];
	}
	ll dp[n + 1][W + 1];
	For(i, 0, n + 1) { 
        For(j, 0, W + 1) { 
            if(i == 0 || j == 0) 
                dp[i][j] = 0; 
            else if(w[i - 1] <= j) 
                dp[i][j] = max(v[i - 1] + dp[i - 1][j - w[i - 1]], dp[i - 1][j]); 
            else
                dp[i][j] = dp[i - 1][j]; 
        } 
    }
    cout << dp[n][W];
}

int main() {
    fio;
    ll t = 1;
    //cin >> t;
    while(t--) {
    	solve();
    }
}

Measured memory_bytes: 82444
n,k = map(int,input().split())
p = list(map(int,input().split()))

exp = [(1+i)/2 for i in p]

s = []
sums = 0
for i in exp:
    sums += i
    s.append(sums)

exps = [s[k-1]]
for i in range(k,len(p)):
    exps.append(s[i] - s[i-k])
print(max(exps))

Measured memory_bytes: 28228
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>

int n, h, w;

int main() {
	scanf("%d %d %d", &n, &h, &w);
	printf("%d\n", (n - h + 1) * (n - w + 1));
	return 0;
}

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

int main() {
  int n,k,sum=1;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    if(sum>k)
      sum+=k;
    else
      sum*=2;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

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

  static class ABC150A {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int x = in.nextInt();
      out.println(500 * n >= x ? "Yes" : "No");
    }

  }
}



Measured memory_bytes: 23764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void push(int);
int pop();

int top, N[1000];

int main(){
  int a, b;
  top = 0;
  char s[100];

  while (scanf("%s",s) != EOF){
    if (s[0] == '+'){
      a = pop();
      b = pop();
      push(a+b);
    }
    else if (s[0] == '-'){
      b = pop();
      a = pop();
      push(a-b);
    }
    else if (s[0] == '*'){
      a = pop();
      b = pop();
      push(a*b);
    }
    else
      push(atoi(s));
  }
  printf("%d\n",pop());

  return 0;
}

void push(int x){
  N[top] = x;
  top++;
}

int pop(){
  top--;
  return N[top];
}



Measured memory_bytes: 2108
# coding: utf-8
# Your code here!

N, M = map(int, input().rstrip().split(' '))

S = []
for _ in range(M):
    S.append(list(map(int, input().rstrip().split(' ')))[1:])
P = list(map(int, input().rstrip().split(' ')))

count = 0
for i in range(2 ** N):
    temp = i
    X = []
    for j in range(N):
        X.append(temp // (2 ** (N-j-1)))
        temp -= X[-1] * 2 ** (N-j-1)
    
    temp_count = 0
    for j, s in enumerate(S):
        if sum([X[temp_s-1] for temp_s in s]) % 2 == P[j]:
            temp_count += 1
            
    if temp_count == M:
        count += 1

print(count)
            
    


Measured memory_bytes: 44892
n, k = map(int, input().split())
c, d = [0] * n, [0] * k
for i in range(k): d[i] = [int(x) for x in input().split()]
for i in range(n): c[i] = [int(x) - 1 for x in input().split()]
z = {}
def f(k, m):
    if (k, m) in z: return z[(k, m)]
    s = 0
    for i in range(n):
        for j in range(n):
            if (i + j) % 3 == m:
                s += d[c[i][j]][k]
    z[(k, m)] = s
    return s
def g(i, s):
    if i == 3: return 0
    m = None
    for l in range(k):
        if s[l]: continue
        s[l] = True
        r = g(i + 1, s)
        s[l] = False
        if r is None: continue
        r += f(l, i)
        if m is None or r < m: m = r
    return m
print(g(0, [False] * k))


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

using namespace std;
 
int main()
{
    int n,x;
    cin >>n >> x;
    int a[n];
    for(int i = 0; i<n;i++){
        cin >>a[i];
    }
    sort(a, a + n);
    int t = 0;
    int j = 0;
    while(x > 0 && j <n){
        x = x  - a[j];
        j++;
    }
    if(x>0){
        cout << n-1;
    }else{
        if(x ==0){
            cout << j;
        }else{
    cout << j-1;}
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class Main {

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st==null || !st.hasMoreElements()){
                try{
                    st=new StringTokenizer(br.readLine());
                }
                catch(IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str="";
            try{
                str=br.readLine();
            }
            catch(IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
       int s=in.nextInt();
       int w =in.nextInt();
       if(w>=s){
           System.out.println("unsafe");
       }else{
           System.out.println("safe");
       }
    }
}



Measured memory_bytes: 32776
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int32_t main()
{
	IOS;
	int n;
	cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; i++)
	{
		if(i % 3 == 0 || i % 5 == 0)
			continue;
		ans += i;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
using namespace std ;
int main( void )
{
	short w ,h ;
	cin >> h >> w ;
	short ans[ h ][ w + 1 ] = { 0 } ;
	char c[ h + 1 ][ w + 1 ] ;
	for( short i = 0 ; i < h ; i++ )
	{
		for( short j = 0 ; j < w ; j++ )
		{
			cin >> c[ i ][ j ] ;
		}
		short k = 0 ;
		for( ; k < w && c[ i ][ k ] == '.' ; k++ )
		{
			ans[ i ][ k ]-- ;
		}
		short p ;
		for( short j = k ; j < w ; j++ )
		{
			if( c[ i ][ j ] == 'c' )
			{
				p = j ;
				ans[ i ][ j ] = 0 ;
			}
			else
			{
				ans[ i ][ j ] = j - p ;
			}
		}
	}
	for( short i = 0 ; i < h ; i++ )
	{
		for( short j = 0 ; j < w ; j++ )
		{
			if( j < w - 1 )
			{
				cout << ans[ i ][ j ] << " " ;
			}
			else
			{
				cout << ans[ i ][ j ] << endl ;
			}
		}
	}
	return 0 ;
}

Measured memory_bytes: 3100
def intlist():
    k = [int(i) for i in input().split()]
    return k
def intmat(x):
    k = [[int(i) for i in input().split()] for i in range(x)]
    return k
#ここから下に書く
N,C = intlist()
d = intmat(C)
c = intmat(N)
anss=[]
numbercount0,numbercount1,numbercount2 = {},{},{}
for i in range(C):
    numbercount0[str(i)]=0
    numbercount1[str(i)]=0
    numbercount2[str(i)]=0
for i in range(N):
    for j in range(N):
        if (i+j+2)%3==0:
            numbercount0[str(c[i][j]-1)] +=1
        if (i+j+2)%3==1:
            numbercount1[str(c[i][j]-1)] +=1
        if (i+j+2)%3==2:
            numbercount2[str(c[i][j]-1)] +=1
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i==j or j==k or k==i:
                continue
            ans=0
            for l in range(C):
                ans+=d[l][i]*numbercount0[str(l)]
                ans+=d[l][j]*numbercount1[str(l)]
                ans+=d[l][k]*numbercount2[str(l)]
            anss+=[ans]
print(min(anss))

Measured memory_bytes: 7704
import sys
sys.setrecursionlimit(10**6)
def input():
	return sys.stdin.buffer.readline()[:-1]

n = int(input())
adj = [[] for _ in range(n)]
edges = []
for _ in range(n-1):
	a, b = map(int, input().split())
	edges.append((a-1, b-1))
	adj[a-1].append(b-1)
	adj[b-1].append(a-1)

grand_sum = [0 for _ in range(n)]
for i in range(n):
	grand_sum[i] = sum([len(adj[x]) for x in adj[i]]) - len(adj[i])

if n <= 3:
	print(*list(range(1, n+1)))
	sys.exit()

ans = [-1 for _ in range(n)]
#ONE, TWO = n//3 + (n%3 > 0), n//3 + (n%3 > 1)

tri = [0 for _ in range(n)]
for a, b in edges:
	tri[b] += grand_sum[a] - len(adj[b]) + 1
	tri[a] += grand_sum[b] - len(adj[a]) + 1
	#print(a, b)
	#print(tri_a, tri_b)
	#print("---")
#print(tri)

#THREE = 3
#for i, t in enumerate(tri):
#	if t >= n - (n//3):
#		if THREE > n:
#			print(-1)
#			sys.exit()
#		ans[i] = THREE
#		THREE += 3

flg = False
orig = -1
for i, t in enumerate(tri):
	if t >= n - (n//3):
		flg = True
		orig = i

#parity = [0, 0]
signs = [-1 for _ in range(n)]
def dfs(x):
	for v in adj[x]:
		if signs[v] < 0:
			signs[v] = 1 ^ signs[x]
			dfs(v)

signs[0] = 0
dfs(0)

if flg:
	cur = [1, 2, 3]
	for i in range(n):
		if signs[i] == signs[orig]:
			ans[i] = cur[2]
			cur[2] += 3
		elif cur[0] <= n:
			ans[i] = cur[0]
			cur[0] += 3
		elif cur[1] <= n:
			ans[i] = cur[1]
			cur[1] += 3
		else:
			ans[i] = cur[2]
			cur[2] += 3
	print(*ans)
	sys.exit()

num1 = sum(signs)
num2 = n - num1

#print(signs)

M, m = max(num1, num2), min(num1, num2) 

if max(num1, num2) >= n - (n // 3):
	if num1 > num2:
		more = 0
	else:
		more = 1
	cur = [1, 2, 3]
	for i in range(n):
		if signs[i] == more:
			ans[i] = cur[2]
			cur[2] += 3
		elif cur[0] <= n:
			ans[i] = cur[0]
			cur[0] += 3
		elif cur[1] <= n:
			ans[i] = cur[1]
			cur[1] += 3
		else:
			ans[i] = cur[2]
			cur[2] += 3
	print(*ans)
	sys.exit()

#	print(-1)
#	sys.exit()
#else:
if num1 > num2:
	one, two = num1, num2
	more = 1
else:
	one, two = num2, num1
	more = 0
cur = [2, 1, 3]
for i in range(n):
	if ans[i] > 0:
		continue
	if signs[i] == more:
		if cur[1] > n and cur[2] <= n: 
			ans[i] = cur[2]
			cur[2] += 3
		elif cur[1] > n and cur[2] > n:
			ans[i] = cur[0]
			cur[0] += 3
		else:
			ans[i] = cur[1]
			cur[1] += 3
	else:
		if cur[0] > n and cur[2] <= n:
			ans[i] = cur[2]
			cur[2] += 3
		elif cur[0] > n and cur[2] > n:
			ans[i] = cur[1]
			cur[1] += 3
		else:
			ans[i] = cur[0]
			cur[0] += 3
print(*ans)


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

using namespace std;

const long long MOD = 1000000007;
const int MAX = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  long long n, m, k, sum, max = 0, input, l, r;
  cin >> n >> m >> k;
  vector<long long> a(n + 1, 0), b(m + 1, 0);
  sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> input;
    sum += input;
    a[i + 1] = sum;
  }
  sum = 0;
  for (long long i = 0; i < m; i++) {
    cin >> input;
    sum += input;
    b[i + 1] = sum;
  }
  for (long long i = 0; i < n + 1; i++) {
    l = 0;
    r = m + 1;
    while (l + 1 < r) {
      if (a[i] + b[(l + r) / 2] > k) {
        r = (l + r) / 2;
      } else {
        l = (l + r) / 2;
      }
    }
    if (l == 0 && a[i] > k) {
      break;
    }
    if (max < l + i) {
      max = l + i;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 6412
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define ran(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main(void)
{
    int N, W;
    vector<int> w(110);
    vector<int> v(110);
    vector<ll> dp(100010, MOD);
    int i, j, k;
    ll ans = 0;
    ll sum = 0;

    cin >> N >> W;

    ran(i, 1, N)
    {
        cin >> w[i] >> v[i];
        sum += v[i];
    }

    dp[0] = 0;

    for (i = 1; i <= N; i++)
    {
        for (j = sum; j >= v[i]; j--)
        {
            dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
        }
    }

    for (i = 1; i <= sum; i++)
    {
        if (dp[i] <= W)
        {
            ans = max(ans, (ll)i);
        }
    }

    cout << ans << endl;
}

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

void solve(){
    map<string, int> cnt;
    int n; cin >> n;
    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;
        cnt[s]++;
    }

    for(auto a : {"AC", "WA", "TLE", "RE"}){
        cout << a << " x " << cnt[a] << '\n';
    }
}

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

Measured memory_bytes: 3664
class Dice:
    def __init__(self, hoge):
        self.num = hoge
        self.face = {'U': 0, 'W': 3, 'E': 2, 'N': 4, 'S': 1, 'B': 5} 
    
    def move(self, direct):
        previouse = {k: v for k, v in self.face.items()}
        if direct == 'E':
            self.face['U'] = previouse['W']
            self.face['W'] = previouse['B']
            self.face['E'] = previouse['U']
            self.face['B'] = previouse['E']
        elif direct == 'W':
            self.face['U'] = previouse['E']
            self.face['W'] = previouse['U']
            self.face['E'] = previouse['B']
            self.face['B'] = previouse['W']
        elif direct == 'N':
            self.face['U'] = previouse['S']
            self.face['N'] = previouse['U']
            self.face['S'] = previouse['B']
            self.face['B'] = previouse['N']
        elif direct == 'S':
            self.face['U'] = previouse['N']
            self.face['N'] = previouse['B']
            self.face['S'] = previouse['U']
            self.face['B'] = previouse['S']
    
    def get_upper(self):
        return self.num[self.face['U']]
        
if __name__ == '__main__':
    dice = Dice([int(x) for x in input().split()])
    for d in input():
        dice.move(d)
    print (dice.get_upper())


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

import sys

input = iter(sys.stdin.read().splitlines()).__next__

def solve(X, K, D):
   if X < 0:
      X = -X
   if X - K*D >= 0:
      return X - K*D
   k = X // D
   X -= k*D
   assert X >= 0
   K -= k
   assert K > 0

   K %= 2
   if K == 1:
      X -= D
   if X < 0:
      X = -X
   return X

X, K, D = map(int, input().split())

res = solve(X, K, D)
print(res)



Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll x[n],y[n];
    bool maki=false;
    for(int i=0;i<n;i++){
    	cin>>x[i]>>y[i];
    	if(i)if(((x[i]+y[i])&1)!=((x[i-1]+y[i-1])&1))maki=true;
    }
    if(maki){
    	cout <<-1 <<endl;
    	return 0;
    }
    vector<ll> d;
    for(int i=30;i>=0;i--){
    	d.pb(1LL<<i);
    }
    if(((x[0]+y[0])&1)==0)d.pb(1);
    cout<<d.size()<<endl;
    for(auto& i:d)cout << i <<" ";
    cout <<endl;
    for(int i=0;i<n;i++){
    	ll a=0,b=0;
    	for(auto& j:d){
    		if(abs(a-x[i])>=abs(b-y[i])){
    			if(a>=x[i])a-=j,cout<<"L";
    			else a+=j,cout<<"R";
    		}else{
    			if(b>=y[i])b-=j,cout<<"D";
    			else b+=j,cout << "U";
    		}
    	}
    	cout << endl;
    }
    return 0;
}


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

int main()
{
  int hs[10];
  for(int i=0; i<10; i++){
    cin >> hs[i];
  }
  sort(hs, hs + 10);
  cout << hs[9] << endl;
  cout << hs[8] << endl;
  cout << hs[7] << endl;
}

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

int main() {

    int k,x;
    cin >> k >> x;
    int a=k-1;
    int b=x-a;
    int c=x+a;
    
    for(int i=b;i<=c;i++) 
    cout << i << " " ;
    
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val xy =  scala.io.StdIn.readLine()
  val xyArray = xy.split(" ").map(_.toInt).toSeq
  val x = xyArray(0)
  val y = xyArray(1)

  if (y % 2 != 0) {
    println("No")
  } else if (x * 4 < y) {
    println("No")
  } else if (x * 2 > y){
    println("No")
  } else {
    println("Yes")
  }
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

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

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF = 1e18;
const int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);
void coutY();
void coutN();
LL ave(LL, LL);

int main() {
	int x,t; cin >> x>>t;
	cout << max(x - t, 0);
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}
void coutY() {
	cout << "Yes" << endl;
	return;
}
void coutN() {
	cout << "No" << endl;
	return;
}
LL ave(LL a, LL b) {
	return (a + b) / 2;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
#define F first
#define S second
#define pb push_back 
#define mp make_pair
#define vi vector <int>
#define vb vector <bool>
#define vc vector <char>
#define vll vector <ll>
#define vs vector <string>
#define pll pair < ll , ll >
#define pld pair < ld , ld >
#define pii pair < int , int >
#define vpld vector < pld >
#define vpii vector < pii >
#define vpll vector < pll >
#define vvi vector < vector < int > >
#define vvll vector < vector < ll > >
#define vvld vector < vector < ld > >
#define vvb vector < vector < bool > >
#define vvpii vector < vector < pii > >
#define all(v) (v).begin() , (v).end()
#define allrev(v) (v).rbegin() , (v).rend()
#define dist(x1 , y1 , x2 , y2) sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
const int MOD = 1e9 + 7 ;
const int infi = INT_MAX ;
const ll infll = LLONG_MAX ;
const int dx4[] = {0 , -1 , 0 , 1} ;
const int dy4[] = {-1 , 0 , 1 , 0} ;
const int dx8[] = {-1 , -1 , -1 , 0 , 1 , 1 , 1 , 0} ;
const int dy8[] = {-1 , 0 , 1 , 1 , 1 , 0 , -1 , -1} ;
const ld PI = 3.1415926535897932384626 ;

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

ll pow_mod(ll a , ll b , ll m) {
	ll ans = 1 ;
	while(b)
	{
		if (b&1) {
			ans = (ans*a) % m ;
		}
		b /= 2 ;
		a = (a*a) % m ;
	}
	return ans ;
}

bool isprime(ll num) {
    for (ll i = 2 ; i * i <= num ; ++i)
        if (num % i == 0) {
        	return false ;
		}
    return true;
}

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 / gcd(a , b)) * b) ;
}

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

void solve (int test_case) {
	ll n ;
	cin >> n ;
	cout << n + n*n + n*n*n << "\n" ;
}

int main() {
	ios_base :: sync_with_stdio (false) ;
	cin.tie(0) ;
	cout.tie(0) ;
	int tc = 1 ;
	//cin >> tc ;
	while (tc--) {
		solve (tc) ;
	}
	return 0 ;
}


Measured memory_bytes: 3648
def solve(n, a):
    a = sorted(a)
    total = 0
    optimal = 0
    for i in range(n-1):
        total += a[i]
        if total * 2 < a[i+1]:
            optimal = i+1
    return n - optimal

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))


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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

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(){
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  
  vector<int>dp(N, INF);
  dp[0] = 0;
  
  for(int i = 1; i < N; i++){
    for(int j = 1; j <= K; j++){
      if(i - j < 0) break;
      dp[i] = min(dp[i], abs(A[i] - A[i - j]) + dp[i - j]);
    }
  }
print(dp[N - 1]);
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b, t;
	cin >> a >> b >> t;
	cout << t / a * b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    ll N, ans = 0;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        ans += max(0LL, (N - 1) / i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>

using namespace std;

int main() {
	
	int n;
	
	while( cin >> n ) {
		
		int A[100] = {};
		int B[100] = {};
		int C[100] = {};
		long long P[3] = {};
		
		for(int i=0;i<n;i++)
		cin >> A[i];
		for(int i=0;i<n;i++)
		cin >> B[i];
		
		for(int i=0;i<n;i++) {
			
			P[0] += abs( A[i] - B[i] );
			P[1] += pow(abs( A[i] - B[i] ), 2);
			P[2] += pow(abs( A[i] - B[i] ), 3);
			C[i] = abs(A[i] - B[i]);
		}
		sort(C, C+n);
		cout << fixed << setprecision(8) << (double) P[0] << "\n"
		 	 << sqrt(P[1]) << "\n"
		 	 << cbrt(P[2]) << "\n"
		 	 << (double) C[n-1] << "\n";
	}
	return 0;
}


Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  

  if(N.at(N.size()-1) == '3'){
    cout << "bon" << endl;
  }
  if(N.at(N.size()-1) == '0' || N.at(N.size()-1) == '1' || N.at(N.size()-1) == '6' || N.at(N.size()-1) == '8'){
    cout << "pon" << endl;
  }
  if(N.at(N.size()-1) == '2' || N.at(N.size()-1) == '4' || N.at(N.size()-1) == '5' || N.at(N.size()-1) == '7' || N.at(N.size()-1) == '9'){
    cout << "hon" << endl;
  }
}
  

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <bitset>
#include <string>
#include <fstream>
#include <cmath>
#include <climits>
#include <vector>
#include <unordered_map>
using namespace std;

#define ll long long

int main()
{
	ll n, x, y;
	cin >> n >> x >> y;
	
	vector<ll> ans(n);
	
	for(ll i = 1; i <= n; i++)
	{
		for(ll j = i + 1; j <= n; j++)
		{
			ll minDistance = min(abs(j - i), min(abs(x - i) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j)));
			ans[minDistance]++;
		}
	}
	
	for(ll i = 1; i <= n - 1; i++)
	{
		cout << ans[i] << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 256