akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int n, m;
vector<int> g[100];
bool visited[100];

int dfs(int from, int cnt) {
	if (cnt >= n - 1) return 1;
	visited[from] = true;
	int ret = 0;
	for (int to : g[from]) {
		if (visited[to]) continue;
		ret += dfs(to, cnt + 1);
	}
	visited[from] = false;
	return ret;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	cout << dfs(0, 0) << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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 ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}

int main() {
  vector <int> v(3);
  rep(i, 3) cin >> v.at(i);
  sort(v.begin(), v.end());
  string ans = "No";
  if ((v.at(0) == v.at(1)) && (v.at(1) != v.at(2))) {
    ans = "Yes";
  } else if ((v.at(1) == v.at(2)) && (v.at(0) != v.at(1))) {
    ans = "Yes";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    string S;
    ll K;
    cin >> S >> K;
    rep(i, 0, K) {
        if(S[i] != '1') {
            cout << S[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main(void) {
	int a ,c=0;
	std::vector<int> v;
	std::cin >> a;
	v.assign(a,0);
	for (int l1 = 0; l1 < a; l1++)
		std::cin >> v[l1];
	bool esc = false;
	while (1) {
		
		for (int l1 = 0; l1 < v.size(); l1++) {
			if (v[l1] % 2 != 0)
				esc++;
			v[l1] = v[l1] >> 1;
		}
		if (esc)
			break;
		c++;
	}
	std::cout << c << std::endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdbool.h>
int main() {
	char a[200][200];
	char b[200][200];
	char c[200][200];
	bool check = false;;
	int H, W,i,j,y,t;
	//入力
	scanf("%d %d", &H, &W);
	for (i = 0; i < H; i++) {
		for (j = 0; j <= W; j++) {
			scanf("%c", &a[i][j]);
		}
	}

	y = 0;
	for (i = 0; i < H; i++) {
		check = false;
		for (j = 0; j <= W; j++) {
			if (a[i][j] == '#') {
				check = true;
			}
		}
		if (check) {
			for (j = 0; j <= W; j++) {
				b[y][j] = a[i][j];
			}
			y++;
		}
	}

	//printf("y=%d", y);
	/*for (i = 0; i < y; i++) {
		for (j = 0; j <= W; j++) {
			printf("%c",b[i][j]);
		}
	}*/


	t = 0;
	for (i = 0; i <= W; i++) {
		check = false;
		for (j = 0; j < y; j++) {
			if (b[j][i] == '#') {
				check = true;
			}
		}
		if (check) {
			for (j = 0; j < y; j++) {
				c[j][t] = b[j][i];
			}
				t++;
		}
	}



	//printf("t=%d", t);
	for (i = 0; i < y; i++) {
		//for (j = 0; j <= t; j++) {
		//printf("%c",c[i][j]);
		//}
		c[i][t] = '\n';
	}

		for (i = 0; i < y; i++) {
			for (j = 0; j <= t; j++) {
				printf("%c", c[i][j]);
			}
		}

	return 0;
}

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

const int MOD=26;
class BIT{
    int n;
    vector<int> dat;
    public:
    BIT(int n):n(n),dat(n,0){};
    void add(int pos,int x){
        pos++;
        while(pos<=n){
            dat[pos-1]=(dat[pos-1]+x)%MOD;
            pos+=(pos & -pos);
        }
    }
    int sum(int pos){
        pos++;
        int res=0;
        while(pos>0){
            res=res+dat[pos-1];
            pos-=(pos & -pos);
        }
        return (res%MOD+MOD)%MOD;
    }
    void debug(){
        cerr<<"####"<<endl;
        for(int i=0;i<n;i++){
            cerr<<dat[i]<<" ";
        }
        cerr<<endl;
    }
};
int main(){
    string s;
    cin>>s;
    int erasep=s.size()+2;
    if(s.size()%2==1){
        erasep=s.size()/2;
        string buf;
        for(int i=0;i<s.size();i++){
            if(i!=erasep) buf+=s[i];
        }
        s=buf;
    }
    int n;
    cin>>n;
    vector<int> l,r;
    for(int i=0;i<n;i++){
        int tmpl,tmpr;
        cin>>tmpl>>tmpr;
        tmpl--,tmpr--;
        if(tmpl==tmpr && tmpl==erasep) continue;
        if(erasep<tmpl) tmpl--;
        if(erasep<=tmpr) tmpr--;
        cerr<<tmpl<<" "<<tmpr<<endl;
        l.push_back(tmpl),r.push_back(tmpr);
    }
    n=l.size();

    vector<int> v(s.size()/2);
    for(int i=0;i<v.size();i++){
        v[i]=(int)(s[s.size()-1-i])-(int)(s[i]);
    }

    vector<set<int>> com(v.size());
    for(int i=0;i<n;i++){
        if(r[i]<v.size()){
            com[l[i]].insert(r[i]);
        }
        else if(v.size()<=l[i]){
            com[s.size()-1-r[i]].insert(s.size()-1-l[i]);
        }
        else{
            int dl=v.size()-l[i];
            int dr=r[i]-v.size()+1;
            if(dl<dr){
                com[s.size()-1-r[i]].insert(v.size()-1-dl);
            }
            if(dl>dr){
                com[l[i]].insert(v.size()-1-dr);
            }
        }
    }
    BIT bit(v.size()+1);
    for(int i=0;i<v.size();i++){
        if(com[i].empty()){
            int x=bit.sum(i)+v[i];
            if(x%MOD!=0){
                cout<<"NO"<<endl;
                return 0;
            }
        }
        else{
            int x;
            int pre=-1;
            for(auto &e:com[i]){
                if(pre==-1){
                    pre=e;
                    x=e;
                }
                else{
                    com[pre+1].insert(e);
                    pre=e;
                }
            }
            int y=-(bit.sum(i)+v[i]);
            bit.add(i,y);
            bit.add(x+1,-y);
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main() {
    int x; cin >> x;
    int now = 0;
    int k = 0;
    
    while(1){
        now = (now + x) % 360;
        k++;
        if(now == 0){
            break;
        }
    }
    
    cout << k << endl;
    return;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 3616
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a,v;
		int maxPtr=0;
		int max=-1;
		for(int i=0;i<n;i++){
			a=sc.nextInt();
			v=sc.nextInt();
			if(v>max||max==v&&a<maxPtr){
				max=v;
				maxPtr=a;
			}
		}
		System.out.println(maxPtr+" "+max);
	}
}

Measured memory_bytes: 17188
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getLine >>= putStrLn

solve :: String -> String
solve = map f
  where
    f c = head . drop 23 . dropWhile(/= c) $ ['A'..'Z'] ++ ['A'..'Z']

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
#define finish(x) reutrn cout << x << endl, 0;
#define ll long long

int d, dp[10001][101][2], mod = 1e9 + 7;
string k;
string c;

int solve(int ind, int cur, int b){
    if(ind == k.size()) return cur == 0;
    int &ret = dp[ind][cur][b];
    if(ret != -1) return ret;
    ret = 0;
    for(int i = 0 ; i <= (b == 0 ? k[ind] - '0' : 9) ; i++)
        ret = (ret + solve(ind + 1, (cur + i) % d, b || (i < k[ind] - '0'))) % mod;
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> k >> d;
    cout << (solve(0, 0, 0) - 1 + mod) % mod << endl;
}


Measured memory_bytes: 9088
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int f[100100],a[100100],b[100100],n;
int main()
{
    scanf("%d",&n);
    int a1=(n+1)/2,b1=n-a1,i;
    int maxd=-1;
    for (i=1;i<=n;i++) {scanf("%d",&f[i]);maxd=max(maxd,f[i]);}
    bool same=1;
    for (i=1;i<n;i++) if (f[i]!=f[i+1]) {same=0;break;}
    if (same) {printf("%d\n",n/2);return 0;}
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    for (i=1;i<=n;i+=2) a[f[i]]++;
    for (i=2;i<=n;i+=2) b[f[i]]++;
    int ans1=0,ans2=0,best1=0,best2=0;
    for (i=1;i<=maxd;i++) 
    {
        if (a[i]>ans1) {ans1=a[i];best1=i;}
        if (b[i]>ans2) {ans2=b[i];best2=i;}
    }
    if (best1!=best2) {printf("%d",n-ans1-ans2);return 0;}
    int ans3=0,ans4=0,best3=0,best4=0;
    a[best1]=0;b[best2]=0;
    for (i=1;i<=maxd;i++) 
    {
        if (a[i]>ans3) {ans3=a[i];best3=i;}
        if (b[i]>ans4) {ans4=b[i];best4=i;}
    }
    int tmp=max(ans1+ans4,ans2+ans3);
    printf("%d",n-tmp);
    return 0;
}


Measured memory_bytes: 1408
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 2e5 + 5;
const int M = 201;
const int Q = 2e5 + 5;
const int OO = 2e9;
const int mod = 998244353;

int n,a[N],vis[N];
ll k;
vector<int> ans;

void init() {
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k;

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

    int nxt = 1;

    while(!vis[nxt]) {

        vis[nxt] = 1;
        nxt = a[nxt];
        if(!(--k)) return cout << nxt << '\n', 0;

    }

    memset(vis,0,sizeof vis);

    while(!vis[nxt]) {

        vis[nxt] = 1;
        ans.pb(nxt);
        nxt = a[nxt];

    }

    cout << ans[k%int(ans.size())] << '\n';

    return 0;
}

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

int main() {
			int N;
  cin >> N;
  string colour;
  for(int i = 0; i < N; i++){
    	cin >> colour;
    if(colour == "Y"){cout << "Four" << endl;
                      break;}
	else if(i == N-1 && colour != "Y")
    {cout << "Three" << endl;}
    else if(colour == "P" || colour == "G" || colour == "W")
    				{continue;}}
    }

Measured memory_bytes: 3624
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
  
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        {
           
            int a=sc.nextInt();
            int b=sc.nextInt();
            System.out.println(a*b*1l);
        }
            
    }
   
}

Measured memory_bytes: 35796
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

B = [0] * (N - 1)
C = [0] * (N - 1)

for n in range(N - 1):
    if n == 0:
        B[0] = A[0]
        C[N - 2] = A[N - 1]
    else:
        B[n] = gcd(B[n - 1], A[n])
        C[N - n - 2] = gcd(A[N - n - 1], C[N - n - 1])

ans = 0
for n in range(N):
    if n == 0:
        ans = C[0]
    elif n == N - 1:
        ans = max(ans, B[N - 2])
    else:
        ans = max(ans, gcd(B[n - 1], C[n]))
print(ans)

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

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

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

using namespace std;

int main(){
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if(N > K){
    cout << K * X + (N - K) * Y << endl;
  }
  else{
	 cout << N * X << endl;
  }
  return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
   bool flg=true;
   ll n,m;cin >>n>>m;
   if(n!=m)flg=false;
   if(flg)puts("Yes");
   else puts("No");
    return 0;
}



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

int main(){
    int a,b,ans;
    scanf("%d %d", &a, &b);
    if(0<=a && a<=5){
        ans = 0;
    }else if(5<a && a<=12){
        ans = b/2;
    }else{
        ans = b;
    }

    printf("%d\n",ans);

    return 0;
}

        



Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 10;
int pt = 0;

typedef long long llong;
vector<llong> num;

llong D[N][N];

void add(int x) {
    if (find(num.begin(), num.end(), x) == num.end())
        num.push_back(x);
}

int pos(int x) {
    return find(num.begin(), num.end(), x) - num.begin();
}

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    add(a);
    add(b);
    add(-a);
    add(-b);
    add(0);
    int n = num.size();
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int a = num[i], b = num[j];
            D[i][j] = (llong)1e10;
            if (a == -b)
                D[i][j] = min(D[i][j], 1ll);
            else if (a <= b) {
                D[i][j] = min(D[i][j], (llong)b - a);
            }
        }
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
            }
        }
    }
    printf("%lld\n", D[pos(a)][pos(b)]);
}


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

int main(){
    int A, B;

    cin >> A >> B;

    if((A+B)%2==1){
        puts("IMPOSSIBLE");
        return 0;
    }

    cout << (A+B) / 2 << endl;
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int N;
vector<int> A;
vector<vector<int> > X;
vector<vector<int> > Y;
int ANS = 0;

void check(int xy[]){
    bool flag = true;
    rep(i, N){
        // 不親切の仮定なら発言の判定はしない
        if(xy[i] == 0) continue;
        rep(j, Y[i].size()){
            if(xy[X[i][j] - 1] != Y[i][j]){
                flag = false;
                break;
            }
        }
    }
    int ans = 0;
    if(flag){
        rep(i, N){
            if(xy[i] == 1) ans++;
        }
    }
    ANS = max(ANS, ans);
}

void rec(int n, int xy[]){
    if(n != N){
        xy[n] = 1;
        rec(n + 1, xy);
        xy[n] = 0;
        rec(n + 1, xy);
    }else{
        // 場合分け完了したらそれぞれチェック
        check(xy);
    }
}

int main() {
    cin >> N;
    A.resize(N);
    X.resize(N);
    Y.resize(N);
    rep(i, N){
        cin >> A[i];
        X[i].resize(A[i]);
        Y[i].resize(A[i]);
        rep(j, A[i]){
            cin >> X[i][j] >> Y[i][j];
        }
    }

    // 再帰関数で判定
    int xy[N];
    rec(0, xy);
    OP(ANS);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#define rep(i, a, n) for(int i = int(a);i < int(n);++i)
#define repe(i, a, n) for(int i = int(a);i <= int(n);++i)
#define repr(i, a, n) for(int i = int(a);i > int(n);--i)
#define reper(i, a, n) for(int i = int(a);i >= int(n);--i)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using namespace std;


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
map<int, int> enumpr(int n) {
    map<int, int> V;
    for (int i = 2; 1LL * i*i <= n; i++) while (n%i == 0) V[i]++, n /= i;
    if (n > 1) V[n]++;
    return V;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    
    map<int, int> sm;
    rep(i, 1, N + 1) {
        auto ep = enumpr(i);
        fore(p, ep) sm[p.first] += p.second;
    }

    int ans = 0;

    // 75
    rep(a, 2, N + 1) if (74 <= sm[a]) ans++;

    // 15*5
    rep(a, 2, N + 1) rep(b, 2, N + 1) if (a != b and 14 <= sm[a] and 4 <= sm[b]) ans++;

    // 3*25
    rep(a, 2, N + 1) rep(b, 2, N + 1) if (a != b and 24 <= sm[a] and 2 <= sm[b]) ans++;


    // 3*5*5
    rep(a, 2, N + 1) rep(b, 2, N + 1) rep(c, b + 1, N + 1) {
        if (a != b and a != c and 2 <= sm[a] and 4 <= sm[b] and 4 <= sm[c]) ans++;
    }   
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define max(a, b) ((a) > (b) ? (a) : (b))

int n, t, s, a[3002], b[3002];
int dp[3002][3002];
int i, j, ans;

int main(){
  scanf("%d%d%d", &n, &t, &s);
  for(i = 0;i < n;i++){
    scanf("%d%d", a + i, b + i);
  }
  for(i = 0;i < n;i++){
    for(j = 0;j <= t;j++){
      dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
      if(j + b[i] <= t){
	if(j < s && s < j + b[i])continue;
	dp[i + 1][j + b[i]] = max(dp[i + 1][j + b[i]], dp[i][j] + a[i]);
      }
    }
  }
  ans = 0;
  for(i = 0;i <= t;i++){
    ans = max(ans, dp[n][i]);
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 35808
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main(void)
{
	int n, x;
	
	std::cin >> n >> x;
	
	while( n != 0 || x != 0 )		
	{
		int ans = 0;
		for(int i = 1; i <= n; ++i)
		{
			for(int j = i + 1; j <= n; ++j)
			{
				for(int k = j + 1; k <= n; ++k)
				{	
					if( i + j + k == x ) ans++;
				}
			}
		}
		
		std::cout << ans << std::endl;
		std::cin >> n >> x;
	}		
	
	return 0;
}



Measured memory_bytes: 3084
#include<iostream>
#include<string>
#include<bitset>

using namespace std;

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

	int max = 0;

	int len = S.length();
	bitset<26> left, right;
	for (int i = 0; i < len; ++i) {
		left.reset();
		right.reset();

		for (int j = 0; j < len; j++) {
			if (j <= i) { // ;eft
				left |= (1 << (S[j] - 'a'));
			}
			else { // right
				right |= (1 << (S[j] - 'a'));
			}
		}

		if (max < (left & right).count()) max = (left & right).count();
	}

	cout << max << endl;

	return 0;
}

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

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));
    for (int i = 0; i < N; i++)
    {
        cin >> C.at(i);
        for (int j = 0; j < M; j++)
        {
            cin >> A.at(i).at(j);
        }
    }

    int res = INT_MAX;
    for (int p = 0; p < (1 << N); p++)
    {
        int sumC = 0;
        vector<int> sumA(M, 0);
        for (int i = 0; i < N; i++)
        {
            if ((p >> i) & 1)
            {
                sumC += C.at(i);
                for (int j = 0; j < M; j++)
                {
                    sumA.at(j) += A.at(i).at(j);
                }
            }
        }
        bool b = true;
        for (int j = 0; j < M; j++)
        {
            if (sumA.at(j) < X)
            {
                b = false;
                break;
            }
        }
        if (b)
        {
            res = min(res, sumC);
        }
    }
    cout << ((res == INT_MAX) ? -1 : res) << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<string>
#include<stdio.h>
#include<cmath>
#include<map>
#include<bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long
// 最大公約数を求める
long gcd(long x, long y){
    if (x > y)
        return gcd(y, x);
    
    long m = 1;
    while(m != 0){
        m = y % x;
        y = x;
        x = m;
    }
    return y;
}

// 最小公倍数を求める
long lcm(long x, long y){
    return x * y / gcd(x, y);
}

int main(){
    long a,b; cin>>a>>b;
    cout << lcm(a, b) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int s;
	cin >> s;
	int pt1=0;
	int pt2 = 0;
	int s1 = s%100;
	if(s/100 > 0 && s/100 < 13){
		pt1 = 1;
	}else if(s/100 == 0){
		pt1 = 2;
	}
	if(s1 > 0 && s1 < 13){
		pt2 = 1;
	}else if(s1 == 0){
		pt2 = 2;
	}
	
	if(pt1 == 1 && pt2 == 1){
		cout << "AMBIGUOUS" << endl;
	}else if(pt1 == 1 && pt2 == 0){
		cout << "MMYY" << endl;
	}else if(pt1 == 0 && pt2 == 1){
		cout << "YYMM" << endl;
	}else if(pt1 == 2 && pt2 == 1){
		cout << "YYMM" << endl;
	}else if(pt2 == 2 && pt1 == 1){
		cout << "MMYY" << endl;
	}else{
		cout << "NA" << endl;
	}
}


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

int main() {
	int N, A;
	int max = 9999999;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A;
		int j = 0;
		while (A % 2 == 0 && j<max) {
			A /= 2;
			j++;
		}
		if (j < max) max = j;
		if (max == 0) break;
	}
	cout << max;

}

Measured memory_bytes: 256
/// Swift5 -> Swift2.2

extension String {
    // split(separator:maxSplits:omittingEmptySubsequences:)
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map(String.init)
    }
}
extension Array {
    // init(repeating:count:)
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
extension Array where Element: Comparable {
    // sorted()
    func sorted() -> [Element] {
        return self.sort( { $0 < $1 } )
    }
}
// stride(from:through:by:)
func stride(from start: Int, through end: Int, by stride: Int) -> StrideThrough<Int> {
    return start.stride(through: end, by: stride)
}
// stride(from:to:by)
func stride(from start: Int, to end: Int, by stride: Int) -> StrideTo<Int> {
    return start.stride(to: end, by: stride)
}
extension Range {
    func reversed() -> [Element] {
        return self.reverse()
    }
}

/// end


let input = readLine()!.split(separator: " ").map { Int($0)! }
let N = input[0]
let W = input[1]

var dp = Array(repeating: 0, count: W + 1)

for _ in 0 ..< N {
    let knapsack = readLine()!.split(separator: " ").map { Int($0)! }
    let weight = knapsack[0]
    let value = knapsack[1]

    for i in stride(from: W, through: weight, by: -1) {
        dp[i] = max(dp[i], dp[i - weight] + value)
    }
}

print(dp.last!)


Measured memory_bytes: 4208
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

ll n,a;
cin>>n;
for(int i=0;i<n-1;i++)
{
    cin>>a;
    myMap[a]++;
}
for(int i=1;i<=n;i++)
{
    cout<<myMap[i]<<endl;
}
return 0;
}



Measured memory_bytes: 16180
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node {int p,l,r;};
struct Node T[MAX];
int n;
void preParse(int u){
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}
void inParse(int u){
  if(u==NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}
void postParse(int u){
  if(u==NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}
int main(){
  int i,v,l,r,root;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p=NIL;
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL) T[l].p=v;
    if(r!=NIL) T[r].p=v;
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL) root=i;
  }
  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");
  return 0;
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int n;cin>>n;

	vector<ll> l(n);
	for(int i=0; i<n; i++){
		cin>>l[i];
	}

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


	ll ans =0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){

			int r = lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();

	
			ans += max(0, r-(j+1));

		}
	}

	writeln(ans);

}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
3 2
acp
ae
)");
#define cin input
#endif

bool bfs(int rGraph[202][202], int s, int t, int parent[])
{
    using namespace std;
    bool visited[202] = {};
    queue <int> q;
    q.push(s);
    visited[s] = true;
    parent[s] = -1;
 
    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        for (int v = 0; v < 202; v++)
        {
            if (visited[v] == false && rGraph[u][v] > 0)
            {
                q.push(v);
                parent[v] = u;
                visited[v] = true;
            }
        }
    }
    return (visited[t] == true);
}
 
int fordFulkerson(int graph[202][202], int s, int t)
{
    int u, v;
    int rGraph[202][202];  
    for (u = 0; u < 202; u++)
    {
        for (v = 0; v < 202; v++)
        {
            rGraph[u][v] = graph[u][v];
        }
    }
    int parent[202];
    int max_flow = 0;
    while (bfs(rGraph, s, t, parent))
    {
        int path_flow = 1 << 30;
        for (v = t; v != s; v = parent[v])
        {
            u = parent[v];
            path_flow = min(path_flow, rGraph[u][v]);
        }
        for (v = t; v != s; v = parent[v])
        {
            u = parent[v];
            rGraph[u][v] -= path_flow;
            rGraph[v][u] += path_flow;
        }
        max_flow += path_flow;
    }
    return max_flow;
}

int main()
{
    int graph[202][202] = {}; 
	int h, w;
	cin >> h >> w;
    int xs, ys, xt, yt;
    REP (i, h)
    {
        string s;
        cin >> s;
        REP (j, w)
        {
            switch (s[j])
            {
            case 'o':
                graph[i][j + 100] = 1;
                graph[j + 100][i] = 1;
                break;
            case 'S':
                graph[200][j + 100] = 1 << 30;
                graph[200][i] = 1 << 30;
                xs = j;
                ys = i;
                break;
            case 'T':
                graph[i][201] = 1 << 30;
                graph[j + 100][201] = 1 << 30;
                xt = j;
                yt = j;
                break;
            }
        }
    }

    if (xs == xt || ys == yt)
        cout << -1 << endl;
    else
    {
        int x = fordFulkerson(graph, 200, 201);
        cout << (x > (1 << 24) ? -1 : x) << endl;
    }

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int Max = 100000;
int dp[Max];

void K(int n, int k, vector<int>&a) {
    for(int i=1 ; i<=k; i++){
        for(int j=0; j<n; j++){
            if(i-a[j] >= 0 && !dp[i-a[j]]){
                dp[i] = 1;
            }
        }
    }
    if(dp[k] == 1){
        cout << "First" << endl;
    }else {
        cout << "Second" << endl;
    }
}
int main() {
    int n, k;
    cin >> n >> k;
    vector<int>a(n);
    int val;
    for(int i=0; i<n; i++){
      cin >> a[i];
    }
    K(n, k, a);
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
class P {
    static void Main() {
        int a = int.Parse(Console.ReadLine());
        var b = Enumerable.Repeat(0,101).ToArray();
        var c = new List<int>();
        for (int i = 2;i<=a;i++) {
            if (c.All(x => i%x!=0)) c.Add(i);
        }
        for (int i = 2;i<=a;i++) {
            int f = 0, g = i;
            while (g!=1) {
                while (g%c[f]==0) {
                    b[c[f]]++;
                    g/=c[f];
                    //Console.WriteLine(g);
                }
                f++;
            }
        }
        int X = 0;
        //74
        X+=b.Count(x => x>=74);
        //2 4 4
        X+=b.Count(x => x>=4)*(b.Count(y => y>=4)-1)*(b.Count(z => z>=2)-2)/2;
        //14 4
        X+=b.Count(x => x>=14)*(b.Count(y => y>=4)-1);
        //24 2
        X+=b.Count(x => x>=24)*(b.Count(y => y>=2)-1);
        Console.WriteLine(X);
    }
}

Measured memory_bytes: 13396
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<int> A(N);
	int a4 = 0;
	int a2 = 0;
	for(int i=0;i<N;++i){
		cin >> A[i];
		if( A[i] %4 == 0 ){
			a4++;
		}else if( A[i]%2 == 0 ){
			a2++;
		}
	}

	if( a2 == 0 ){
		if( N&1 ){
			if( (N)/2 <= a4 ){
				cout << "Yes" << endl;
			}else{
				cout << "No" << endl;
			}
		}else{
			if( (N)/2 <= a4 ){
				cout << "Yes" << endl;
			}else{
				cout << "No" << endl;
			}
		}
		return;
	}
	N -= a2;
	if( N&1 ){
		if( (N+1)/2 <= a4 ){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}else{
		if( (N/2) <= a4 ){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int[] nums = new int [n];
			for (int i = 0; i < n; i++) {
				nums[i] = sc.nextInt();
			}

			int count = 0;

			for (int i = 0; i < n - 2; i ++) {
				if ((nums[i]< nums[i+1] && nums[i+1] < nums[i+2]) || (nums[i+2]< nums[i+1] && nums[i+1] < nums[i])) {
					count++;
				}

			}
			System.out.println(count);
	}

}

Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main(){
  int N,W;
  cin >>N>>W;
  vector<long long>w(N),v(N);
  map<long long,long long>m[2];
  for (int i = 0; i < N; i++) {
    cin >>w[i]>>v[i];
  }
  m[0][0]=0;
  for(int i=0;i<N;i++){
    for(auto &&it:m[0]){
      if(m[1][it.first+w[i]]<(it.second+v[i]) &&(it.first+w[i])<=W ){
        m[1][it.first+w[i]] = (it.second+v[i]);
      }
    }
    for(auto &&it:m[1]){
      m[0][it.first]=it.second;
    }
  }
  long long val = 0;
  for(auto &&it:m[0]){
    if(it.second>val )val = it.second;
  }
  cout <<val <<endl;
}


Measured memory_bytes: 1024
from collections import deque
from copy import deepcopy
def main():
    h, w = map(int, input().split())
    maze = {}
    white_cell = 0  # 白いマスの数
    for i1 in range(h):
        mazerow = input()
        for i2 in range(w):
            if mazerow[i2] == '.':
                maze[(i1, i2)] = 0  # 白います。通れる。
                white_cell += 1
            else:
                maze[(i1, i2)] = -1  # 黒います。とおれない。

    vx = (0, 0, 1, -1)
    vy = (1, -1, 0, 0)
    cnt = 1
    next_nodes = deque()
    next_nodes.append((0, 0))
    next2_nodes = deque()
    """
    方針：
    mazeをBFSで更新し「ゴール到達可否」「最短路」を求める。
    ゴール到達可なら「白いマスの数 - スタートとゴールを含む再短路のマス数」が
    塗ることのできる黒いマス数になる。
    (0,0)からの距離cntを１で開始し、１ずつカウントアップして更新してmapの各マスにいれる。
    ゴールセルに入った数が「スタートとゴールを含む再短路のセル数」になる。
    """
    while next_nodes:
        while next_nodes:
            nextn = next_nodes.popleft()
            nextny = nextn[0]
            nextnx = nextn[1]
            for j1 in range(4):
                ny = nextny + vy[j1]
                nx = nextnx + vx[j1]
                if ny == -1 or ny == h or nx == -1 or nx == w:
                    continue
                elif maze[(ny, nx)] == 0:
                    next2_nodes.append((ny, nx))
                    # 「次の遷移先ノード」を更新し、重複してnext2_nodesに加えないようにする。
                    maze[(ny, nx)] = cnt + 1
        cnt += 1
        next_nodes = deepcopy(next2_nodes)
        next2_nodes = deque()

    """
    結果出力。maze[(h-1, w-1)]が0のままなら「ゴール到達不可」なので-1、
    そうではないなら「黒にできるマスの数」をprint
    """
    if maze[(h-1, w-1)] == 0:
        print(-1)
    else:
        r = white_cell - maze[(h-1, w-1)]
        print(r)

if __name__ == '__main__':
    main()


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

typedef long long ll;

const int maxn = 1e3 + 1e2;
char val[maxn][maxn];

int main(){
	std::ios::sync_with_stdio(false);

	int n;
	std::cin >> n;

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			std::cin >> val[i][j];
			val[n + i][j] = val[i][n + j] = val[n + i][n + j] = val[i][j];
		}
	}

	int res = 0;

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i != 0 and j != 0){
				continue;
			}

			int mistakes = 0;
			for(int k = 0; k < n; k++){
				for(int l = 0; l < k; l++){
					if(val[i + k][j + l] != val[i + l][j + k]){
						mistakes++;
					}
				}
			}

			for(int k = 0; i + k < n and j + k < n; k++){
				if(mistakes == 0){
					res++;
				}
				for(int l = 0; l < n; l++){
					if(val[i + k + l][j + k] != val[i + k][j + k + l]){
						mistakes--;
					}
				}
				for(int l = 0; l < n; l++){
					if(val[i + k + n - l][j + k + n] != val[i + k + n][j + k + n - l]){
						mistakes++;
					}
				}
			}
		}
	}

	std::cout << res << '\n';
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

vi to[200005];
vi ans;
void dfs(int v, int p=-1){
	for(int u : to[v]){
		if(u==p) continue;
		ans[u]+=ans[v];
		dfs(u,v);
	}
}

int main(){
	int k,x;
	cin>>k>>x;
	int lb=-1000000;
	int hb=1000000;
	int l,h;
	l=max(lb,x-k+1);
	h=min(hb,x+k-1);
	for(int i=l;i<h+1;i++){
		cout<<i<<endl;
	}
    return 0;
}




























Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    int k; cin >> k;
    string s; cin >> s;
    if(s.size()<=k) cout << s << endl;
    else {
        rep(i,k) cout << s.at(i);
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  
  string ans = "yes";
  vector<bool> a(26, false);
  
  rep(i, 0, s.size()) {
    if(a.at(s.at(i) -'a')) {
      ans = "no";
      break;
    }
    else
      a.at(s.at(i) -'a') = true;
  }
  
    cout << ans << "\n";

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;
    String[]       in_str_split;

    int   in_N;
    int   in_x;
    int[] in_a;

    int cnt;
    int tmp;
    int ans;

    try
    {
      in_stream = new BufferedReader(new InputStreamReader(System.in));

      /*----------------
       * 引数
       *----------------*/
      in_str       = new String(in_stream.readLine());
      in_str_split = in_str.split(" ");
      in_N         = Integer.parseInt(in_str_split[0]);
      in_x         = Integer.parseInt(in_str_split[1]);

      in_a         = new int[in_N];
      in_str       = new String(in_stream.readLine());
      in_str_split = in_str.split(" ");
      for(cnt=0; cnt<in_N; cnt++)
      {
        in_a[cnt] = Integer.parseInt(in_str_split[cnt]);
      }


      /*----------------
       * 計算
       *----------------*/
      ans = 0;
      tmp = 0;

      Arrays.sort(in_a);

      for(cnt=0; cnt<in_N; cnt++)
      {
        tmp += in_a[cnt];

        if(tmp <= in_x)
        {
          ans++;
        }
        else
        {
          break;
        }
      }

      if((cnt == in_N) && (tmp < in_x))
      {
        ans--;
      }


      System.out.println(String.valueOf(ans));
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i=0; i<N; i++) cin >> v[i];

  if (N == 2) {
    cout << v[1] << endl;
    cout << v[0] << endl;
    return 0;
  }

  vector<int> sorted_v(v);
  sort(sorted_v.begin(), sorted_v.end());

  int one = sorted_v[(N/2) - 2];
  int two = sorted_v[(N/2) - 1];
  int three = sorted_v[N/2];
  int four = sorted_v[N/2 + 1];

  for (int i=0; i<N; i++) {
    if (v[i] >= three) {
      cout << two << endl;
    } else if (v[i] <= two) {
      cout << three << endl;
    }
  }
}


Measured memory_bytes: 3712
#include <stdio.h>

/*
Apples = 3 pieces of apple
1 apple pie = 3 pieces of apple
*/
int main (){
	int apples, pieces1 = 3, pieces2;
	int applePie;
	
	scanf ("%d %d", &apples, &pieces2);
	
	
	pieces1 = apples*3;
	applePie = (pieces1 + pieces2) / 2;
	
	printf ("%d",applePie);
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll a, b, c;
  cin >> a >> b >> c;
  ll ans = (a + b) * c / 2;
  ANS;
  return 0;
}

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

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int i, j;
    i = 0, j = n - 1;
    int ans = 0;
    while(i < j)
    {
        while(s[i] == 'R')
            i++;

        while(s[j] == 'W')
            j--;

        if(i < j)
        {
            swap(s[i], s[j]);
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string S;
  cin>>S;
  int k=0,j=0;
  for(int i=0;i<S.size();i++){
    if(S[i]=='W'){
      k+=i-j;
      j++;
    }
  }
  cout<<k<<endl;
}

Measured memory_bytes: 3776