akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=1e4+5;
int d;
vector<int> k;
int dp[N][101];
const int mod=1e9+7;
int add(int a,int b)
{
    a+=b;
    if(a>=mod)
        a-=mod;
    return a;
}
int mul(int a,int b)
{
    return ((ll)a*b)%mod;
}
int sub(int a,int b)
{
    b%=d;
    a-=b;
    if(a<0)
        a+=d;
    assert(a>=0&&a<d);
    return a;
}
int main()
{
    string s;
    cin >> s;
    int n=s.size();
    int sum=0;
    for(int i=0;i<n;i++)
        k.pb(s[i]-'0'),sum+=k.back();
    reverse(all(k));
    scanf("%i",&d);
    dp[0][0]=1;
    int ans=0;
    if(sum%d==0)
        ans++;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<d;j++)
        {
            for(int k=1;k<10;k++)
            {
                dp[i][j]=add(dp[i][j],dp[i-1][sub(j,k)]);
            }
        }
        ans=add(ans,dp[i][0]);
        //printf("%i %i\n",dp[i][0],ans);
        for(int j=0;j<d;j++)
        {
            dp[i][j]=add(dp[i][j],dp[i-1][j]);
        }
    }
    for(int i=0;i<n;i++)
    {
        //printf("%i %i\n",k[i],sum);
        sum-=k[i];
        for(int j=0;j<k[i];j++)
        {
            if(i==n-1&&j==0)
                continue;
            ans=add(ans,dp[i][sub(0,sum+j)]);
        }
    }
    printf("%i\n",ans);
    return 0;
}


Measured memory_bytes: 4352
require 'matrix'

n, m, l = gets.split.map(&:to_i)
x = []
a = Matrix[*n.times.with_object([]) {|_, x| x << gets.split.map(&:to_i) }]
b = Matrix[*m.times.with_object([]) {|_, x| x << gets.split.map(&:to_i) }]
puts (a * b).to_a.map {|r| r.join ' ' }.join ?\n



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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL){
    x=x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(x->right!=NIL){
    x=x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  if(u==NIL||k==u->key)return u;
  if(k<u->key) return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
}

Node treeSuccessor(Node x){
  if(x->right!=NIL)return treeMinimum(x->right);
  Node y;
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left==NIL||z->right==NIL)y=z;
  else y=treeSuccessor(z);
  if(z->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL)root=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  if(y!=z)z->key=y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;
  }

    z->parent=y;

    if(y==NIL)root=z;
    else if(z->key<y->key)y->left=z;
    else y->right=z;
  
}

void inorder(Node u){
  if(u==NIL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);    
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



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

int main() {
int N;
bool y=0;
string Color;
cin  >> N;
for(int i =0;i<N;i++){
cin >>Color;
if(Color=="Y"){
y=1;
break;
}}
if (y){
cout<<"Four";
}
else {
cout<<"Three";
}
}




Measured memory_bytes: 3500
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define for1(x,y,z) for(int z=x;z<=y;z++)
#define for2(x,y,z) for(int z=x;z>=y;z--)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pI64d(x) printf("%I64d\n",x)
#define pi 3.141592653
const int INF=0x3f3f3f3f;
const int N=1e6;
const int MOD=1e9+7;
int a[N],v[N];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
       int ans=1,f=0;
       memset(v,0,sizeof(v));
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a[i]);
           v[a[i]]++;
           if((a[i]==0&&v[0]>1)||(v[a[i]])>2) f=1;
           if(v[a[i]]==2) ans=ans*2%MOD;
       }
       if(f) printf("0\n");
       else printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 4480
//g++ -std=c++11 -Wall -O2 -o main.exe main.cpp

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <complex>

using namespace std;

//template <typename T>

int main(){
    vector<int> v(3);

    for(int i = 0; i < 3; i++) cin >> v[i];

    sort(v.begin(), v.end(), std::greater<int>());

    cout << abs((v[1] - v[0]) + (v[2] - v[1])) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>

using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

#define MOD (1000000000+7)

int h[100001];
int dp[100001];
int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> h[i];
        if (i == 0) dp[i] = 0;
        else if (i == 1) dp[i] = abs(h[0]-h[1]);
        else {
            dp[i] = min(dp[i-2] + abs(h[i-2]-h[i]), dp[i-1] + abs(h[i-1]-h[i]));
        }
    }
    cout << dp[N-1] << endl;
}


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

using namespace std;
using ll = long long;

// 最大公約数を求める (a > b) 非再帰ver
int gcb(int a, int b) {
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b; 
}


int main(void) {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        ans += gcd(k, gcd(i, j));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3560
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=5e5+5,M=2e6+5,MOD=1e9+7,OO=1e9;
ll n;


int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();	
 	
 	scanf("%lld",&n);
 	int k = 0;
 	while(n)k++,n/=2;
 	printf("%lld\n",(1LL << k)-1);
}		


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,i,j;
	int k,x;
	cin>>k>>x;
	int min=x-(k-1);
	int max=x+(k-1);
	for(i=min;i<=max;i++){
	    cout<<i<<" ";
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x, y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x, y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=pow(10,9)+7;
bool cmp(pair<long double, int > x, pair<long double, int> y){ return x.F<y.F && x.S<y.S; }
const ll maxn=2*1e7+10;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
ll random(ll mn, ll mx){
	return (rand() % (mx - mn + 1)) + mn; 
}
void solve(){
	
	string s;
	cin>>s;
	ll a=0, b=0;
	if (s[0]=='A') a++;
	else b++;
	if (s[1]=='A') a++;
	else b++;
	if (s[2]=='A') a++;
	else b++;
	if (a==3 || b==3) {
		cout<<"No"<<endl;
	}
	else cout<<"Yes"<<endl;
	
	return;
}

int main(){ 
    
    #ifndef ONLINE_JUDGE
  		//freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
	
	//T{ solve(); }
	solve();
	
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
int a[N][3], dp[N][3];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int j = 0; j < 3; ++j) dp[n][j] = 0;
  for (int i = n - 1; i >= 0; --i) {
    for (int j = 0; j < 3; ++j) {
      dp[i][j] = 0;
      for (int k = 0; k < 3; ++k) {
        if (j == k) continue;
        dp[i][j] = max(dp[i][j], dp[i + 1][k] + a[i][j]);
      }
    }
  }
  int ret = 0;
  for (int j = 0; j < 3; ++j) ret = max(ret, dp[0][j]);
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 2560
n=input()
I=[int(x) for x in input().split()]
d1,d2,d4=0,0,0
for i in I:
    if i%4==0:
        d4+=1
    elif i%2 == 0:
        d2+=1
    else:
        d1+=1
if d2>0:
    d1+=1
if d4+1>=d1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 63216
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define mp make_pair
#define v vector
#define inp_push(no, v) \
    ll no;              \
    cin >> no;          \
    v.push_back(no);
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define N 200005
#define mod 1000000009
#define INF INT64_MAX

//////////////////////////IMPORTANT FUNCTIONS/////////////////////////////////////////////

/* Guidlines berfore submitting solution
1. Check N value before submitting
2. Check all constant kind of values you are using. Might give WA. Think
3. Check mod value
*/

v<ll> fact(N);
v<ll> prime_check(1e7 + 2);
v<ll> primes;

long long powmod(long long x, long long y, long long m)
{
    long long res = 1LL;
    while (y)
    {
        if (y & 1)
            res = (res * x) % m;
        x = (x * x) % m;
        y /= 2;
    }
    return res;
}

void init_fact()
{
    fact[0] = 1;
    for (ll i = 1; i < N; i++)
    {
        fact[i] = (fact[i - 1] * i) % mod;
    }
}

ll C(ll n, ll r)
{
    if (n < r)
        return 0;
    ll temp = fact[n] * powmod(fact[r], mod - 2, mod) % mod;
    temp *= powmod(fact[n - r], mod - 2, mod);
    temp %= mod;
    return temp;
}

void Sieve()
{
    for (ll i = 2; i <= 1e7 + 1; i++)
    {
        if (prime_check[i])
            continue;
        primes.pb(i);
        for (ll j = 2 * i; j <= 1e7 + 1; j += i)
            prime_check[j] = i;
    }
}
ll phi(ll n)
{
    ll i, res = n;
    for (i = 2; i * i <= n; i++)
        if (n % i == 0)
        {
            while (n % i == 0)
                n /= i;
            res -= res / i;
        }
    if (n > 1)
        res -= res / n;
    return res;
}

/////////////////////////////////////START CODE HERE/////////////////////////////////////////////

ll n;
v<ll> a(N), c(N);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // init_fact();
    // Sieve();
    cin >> n;
    ll C = 0;
    for (ll i = 1; i <= n; i++)
        cin >> a[i], C = C ^ a[i];
    for (ll i = 1; i <= n; i++)
    {
        c[i] = C ^ a[i];
    }
    for (ll i = 1; i <= n; i++)
        cout << c[i] << " ";
    cout << "\n";
}

Measured memory_bytes: 86004
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i

[a,b,c,d,e].combination(2) do | a,b |
  if (b - a).abs > k
    puts ":("
    exit
  end
end
puts "Yay!"

Measured memory_bytes: 1788
#include <iostream>

int main()
{
  int R, G, B, N;
  
  std::cin >> R >> G >> B >> N;
  
  long long buf[3001] = { 1 };
  
  for (auto i = R; i <= N; i++) buf[i] += buf[i - R];
  for (auto i = G; i <= N; i++) buf[i] += buf[i - G];
  for (auto i = B; i <= N; i++) buf[i] += buf[i - B];
  
  std::cout << buf[N];
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int h[] = new int[100];

		for (int i = 0; i < N; i++) {
			h[i] = scan.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			boolean is_candi = true;
			for (int j = 0; j < i; j++) {
				if (h[j] > h[i]) {
					is_candi = false;
					break;
				}
			}

			if(is_candi) {
				ans++;
			}


		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
#define Pct puts("------ Yes ------");
#define rep(a, b, c) for(int a = (b); a <= (c); ++ a)
#define per(a, b, c) for(int a = (b); a >= (c); -- a)
#define fir first
#define sec second
#define ls son[u][0]
#define rs son[u][1]
#define eps 1e-8
#define PI acos(-1.0)
using namespace std;
template <class T> void rd(T &x){ x = 0; int f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); x *= f; }

typedef long long ll;
ll k, a, b;

int main(){
	rd(k), rd(a), rd(b);
	if(k <= a){ printf("%lld\n", k + 1); exit(0); }
	else{
		if(b - a > 2){
			k -= (a - 1);
			if(k & 1) printf("%lld\n", a + 1 + (k / 2) * (b - a));
			else printf("%lld\n", a + (k / 2) * (b - a));
		}
		else printf("%lld\n", k + 1);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,blb = 0,j,k;
    cin>>n;
    for(i = 1;i <= n;i++)
    {
       for(j = 1;j <= n;j++)
       {
           long long int tmp = __gcd(i,j);
           for(k = 1;k <= n;k++)
           {

               long long int tmp2 =  __gcd(k,tmp);
               blb += tmp2;
           }
       }
    }
    cout<<blb<<endl;
    return 0;
}



Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    vector<int> a(s.size() + 1), b(s.size() + 1);
    rep (i, s.size()) a[i] = (int)(s[s.size() - i - 1] - '0');
    rep (i, s.size()) {
        if (a[i] >= 6 || (i + 1 < i_len && a[i] == 5 && a[i + 1] >= 5)) {
            a[i + 1] ++;
            b[i] += 10 - a[i];
            a[i] = 0;
        }
    }
    int ans = 0;
    rep (i, a.size()) ans += a[i];
    rep (i, b.size()) ans += b[i];
    reprev (i, a.size()) eprintf("%d ", a[i]); eprintf("\n");
    reprev (i, b.size()) eprintf("%d ", b[i]); eprintf("\n");
    cout << ans << "\n";
    return 0;
}

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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

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

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

int main()
{
  ll n, x;
  cin >> n >> x;

  cout << 3*(n-gcd(n, x)) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = scan.nextInt();
        }
        //Collections.reverse(a);
        for(int i=0;i<n;i++){
            System.out.print(a[n-1-i]);
            if(i<n-1)System.out.print(" ");
        }
        System.out.println();
    }
}


Measured memory_bytes: 26284
# 2019/07/24

from collections import Counter

n=int(input())
v=list(map(int,input().split()))

even=[]
odd=[]

for i in range(n):
    if i%2==0:even.append(v[i])
    else:odd.append(v[i])

e=Counter(even).most_common(2)
if len(e)<2:e=[e[0][0]]
else:e=list([e[0][0]]+[e[1][0]])
o=Counter(odd).most_common(2)
if len(o)<2:o=[o[0][0]]
else:o=list([o[0][0]]+[o[1][0]])

ans=float('inf')
for i in e:
    for j in o:
        cnt=0
        if i==j:continue
        for k in range(n):
            if k%2==0 and v[k]!=i:
                cnt+=1
            elif k%2==1 and v[k]!=j:
                cnt+=1
        ans=min(cnt,ans)

if ans==float('inf'):ans=n//2
print(ans)

Measured memory_bytes: 16092
#include <iostream>
#include <algorithm>

int main()
{
  int N, X;
  std::cin >> N >> X;
  int m[N];
  int sum = 0;
  int ans = 0;
  for ( int i = 0; i < N; i++ ) {
    std::cin >> m[i];
    sum += m[i];
  }
  X -= sum;
  ans += N;

  std::sort(m, m + N);
  int add = X / m[0];
  ans += add;
  std::cout << ans << std::endl;
  return 0;
}


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

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

#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,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL C[51][51];
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  REP(i,51){
	C[i][0] = C[i][i] = 1;
	FOR(j,1,i)
	  C[i][j] = C[i-1][j] + C[i-1][j-1];
  }

  LL N, P;
  cin >> N >> P;
  VI xs(N);
  REP(i,N) cin >> xs[i];
  VL num(2);
  REP(i,N) num[xs[i]&1]++;

  LL a1 = 1ll << num[0], a2 = 0;
  for(LL i=P;i<=num[1];i+=2)
	a2 += C[num[1]][i];
  cout << a1 * a2 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String datas = br.readLine();
		int n = Integer.parseInt(datas);
		
		for(int i = 1;i<=n;i++) {
			
			if(i % 3 ==0){
				sb.append(" ").append(i);
				continue;
			}
			
			int tmp = i;
			
			do {
				if(tmp % 10 == 3) {
					sb.append(" ").append(i);
					break;
				}
				tmp = tmp /10;
			}while(tmp !=0);
			
			
		
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 25120
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

vector<bool> visited(105);
vector<vector<int>> edge(105);
bool dfs(int cur, int par) {
    // if a cycle doesn't exist, return true
    visited[cur] = true;
    bool ic = false;
    if (edge[cur].size() == 0) {
        return true;
    } else {
        for (int i = 0; i < edge[cur].size(); i++) {
            if (edge[cur][i] == par) {
                continue;
            }
            if (visited[edge[cur][i]]) {
                ic = true;
                break;
            } else {
                visited[edge[cur][i]] = true;
            }
            if (!dfs(edge[cur][i], cur)) {
                ic = true;
            }
        }
        if (ic) {
            return false;
        } else {
            return true;
        }
    }
}
int main() {
    long long n, mi = 1e16;
    cin >> n;
    REP(i, 5) {
        long long a;
        cin >> a;
        mi = min(mi, a);
    }
    int sp = 0;
    if (n % mi == 0) {
        sp++;
    }
    cout << 5 + n / mi - sp << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
const double dtr=atan(1)/45;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    double x=0, y=0;
    int dir=90;
    while(true){
        int d, a;
        cin>>d;
        cin.ignore();
        cin>>a;
        if(d==0&&a==0) break;
        x+=d*cos(dir*dtr);
        y+=d*sin(dir*dtr);
        dir-=a;
    }
    cout<<(int)x<<'\n'<<(int)y<<'\n';
    return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> s(n);
	for(int i = 0; i < n; ++i){ cin >> s[i]; }
	const int m = n * 100;
	vector<bool> dp(m + 1);
	dp[0] = true;
	for(int i = 0; i < n; ++i){
		for(int j = m; j >= 0; --j){
			if(dp[j]){ dp[j + s[i]] = true; }
		}
	}
	int answer = 0;
	for(int i = 0; i <= m; ++i){
		if(i % 10 != 0 && dp[i]){ answer = i; }
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 256
S=input()
S=S.replace("BC","X")
# "X"の移動先
target=0
ans=0
for i in range(len(S)):
  if S[i]=="X":
    ans+=(i-target)
    target+=1
  elif S[i]!="A" and S[i]!="X":
    # A,X以外の文字より左には移動できないので、その右位置が移動可能な左端となる。
    target=i+1
print(ans)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int N=1e6+100;
typedef long long ll;
ll qpow(ll x,ll y)
{
    ll sum=1;
    while(y)
    {
        if(y&1)
            sum=sum*x%mod;
        y/=2;
        x=x*x%mod;
    }
    return sum;
}
ll fac[N];
ll C(ll m,ll n)
{
    return fac[n]*qpow(fac[m],mod-2)%mod*qpow(fac[n-m],mod-2)%mod;
}
int main()
{
    int x,y;
    ll tot=0;
    cin >> x >> y;
    fac[0]=1;
    for(int i=1; i<=1e6; i++)
        fac[i]=fac[i-1]*i%mod;
    for(ll i=0; i<=x; i++)

    {

        ll step = x-i;

        if(step%2!=0)

            continue;

        ll ano = step/2;

        if((i*2+ano)!=y)

            continue;

        tot=(tot+C(i,i+ano)%mod)%mod;

    }

    cout << tot ;
    return 0;
}


Measured memory_bytes: 8064
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
  long long N, K;
  cin>>N>>K;
  int p[N];
  for(long long i=0;i<N;i++){
    cin>>p[i];
  }
  double sum=0;
  double max=0;
  for(long long i=0;i<K;i++){
    sum+=p[i];
  }
  max=sum;
  for(long long j=K;j<N;j++){
    sum=sum+p[j]-p[j-K];
    if(sum>max){
      max=sum;
    }
  }
  cout<<setprecision(12)<<((double)(max+K)/2.0);
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define mn(a, b) (a < b ? a : b)
#define mx(a, b) (a > b ? a : b)
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
#define base 331

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int const MAXn = 3e3 + 2;

ll dp[MAXn][MAXn];
ll arr[MAXn];
int part;

int main(){

    //freopen(".in","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    part = n % 2;
    for(int i = 1; i <= n; i++){
        cin>>arr[i];
        dp[i][i] = arr[i] * (part ? 1 : -1);
        for(int j = i + 1; j <= n; j++)
            dp[i][j] = (1e15) * (((j - i + 1) % 2 == part) ? -1 : 1);
    }
    for(int d = 1; d < n; d++){
        for(int i = 1; i + d - 1 <= n; i++){
            int j = i + d - 1;
            if((j - i + 1) % 2 == part){
                dp[i][j + 1] = mn(dp[i][j + 1], dp[i][j] - arr[j + 1]);
                dp[i - 1][j] = mn(dp[i - 1][j], dp[i][j] - arr[i - 1]);
            }
            else{
                dp[i][j + 1] = mx(dp[i][j + 1], dp[i][j] + arr[j + 1]);
                dp[i - 1][j] = mx(dp[i - 1][j], dp[i][j] + arr[i - 1]);
            }
        }
    }
    cout<<dp[1][n];
    return 0;
}
/**
3
4 2 9
*/


Measured memory_bytes: 70016
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        return 2.0 * (double)n * Math.PI;
    }
}


Measured memory_bytes: 27528
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef complex<double> P;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

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

//AOJ 2233
char g[11][11];
char cc[256];
char *cx="URDL";
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
int h,w;
int cnt;

string DFS(int x, int y, int d){
	string tmp;
	string ret;
	int nx, ny;
	REP(i,4){
		if(i==(d+2)%4)continue;
		nx = x+dx[i];
		ny = y+dy[i];
		while(nx>=0&&nx<w&&ny>=0&&ny<h){
			if(g[ny][nx]=='o'){
				g[ny][nx]='.';
				cnt--;
				if(cnt==0){
					ret=cx[i];
					return ret;
				}
				tmp=DFS(nx,ny,i);
				if(tmp!=""){
					ret = cx[i];
					ret += tmp;
					return ret;
				}
				g[ny][nx]='o';
				cnt++;
				break;
			}
			nx+=dx[i];
			ny+=dy[i];			
		}
	}
	return "";	
}

int main(){
	int d,x,y;
	cin>>h>>w;
	cc['U']=0;
	cc['R']=1;
	cc['D']=2;
	cc['L']=3;
	cnt=0;
	REP(i,h){
		REP(j,w){
			cin>>g[i][j];
			if(g[i][j]=='o')cnt++;
			if(g[i][j]=='U'||g[i][j]=='R'||g[i][j]=='D'|g[i][j]=='L'){
				y=i;
				x=j;
				d=cc[g[i][j]];
				g[i][j]='.';
			}
		}
	}
	cout << DFS(x,y,d)<<endl;
	return 0;
}

Measured memory_bytes: 1212
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
s=""
for i in range(y):
  s+="U"
for i in range(x):
  s+="R"
for i in range(y):
  s+="D"
for i in range(x+1):
  s+="L"
for i in range(y+1):
  s+="U"
for i in range(x+1):
  s+="R"
s+="DR"
for i in range(y+1):
  s+="D"
for i in range(x+1):
  s+="L"
s+="U"
print(s)

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

int main()
{
    int a,b;
    cin >> a >> b;
    int ans = 0;
    if(a==b) cout << 2*a << endl;
    else     cout << max(a,b) * 2 -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void){
    ll n, a[100010];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    
    ll ans1 = 0, ans2 = 0, sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i % 2 == 0 && sum <= 0) {
            ans1 += 1 - sum;
            sum = 1;
        }
        else if (i % 2 == 1 && sum >= 0) {
            ans1 += sum + 1;
            sum = -1;
        }
    }
    
    sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i % 2 == 0 && sum >= 0) {
            ans2 += sum + 1;
            sum = -1;
        }
        else if (i % 2 == 1 && sum <= 0) {
            ans2 += -sum + 1;
            sum = 1;
        }
    }
    
    cout << min(ans1, ans2) << endl;
}


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

using namespace std;

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

  for(int i=0;;++i){
	bool ok = false;
	for(int j=0;j<N;++j){
	  int x = 0;
	  for(int k=j;k<N;++k){
		x = x * 10 + xs[k];
		if(x == i){
		  ok = true;
		  break;
		}
		if(x > i) break;
	  }
	  if(ok) break;
	}
	if(!ok){
	  cout << i << endl;
	  break;
	}
  }
  
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

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

    ll n;
    cin>>n;
    vector<ll> ar(n);
    vector<ll> p(n);
    for(ll i=0;i<n;++i){cin>>ar[i];p[i]=i+1;}
    ll a=0;
    do{
        ++a;
        int f=1;
        for(ll i=0;i<n;++i){
            if(p[i]!=ar[i]){f=0;break;}
        }
        if(f){break;}
    }while(next_permutation(p.begin(),p.end()));
    ll b=0;
    for(ll i=0;i<n;++i){cin>>ar[i];p[i]=i+1;}
    do{
        ++b;
        int f=1;
        for(ll i=0;i<n;++i){
            if(p[i]!=ar[i]){f=0;break;}
        }
        if(f){break;}
    }while(next_permutation(p.begin(),p.end()));
    cout<<abs(a-b);

    return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    ll N,M;
    cin >> N >> M;
    ll count = 1;
    ll count2 = 1;
    ll ans;
    if(N==M){
        for(int i=1;i<=N;i++){
            count = (count*i)%mod;
        }
        ans = (2*count*count)%mod;
    }else if(abs(N-M)==1){
        for(int i=1;i<=N;i++){
            count = (count*i)%mod;
        }
        for(int i=1;i<=M;i++){
            count2 = (count2*i)%mod;
        }
        ans = (count * count2)%mod;
    }else{
        ans = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:usize, a:[i64;n]};

    let mut f = 2;
    let mut cnt1 = 0i64;
    for i in 0..n-1 {
        if f==2 {
            if a[i] < a[i+1] { f=0; }
            else if a[i] > a[i+1] { f=1; }
        }
        else if a[i] < a[i+1] && f!=0 {
            cnt1 += 1;
            f = 2;
        }
        else if a[i] > a[i+1] && f!=1 {
            cnt1 += 1;
            f = 2;
        }
        //debug!(a[i],a[i+1],f,cnt1);
    }

    println!("{}", cnt1+1);

}

Measured memory_bytes: 4352
fun main(args: Array<String>) {
    val (N, W) = readLine()!!.split(" ").map(String::toInt)

    val dp = Array(N + 1) { LongArray(W + 1) { 0 } }
    for (i in 0 until N) {
        val (weight, value) = readLine()!!.split(" ").map(String::toInt)
        for (w in 0..W) {
            if (w < weight) {
                dp[i + 1][w] = dp[i][w]
            } else {
                dp[i + 1][w] = Math.max(value + dp[i][w - weight], dp[i][w - 1])
            }
        }
    }

    println(dp[N][W])
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/


int main()
{
    int n, m, Q; cin >> n >> m >> Q;
    int l[m], r[m];
    rep(i,m){
        cin >> l[i] >> r[i];
        --l[i], --r[i];
    }

    int c[n][n];
    rep(i,n) rep(j,n) c[i][j] = 0;
    rep(i,m) c[r[i]][l[i]]++;

    rep(i,n){
        rep(j,n){
            if(i == 0){
                if(j == 0) continue;
                c[i][j] = c[i][j-1] + c[i][j];
            }else{
                if(j == 0){
                    c[i][j] = c[i-1][j] + c[i][j];
                }else{
                    c[i][j] = c[i][j] + c[i-1][j] + c[i][j-1] - c[i-1][j-1];
                }
            }
        }
    }

    rep(_,Q){
        int p, q; cin >> p >> q;
        --p, --q;

        if(p == 0 && q == 0) cout << c[p][q] << endl;
        else if(p == 0) cout << c[q][q] << endl;
        else if(q == 0) continue;
        else{
            cout << (c[q][q]-c[q][p-1]-c[p-1][q]+c[p-1][p-1]) << endl;
        }
    }
}

Measured memory_bytes: 6008
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL read()
{
    LL x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

const int maxn=4005;
const int MOD=998244353;
int c[maxn][maxn];
int f[maxn];
void init()
{
    c[0][0]=1;f[0]=1;
    for(int i=1;i<=4001;i++){
        c[i][0]=1;
        for(int j=1;j<=i;j++){
            c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
        }
        f[i]=(f[i-1]*2)%MOD;
    }
}

int solve(int x,int y,int z)
{
    int res=0;
    for(int i=0;i<=z&&i<=x;i++){
        if(y+i-1>=0)res=(res+((1LL*f[i]*c[x][i])%MOD*1LL*c[z+y-1][y+i-1])%MOD)%MOD;
    }
    return res;
}

int main()
{
    init();
    int k=read(),n=read();
    for(int i=2;i<=2*k;i++){
        int cnt=0;
        for(int j=1;j<=k;j++){
            if(1<=i-j&&i-j<=k)cnt++;
        }
        if(i&1){
            printf("%d\n",solve(cnt/2,k-cnt,n));
        }
        else{
            printf("%d\n",(solve((cnt-1)/2,k-cnt,n)+solve((cnt-1)/2,k-cnt,n-1))%MOD);
        }
    }
    return 0;
}


Measured memory_bytes: 61440
#include <iostream>

 

using namespace std;

 

int main()
{
   int i, h, m, s;     
   cin >> i;
   h = i / 3600;
   m = i / 60 - h * 60;
   s = i % 60  ;
   cout << h << ":" << m << ":" << s <<endl;
   
   return 0;
}


Measured memory_bytes: 3088
def gcd(a, b)
  gcd(b, a) if b > a
  return b if (r = a % b).zero?
  gcd(b, r)
end

points = [gets.split(" ").last.to_i] + gets.split(" ").map(&:to_i)

distances = []
points.sort.each_cons(2) { |a, b| distances << b - a }
distances = distances.uniq.sort.reverse
puts distances.inject(distances.first) { |ans, dist| gcd ans, dist }


Measured memory_bytes: 11632
#include<stdio.h>
int main(void){
    int n,x,y;
    int a,b,c;
    int ans;
    while(1){
        scanf("%d %d",&n,&x);
        if(n==0 && x==0){
            break;
        }
        ans=0;
        y=x;
        if(y>n){
            y=n;
        }
        for (a=1;a<=y;a++){
			for (b=a+1;b<=y;b++){
				c=x-a-b;
				if (c>b && c<=n){
				    ans++;
				}
			}
		}
		printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define INF 1e13
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }

typedef long long ll;


// 累積和
int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    // cout << "sum" << accumulate(ALL(A),ll(0)) << endl;
    ll right = accumulate(ALL(A),ll(0));
    ll left=0;
    ll ans = INF;
    REP(i,N) {
        right-=A[i];
        left+=A[i];
        chmin(ans,abs(left-right));
    }

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


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,d,x,y,i,count=0;
double p;
cin>>n>>d;
for(i=0;i<n;i++){
cin>>x>>y;
p=sqrt(pow(x,2)+pow(y,2));
if(p<=d){count++;}
else{count=count;}

}
cout<<count<<endl;


}


Measured memory_bytes: 3648
num = int(input())
A=list(map(int,input().split(" ")))

chg = 0
for i in range(num-1):

	minv = i
	for j in range(i+1,num):
		if A[minv] > A[j]:
			minv = j

	if A[i] > A[minv]:
		A[i],A[minv] = A[minv],A[i]
		chg += 1
print(*A)
print(chg)



Measured memory_bytes: 5604
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    ans = 0
    for b in range(1, N):
        ans += (N - 1) // b

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 62852
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::string S)
{
    if (N % 2 != 0)
    {
        cout << NO << endl;
        return;
    }
    else
    {
        for (int i = 0; i < N / 2; i++)
        {
            if (S[i] != S[i + N / 2])
            {
                cout << NO << endl;
                return;
            }
        }
    }
    cout << YES << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int m = min(x, y);
	int sum = 0;
	sum += m * min(a + b, 2 * c);
	sum += min((x - m)*a + (y - m)*b,2*c*(max(x,y)-m));
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
map<string, int> dp;
int go(string str) {
	if (dp.find(str) != dp.end()) return dp[str];
	string tt = str; tt.pop_back();
	int res = (str.back() - '0' + 1) * go(tt) % mod;
	for (int l = 1; l <= (int)str.size() / 2; l++) {
		tt.assign(str.end() - l, str.end());
		for (int i = 2; i * l <= (int)str.size(); i++) {
			for (int j = 0; j < l; j++)
				if (str[str.size() - i * l + j] == '0')
					tt[j] = '0';
			res = (res + 1ll * go(tt) * go(str.substr(0, (int)str.size() - i * l))) % mod;
		}
	}
	return dp[str] = res;
}
int main() {
	string S;
	cin >> S;
	dp[""] = dp["0"] = 1;
	dp["1"] = 2;
	cout << go(S) << endl;
	return 0;
}

Measured memory_bytes: 5632
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	int n;
	int t[100010], x[100010], y[100010];
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> t[i] >> x[i] >> y[i];
	}

	bool flag = true;
	int ret, last;
	for(int i = 0;i < n;i++){
		if(i == 0){
			ret = x[i] + y[i];
			last = t[i] - ret;
			if(last < 0 || last % 2 == 1) flag = false;
		}else{
			ret = (x[i] - x[i-1]) + (y[i] - y[i-1]);
			last = t[i] - t[i-1] - ret;
			if(last < 0 || last % 2 == 1) flag = false;
		}
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1408