akhauriyash/Code-Regression huggingface dataset:
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define debug(x) cout<<#x<<": "<<x<<" "
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    IO;
    int T;
    cin>>T;
    if(T>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 40;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};



int main()
{
  string s; 
  int q;
  cin >> s >> q;
  deque<char> l, r;
  bool rev = false;
  rep(i, q) {
    int t; cin >> t;
    if(t == 1) rev = !rev;
    else {
      int f; 
      char c;
      cin >> f >> c;
      bool rr = f-1;
      if(rev ^ rr) {
        r.push_back(c);
      }
      else {
        l.push_front(c);
      }
    }
  }
  string ans = "";
  if(!rev) {
    for(auto c : l) ans += c;
    ans += s;
    for(auto c : r) ans += c;
  }
  else {
    reverse(ALL(l));
    reverse(ALL(s));
    reverse(ALL(r));
    for(auto c : r) ans += c;
    ans += s;
    for(auto c : l) ans += c;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1248
import java.util.Scanner;

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

		int cntA = 0;
		int cntB = 0;

		for (int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);
			if (i%2==0) {
				if (c!='0') {
					cntA++;
				} else {
					cntB++;
				}
			} else {
				if (c!='1') {
					cntA++;
				} else {
					cntB++;
				}
			}
		}
		System.out.println(Math.min(cntA, cntB));
	}
}


Measured memory_bytes: 25324
#include <bits/stdc++.h>
using namespace std;
int a[1050];
int main()
{
       ios::sync_with_stdio(false);
       int x, n;
       int ans=100000;
       cin >> x >> n;
       for (int i=0; i<n; i++)
       {
             int temp;
             cin >>temp;
             a[temp]=1;
       }
       for (int i=x; i>=0; i--)
       {
             if (a[i]==0)
             {
                   ans=i;
                   break;
             }
       }
       for (int i=x; i<=101; i++)
       {
             if (a[i]==0&&abs(x-i)<abs(x-ans))
             {
                   ans=i;
                   break;
             }
       }
       if (n==0) cout << x << endl;
       else cout <<ans << endl;
	return 0;
}

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


int main() {

    int res = 0;
    int ans = 0;
    rep(i,5) {
        int x; cin >> x;
        int v = ceil((double)x/10)*10;
        res = max(v-x,res);
        ans += v;
    }
    cout << ans - res << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可

const ll INF=1000000000000000000;

signed main(){
    ll n,k;
    cin>>n>>k;
    V<double> p(n);
    cinf(n,p);
    V<double> q(n);
    rep(i,n){
        q[i]=p[i]*(p[i]+1)/2;
    }
    vector<double> a(n);
    rep(i,n)a[i]=(double)q[i]/p[i];
    V<double> s(n+1,0.0);
    rep(i,n) s[i+1]=s[i]+a[i];
    double ans=0.0;
    rep(i,n-k+1){
        chmax(ans,(double)s[i+k]-s[i]);
    }
    cout<<fixed<<setprecision(10)<<ans;
}

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

using namespace std;

#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()

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

template<class T>
void print(vector<T>& V, bool spaced = true) {
    string space;
    spaced ? space = " " : space = "";
    for(int i = 0; i < V.size(); i++) {
        cout<< V[i] << space;
    }cout<< '\n';
}

template<class T>
void printendl(vector<T>& V) {
    for(int i = 0; i < V.size(); i++) {
        cout<< V[i] << '\n';
    }
}

template<class T>
T gcd(T a, T b) {
    T r;
    while (b != 0) {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

template <class T>
T lcm (T a, T b) {
    return a / gcd(a, b) * b;
}

template<class T>
T Max(T a, T b) {
    return (a < b) ? b : a;
}

template<class T>
T Min(T a, T b) {
    return (a < b) ? a : b;
}

//str

bool isPalindrome(string str){
    
    int length = str.length();
 
    for (int i = 0; i < (length / 2); i++)
        if (str[i] != str[length - 1 - i])
            return false;
 
    return true;    
}

void reverseStr(string& str) 
{ 
    int n = str.length(); 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
}
 

//Read through the messages at the end when you're done

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n; cin>> n;
    cout << n*(n+1)/2 << '\n';
    
    

    
    

    return 0;
}

    //Use long long da5eel rabbak!
    //Dont use endl;
    //DONT SUBMIT IZA UR NOT SURE WALLAHI BTENDAM
    //Dear Amine, just because it worked for the test cases doesnt necessarily mean it is correct.
    //Dear Amine, try it on ur own test cases iza ur not SURE
    //In case u didnt use long long, CHECK FOR POTENTIAL OVERFLOWS
    //DONT FORGET TO MOD EVERYTHING IZA U NEED TO MOD



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

void call(int n);
void check(int i);

int main() {
    int n;
    cin >> n;
    call(n);
}

void call(int n) {
    for (int i = 1; i <= n; ++i) {
        check(i);
    }
    cout << endl;
}

void check(int i) {
    if (i % 3 == 0) {
        cout << " " << i << flush;
    } else if (i % 10 == 3) {
        cout << " " << i << flush;
    } else if ((i / 10) % 10 == 3) {
        cout << " " << i << flush;
    } else if ((i / 100) % 10 == 3) {
        cout << " " << i << flush;
    } else if ((i / 1000) % 10 == 3) {
        cout << " " << i << flush;
    }
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	
	int n; cin>>n; map<string,int> m; string res; int co = 0;
	for(int i = 0; i < n; i++){
		string x; int y; cin>>x>>y;
		co+=y;
		m[x] += co;
		if(i == n-1) res = x;
	}
	string s; cin>>s;
	cout<<m[res]-m[s]<<"\n";
	
	
	
	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vvchar vector<vector<char>>
#define vchar vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n,k; cin >> n >>k;
    vint a(n);
    rep(i,n)cin>>a[i];

    int num1=0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            if(a[i]>a[j]) num1++;
        }
    }
    
    int num2=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(a[i]>a[j]) num2++;
        }
    }
    int m1=k,m2=(k*(k-1)/2)%MOD;
    cout<<(num1*m1+num2*m2)%MOD<<endl;

}

Measured memory_bytes: 3640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        long N = stdIn.nextLong();
        long K = stdIn.nextLong();

        long min = ((N % K) > Math.abs((N % K) - K)) ?  Math.abs((N % K) - K) : (N % K);

        System.out.println(min);
    }
}

Measured memory_bytes: 23764
H, W = map(int, input().split())
white_column = []
a = [list(input()) for _ in range(H)]

# Mark white columns
for j in range(W-1, -1, -1):
    flag = True

    for i in range(H):
        if a[i][j] != '.':
            flag = False
            break

    if flag:
        for i in range(H):
            a[i].pop(j)
        W -= 1

# Print line if it contains black grid
for i in range(H):
    flag = True

    for j in range(W):
        if a[i][j] == '.':
            continue
        else:
            flag = False
            break

    if flag:
        continue
    else:
        print(''.join(a[i]))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  vector<int> r(n),l(n);
  rep(i,n-1){
    r[i+1] = r[i];
    if(s[i]=='W') r[i+1]++;
    l[n-1-i-1] = l[n-i-1];
    if(s[n-1-i]=='E') l[n-1-i-1]++;
  }
  int ans = n;
  rep(i,n) ans = min(ans,l[i]+r[i]);
  cout << ans << endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  int ans = INT_MAX;
  for (int t = 1; t < n; t++) {
    int d1 = accumulate(w.begin(), w.begin() + t, 0);
    int d2 = accumulate(w.begin() + t, w.end(), 0);
    int diff = abs(d1 - d2);
    ans = min(ans, diff);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int ai[200005];
int bi[200005];
int main()
{
    int n;
    scanf("%d",&n);
    int a;
    if(n>999)
     printf("ABD");
    else
    printf("ABC");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    VEC(int) Heights(N);
    READVEC(Heights);
    FORD(i, N - 2, -1) {
        if (Heights[i] > 1 + Heights[i + 1]) {
            cout << "No" << endl;
            return 0;
        } else if (Heights[i] == 1 + Heights[i + 1]) {
            Heights[i]--;
        }
    }

    cout << "Yes" << endl;
    return 0;
};


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


string s;

void read() {
    cin >> s;
}


void work() {
    const static string wList[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    cout << 7 - (find(wList, wList + 7, s) - wList) << endl;
}


int main() {
    read();
    work();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int n = sc.nextInt();

        int ans = 0;
        for(int i = 0; i < n; i++) {
            if(isPrime(sc.nextInt())) ans++;
        }

        System.out.println(ans);
    }

    private static boolean isPrime(int x) {
        if(x == 2) return true;
        if(x < 2 || (x & 1) == 0) return false;

        int i = 3;
        while(i <= Math.sqrt((int)x)) {
            if(x % i == 0) return false;
            i += 2;
        }

        return true;
    }
}


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

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

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

int main(){
	int N;
	cin >> N;
	char color[N + 1];
	for(int i = 0; i < N; ++i){
		cin >> color[i];
	}
	color[N] = 'Y';
	
	int j = 0;
	while(color[j] != 'Y'){
		++j;
	}
	
	if(j == N){
		cout << "Three" << endl;
	} else {
		cout << "Four" << endl;
	}
}

Measured memory_bytes: 256
N = int(input())
S = input()
alphabets = {}
ans = 0
mod = 10**9+7
for i in range(N):
    if not S[i] in alphabets:
        alphabets[S[i]] = 0
    alphabets[S[i]] += 1

ans = 1
for c in alphabets:
    ans = ans + ans * alphabets[c]
    ans %= mod
print((ans-1)%mod)

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

int main(){
  string S;
  cin >> S;
  if(S.size()<4){
    cout << "No" << endl;
    return 0;
  }
  if(S[0]=='Y' && S[1]=='A' && S[2]=='K' && S[3]=='I'){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
# encoding:utf-8

def main():
	n = int(input())
	ps = {int(input()):i for i in range(n)}
	#print(ps)

	out = 0
	cnt = 1
	tmp = 0
	for i in range(1, n):
		#print(out)
		if ps[i+1] >= ps[i]:
			cnt += 1
		else:
			out = max(cnt, out)
			cnt = 1
	else:
		if out == 0:
			out = n 
		else:
			out = max(cnt, out)

	print(n - out)

if __name__ == '__main__':
	main()

Measured memory_bytes: 32608
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
ll dp[82][82][13000];
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	ll n, m, k, ans1, ans2, i, j;
   	cin>>n>>m;
   	ll a[n+1][m+1], b[n+1][m+1];
   	for(i=0; i<n; i++) {
   		for(j=0; j<m; j++) {
   			cin>>a[i][j];
   		}
   	}
   	for(i=0; i<n; i++) {
   		for(j=0; j<m; j++) {
   			cin>>b[i][j];
   		}
   	}
   	for(i=0; i<n; i++) {
   		for(j=0; j<m; j++) {
   			for(k=0; k<13000; k++) {
   				dp[i][j][k] = 0;
   			}
   		}
   	}
   	dp[0][0][abs(a[0][0] - b[0][0])] = 1;
   	for(i=0; i<n; i++) {
   		for(j=0; j<m; j++) {
   			for(k=0; k<13000; k++) {
   				if(dp[i][j][k]) {
   					if(i + 1 < n) {
						ans1 = k + abs(a[i+1][j] - b[i+1][j]);
						ans2 = abs(k - abs(a[i+1][j] - b[i+1][j]));
						dp[i+1][j][ans1] = 1;
						dp[i+1][j][ans2] = 1; 
					}
   					if(j + 1 < m) {
	   					ans1 = k + abs(a[i][j+1] - b[i][j+1]);
	   					ans2 = abs(k - abs(a[i][j+1] - b[i][j+1]));
	   					dp[i][j+1][ans1] = 1;
	   					dp[i][j+1][ans2] = 1;
	   				}
   				}
   			}
   		}
   	}
   	for(k=0; k<13000; k++) {
   		if(dp[n-1][m-1][k]) {
   			cout<<k<<"\n";
   			return 0;
   		}
   	}
}

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

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

    long long chk = 0;
    long long sum = 0;
    long long res = 0;

// -1 4 3 2 -5 4

    for(int i = 0; i<N; i++) {
        sum += a[i];
        if(i % 2 == 0 && sum <= 0) {
            chk += 1 - sum;
            sum = 1;
        } else if(i % 2 == 1 && sum >= 0) {
            chk += sum + 1;
            sum = -1;
        }
    }
    res = chk;
    sum = 0;
    chk = 0;
    for(int i = 0; i<N; i++) {
        sum += a[i];
        if(i % 2 == 1 && sum <= 0) {
            chk += 1 - sum;
            sum = 1;
        } else if(i % 2 == 0 && sum >= 0) {
            chk += sum + 1;
            sum = -1;
        }
    }
    cout << min(res , chk) << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if v<=w:
    print("NO")
    sys.exit()

if a<b:
    if a+t*v>=b+t*w:
        print("YES")
    else:
        print("NO")
else:
    if a-t*v<=b-t*w:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 9024
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>



class BinaryIndexedTree {
	std::vector<int> vec;
public:
	BinaryIndexedTree(const int _size) : vec(_size, 0) {};
	void increment(int position) {
		while (position < vec.size()) {
			vec[position]++;
			position += (position + 1) & ~position;
		}
	}
	void decrement(int position) {
		while (position < vec.size()) {
			vec[position]--;
			position += (position + 1) & ~position;
		}
	}
	int operator[](int position) const {
		return (position < 0) ? 0 : vec[position] + operator[](position - ((position + 1) & ~position));
	}
	int size() const { return vec.size(); }
};
template<typename V>
int lower_bound(const V& vec, const int target) {
	int left = 0;
	int right = vec.size();
	while (left < right) {
		auto mid = (left + right) / 2;
		if (vec[mid] < target) left = mid + 1;
		else right = mid;
	}
	return right;
}
int main() {
	while (true) {
		int n, k, m; std::cin >> n >> k >> m;
		if (n == 0) return 0;
		BinaryIndexedTree bit(n);
		for (auto i = 0; i < n; ++i) bit.increment(i);
		auto prev_num = m - 1; auto prev_rank = m - 1; bit.decrement(prev_num);
		for (int i = n - 1; i > 1; --i) {
			prev_rank = (prev_rank + k - 1) % i;
			prev_num = lower_bound(bit, prev_rank + 1);
			bit.decrement(prev_num);
		}
		std::cout << lower_bound(bit, 1) + 1 << std::endl;
	}
}


Measured memory_bytes: 3120
using System;

    class Program
    {
        static void Main()
        {
            while (true)
            {
                char line = (char)Console.Read();

                if(char.IsUpper(line))
                    Console.Write(line.ToString().ToLower());
                else
                    Console.Write(line.ToString().ToUpper());

                if (line.ToString() == "\n")
                    break;
            }
        }
    }

Measured memory_bytes: 17824
#include<stdio.h>
#include<string.h>
int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    d=a>=b? a:b;
    if(c%d==0) e=c/d;
    else  e=c/d+1;
    printf("%d\n",e);
    return 0;
}


Measured memory_bytes: 128
//dwango6_a.cpp
//Sat Feb 29 09:01:57 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<string,int> P;

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

	vector<P> list;
	for (int i=0;i<n;i++){
		string s;
		int t;
		cin >> s >> t;
		list.push_back(P(s,t));
	}

	string x;
	cin >> x;

	int flag = 0;
	int ans = 0;
	for (int i=0;i<n;i++){
		if (list[i].first==x){
			flag = 1;
		}else if (flag){
			ans += list[i].second;
		}
	}


	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

        int S;
        int h, m, s;

        scanf("%d", &S);

        if(0 <= S && S <= 86400){
                h = S /(60*60);
                m = (S%(60*60))/60;
                s = S % 60;

                printf("%d:%d:%d\n", h, m, s);
        }

        return 0;
}

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

int main(){
	int x, a, b;
	cin >> x >> a >> b;
	int ax = abs(x - a);
	int bx = abs(x - b);
	if (ax > bx)
	{
		cout << "B" << endl;
	}else{
		cout << "A" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const int INF = 1 << 30;

int c[15], a[15][15];

int main(){
	int n, m, x;
	scanf("%d%d%d", &n, &m, &x);
	for(int i = 0; i < n; i++) {
		scanf("%d", c + i);
		for(int j = 0; j < m; j++)
			scanf("%d", &a[i][j]);
	}
	int ans = INF;
	for(int i = 0; i < (1 << n); i++) {
		bool flag = true;
		vector<int> sum(m + 1, 0);
		for(int j = 0; j < n; j++) {
			if(i & (1 << j)) {
				sum[0] += c[j];
				for(int k = 0; k < m; k++)
					sum[k+1] += a[j][k];
			}
		}
		for(int j = 1; j <= m; j++)
			if(sum[j] < x) flag = false;
		if(flag) ans = min(ans, sum[0]);
	}
	printf("%d\n", (ans < INF) ? ans : -1);
}


Measured memory_bytes: 3776
import heapq
n,m = input().split(" ")
n = int(n)
m = int(m)

arr = [[] for _ in range(m)]

for i in range(n):
  a,b = input().split(" ")
  a = int(a)
  b = - int(b) # for heap
  
  if a > m:
    continue
    
  arr[a-1].append(b)

vs = []
heapq.heapify(vs)

res = 0
for item in arr:
  for v in item:
	  heapq.heappush(vs, v)
  
  if len(vs) == 0:
    continue
    
  maxi = heapq.heappop(vs)
  res += (-1* maxi)
  
print(res)

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

#define ll long long

using namespace std; 

const int N = 200505;
const int mod = 1000000007;

int arr[15],n;
ll ans = 0;

void fun(int a){
	ll cur = arr[0];
	for(int i=0;i<n-1;i++){
		if((1<<i) & a){
			ans += cur;
			cur = arr[i+1];
		}
		else cur = cur * 10 + arr[i+1];
	}
	ans += cur;
}

int main(){
	string s;
	cin>>s;
	n = s.length();
	for(int i=0;i<n;i++) arr[i] = s[i]-'0';
	int k = 1<<(n-1);
	for(int i=0;i<k;i++){
		fun(i);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

long long gcd(int a, int b){
  if (a%b == 0){
    return(b);
  }
  else{
    return(gcd(b, a%b));
  }
}

int main(){
  long long K;
  string S;
  cin >> K >> S;
  int U = S.length();
  
  if(U<=K){
    cout << S << endl;
  }
  else{
    S = S.substr(0,K) + "...";
     cout << S << endl;
  }
  

}
 


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

int N, arr[200005];
bool rev;
deque<int> D;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%d", &arr[i]);
	for (int i = 0; i < N; i++) {
		if (rev) D.push_front(arr[i]);
		else D.push_back(arr[i]);
		rev = !rev;
	}
	if (rev) {
		for (int i = D.size() - 1; i >= 0; i--) printf("%d ", D[i]);
		printf("\n");
	} else {
		for (int i = 0; i < D.size(); i++) printf("%d ", D[i]);
		printf("\n");
	}
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  int n, m; cin >> n >> m;
  V<> p(m), y(m); for (int i = 0; i < m; ++i) cin >> p[i] >> y[i];
  V<> id(m); iota(begin(id), end(id), 0);
  sort(begin(id), end(id), [&](int i, int j) { return y[i] < y[j]; });
  V<> c(n + 1, 1);
  V<lint> res(m);
  for (int i = 0; i < m; ++i) {
    res[id[i]] = p[id[i]] * 1000000LL + c[p[id[i]]]++;
  }
  for (int i = 0; i < m; ++i) {
    printf("%012lld\n", res[i]);
  }
}

Measured memory_bytes: 3840
#[allow(unused_imports)]
use {
    itertools::Itertools,
    proconio::{fastout, input, marker::*},
    std::cmp::*,
    std::collections::*,
    std::io::Write,
    std::ops::*,
};

#[allow(unused_macros)]
macro_rules! dbg { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; }

#[fastout]
fn main() {
    input! {
        n: usize,
        x: usize,
        m: usize,
    }
    let mut r = x;
    let mut l = vec![x];
    let mut set = BTreeSet::new();
    set.insert(x);
    loop {
        r = (r * r) % m;
        l.push(r);
        if set.contains(&r) {
            break;
        }
        set.insert(r);
    }
    let l_len = l.len();
    let mut ans = 0;
    let mut k1 = 0;
    for i in 0..l_len {
        if l[i] == l[l_len - 1] {
            k1 = i;
            break;
        }
        ans += l[i];
    }
    l.pop();
    let k2 = l_len - k1 - 1;
    let mut ll = l[k1..]
        .iter()
        .scan(0, |arr, a| {
            *arr += a;
            Some(*arr)
        })
        .collect::<Vec<_>>();
    ll.insert(0, 0);
    if n > k1 {
        ans += ll[k2] * ((n - k1) / k2) + ll[(n - k1) % k2];
    }
    println!("{}", ans);
}


Measured memory_bytes: 3700
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        if (input == "A") { Console.WriteLine("T"); }
        else if (input == "T") { Console.WriteLine("A"); }
        else if (input == "C") { Console.WriteLine("G"); }
        else if (input == "G") { Console.WriteLine("C"); }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
bool func(long long mid, vector<long long>&line) {
	int lp = 0, hp = 1;
	while (true) {
		if (line[hp] - line[lp] >= mid) {/*
			int fp = hp + 1;
			int bp = lp + N;
			while (fp < bp) {
				int mp = (fp + bp) >> 1;
				if (line[mp] - line[hp+1] >= mid) {
					if (line[lp + N] - line[mp] >= mid) {
						return true;
					}
					bp = mp;
				}
				else {
					fp = mp + 1;
				}
			}*/
			int it = lower_bound(line.begin() + hp + 1, line.begin() + lp + N, mid + line[hp])-line.begin();
			if (line[lp + N] - line[it] >= mid) {
				return true;
			}
			++lp;
		}
		else {
			++hp;
			if (hp == N - 1) {
				break;
			}
		}
	}
	return false;
}
int main() {
	cin >> N;
	vector<long long> line(N+1);
	for (int i = 1; i <= N; ++i) {
		cin >> line[i];
		line.push_back(line[i]);
	}
	line[0] = 0;
	for (int i = 1; i < line.size(); ++i) {
		line[i] = line[i] + line[i - 1];
	}
	long long lp = 0, hp = INT64_MAX;
	while (lp < hp) {
		long long mid = (lp + hp) >> 1;
		if (func(mid, line)) {
			lp = mid+1;
		}
		else {
			hp = mid;
		}
	}
	cout << lp - 1 << endl;
}


Measured memory_bytes: 4524
s = gets.chomp.split(" ")
h = s[0].to_i
w = s[1].to_i
list = []

for i in 0..h-1 do
    list[i] = gets.chomp.split("")
end

for i in 0..h-1 do
    for j in 0..w-1 do
        if list[i][j] == '.' then
            count = 0
            count += 1 if 0<=i-1 and 0<=j-1 and list[i-1][j-1] == "#"
            count += 1 if 0<=i-1 and list[i-1][ j ] == "#"
            count += 1 if 0<=i-1 and j+1<w and list[i-1][j+1] == "#"
            count += 1 if 0<=j-1 and list[ i ][j-1] == "#"
            count += 1 if j+1<w and list[ i ][j+1] == "#"
            count += 1 if i+1<h and 0<=j-1 and list[i+1][j-1] == "#"
            count += 1 if i+1<h and list[i+1][ j ] == "#"
            count += 1 if i+1<h and j+1<w and list[i+1][j+1] == "#"
            print count
        else
            print list[i][j]
        end
    end
    puts ""
end

Measured memory_bytes: 3836
// Problem : A - Circle Pond
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;

int r;

int main() {
	cin >> r;
	cout << acos(-1) * 2 * r;
}


Measured memory_bytes: 3788
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
  char L[100001];
  long long pow2[100001], pow3[100001];
  
  scanf("%s", L);
  int n = strlen(L);
  
  pow3[0] = 1;
  pow2[0] = 1;
  for (int i = 1; i <= n; i++) {
    pow3[i] = (3 * pow3[i - 1]) % 1000000007;
    pow2[i] = (2 * pow2[i - 1]) % 1000000007;
  }
  
  int cnt = 0;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (L[i] == '1') {
      long long tmp = (pow2[cnt] * pow3[n - i - 1]) % 1000000007;
      ans = (ans + tmp) % 1000000007;
      cnt++;
    }
  }
  ans = (ans + pow2[cnt]) % 1000000007;
  
  printf("%lld\n", ans);
  
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
ll N;

int main(){
    //ll P , Q , R;
    //cin >> P >> Q  >> R;
    vector <int > s(3, 0);
    cin >> s[0] >> s[1] >> s[2];
    sort(s.begin(), s.end());
    ll ans = s[0] + s[1];

    cout << ans << endl;

} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool f = true;

    if (s[0] != 'A') f = false;
    if (count(s.begin(), s.end(), 'C') != 1) f = false;
    if (s[1] == 'C' || s[s.size()-1] == 'C') f = false;
    for (int i = 1; i < s.size(); ++i) {
        if (s[i] == 'C') continue;
        if (s[i] < 'a' || s[i] > 'z') f = false;
    }

    if (f) cout << "AC" << endl;
    else cout << "WA" << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int n, m;
char c[110][110];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    int d[26] = {};
    rep(i, 0, n){
        rep(j, 0, m){
            cin >> c[i][j];
            d[c[i][j] - 'a']++;
        }
    }
    int four = 0, two = 0, one = 0;
    bool f = true;
    rep(i, 0, 26){
        four += d[i] / 4;
        d[i] %= 4;
        two += d[i] / 2;
        d[i] %= 2;
        one += d[i];
    }
    
    int want_four =  (n / 2) * (m / 2);
    int want_two = 0;
    int want_one = 0;
    if(n % 2) want_two += m / 2;
    if(m % 2) want_two += n / 2;
    if(n % 2 && m % 2) want_one = 1;
    // cout << four << " " << two << " " << one << endl;
    // cout << want_four << " " << want_two << " " << want_one << endl;
    if(want_four <= four && want_one == one && 4 * want_four + 2 * want_two == 4 * four + 2 * two) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    ll n,k;
    ll mem;
    ll sum = 0;
    vector<ll> h;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> mem;
        h.push_back(mem);
        sum = sum + mem;
    }

    if(n>k){
        sort(h.begin(),h.end(),greater<int>());
        for(int i=0;i<k;i++){
            sum = sum - h[i];
        }
        
        cout << sum << endl;
    }else{
        cout << 0 << endl;
    }

}

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

typedef long long ll;

vector<vector<ll>> graph(50,vector<ll>(50, 0));
vector<ll> visit(50,0);

void dfs(ll v)
{
    visit.at(v) = true;
    ll i;
    for(i = 0;i < 50;++i){
        if(graph.at(v).at(i)){
            if(!visit.at(i)){
                dfs(i);
            }
        }
    }
    return;
}

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    vector<ll> a(m);
    vector<ll> b(m);
    for(i = 0;i < m;++i){
        ll s,g;
        cin >> s >> g;
        --s;
        --g;
        a.at(i) = s;
        b.at(i) = g;
        graph.at(s).at(g) = 1;
        graph.at(g).at(s) = 1;
    }
    ll ans = 0;
    for(i = 0;i < m;++i){
        graph.at(a.at(i)).at(b.at(i)) = 0;
        graph.at(b.at(i)).at(a.at(i)) = 0;
        for(j = 0;j < n;++j){
            visit.at(j) = 0;
        }
        dfs(0);
        bool flag = false;
        for(j = 0;j < n;++j){
            if(!visit.at(j)){
                flag = true;
                break;
            }
        }
        if(flag){
            ++ans;
        }
        graph.at(a.at(i)).at(b.at(i)) = 1;
        graph.at(b.at(i)).at(a.at(i)) = 1;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    string s;
    bool isCorrect = true;

    cin>>s;

    for(int i=0; i<a && i<s.size(); i++){
        int n = s[i] - '0';
        if(n<0 || n>9)
            isCorrect = false;
    }

    if(a<s.size() && s[a]!='-')
        isCorrect = false;

    if(a+1<s.size())
        for(int i=a+1; i<s.size(); i++){
            int n = s[i] - '0';
            if(n<0 || n>9)
                isCorrect = false;
        }

    if(isCorrect)
        puts("Yes");

    else
        puts("No");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

ll f(ll k){
    int rtn = pow(3,k) - pow(2,k)*3 + 3;
    return rtn;
}

ll g(ll k){
    int rtn = 0;
    for(int i = k; i >= 3; i--){
        rtn += f(i);
    }
    return rtn;
}


int main(){
    string s;
    cin >> s;
    int keta[3] = {3,5,7};
    int dp[10][(1<<3)][2];
    rep(i,10)rep(j,1<<3)rep(k,2) dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    rep(i,s.length()){
        for(int j = 0; j < (1<<3); j++){
            for(int k = 0; k < 2; k++){
                int ni = i+1, nj = j, nk = k;
                if(k==0){
                    rep(ri, 3){
                        nj = j | 1 << ri;
                        if(s[i]-'0'< keta[ri]) continue;
                        else if(s[i]-'0' == keta[ri]) dp[ni][nj][0] += dp[i][j][0];
                        else if(s[i]-'0' > keta[ri]) dp[ni][nj][1] += dp[i][j][0];
                    }
                }else if(k==1){
                    rep(ri, 3){
                        nj = j | 1 << ri;
                        dp[ni][nj][1] += dp[i][j][1];
                    }
                }
            }
        }
    }
    
    cout << dp[s.length()][(1<<3)-1][0]+ dp[s.length()][(1<<3)-1][1]+g(s.length()-1);
}

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

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int k,x;cin>>k>>x;

  vi ans;
  rep(i, max(-1000000LL, x-k+1), min(1000001LL, x+k)){
    ans.pb(i);
  }
  rep(i, sz(ans)) cout << ans[i] << (i!=sz(ans)-1 ? " " : "\n");
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

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

int main(void) {
    int ans = 0;
    string s, t;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    cin >> t;
    REP(i, s.length()) {
        if (s[i] == t[i]) {
            ans++;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        char a = in.next().charAt(0);
        char b = in.next().charAt(0);
        System.out.println(a == 'H' ? b : b == 'H' ? 'D' : 'H');
    }
}


Measured memory_bytes: 19924
#include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
int main(){
  string str;
  while( cin >> str ){
    int k,u,p,c;
    k = u = p = c = 0;
    for(int i = 0 ; i < (int)str.size() ; i++ ){
      if(str[i] == 'K')k++;
      if(str[i] == 'U')u++;
      if(str[i] == 'P')p++;
      if(str[i] == 'C')c++;
    }
    cout << min(k,min(u,min(p,c))) << endl;
  }
  return 0;
}

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

int n, m, x;

int main()
{
  cin >> n >> m >> x;
  vector<int> cost(20);
  vector<vector<int>> book(20, vector<int>(20));
  rep(i, n)
  {
    cin >> cost[i];
    rep(j, m)
    {
      cin >> book[i][j];
    }
  }
  
  int res = 1e9;
  for(int S = 0; S < (1 << n); S++)
  {
    vector<int> progress(20, 0);
    rep(i, n) rep(j, m)
    {
      if((S >> i) & 1)
        progress[j] += book[i][j];
    }
    bool flag = true;
    rep(i, m)
    {
      if(progress[i] < x)
      {
        flag = false;
        break;
      }
    }
    if(!flag) continue;
    
    
    int sum = 0;
    rep(i, n)
    {
      if((S >> i) & 1) sum += cost[i];
    }
    res = min(res, sum);
  }
  
  if(res == 1e9) res = -1;
  cout << res << endl;
      
  
  return 0;
}

Measured memory_bytes: 3592
N,M = map(int, input().split())
A = [int(input()) for a in range(M)]
A = set(A)
	
DP = [0] * (N + 1)	
DP[0] = 1

mod = (10 ** 9) + 7

for i in range(1,N+1):
	if i in A:
		DP[i] = 0
	else:
		DP[i] = DP[i-1] + DP[i-2]

print(DP[N] % (mod))

Measured memory_bytes: 460020
/**
 * Created by hiramekun at 20:44 on 2019-12-08.
 */
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    ll h, w;
    cin >> h >> w;
//    vector<vector<ll>> a(h, vector<ll>(w)), b(h, vector<ll>(w));
    int a[h][w], b[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) cin >> b[i][j];

    ll max_diff = 2 * 80 * 160;
    vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(max_diff)));
//    bool dp[h][w][max_diff];
    rep(i, h) rep(j, w) rep(l, max_diff) dp[i][j][l] = false;

    ll mid = max_diff / 2;
    dp[0][0][b[0][0] - a[0][0] + mid] = true;
    dp[0][0][-b[0][0] + a[0][0] + mid] = true;

    rep(i, h) {
        rep(j, w) {
            rep(l, max_diff) {
                if (!dp[i][j][l]) continue;
                if (i + 1 <= h - 1) {
                    dp[i + 1][j][l + b[i + 1][j] - a[i + 1][j]] = true;
                    dp[i + 1][j][l - b[i + 1][j] + a[i + 1][j]] = true;
                }
                if (j + 1 <= w - 1) {
                    dp[i][j + 1][l + b[i][j + 1] - a[i][j + 1]] = true;
                    dp[i][j + 1][l - b[i][j + 1] + a[i][j + 1]] = true;
                }
            }
        }
    }
    ll ans = 1e18;
    rep(i, max_diff) {
        if (dp[h - 1][w - 1][i]) ans = min(ans, abs(i - mid));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 22912
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>

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

using namespace std;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



int main()
{
	string s;
	cin >> s;
	reverse(all(s));
	s = s + '0';
	int n = s.size();
	vector<vector<int>> dp(n+1,vector<int>(2,inf));
	dp[0][0] = 0;
	rep(i,n){
		rep(j,2){
			int x = s[i] - '0';
			x += j;
			rep(a,10){
				int ni = i + 1, nj = 0;
				int b = a - x;
				if (b < 0){
					nj = 1;
					b += 10;
				}
				dp[ni][nj] = min(dp[ni][nj], dp[i][j] + a + b);
			}
		}
		
	}
	cout << dp[n][0] << endl;

	return 0;
}

Measured memory_bytes: 55900
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    ll ans=INF;
    string s; cin>>s;
    vector<ll> L(sz(s),0);
    vector<ll> R(sz(s),0);
    // 0 1 2 3 ...  sz(s)-1
    rep1(i,sz(s)-1){
        L[i]=L[i-1];
        if(s[i-1]=='W') L[i]++;
    }
    rrep(i,sz(s)-1){
        R[i]=R[i+1];
        if(s[i+1]=='E') R[i]++;
    }
    
    rep(i,sz(s)){
        chmin(ans,L[i]+R[i]);
    }
    cout<<ans<<endl;
}



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

using namespace std;

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

	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++)
		cin >> h[i];
	int ans = 1, hi = h[0];
	for (int i = 1; i < n; i++) {
		if (h[i] >= hi) {
			ans++;
			hi = h[i];
		}
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256