akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll N,M,Y=0;
  cin >> N >> M;
  ll K;
  cin >> K;
  rep(i,N+1){
    rep(j,M+1){
      if((N-i)*j+(M-j)*i==K){
        Y=1;
      }
    }
  }
  if(Y){
    cYes;
  }
  else{
    cNo;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if (a == b) {
			System.out.println("Draw");
		} else if ((b < a || a == 1) && b != 1) {
			System.out.println("Alice");
		} else {
			System.out.println("Bob");
		}


		sc.close();

	}

}

Measured memory_bytes: 35652
#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);

int main(){
  double A,B,H,M;
  cin >> A >> B >> H >> M;
  double a = (H*60+M)/720*(pi*2);
  double b = M/60*(pi*2);
  double theta = a - b;
  double res = sqrt(A*A + B*B - 2.0*A*B*cos(theta));
  cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 4088
//

#include <iostream>
#include <cmath>
#include <limits>

using namespace std;
int fact(int n) {  //factorial
	int a = 1;
	if (n == 1)return 0;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}

int n,k;
double p;
int main() {
	cin >> n >> k;
	for (int i = 0;i < n;i++) {
		int j = i + 1;
		double l = n;
		while (j < k) {
			j *= 2;
			l *= 2;

		}
		p += 1.0 / l;
	}
	printf("%.10lf\n", p);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    set<int> ans;

    rep(i, N)
    {
        cin >> H[i];
        ans.insert(i);
    }

    rep(i, M)
    {
        int A, B;

        cin >> A >> B;

        A--;
        B--;

        if (H[A] >= H[B])
        {
            ans.erase(B);
        }
        if (H[B] >= H[A])
        {
            ans.erase(A);
        }
    }

    cout << ans.size() << endl;
}


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

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

    int ans = 0;
    rep(x, k+1)rep(y, k+1){
        int z = s - x - y;
        if(0<= z && z <= k) ans++;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]

typedef vector< int > vi;
typedef vector<long long> lvi;
typedef vector< vector<int> > vvi;
typedef vector< vector<long long> > lvvi;
typedef pair< int,int > ii;
typedef pair< long long,long long > lii;
typedef vector<pair<int,int>> vii;
typedef vector<pair<long long,long long>> lvii;
typedef vector<vector<pair<int,int>>> vvii;
typedef vector<vector<pair<long long,long long>>> lvvii;

#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " is " << a << endl;
	err(++it, args...);
}

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#define mod 1000000007
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

long long mod_sum() { return 0LL; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

long long mod_product() { return 1LL; }
template<typename T, typename... Args>
T mod_product(T a, Args... args) { return (a*mod_product(args...))%mod; }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------


signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll n;
	cin>>n;
	lvi a(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	sort(all(a),greater<ll>());
	ll ans=a[0];
	int s=1,r=0;
	for(int i=3;i<=n;i++)
	{
		if(r<2)
		{
			ans+=a[s];
			r++;
		}
		else
		{
			r=0;
			s++;
			ans+=a[s];
			r++;
		}
	}
	cout<<ans<<endl;
	return 0;
}	

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

long long N, A[1 << 18], B[1 << 18], S, cnt;
vector<int> X[1 << 18];
bool used[1 << 18];

void dfs(int pos) {
	used[pos] = true;
	for (int i = 0; i < X[pos].size(); i++) {
		if (used[X[pos][i]] == true) continue;
		dfs(X[pos][i]);
	}
	B[pos] = A[cnt]; cnt++;
}

int main() {
	cin >> N;
	for (int i = 1; i <= N - 1; i++) {
		int p, q; cin >> p >> q;
		X[p].push_back(q);
		X[q].push_back(p);
	}
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	for (int i = 0; i < N - 1; i++) S += A[i];

	dfs(1);

	cout << S << endl;
	for (int i = 1; i <= N; i++) { if (i >= 2) cout << " "; cout << B[i]; } cout << endl;
	return 0;
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
int main() {
	// #ifndef ONLINE_JUDGE
	// 	// for getting input from input.txt
	// 	freopen("input.txt", "r", stdin);
	// 	// for writing output to output.txt
	// 	freopen("output.txt", "w", stdout);
	// #endif
		string a,b,c;
		cin>>a>>b>>c;
		int d = a.length();
		int e = b.length();
		// int f = a.length();
		// cout<<a.at(d-1);

		if(a.at(d-1) == b.at(0) && b.at(e-1) == c.at(0)){
			cout<<"YES"<<"\n";
		}
		else{
			cout<<"NO"<<"\n";
		}

		return 0;	
	}	

Measured memory_bytes: 256
#include<stdio.h>
 int N,K;
 int j=0;
 int hoge[100000];
 int array[100000];
 
 main(void)
{scanf("%d",&N);
 
 for(int i=1;i<=N;i++){
 scanf("%d",&hoge[i-1]);
 array[hoge[i-1]] = i;
 }
	for(int i=1; i<=N; i++){
		printf("%d ",array[i]);
	}
  return 0;
}
	
 


Measured memory_bytes: 1536
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 998244353;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    string s;
    cin >> s;
    ll n = s.size();

    rep(i, n-1) {
        if(s[i] == s[i+1]) {
            out("Bad");
            re0;
        }
    }
    
    out("Good");
    re0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define READ(FILE) freopen(FILE,"r",stdin)
#define WRITE(FILE) freopen(FILE,"w",stdout)
#define loop(i,s,e) for(int i=s;i<e;i++)
#define mego fast();
using namespace std;
void fast()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

ll lcm(ll x, ll y)
{
    return (x*y)/__gcd(x,y);
}
int sum(string s)
{
    int x=0,sz=s.size();
    loop(i,0,sz)x+=(s[i]-'0');
    return x;
}
/*
struct node
{
int data;
node *link;
};
typedef node* nodeptr;
void head_insert(nodeptr& head,int x)
{
    nodeptr tmp;
    tmp=new node;
    tmp->data=x;
    tmp->link=head;
    head=tmp;
}
nodeptr search(nodeptr head,int x)
{
    nodeptr cur=head;
    if(cur ==  nullptr)return cur;
    while(cur->data!=x&&cur->link!=nullptr)
    {
        cur=cur->link;
    }
    if(cur->data==x)return cur;
    else return nullptr;
}
void show(nodeptr head)
{
    nodeptr cur=head;
    if(cur==nullptr)return;
   // cout<<head->data<<" ";
    while(cur->link!=nullptr){
        cout<<cur->data<<" ";
        cur=cur->link;
    }
    cout<<endl;
}
*/

int main()
{
    mego
   int n,ans=0,x;
   cin>>n;
   loop(i,1,n+1)
   {
       cin>>x;
       ans+=((i&1)&&(x&1));
   }
   cout<<ans;
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
int a[100005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
		if(a[i]>a[i+1]){
			if(a[i]-a[i+1]!=1||a[i-1]>a[i]-1){
				cout<<"No";return 0;
			}
		}
		if(a[i-1]<a[i])a[i]--;
	} 
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<algorithm>

using namespace std;

int main(){

    int size,a,b,min=9999999,max=-1,ans = 0;
    cin >> size;
    map<int,int> dicts;
    for(int i=0;i<size;i++){
        cin >> a >> b;
        if(a<min){
            min = a;
        }
        if(a>max){
            max = a;
        }
        dicts[a] = b;
    }
    ans += dicts[max]+1+(max-min) +(min-1);
    cout << ans;


}

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

int main() {
  int n, k;
  cin >> n >> k;
  k *= 2;
  vector<array<int, 3>> constraints(n);
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> constraints[i][0] >> constraints[i][1] >> c;
    constraints[i][0] = (constraints[i][0] % k + k) % k;
    constraints[i][1] = (constraints[i][1] % k + k) % k;
    constraints[i][2] = c == 'B';
  }
  sort(constraints.begin(), constraints.end(), [&](auto lhs, auto rhs) {
    return lhs[0] < rhs[0];
  });
  auto add = [&](vector<int> &bit, int point, int val) {
    for (; point < (int) bit.size(); point |= point + 1) {
      bit[point] += val;
    }
  };
  auto get = [&](vector<int> &bit, int p) {
    int ans = 0;
    for (; p >= 0; p = (p & (p + 1)) - 1) {
      ans += bit[p];
    }
    return ans;
  };
  int ans = 0;
  vector<vector<int>> bits(4, vector<int>(k, 0));
  for (int i = 0; i < n; ++i) {
    add(bits[2 * constraints[i][2] + 1], constraints[i][1], 1);
  }
  for (int x = 0, l = 0, r = 0; x < k / 2; ++x) {
    // [l, r)
    while (r < n && constraints[r][0] < x + k / 2) {
      add(bits[2 * constraints[r][2]], constraints[r][1], 1);
      add(bits[2 * constraints[r][2] + 1], constraints[r][1], -1);
      ++r;
    }
    while (l < r && constraints[l][0] < x) {
      add(bits[2 * constraints[l][2]], constraints[l][1], -1);
      add(bits[2 * constraints[l][2] + 1], constraints[l][1], 1);
      ++l;
    }
    for (int y = 0; y < k / 2; ++y) {
      int a1 = get(bits[2], y + k / 2 - 1) - get(bits[2], y - 1);
      int a2 = get(bits[0], k - 1) - get(bits[0], y + k / 2 - 1) + get(bits[0], y - 1);
      int a3 = get(bits[1], y + k / 2 - 1) - get(bits[1], y - 1);
      int a4 = get(bits[3], k - 1) - get(bits[3], y + k / 2 - 1) + get(bits[3], y - 1);

      int b1 = get(bits[0], y + k / 2 - 1) - get(bits[0], y - 1);
      int b2 = get(bits[2], k - 1) - get(bits[2], y + k / 2 - 1) + get(bits[2], y - 1);
      int b3 = get(bits[3], y + k / 2 - 1) - get(bits[3], y - 1);
      int b4 = get(bits[1], k - 1) - get(bits[1], y + k / 2 - 1) + get(bits[1], y - 1);

      ans = max({ans, a1 + a2 + a3 + a4, b1 + b2 + b3 + b4});
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4500
import java.util.*;

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

    int N = in.nextInt();
    long K = in.nextLong();

    int[] path = new int[N];
    for (int i = 0; i < N; i++) {
      path[i] = in.nextInt() - 1;
    }

    int[] visited = new int[N];
    Arrays.fill(visited, -1);
    
    int count = 0;
    int index = 0;
    
    while (visited[index] == -1) {
      visited[index] = count;
      index = path[index];
      count++;
    }

    int stepToLoop = visited[index];
    int stepInLoop = count - visited[index];

    int k;
    if (K < stepToLoop) {
      k = (int) K;
    } else {
      k = stepToLoop + (int) ((K - ((long) stepToLoop)) % stepInLoop);
    }

    int ans = 0;
    for (int i = 0; i < k; i++) {
      ans = path[ans];
    }

    System.out.println(ans + 1);

  }
}


Measured memory_bytes: 59868
n=int(input())
a=list(map(int,input().split()))
l=r=now=0
ans=[0]*n 
while l<n:
    if r<n and now^a[r]==now+a[r]:
        now+=a[r]
        #ans[l]=r 
        r+=1
    else:
        now-=a[l]
        l+=1
        ans[l-1]=r-1
print(sum([ans[i]-i+1 for i in range(n)]))

Measured memory_bytes: 24712
#include<stdio.h>

int main(void){
    int a,b;
    char op;

    while(1){
        scanf("%d %c %d", &a, &op, &b);
        if(op == '?') break;
        else if(op == '+') printf("%d\n", a + b);
        else if(op == '-') printf("%d\n", a - b);
        else if(op == '*') printf("%d\n", a * b);
        else if(op == '/') printf("%d\n", a / b);
    }

    return 0;
}


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

#define N 200123
#define mod 1000000007

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    string s, bef = "", curr;
    int ans = 1;
    int n;
    cin >> s;
    n = (int)s.size();
    bef.push_back(s[0]);
    for(int i = 1 ; i < n ; i++){
    	curr = "";
    	curr.push_back(s[i]);
    	if(curr == bef){
    		if(i+1 < n){
    			curr.push_back(s[i+1]);
    			ans++;
    			i++;
    		}
    	} else {
    		ans++;
    	}
    	bef = curr;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii              pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define PI              3.14159265
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define __              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,b) 		for(int i=a;i<b;i++)
#define repb(i,a,b) 	for(int i=a;i>=b;i--)
#define endl			"\n"
#define m(a)		    memset(a,0,sizeof(a))
#define all(x)          begin(x), end(x)

/*
// warning this works with cpp14 only...register depricated in 17
void fastscan(int &x){
bool neg = false;register int c;
x = 0;c = getchar();
if(c=='-'){neg = true;c = getchar();}
for(; (c>47 && c<58); c=getchar()){x = x *10 + c - 48;}
if(neg){x *= -1;}}

*/

void file(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt" , "r" , stdin);
	freopen("out.txt" , "w" , stdout);
	#endif
}

int bs(int a[] , int s , int e, int x){
	if(s<=e){
		int m = (s+e)/2;
		if(a[m]==x)
			return m;
		else if(a[m] > x)
			return bs(a,s,m-1,x);
		else return bs(a,m+1,e,x);
	}
	return -1;
}

#define tr(x) cout<<x<<endl;
#define tr2(x,y) cout<<x<<" "<<y<<endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(w,x,y,z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define tr5(v,w,x,y,z) cout<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define tr6(u,v,w,x,y,z) cout<<u<<" "<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;

#define deb(x) cout<<#x<<"="<<x<<endl
#define deb2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
#define deb3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl
#define deba(a) for(auto &x:a) cout<<x<<" ";

#define sd(x) cin >> x;
#define sd2(x,y) cin >> x >> y;
#define sd3(x,y,z) cin >> x >> y >> z;
#define sd4(w,x,y,z) cin >> w >> x >> y >> z;

bool is_pal(string s) {return equal(all(s), s.rbegin());}

int fxp(int a, int b ,int p){       //(logn) fast exponentiation
    int res = 1;            		// call int x = fxp(2,5);
    while (b > 0) {
        if (b & 1)
            res = (res * a)%p;
        a = (a * a)%p;
        b >>= 1;
    }
    return (res%p);
}

void solve1(){
	int n,x,t; cin >> n >> x >> t;
	int ans=0;
	ans+=(t*(n/x));
	if(n%x!=0)
		ans+=t;
	cout << ans << endl;
}

void solve(){
	string s; cin >> s;
	int sc=0;
	for(char c : s){
		int cur = c-'0';
		sc+=cur;
	}
	if(sc%9)
		cout <<"No" << endl;
	else cout << "Yes" << endl;
}

int32_t main(){	
	__;
	file();
	solve();
	return 0;
}







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

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define mod (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()

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

void print(bool f)
{
    cout << (f ? "Yes" : "No") << endl;
}

void Print(bool f)
{
    cout << (f ? "YES" : "NO") << endl;
}

int main(void)
{
    ll n;
    cin >> n;
    vll a;
    a.push_back(3);
    a.push_back(5);
    a.push_back(7);
    rep(i, 0, a.size())
    {
        rep(j, 0, 3)
        {
            if (a[i] * 10 + 2 * j + 3 <= n)
                a.push_back(a[i] * 10 + 2 * j + 3);
        }
    }
    ll cnt = 0;
    rep(i, 0, a.size())
    {
        vll f(3, false);
        while (a[i])
        {
            f[(a[i] % 10 - 3) / 2] = true;
            a[i] /= 10;
        }
        rep(j, 0, 3)
        {
            if (!f[j])
                break;
            if (j == 2)
                cnt++;
        }
    }
    cout << cnt << endl;
}

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


int main()
{
  int A, B;
  cin >> A >> B;
  if (A <= 5) {
    cout << 0 << endl;
  } else if (A <= 12) {
    cout << B / 2 << endl;
  } else {
    cout << B << endl;
  }
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function get_k(num)
    return (num+1)/2
end
function main()
N, K = parseMap(split(readline()))
P = parseMap(split(readline()))
P = get_k.(P)

res = 0
max_ans_index = 1
for i in 1:N-K
    new = P[i+K]
    less = P[i]
    res += new - less
    if res > 0  #増加　
        max_ans_index = i + 1
        res = 0
    end
end    
println(sum(P[max_ans_index:max_ans_index+K-1]))
end





main()


Measured memory_bytes: 170960
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  Vs = list(map(int, input().strip().split()))
  Vs.sort()
  sum = Vs[0]
  for V in Vs[1:]:
    sum += V
    sum /= 2
  print(sum)

if __name__=='__main__':
  main()



Measured memory_bytes: 2940
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int K = sc.nextInt();
      int[] p = new int[N];
      for(int i = 0; i < N; i++){
        p[i] = sc.nextInt();
      }
      Arrays.sort(p);
      
      // 算出
      int price = 0;
      for(int i = 0; i < K; i++){
        price += p[i];
      }
      
      // 出力
      System.out.println(price);
    }

}

Measured memory_bytes: 38856
/*
* @Author: kabbo
* @Date:   2020-06-24 08:40:07
* @Last Modified by:   kabbo
* @Last Modified time: 2020-06-24 08:49:58
*/
#include<bits/stdc++.h>
using namespace std;
#define pii pair<long long,long long>
#define endl '\n'
#define ull unsigned long long
#define ll long long
const int mod = 1e9 + 7;
using u64 = uint64_t;
using u128 = __uint128_t;
#define sc1(x) scanf("%lld",&(x));
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
void solve() {
	ll n;
	cin >> n;
	auto x = n % 1000;
	auto ans = (n / 1000) * 1000;
	if (x == 0) {
		cout << 0 << endl;
		return;
	}
	else {
		ans += 1000;
		cout << ans - n << endl;
	}


}
int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//int t;
	////cin >> t;
	//for (int i(1); i <= t; ++i) {
	//printf("Case %d:\n", i);
	solve();
	//}
#ifndef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
	return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>d>>n;
    if(d==0){
        if(n==100)Cout(101);
        else Cout(n);
    }
    else if(d==1){
        if(n==100)Cout(10100);
        else Cout(100*n);
    }
    else{
        if(n==100)Cout(1010000);
        else Cout(10000*n);
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())

a = [0] * 4
t = ['AC', 'WA', 'TLE', 'RE']
for i in range(n):
    s = (input())

    if s == 'AC':
        a[0] += 1
    elif s == 'WA':
        a[1] += 1
    elif s == 'TLE':
        a[2] += 1
    else:
        a[3] += 1

for i in range(4):
    print(t[i], end=' ')
    print('x', end=' ')
    print(a[i])


Measured memory_bytes: 9232
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            var cloud = 0;
            for (int j = 0; j < w; j++)
            {
                if (s[j] == 'c') { Console.Write(0); cloud = 1; }
                else if (cloud == 0) Console.Write(-1);
                else { Console.Write(cloud);  cloud++; }
                if (j == w - 1) Console.WriteLine();
                else Console.Write(" ");
            }
        }
    }
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		
		ArrayList<Integer> sumList = new ArrayList<Integer>();
		
		while(true) {
			String line = br.readLine();
			int n = Integer.parseInt(line);
			if(n == 0)break;
			
			Dice dice = new Dice();
			
			int sum = 1;
			for(int i = 0;i < n;i++) {
				line = br.readLine();
				if(line.equals("North")) {
					dice.north();
				}else if(line.equals("East")) {
					dice.east();
				}else if(line.equals("South")) {
					dice.south();
				}else if(line.equals("West")) {
					dice.west();
				}else if(line.equals("Right")) {
					dice.right();
				}else {
					dice.left();
				}
				
				sum += dice.getUpper();
			}
			
			sumList.add(sum);
		}
		
		// データセットごとに上面の数の合計値を出力する
		for(int sum : sumList) {
			System.out.println(sum);
		}
	}
}

// サイコロクラス
class Dice{
	private int upper;
	private int north;
	private int east;
	private int south;
	private int west;
	private int bottom;
	
	// コンストラクタ
	public Dice() {
		upper = 1;
		north = 5;
		east = 3;
		south = 2;
		west = 4;
		bottom = 6;
	}
	
	// サイコロの上面を取得するメソッド
	public int getUpper() {
		return upper;
	}
	
	// 北方向へ90度回転させるメソッド
	public void north() {
		int temp = upper;
		upper = south;
		south = bottom;
		bottom = north;
		north = temp;
	}
	
	// 東方向へ90度回転させるメソッド
	public void east() {
		int temp = upper;
		upper = west;
		west = bottom;
		bottom = east;
		east = temp;
	}
	
	// 南方向へ90度回転させるメソッド
	public void south() {
		int temp = upper;
		upper = north;
		north = bottom;
		bottom = south;
		south = temp;
	}
	
	// 西方向へ90度回転させるメソッド
	public void west() {
		int temp = upper;
		upper = east;
		east = bottom;
		bottom = west;
		west = temp;
	}
	
	// 右回りに90度回転させるメソッド
	public void right() {
		int temp = north;
		north = west;
		west = south;
		south = east;
		east = temp;
	}
	
	// 左回りに90度回転させるメソッド
	public void left() {
		int temp = north;
		north = east;
		east = south;
		south = west;
		west = temp;
	}
}



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

using namespace std;

int main() {
	int A, B, C, D;
	string in;
	cin >> in;
	A = in[0] - '0', B = in[1] - '0', C= in[2] - '0', D = in[3] - '0';
	for (int i = 0; i < 8; i++) {
		int ans = A;
		string out;
		if (i & 1)ans += B,out += '+';
		else ans -= B,out += '-';
		if (i & 2)ans += C, out += '+';
		else ans -= C, out += '-';
		if (i & 4)ans += D, out += '+';
		else ans -= D, out += '-';
		if (ans == 7) {
			cout << A << out[0] << B << out[1] << C << out[2] << D <<"=7"<< endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
unordered_set<string> set1;
unordered_set<string> set2;
void expand(string str, int low, int high, auto &set)
{
	while (low >= 0 && high < str.length()&& str[low] == str[high])
	{	
		set.insert(str.substr(low, high - low + 1));
		low--, high++;
	}
}

void all1(string str)
{
	for (int i = 0; i < str.length(); i++)
	{
		
		expand(str, i, i, set1);
		expand(str, i, i + 1, set1);
	}

}
void all2(string str)
{
	for (int i = 0; i < str.length(); i++)
	{
		
		expand(str, i, i, set2);
		expand(str, i, i + 1, set2);
	}

}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int res=0;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            res+=a[i]*a[j];
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
import scala.math.ceil

object Main {
  val sc = new java.util.Scanner(System.in)

  def sin(n: Int): Seq[Int] = Seq.fill(n)(sc.nextInt())

  def iin(): Int = sc.nextLine().toInt

  def main(args: Array[String]): Unit = {
    val n, d = sc.nextDouble()

    println( ceil(n / (d * 2 + 1)).toInt )
  }
}

Measured memory_bytes: 25420
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>

using namespace std;

int main(void){

    string s;
    cin>>s;
    vector<char> test;
    
    for(int i=0;i<s.size();i++){
        if(s[i]!='x') test.push_back(s[i]);
    }

    // for(int i=0;i<test.size();i++){
    //     cout<<test[i];
    // }

    int i=0;
    int j=test.size()-1;
    while(i!=j && j>=0){
        if(test[i] == test[j]){
            i++;    
            j--;
            if(i>j) break;
        }else{
            cout<<"-1"<<endl;
            return 0;
        }
    }

    i = 0;
    j = s.size()-1;
    int count = 0;

    while(i!=j){
        if(j<i) break;
        if(s[i]==s[j]){
            i++;
            j--;
        }else if(s[i]=='x'){
            count++;
            i++;
        }else{
            count++;
            j--;
        }
    }
    
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;

inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
    int x=0;char ch=gc();bool positive=1;
    for(;!isdigit(ch);ch=gc())if(ch=='-')positive=0;
    for(;isdigit(ch);ch=gc())x=x*10+ch-'0';
    return positive?x:-x;
}

inline void write(int x){
    if(x<0)x=-x,putchar('-');
    if(x>9)write(x/10);putchar(x%10+'0');
}

inline void writeln(int x){
    write(x);puts("");
}

int n,c,ans,num[3][1005],C[1005][1005],d[1005][1005];

inline int calc(int x,int y,int z){
    int sum=0;
    for(int j=1;j<=c;j++){
        sum+=d[j][x]*num[0][j]+d[j][y]*num[1][j]+d[j][z]*num[2][j];
    }
    return sum;
}

int main(){
    n=read();c=read();
    for(int i=1;i<=c;i++){
        for(int j=1;j<=c;j++){
            d[i][j]=read();
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            C[i][j]=read();
            num[(i+j)%3][C[i][j]]++;
        }
    }
    ans=1e9;
    for(int i=1;i<=c;i++){
        for(int j=1;j<=c;j++){
            for(int k=1;k<=c;k++){
                if(i==j||k==j||i==k)continue;
                ans=min(ans,calc(i,j,k));
            }
        }
    }
    writeln(ans);
    return 0;
}


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

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

    int N, M;
    cin >> N >> M;
    map<int, int> rems;
    int tmp;
    long long acc = 0;
    int rem;
    for (int i = 0; i < N; ++i) {
        cin >> tmp;
        acc += tmp;
        rem = static_cast<int>(acc % M);
        if (rems.find(rem) == rems.end()) {
            rems.insert(make_pair(rem, 0));
        }
        rems[rem]++;
    }
    
    long long total = 0;
    for (auto &r : rems) {
        int rem = r.first;
        long long count = r.second;
        total += (count - 1) * count / 2;
        if (rem == 0) total += count;
    }

    printf("%lld", total);
    // cout << total << '\n';

    return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define PI                      3.1415926535897932384626
#define int                     long long int
#define fi                      first
#define se                      second
#define pq                      priority_queue
#define pb                      push_back
#define endl                    '\n'
#define all(x)                  x.begin(),x.end()
#define pii                     pair<int,int>
#define fill(x,y)               memset(x,y,sizeof(x));
#define fast                    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define hash                    _H
#define lg                      long double         
#define vi                      std::vector<int>
#define sz(x)                   ((int)x.size())
 
 
 
template<typename T> T pow(T a,T b, int m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
template<typename T>T InverseMod(T a,int m){return pow(a,m-2,m);}
template<typename T>int SquareDist(T a,T b){int x = abs(a.fi - b.fi),y = abs(a.se - b.se); return x*x + y*y;}
 
struct node
{
    int a,b,c;    
};

void solve() {
    int n;
    cin >> n;
    int dp[n+1][3];
    std::vector<node> v;
    for(int i = 0; i < n; ++i) {
        struct node temp;
        cin >> temp.a >> temp.b >> temp.c;
        v.pb(temp);
    }
    fill(dp,-1);
    dp[1][0] = v[0].a;
    dp[1][1] = v[0].b;
    dp[1][2] = v[0].c;
    for(int i = 2; i <=n ; ++i) {
        node temp = v[i-1];
        if(i-1 >= 1) {
            dp[i][0] = max(dp[i][0],max(dp[i-1][1],dp[i-1][2]) + temp.a);
            dp[i][1] = max(dp[i][1],max(dp[i-1][0],dp[i-1][2]) + temp.b);
            dp[i][2] = max(dp[i][2],max(dp[i-1][0],dp[i-1][1]) + temp.c);
        }
        if(i - 2 >= 1) {
            dp[i][0] = max(dp[i][0],max(dp[i-2][1],dp[i-2][2]) + temp.a);
            dp[i][1] = max(dp[i][1],max(dp[i-2][0],dp[i-2][2]) + temp.b);
            dp[i][2] = max(dp[i][2],max(dp[i-2][0],dp[i-2][1]) + temp.c);
        }
    }
    cout << max({dp[n][0],dp[n][1],dp[n][2]}) << endl;
}   
 
 
 
 
signed main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
} 

Measured memory_bytes: 5744
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

typedef long long ll;

ll mod=1000000007;
int n,r;
int a[100001];
int s[51],t[51];
int bit[100001];

ll sum(int i){
	ll s=0;
	while(i>0){
		s+=bit[i];
		i-= i & -i;
	}
	return s;
}

void add(int i){
	while(i<=n){
		bit[i]+=1;
		i+= i & -i;
	}
}

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		memset(bit,0,sizeof(bit));
		for(int i=1;i<=n;i++)a[i]=i;
		scanf("%d",&r);
		for(int i=0;i<r;i++){
			scanf("%d%d",&s[i],&t[i]);
			swap(a[s[i]],a[t[i]]);
		}
		ll res=0;
		ll p2=1;
		for(int i=n;i>=1;i--){
			res=(res+sum(a[i])*p2)%mod;
			add(a[i]);
			p2=p2*(n-i+1)%mod;
		}
		printf("%lld\n",res);
	}
	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a<10&&b<10) cout << a*b << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
static const int MAX_N = 15;
static const int MAX_M = 15;

int N, M;
int b[MAX_N];
int p[MAX_M];
int cnt, cnt2;
int sum, sum2;

int calc(int num){
	int b2[MAX_N];
	int index = 0;
	for(int i = 0; i < M; i++){
		for(int j = 0; j < p[i]; j++){
			b2[index] = (i % 2 + num) % 2;
			index++;
		}
	}
	int res = 0;
	for(int i = 0; i < N; i++){
		if(b[i] != b2[i]){
			int index = -1;
			for(int j = i + 1; j < N; j++){
				if(b2[j] == b[i]){
					index = j;
					break;
				}
			}
			if(index == -1) return 1 << 30;
			for(; index > i; index--){
				swap(b2[index], b2[index - 1]);
				res++;
			}
		}
	}
	return res;
}

int main(){
	scanf("%d %d", &N, &M);
	cnt = 0, cnt2 = 0, sum = 0, sum2 = 0;
	for(int i = 0; i < N; i++){
		scanf("%d", &b[i]);
		if(b[i] == 0) cnt++;
		else cnt2++;
	}
	for(int i = 0; i < M; i++){
		scanf("%d", &p[i]);
		if(i % 2 == 0) sum += p[i];
		else sum2 += p[i];
	}
	printf("%d\n", min(calc(0), calc(1)));
	return 0;
}



Measured memory_bytes: 2760
using System;

 class Program
 {
     static void Main(string[] args)
     {
         double data0, data1, data2;
         double[] result = new double[3];
         String nyuryoku;
         string[] data; 
         while (true)
         {
             nyuryoku = Console.ReadLine();
             data = nyuryoku.Split(' ');
             data0 = Double.Parse(data[0]);
             data2 = Double.Parse(data[2]);
             //data2 = Double.Parse(data[2]);
             double result1, result2, result3;

             switch (data[1])
             {
                 case "+":
                     result1 = data0 + data2;
                     break;
                 case "-":
                     result1 = data0 - data2;
                     break;
                 case "/":
                     result1 = data0 / data2;
                     break;
                 case "*":
                     result1 = data0 * data2;
                     break;
                 default:
                     return;
             }
             Console.WriteLine(String.Format("{0}", (int)result1));

         }

      }
 }



Measured memory_bytes: 17888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

ll f(ll n, ll i) {
    return n/(1LL << i+1) * (1LL << i) + max((ll)0, n % (1LL << i+1) - (i == 0 ? 0 : (1LL << i)-1));
}

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

  ll a, b;
  cin >> a >> b;
  ll ans = 0;
  a--;

  rep(i, 50) {
    ll ac = f(a, i);
    ll bc = f(b, i);
    if ((bc-ac)%2 == 1) {
      ans |= 1LL << i;
    }
  }
  cout << ans << endl;
}


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

template <typename T,typename U>
struct compressor{
	vector<pair<T,U>> v;
	void add(T x,U y){
		v.emplace_back(x,y);
	}
	
	void compress(bool stable = false){
		
		if(stable){
			stable_sort(v.begin(),v.end(),[&] (pair<T,U> a,pair<T,U> b){
				return a.first < b.first;
			}
			);
		}
		else sort(v.begin(),v.end());
		
		vector<pair<T,U>> t;
		rep(i,v.size()){
			if(t.size()!=0 && t.back().first == v[i].first){
				t.back().second = func(t.back().second,v[i].second);
			}
			else{
				t.push_back(v[i]);
			}
		}
		swap(v,t);
		
	}

	U func(U a,U b){
		return a+b;
	}

	U e(){
		return 0;
	}

	int size(){
		return v.size();
	}
	
	pair<T,U> get(int p){
		return v[p];
	}
	
	U operator[] (T &x){
		auto it = lower_bound(v.begin(),v.end(),make_pair(x,e()));
		if(it==v.end() || it->first!=x){
			if(it!=v.begin()){
				it--;
			}
		}
		if(it==v.end() || it->first!=x){
			return e();
		}
		else return it->second;
	}
	
	U operator[] (T x){
		auto it = lower_bound(v.begin(),v.end(),make_pair(x,e()));
		if(it==v.end() || it->first!=x){
			if(it!=v.begin()){
				it--;
			}
		}
		if(it==v.end() || it->first!=x){
			return e();
		}
		else return it->second;
	}
};

bool f = false;
compressor<pair<string,string>,int> get(string S){
	int N = S.size();
	compressor<pair<string,string>,int> C;
	for(int i=0;i<(1<<N);i++){
		string s="",t="";
		for(int j=0;j<N;j++){
			if((i>>j)&1)s+=S[j];
			else t+=S[j];
		}
		reverse(t.begin(),t.end());
		if(f)swap(s,t);
		C.add(make_pair(s,t),1);
	}
	f=true;
	C.compress();
	return C;
}
 
int main(){
	
	int N;
	cin>>N;
	
	string S;
	cin>>S;
	
	compressor<pair<string,string>,int> C0 = get(S.substr(0,N)),C1 = get(S.substr(N));
	
	long long ans = 0;
 
	rep(i,C0.size()){
		ans += (long long)C0.get(i).second * C1[C0.get(i).first];
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 86188
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int main(){
    int X,K;
    cin>>K>>X;
    for(int i=X-K+1; i<=K+X-1;i++) cout<<i<<' ';
    cout<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long INF = 4000000000000000000;
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> x(N), y(N);
  for (int i = 0; i < N; i++){
    cin >> x[i] >> y[i];
  }
  long long ans = INF;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      vector<int> y2;
      for (int k = 0; k < N; k++){
        if (x[i] <= x[k] && x[k] <= x[j]){
          y2.push_back(y[k]);
        }
      }
      sort(y2.begin(), y2.end());
      if (y2.size() >= K){
        long long W = abs(x[j] - x[i]);
        int cnt = y2.size();
        for (int i = 0; i < cnt - K + 1; i++){
          long long H = y2[i + K - 1] - y2[i];
          ans = min(ans, H * W);
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
const int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
typedef long long ll;
const int N=200005;
const int mod=1e9+7;
int n,a[N],fac[N],ifac[N];
using namespace std;

int calc(int a,int b)
{
	int ans=1,tmp=a;
	while (b)
	{
		if (b&1) ans=(ll)ans*tmp%mod;
		tmp=(ll)tmp*tmp%mod,b>>=1;
	}
	return ans;
}
inline int read()
{
	char c;int x;
	while (c=getchar(),c<'0' || c>'9');x=c^'0';
	while (c=getchar(),c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x;
}
void write(int x)
{
	if (x==0) return;
	write(x/10);
	putchar((x%10)+'0');
}
int C(int x,int y){if (x<y) return 0;return (ll)fac[x]*ifac[y]%mod*ifac[x-y]%mod;}
int app[N];
int main()
{
	#ifdef Kay
		freopen ("code.in","r",stdin);
		freopen ("code.out","w",stdout);
	#endif
	scanf ("%d",&n);n++;
	int i,x,y;
	for (i=1;i<=n;i++)
	{
		a[i]=read();
		if (app[a[i]]) x=app[a[i]],y=i;
		app[a[i]]=i;
	}
	fac[0]=ifac[0]=1;
	for (i=1;i<=n;i++) fac[i]=(ll)fac[i-1]*i%mod;
	ifac[n]=calc(fac[n],mod-2);
	for (i=n-1;i>=1;i--) ifac[i]=(ll)ifac[i+1]*(i+1)%mod;
	for (i=1;i<=n;i++)
	printf ("%d\n",(C(n,i)-C(x-1+n-y,i-1)+mod)%mod);
	return 0;
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main(){
    long d,n;
    cin >> d >> n;
    if(d==0){
        if(n==100) cout << 101 << endl;
        else cout << n << endl;
    }
    else if(d==1){
        if(n==100) cout << 10100<< endl;
        else cout << n*100 << endl;
    }
    else if(d==2){
        if(n==100){
            long i=101*10000;
            cout << i <<endl;
        }
        else{
            long i=n*10000;
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
N, M = map(x -> parse(Int64, x), split(chomp(readline())))
if M % 2 == 1
    M -= 1
end
nb_scc = 0

if N <= div(M, 2)
    nb_scc += N
    M -= 2*N
    nb_scc += div(M, 4)

else
    nb_scc = min(div(M, 2), N)
end

println(nb_scc)


Measured memory_bytes: 167616
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <sstream>
#include <fstream>
#include <cmath>
#include <cstring>

using namespace std;
#define int long long
const int mod = 1000000007;

int A[100000] = {};
signed main()
{
	int N;
	cin >> N;
	int p = 0, q = 0;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) {
		if (A[i] % 2 == 0) p++;
		else q++;
	}

	if (q % 2 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;

}



Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
using namespace std;

int main(){
    int A, V, B, W, T;
    scanf("%d %d\n%d %d\n%d", &A, &V, &B, &W, &T);
    if(V > W && (abs(A - B) - 1)/(V - W) + 1 <= T) printf("YES\n");
    else printf("NO\n");
	return 0;
}

Measured memory_bytes: 1648
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
ans = 0
for i in range(K):
    k = i
    if T[k]=='r':
        ans += P
    elif T[k]=='s':
        ans += R
    else:
        ans += S
    flag = False
    while k < N:

        if k+K < N:
            if T[k+K]!=T[k]:
                if T[k+K]=='r':
                    ans += P
                elif T[k+K]=='s':
                    ans += R
                else:
                    ans += S
                flag = False
            else:
                if not flag:
                    flag = True
                else:
                    flag = False

                    if T[k+K]=='r':
                        ans += P
                    elif T[k+K]=='s':
                        ans += R
                    else:
                        ans += S
        k += K
print(ans)

Measured memory_bytes: 3316
import java.util.*;

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

	int[] wight = {1,2,4,8,16,32,64,128,256,512};

	while(sc.hasNext()){

	    int n = sc.nextInt();
	    int nn = n;
	    int[] record = new int[wight.length];

	    while(n!=0){
		for(int i=9; i>=0; i--){
		    if(n-wight[i]>=0 && record[i]==0){record[i] = 1; n-=wight[i];}
		}
	    }

	    List<Integer> ans = new ArrayList<Integer>();
	    for(int i=0; i<record.length; i++){
		if(record[i]==1){
		    ans.add(wight[i]);
		}
	    }
	    for(int i=0; i<ans.size()-1; i++){
		System.out.print(ans.get(i)+" ");
	    }
	    System.out.println(ans.get(ans.size()-1));
	}
    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include<cassert>
using namespace std;
#include<atcoder/all>
using namespace atcoder;


#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const long double eps = 1E-14;

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

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

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

using mint = modint998244353;

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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

int main() {
	ll N, M;
	cin >> N >> M;
	vector<string>S(N);
	rep(i, N)cin >> S[i];

	mf_graph<ll> g(N * M + 2);
	ll s = N * M;
	ll t = N * M + 1;
	
	auto v = [&](ll i, ll j) {return i * M + j; };

	rep(i, N)rep(j, M) {
		
		if((i+j)%2==0){
			g.add_edge(s, v(i, j), 1);
			if (i < N - 1 && S[i][j] == '.' && S[i + 1][j] == '.') {g.add_edge(v(i, j), v(i + 1, j), 1); }
			if (i > 0 && S[i][j] == '.' && S[i - 1][j] == '.') {g.add_edge(v(i, j), v(i - 1, j), 1); }
			if (j < M-1 && S[i][j] == '.' && S[i][j + 1] == '.') {g.add_edge(v(i, j), v(i, j + 1), 1); }
			if (j > 0 && S[i][j] == '.' && S[i][j - 1] == '.') {g.add_edge(v(i, j), v(i, j - 1), 1); }

		}
		else {
			g.add_edge(v(i, j), t, 1);
		}
	}

	ll ans = g.flow(s, t);
	
	auto ed = g.edges();

	vector<string> grid = S;
	for (auto e : ed) {
		if (e.flow == 1) {
			ll x = e.from;
			ll y = e.to;
			if (x == s || y == t) { continue; }

			if (x > y) { swap(x, y); }
			if (x + M == y) {
				grid[x / M][x % M] = 'v';
				grid[y / M][y % M] = '^';
			}
			else if (x + 1 == y) {
				grid[x / M][x % M] = '>';
				grid[y / M][y % M] = '<';
			}
			
		}
	}
	cout << ans << endl;
	rep(i, N)cout << grid[i] << endl;
}


Measured memory_bytes: 6368