akhauriyash/Code-Regression huggingface dataset:
H, W = map(int, input().split())
value = H * W
#3つの長方形を(hi,wi)として考える

#h1 == H 横に3分割パターンか縦長一つ横二つパターン
#h1 + h2 = H 縦長1つ横2つパターン
#h1 + h3 = H 縦長2つ横1つパターン
##h1 + h2 + h3 = H 縦に3分割パターン

#横に3分割パターン
if W % 3 == 0:
  value = 0
else:
  value = H

#縦に3分割
if H % 3 == 0:
  value = 0
else:
  value = min(value, W)
  
#縦長一つ横二つパターン
if W % 3 != 0: #3で割り切れるならすでに上記で0になってる
  for i in range(3):
    w1 = W//3 - 1 + i
    s1 = H * w1
    w_amari = W - w1
    for j in range(3):
      h1 = H//2 - 1 + j
      s2 = h1 * w_amari
      s3 = H * W - s1 - s2
      value2 = max(s1,s2,s3) - min(s1,s2,s3)
      #print(s1,s2,s3)
      value = min(value, value2)
#縦長2つ横1つパターン      
if H % 3 != 0: #3で割り切れるならすでに上記で0になってる
  for i in range(3):
    h1 = H//3 - 1 + i
    s1 = h1 * W
    h_amari = H - h1
    for j in range(3):
      w1 = W//2 - 1 + j
      s2 = h_amari * w1
      s3 = H * W - s1 - s2
      value3 = max(s1,s2,s3) - min(s1,s2,s3)
      value = min(value, value3)
      
print(value)
  
  
  


Measured memory_bytes: 3064
import sys

input = sys.stdin.readline


def main():
    H, W = map(int, input().split())
    C = [None] * H
    for i in range(H):
        C[i] = input().rstrip()

    for i in range(H):
        print(C[i])
        print(C[i])


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
// think twice code once
// Start:[]
// End  :[]
/*{{{*/
#include <bits/stdc++.h>
using namespace std;

#define rep(i, x, y) for(int i = (x), _ = (y); i <= _; ++ i)
#define per(i, x, y) for(int i = (x), _ = (y); i >= _; -- i)
#define dprintf(...) fprintf(stderr, __VA_ARGS__)
#define disp(x) cout << #x << " = " << x << "; "
#ifdef __linux__
#define getchar getchar_unlocked
#define LLFORMAT "%lld"
#else
#define LLFORMAT "%I64d"
#endif

typedef long long LL;

template <class T> bool chkmin(T& a, T b) { return a > b ? a = b, true : false; }
template <class T> bool chkmax(T& a, T b) { return a < b ? a = b, true : false; }

template <class T> void read(T& a) {
	char c = getchar(); T f = 1; a = 0;
	for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) a = a * 10 + c - '0';
	a *= f;
}
/*}}}*/

const int maxN = 1050;

struct Edge
{
	int v, next;
}G[maxN];

int st[maxN], e;
int N, M;
int ans;
bool vis[maxN];

void addedge(int u, int v)
{
	G[++e] = (Edge) {v, st[u]};
	st[u] = e;
}

void dfs(int u, int cnt)
{
	if(cnt == N)
	{
		++ ans;
		return;
	}

	for(int e = st[u]; e; e = G[e].next)
	{
		int v = G[e].v;
		if(vis[v])
			continue;
		vis[v] = 1;
		dfs(v, cnt + 1);
		vis[v] = 0;
	}
}

int main()
{
#ifdef Leeson
	freopen("tmp.in", "r", stdin);
	freopen("tmp.out", "w", stdout);
#endif

	read(N); read(M);
	rep(i, 1, M)
	{
		int u, v;
		read(u); read(v);
		addedge(u, v);
		addedge(v, u);
	}

	vis[1] = 1;
	dfs(1, 1);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ld = double;
const ld PI = acos(-1);

int main()
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double rad = abs((60 * h + m) / 720 * 2 * PI) - (m / 60 * 2 * PI);
    double res = sqrt(a * a + b * b - 2 * a * b * cos(rad));

    cout << fixed << setprecision(10) << res << "\n";
    return 0;
}

Measured memory_bytes: 4244
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;

int so(int y,int m,int d){
  int res=d-1;
  if(y%3==0){ rep(i,m-1) res+=20;}
  else{ rep(i,m-1){ if((i+1)%2==0){ res+=19;} else res+=20;}}
  rep(i,y-1){
    if((i+1)%3==0){
      res = res + 20*10;
    }else{
      res = res + 19*5 + 20*5;
    }
  }
  return res;
}

int main(){

  int n,y,m,d;
  scanf("%d",&n);
  rep(i,n){
    scanf("%d%d%d",&y,&m,&d);
    printf("%d\n",so(1000,1,1)-so(y,m,d));

  }

  return 0;

}

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

int main() {
  int n, k; cin >> n >> k;
  vector<int> l(n);
  for(int i = 0; i < n; i++){
    cin >> l.at(i);
  }
  
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());
  
  int ans = 0;
  for(int i = 0; i < k; i++){
    ans += l.at(i);
  }
    
  cout << ans << endl;
    
    

}


Measured memory_bytes: 256
#include<iostream> 
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(I,N) for(int I=0;I<N;I++)


int main() {
	string s;
	bool al[26] = {};
	std::cin >> s;

	REP(i, s.length()) {
		al[s[i] - 'a'] = true;
	}
	if (s.length() != 26) {
		REP(i, 26) {
			if (al[i] == 0) {
				s.push_back(  i + 'a');
				break;
			}
		}
		cout << s << endl;
	}
	else if (s == "zyxwvutsrqponmlkjihgfedcba") {
		cout << "-1" << endl;
	}
	else {
		int poi = 0;
		int size = s.length() - 1;
		for (int i = s.length() - 1; i >= 0; --i) {
			if (i == size) {
				poi = s[i] - 'a';
				s.pop_back();
				al[poi] = false;
			}
			else {
				if (poi < s[i] - 'a') {
					poi = s[i] - 'a';
					s.pop_back();
					al[poi] = false;
				}
				else {
					int ans = s[s.length() - 1] - 'a';
					REP(i, 26) {
						if (al[(ans + i) % 26] ==false) {
							s.pop_back();
							s.push_back(ans + i + 'a');
							break;
						}
					}
					break;
				}
			}
		}
		cout << s << endl;
	}
	return 0;
}

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

int main(){
    int x, y;
    int ans;
    cin >> x >> y;
    for (int i = 0; i < x + 1; i++){
        if(4 * x - y == 2 * i ){
            ans ++;
        }
    }
    if (ans > 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    
}

Measured memory_bytes: 3624
//0046
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void)
{
	vector<double> v;
	double height;
	while(cin >> height)
	{
		v.push_back(height);
	}
	sort(v.begin(), v.end());
	cout << (v.back()-v[0]) << endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include<string>
#include <cassert>
#include <algorithm>
#include <functional>
using namespace std;


int main() {
	int A, B;
	int add;//足し算
	int sub;//引き算
	int mal;//掛け算
	int tmp;
	cin >> A >> B;
	add = A + B;
	sub = A - B;
	mal = A * B;
	cout << max({ add,sub,mal });
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;

struct Input
{
	int n;char c;char str[1024];string s;ll l;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;

int main(){
	while(1){
		int m = in.nextInt(), n1 = in.nextInt(), n2 = in.nextInt();
		if(m == 0) break;
		vi v(m);
		rep(i, m) v[i] = in.nextInt();
		sort(rall(v));
		int ans = n1;
		for(int i = n1; i <= n2; i++){
			if(v[i-1]-v[i] >= v[ans-1] -v[ans]) ans = i;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1212
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include <iostream>
#include <vector>
using namespace std;

int main(){
    string S, T;
    cin >> S;
    cin >> T;

    int point = 0;
    for (int i=0; i<3; i++){
        point += S[i] == T[i] ? 1: 0;
    }

    cout << point;
}

Measured memory_bytes: 256
import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n=int(input())
edge=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
inf=10**6
Par=[inf]*n
Par[0]=-1
Deg=[0]*n
Deg[0]=0
Chk=[0]
while Chk:
  c=Chk.pop()
  for next in edge[c]:
    if Par[next]==inf:
      Par[next]=c
      Deg[next]+=1
      Chk.append(next)

from collections import deque
TS=list(v for v in range(n) if Deg[v]==0)
D=deque(TS)
while D:
  v=D.popleft()
  for t in edge[v]:
    if t!=Par[v]:
      Deg[t]-=1
      if Deg[t]==0:
        D.append(t)
        TS.append(t)

Used=[False]*n
C=[0]*n
for i in reversed(range(n)):
  v=TS[i]
  Used[v]=True
  for g in edge[v]:
    if not Used[g]:
      C[g]+=C[v]+1

H=[0]*n
H[0]=1
H[1]=pow(2,mod-2,mod)
for i in range(2,n):
  H[i]=(H[i-1]*H[1])%mod

ans=0
for i in range(n):
  if len(edge[i])==1:
    continue
  else:
    A=[]
    for e in edge[i]:
      if e==Par[i]:
        A.append(n-1-C[i])
      else:
        A.append(C[e]+1)
    cur=1+(len(edge[i])-1)*H[-1]
    for a in A:
      cur-=H[n-1-a]
    ans=(ans+cur)%mod
print((ans*H[1])%mod)


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int64_t gcd(int64_t a, int64_t b) {
	while (a && b) {
		if (a > b) a %= b;
		else b %= a;
	}
	return a + b;
}
int64_t lcm(int64_t a, int64_t b) {
	return a / gcd(a, b) * b;
}

int main() {
	int64_t a, b, c, d;
	std::cin >> a >> b >> c >> d;
	int64_t lc = lcm(c, d);
	int64_t res = 0;
	res += b;
	res -= b / c;
	res -= b / d;
	res += b / lc;
	a--;
	res -= a;
	res += a / c;
	res += a / d;
	res -= a / lc;
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;

int main() {
  string s,t;
  cin>>s>>t;
  ///////
  bool ok=false;
  string ans=s;
  int n=s.size();
  int m=t.size();
  rep(i,n-m+1){
    bool au=true;
    rep(j,m){
  
      if(s[i+j]!='?'&&s[i+j]!=t[j]){
       au=false;
        break;
      }
    }
    
    if(au){
     string kari=s;
      rep(j,m){
        kari[i+j]=t[j] ;
      }
      ans=kari;
      ok=true;
    }
   
    
    
    
  }
  
  
  
  rep(i,n){
   if(ans[i]=='?') ans[i]='a'; 
  }
  
  
  
  
  
  if(ok) cout<<ans<<endl;
  else cout<<"UNRESTORABLE"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  long sum = 0;
  for (int i=1; i<=N; i++){
    if (i%3 == 0){
      sum = sum + 0;
    } else if(i%5 == 0){
      sum = sum + 0;
    } else{
      sum = sum + i;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const long long MOD = 1e9 + 7;

class Combination {
    //a^p%mod
    ll powmod(ll a, ll p) {
        ll ans = 1LL;
        ll mul = a;
        // p >>=1 <-> p=(p >> 1)
        for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
            if ((p & 1) == 1) ans = (ans * mul) % mod;
        }

        return ans;
    }
public:
    int N;
    ll mod;
    vector<ll> fact;
    vector<ll> revFact;

    Combination(int n, ll m) : N(n), mod(m), fact(n+1), revFact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= N; i++) {
            fact[i] = fact[i-1] * i;
            fact[i] %= mod;
        }

        // Fermat's little theorem
        revFact[N] = powmod(fact[N], mod - 2);

        for (int i = N-1; i >= 0; i--) {
            revFact[i] = revFact[i+1] * (i+1);
            revFact[i] %= mod;
        }
    }

    ll get(int a, int b) {
        if (a < 0 || b < 0) return 0;
        if (b > a) return 0;
        return (((fact[a] * revFact[b]) % mod) * revFact[a-b]) % mod;
    }
};

Combination cm = Combination(2000005, MOD);

ll g(int r, int c) {
    return cm.get(r + c + 2, c + 1) - 1;
}

int main(){
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    ll ans = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1);
    ans += MOD;
    ans %= MOD;

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

Measured memory_bytes: 31488
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>

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

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

ll dp[100100];

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    dp[1] = abs(h[1]-h[0]);
    rep(i, n-2) {
        dp[i+2] = min(dp[i+1]+abs(h[i+2]-h[i+1]), dp[i]+abs(h[i+2]-h[i]));
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll n, d;
  cin >> n >> d;
  ll a = 2 * d + 1;
  ll ans = 0;
  while(n>0){
    n -= a;
    ans++;
  }
  print(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 100010;
//a数组用来记录每一个段的数量 op用来记录每一个段是0还是1 tot用来记录段之前0段的数量
int a[N],op[N],tot[N];
int main(){
    int n,k,cnt=0,sum=0,res=0;
    cin>>n>>k;
    string s;
    cin>>s;
    //tricky
    s = s+"3";
    
    memset(tot, 0, sizeof(tot));
    for(int i = 1;i<=n;i++){
        sum++;
        if(s[i]!=s[i-1]){
            a[++cnt] = sum;
            sum = 0;
            op[cnt] = s[i]-'0';
            if(s[i-1]=='0'){
                tot[cnt] = tot[cnt-1]+1;
            }else{
                tot[cnt] = tot[cnt-1];
            }
        }
    }
    a[0]=0;
    for(int i=1;i<=cnt;i++){
        a[i] += a[i-1];
    }
    for(int l=0,r=1;r<=cnt;r++){
        while(l<r&&tot[r]-tot[l-1]>k) ++l;
        res = max(res,a[r]-a[l-1]);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 1660
#include<iostream>
using namespace std;
int main()
{
	int N,a,b;
	cin >>N;
	 int ans=0;
	for(int i=1;i<=N;i++)
{
   cin  >>a>>b;
   ans=ans+(b-a+1);
}
   cout <<ans;
   return 0;
}
   
   

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
#define INT_MAX 1<<30
const ll mod = 1e9+7;

int main(){
	ll n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	ll sum = 0;
	rep(i,n) sum += a[i];
	bitset<4000050> dp;
	dp[0] = 1;
	rep(i,n){
		dp |= dp << a[i];
	}
	REP(i,(sum+1)/2,sum+1){
		if(dp[i]){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1664
from collections import Counter
def main():
    import sys
    def input():
        return sys.stdin.readline()
    n = int(input())
    A = list(map(int, input().split()))
    q = int(input())
    C = Counter(A)
    s = set(C.keys())
    ans = sum(A)
    for _ in range(q):
        b, c = list(map(int, input().split()))
        if b in s:
            d = C.pop(b)
            ans = ans + (c - b) * d
            C[c] += d
            s.remove(b)
            s.add(c)
        print(ans)


if __name__ == '__main__':
    main()


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

int main(){
  string s;
  cin >>s;
  if(s.at(0)=='7') cout << "Yes" << endl;
  else if(s.at(1)=='7') cout << "Yes" << endl;
  else if(s.at(2)=='7') cout << "Yes" << endl;
  else cout << "No" << endl; 
  return 0;
}

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

int N;
int A[100000];
int R[100000];
int L[100000];
int T[100000];

int gcd(int x, int y) {
  if(y == 0 || x == 0) return max(x,y);
  if(x > y) gcd(y, x%y);
  else gcd(x, y%x);
}

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

  int R[1000000];
  int L[1000000];

  int m = A[0];
  for(int i = 0; i < N; i++) {
    m = gcd(m, A[i]);
    R[i] = m;
  }

  m = A[N-1];
  for(int i = N-1; i >= 0; i--) {
    m = gcd(m, A[i]);
    L[i] = m;
  }

  for(int i = 0; i <N; i++) {
    if(i == 0) T[i] = L[1];
    else if(i == N-1) T[N-1] = R[N-2];
    else T[i] = gcd(R[i-1], L[i+1]);
  }
  sort(begin(T), begin(T)+N);
  cout << T[N-1];

}



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

#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]); if(i!=n-1) cout << " ";} cout << endl;
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W;
    cin >> H >> W;
    ll a[510][510];
    rep(i,0,H){
        rep(j,0,W){
            cin >> a[i][j];
        }
    }
    ll ans[300010][4] = {};
    ll cnt = 0;
    rep(i,0,H){
        rep(j,0,W-1){
            if(a[i][j] % 2 == 1){
                ans[cnt][0] = i+1; ans[cnt][1] = j+1; ans[cnt][2] = i+1; ans[cnt][3] = j+2;
                a[i][j]--;
                a[i][j+1]++;
                cnt++;
            }
        }
    }
    rep(j,0,W){
        rep(i,0,H-1){
            if(a[i][j] % 2 == 1){
                ans[cnt][0] = i+1; ans[cnt][1] = j+1; ans[cnt][2] = i+2; ans[cnt][3] = j+1;
                a[i][j]--;
                a[i+1][j]++;
                cnt++;
            }

        }
    }
    print(cnt);
    rep(i,0,cnt){
        rep(j,0,4){
            cout << ans[i][j];
            if(j != 3) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 13568
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String[] a = sc.next().split("",0);
		String[] b = sc.next().split("",0);
		int count = 0;
		for(int i = 0; i < a.length; i++){
			if(!a[i].equals(b[i])){
				count++;
			}
		}
		System.out.print(count);
	}
}

Measured memory_bytes: 66716
s = input()
y = int(s[:4])
m = int(s[5:7])
d = int(s[8:])
ans = "TBD"
if y < 2019:
    ans = "Heisei"
elif y == 2019:
    if m < 4:
        ans = "Heisei"
    elif m == 4:
        if d <= 30:
            ans = "Heisei"
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int N;
int A[200000];

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

	sort(A, A + N);
	
	bool res = true;
	for(int i = 0; i < N-1; i++){
		if(A[i] == A[i+1]) res = false;
	}

	cout << (res ? "YES" : "NO") << '\n';

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define cinf(x,n) for(int i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(int i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

string s[101];
string ans;

int main(){
	ll n,l;
	cin >> n >> l;
	rep(i,n){
		cin >> s[i];
	}
	rep(i,n){
		for(ll j=n-2;j>=i;j--){
			rep(k,l){
				if(s[j][k]>s[j+1][k]){
					swap(s[j],s[j+1]);
					break;
				}else if(s[j][k]<s[j+1][k]){
					break;
				}
			}
		}
	}
	rep(i,n){
		cout << s[i];
	}
	cout << endl;


	/*debug
	rep(i,n){
		cout << s[i] << endl;
	}*/
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

int n;
vector<vector<pair<int,int>>> memo(100010);
int ans[100010];

void dfs(int n){
  if(n==0){
    ans[n]=0;
  }
  for(auto next_n:memo[n]){
    if(ans[next_n.first]<0){
      if(next_n.second%2==0){
        ans[next_n.first]=ans[n];
        dfs(next_n.first);
      }
      else{
        ans[next_n.first]=(ans[n]==0?1:0);
        dfs(next_n.first);
      }
    }
  }
  return;
}

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


Measured memory_bytes: 7552
#include<stdio.h>

int main(void){
	int count,i,n;
long  min,max,sum;
min=1000000;
max=-1000000;
sum=0;
scanf("%d",&count);
for(i=0;i<count;i++){
scanf("%d",&n);
if(max<n) max=n;
if(min>n) min=n;
sum+=n;
}
printf("%ld %ld %ld\n",min,max,sum);
return 0;
} 

Measured memory_bytes: 600
#include "iostream"
using namespace std;

int main(){
	int n, a[10010], cnt = 0, j = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	while (j<n) {
		if (a[j] % 2 == 0) {
			a[j] = a[j] / 2;
			cnt++;
		}
		else j++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FOR(i,j,k) for(int i=j;i<k;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair < int, int > pii;

const int maxn=1e5+100, INF=1000000000+7;


int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,d,x,a[maxn],ans=0;
    cin>>n>>d>>x;
    FOR(i,0,n){
        cin>>a[i];
        int temp=1;
        while(temp<=d){
            ans++;
            temp+=a[i];
        }
    }
    cout<<ans+x<<endl;
    return 0;
}


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

int main() {
  int N, A, B;
  int planA, planB, x;

  cin >> N >> A >> B;

  planA = A * N;
  planB = B;
  
  if (planA < planB) {
    cout << planA << endl;
  } else if (planA > planB) {
    cout << planB << endl;
  } else {
    cout << planA << endl;
  }
}

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

int main(){
    int n;
    cin >>n;
    int a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    int count=0;
    int tmp;
    for(int i=0;i<n;i++){
        int mini=i;
        for(int j=i;j<n;j++){
            if(a[j]<a[mini]){
                mini=j;
            }
            }
        if(mini!=i){
                tmp=a[i];
                a[i]=a[mini];
                a[mini]=tmp;
                count++;
        }
    }
    for(int i=0;i<n;i++){
        if(i!=n-1)printf("%d ",a[i]);
        else{
            printf("%d\n",a[i]);
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		
		String ansa = "";
		String ansb = "";
		
		for(int i=0;i<a;i++) {
			ansa += "1";
			ansb += "0";
		}
		for(int i=a;i<w;i++) {
			ansa += "0";
			ansb += "1";
		}
		
		for(int i=0; i<b;i++) {
			System.out.println(ansa);
		}
		for(int i=b;i<h;i++) {
			System.out.println(ansb);
		}
		
	}

}


Measured memory_bytes: 31828
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

  cout << n * n * n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

    ll A, B;
    cin >> A >> B;

    ll h = 100, w = 100;
    vector<vector<char>> s(h, vector<char>(w));
    Rep (i, h) {
        Rep (j, w) {
            if (i < 50) s[i][j] = '.';
            else s[i][j] = '#';
        }
    }

    B--;

    for (ll i = 2; i <= 48; i += 2) {
        for (ll j = 2; j <= 98; j += 2) {
            if (B == 0) i = j = 100;
            else {
                s[i][j] = '#';
                B--;
            }
        }
    }

    A--;
    for (ll i = 52; i <= 98; i += 2) {
        for (ll j = 2; j <= 98; j += 2) {
            if (A == 0) {
                i = j = 100;
            } else {
                s[i][j] = '.';
                A--;
            }
        }
    }

    cout << h << " " << w << "\n";
    Rep (i, h) {
        Rep (j, w) {
            cout << s[i][j];
        }
        cout << "\n";
    }


}

Measured memory_bytes: 896
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 234567;
int A[MAXN], B[MAXN];

int main() {
    int N;
    while (~scanf("%d", &N)) {
          LL sum = 0;
          vector<int> ans;
          for (int i = 0; i < N; i++) {
              scanf("%d %d", &A[i], &B[i]);
              if (A[i] > B[i]) ans.push_back(B[i]);
              sum += A[i];
          }
          sort(ans.begin(), ans.end());
          if (ans.empty()) puts("0");
          else printf("%lld\n", sum - ans[0]);
    }
    return 0;
}
//1: 9346436444504
//2: 9394505453297


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main(){
  ll r,D,x;
  cin>>r>>D>>x;
  for (ll i=0;i<10;i++) {
    cout<<r*x-D<<endl;
    x=r*x-D;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc167/tasks/abc167_c>
 問題文============================================================
 C - Skill Up
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N,M,X; cin >> N >> M >> X;
    vector<int> C(N);
    auto A = make_v<int>(N,M);
    
    for(int i = 0; i < N;i++){
        cin >> C[i];
        for(int j = 0; j < M;j++){
            cin >> A[i][j];
        }
    }
    
    res = LINF;
    for(int b = 0; b < (1<<N); b++){
        vector<int> sum(M);
        ll Csum = 0;
        for(int i = 0; i < N; i++){
            if((b>>i)&1){
                Csum += C[i];
                for(int j = 0; j < M;j++){
                    sum[j] += A[i][j];
                }
            }
        }
        
        bool ok = true;
        for(int j = 0; j < M;j++){
            if(sum[j] < X) ok = false;
        }
        if(ok) res = min(res,Csum);
    }
    if(res == LINF) res = -1;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 3676
def gcd(x,y):
    x,y=max(abs(x),abs(y)),min(abs(x),abs(y))
    if y==0:
        return x
    if x%y==0:
        return y
    while x%y!=0:
        x,y=y,x%y
    return y

n,x=map(int,input().split())

t=[int(j)-x for j in input().split()]
ans=abs(t.pop())
for i in t:
    ans=gcd(ans,i)

print(ans)


Measured memory_bytes: 62576
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, k;
  cin >> n >> k;

  vll csum(n + 1, 0);
  rep(i, n) cin >> csum[i];

  ll minv = 0;
  for (ll j = 0; j < k; j++) {
    vll ncsum(n + 1, 0);
    rep(i, n) {
      ll in = max(0LL, i - csum[i]);
      ll ot = min(n, i + csum[i] + 1);
      ncsum[in] += 1;
      ncsum[ot] -= 1;
    }
    rep(i, n) { ncsum[i + 1] += ncsum[i]; }
    minv = minv * 2 + 1;
    swap(csum, ncsum);

    bool chk = true;
    rep(i, n) {
      if (csum[i] != n) {
        chk = false;
        break;
      }
    }
    if (chk) break;
  }
  rep(i, n) cout << csum[i] << (i < n - 1 ? " " : "\n");
}


Measured memory_bytes: 6704
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl v(n);rep(i,n)cin >> v[i];
    sort(all(v),greater<ll>());
    ll ans=0;ll tmp=0;
    while(v[0]>n-1){
        ll p=v[0]-(n-1);
        ll z=(p+n-1)/n;
        ans+=z;
        v[0]-=z*n;
        repl(i,1,n){
            v[i]+=z;
        }
        sort(all(v),greater<ll>());
        //rep(i,n)cout << v[i] <<" ";
        //cout << endl;
        tmp++;
    }
    cout << ans <<endl;
    //cout << tmp <<endl;
}

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

const int N = 500009;
const int mod = 1000000007;

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define int long long int
#define endl "\n"
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()

int n, a, b;

void pre()
{
}

int32_t main()
{
	IOS;
	pre();
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0)
	{
		cout << ((b - a) / 2) << endl;
	}
	else
	{
		// a goes to 1 then waits one turn then goes to b
		int tim = a - 1 + 1;
		int newb = b - tim;
		int ans1 = ((newb - 1) / 2 + tim);
		tim = n - b + 1;
		int newa = a + tim;
		int ans2 = (tim + ((n - newa) / 2));
		cout << min(ans1, ans2) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int n;
    cin >> n;
    cout << n/3 << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char x[3];
	char y[3];
	
	gets(x);
	gets(y);
	if(x[1] == y[1]){
		if(x[0] == y[2] && x[2] == y[0]) printf("YES");
		else printf("NO");
	}else{
		printf("NO");
	}
	return(0);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
void pre(){}
void solve(){
    long long int n;cin>>n;
    long long int arr[n+1][3];
    long long int dp[n+1][3];
    for(long long int i=1;i<=n;i++){
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }
    dp[0][0]=0;dp[0][1]=0;dp[0][2]=0;
    for(long long int i=1;i<=n;i++){
        dp[i][0]=max(dp[i-1][1]+arr[i][0],dp[i-1][2]+arr[i][0]);
        dp[i][1]=max(dp[i-1][0]+arr[i][1],dp[i-1][2]+arr[i][1]);
        dp[i][2]=max(dp[i-1][0]+arr[i][2],dp[i-1][1]+arr[i][2]);
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pre();
    long long int num = 1;
    //cin>>num;
    for(long long int i=0;i<num;i++){
       	solve();
    }   
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
// const ll INF = 1000000000000000000LL;

  const int MAX = 510000;
  
  ll fac[MAX], finv[MAX], inv[MAX];
  
  // テーブルを作る前処理
  //ここO(n)
  void COMinit() {
      fac[0] = fac[1] = 1;
      finv[0] = finv[1] = 1;
      inv[1] = 1;
      for (int i = 2; i < MAX; i++){
          fac[i] = fac[i - 1] * i % MOD;
          //すごいことしてO(1)で求めてる
          inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
          finv[i] = finv[i - 1] * inv[i] % MOD;
      }
  }
  
  // 二項係数計算
  ll COM(int n, int k){
      if (n < k) return 0;
      if (n < 0 || k < 0) return 0;
      return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
  }
  
int main() {
    COMinit();
    int s;
    cin >> s;
    ll cnt = 0;
    int keta=1;
    for(int keta=1;keta<=ll(s/3);keta++){
        ll remain = s-keta*3;
        cnt+=COM(keta-1+remain,remain);
        cnt %= MOD;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 15564
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
#ifdef BOOST_RANGE_ALGORITHM_FOR_EACH_HPP_INCLUDED
  boost::for_each(vc, [&os](T value) {
#else
  std::for_each(vc.begin(), vc.end(), [&os](T value) {
#endif
    os << value << ' ';
    });
  return os;
    }

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  //string S{}; std::cin >> S;
  //ui N{}; cin >> N;
  int K{}, X{};
  cin >> K >> X;

  vector<int> ans{};

  rep_si(X - K + 1, X + K)
    ans.push_back(i);


  using std::cout;
  cout << ans << '\n';
  return;
}

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

  solve();

  return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------
-----問題ここまで----- */
/* -----解説等-----
----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
  ans=2*N;
if(N%2==0)ans=max(2LL,N);

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define mod 1000000007 //10^9+7
int main(void){
	int N,A=0,G=1,C=2,T=3;
	long long ans=0,memo[101][4][4][4]={0};
	scanf("%d",&N);
	int i,j,k,l,m;
	for(i=0;i<4;i++){
		for(j=0;j<4;j++){
			for(k=0;k<4;k++){
				if(i==A && j==G && k==C) continue;
				if(i==A && j==C && k==G) continue;
				if(i==G && j==A && k==C) continue;
				memo[3][i][j][k] = 1;
			}
		}
	}
	
	//文字列の長さi、i-2番目がj、i-1番目がk、i番目がl、何を入れるか考えるi+1番目がm
	for(i=3;i<N;i++){
		for(j=0;j<4;j++){
			for(k=0;k<4;k++){
				for(l=0;l<4;l++){
					for(m=0;m<4;m++){
						if(k==A && l==G && m==C)continue;
						if(k==A && l==C && m==G)continue;
						if(k==G && l==A && m==C)continue;
						if(j==A && l==G && m==C)continue;
						if(j==A && k==G && m==C)continue;
						memo[i+1][k][l][m] += memo[i][j][k][l];
						memo[i+1][k][l][m] %= mod;
					}
				}
			}
		}
	}
	for(i=0;i<4;i++){
		for(j=0;j<4;j++){
			for(k=0;k<4;k++){
				ans += memo[N][i][j][k];
			}
		}
	}
	
	printf("%lld",ans%mod);
	return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    lli a , b ;
  cin >> a >> b ;
  if (a == 1) a = 14 ;
  if (b == 1) b = 14 ;
  cout << (a < b ? "Bob" :(a > b ? "Alice" :(a == b ? "Draw" : 0)));
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


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

int main()
{
    ll N;
    int X, M;
    io >> N >> X >> M;

    vector<int> bucMi(M+1, -1);
    vector<ll> rui(M+4, 0);
    
    ll a = X;
    ll sum = 0;

    int i;
    for (i = 0; i <= M; i++)
    {
        if (bucMi[a] >= 0)
        {
            break;
        }
        else
        {
            bucMi[a] = i;
            sum += a;
            rui[i+1] = sum;
            a = (a * a) % M;
        }
    }
    
    if (bucMi[a] < 0)
    {
        io << sum << BR;
        return 0;
    }

    ll loop_l = bucMi[a], loop_r = i;
    ll loop_range = loop_r - loop_l;
    ll loop_n = (N - loop_l) / loop_range;
    ll rest = (N - loop_l) % loop_range;

    ll ans = (rui[loop_r] - rui[loop_l]) * loop_n + rui[loop_l+rest];
    
    io << ans << BR;
    return 0;
}


Measured memory_bytes: 4620
n = gets.chomp.to_i

t = gets.chomp.split(" ").map(&:to_i)
v = gets.chomp.split(" ").map(&:to_i)

v.unshift(0)
v.push(0)

lr = [0, 0]
t.each do |tt|
    lr << lr[-1] + tt
end
lr << lr[-1]

def f(lr, v, x, i)
end

prev_v = 0
sum = 0
0.step(t.inject(:+),  0.5) do |tt|
    min = 1000000000
    for i in 0..(n+1) do
        if lr[i] <= tt && tt <= lr[i+1]
            min = v[i] if v[i] < min
        elsif tt < lr[i]
            min =  v [i] + lr[i] - tt if v [i] + lr[i] - tt < min
        else
            min =  v [i] + tt - lr[i+1] if v [i] + tt - lr[i+1] < min
        end
    end
    #printf "%f: %f\n", tt, ff.min
    sum += (prev_v + min)*0.25
    prev_v = min
end
puts sum

Measured memory_bytes: 1788
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string S;
	scan(S);
	int count[26]={0};
	vint pos[26];
	int xcount=0;
	int N=S.size();
	rep(i,S.size()){
		pos[S[i]-'a'].push_back(i);
		if(S[i]=='x') xcount++;
		else count[S[i]-'a']++;
	}
	int alonen=0;
	char alonechar;
	rep(i,26){
		if(count[i]%2==1){
			alonen++;
			alonechar='a'+i;
		}
	}
	if(alonen>=2){
		prin("-1");
		//prin("hoge");
	}
	else{
		//int katayori=0;
		int ans=0;
		int left=0,right=N-1;
		while(left<right){
			if(S[left]==S[right]){
				left++;
				right--;
			}
			else if(S[left]=='x'){
				left++;
				ans++;
				//katayori++;
			}
			else if(S[right]=='x'){
				right--;
				ans++;
				//katayori--;
			}
			else{
				prin("-1");
				//prin("huga");
				return 0;
			}
		}
		prin(ans);
	}
	return 0;
}


Measured memory_bytes: 1148
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>L(N);
	rep(i, N) in >> L[i];

	LL maxL = -1, sum = 0;
	rep(i, N)
	{
		maxL = std::max(maxL, L[i]);
		sum += L[i];
	}

	out << (maxL < sum - maxL ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256