akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<int> v(1, 0);
    v.push_back(1);
    for (int i = 1; i < N; i++) {
        if (S[i] == S[i - 1]) {
            v[v.size() - 1]++;
        } else {
            v.push_back(1);
        }
    }
    v.push_back(0);
    dump(v);

    vector<int> L(v.size() + 1, 0);
    rep(i, v.size()) { L[i + 1] = L[i] + v[i]; }
    dump(L);

    int m = -1;
    for (int i = 0; i < v.size(); i++) {
        m = max(m, v[i]);
    }
    d(m);

    int ma = -1;
    for (int l = 0; l < v.size() + 1; l++) {
        if (S[0] == '1' and l % 2 == 0) continue;
        if (S[0] == '0' and l % 2 == 1) continue;
        int r = min((int)v.size(), l + 2 * K + 1);

        int val = L[r] - L[l];
        ma      = max(ma, max(m, val));
        dd(l, r);
        d(ma);
    }
    cout << ma << endl;
    return 0;
}

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int H, W;
    cin >> H >> W;
    vs v;
    rep(i,H) {
        string s;
        cin >> s;
        v.push_back(s);
    }
    rep(i,v.size()) {
        P(v[i]);
        P(v[i]);
    }
    return 0;
}



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

struct node{
  struct node *parent;
  struct node *right;
  struct node *left;
  int key;
};

typedef struct node *Tree;

#define NILL NULL

Tree tree;void TreeInsert(int k){
  Tree m = NILL;
  Tree l = tree;
  Tree n;

  n = malloc(sizeof(struct node));
  n->key = k;
  n->left = NILL;
  n->right = NILL;

  while(l != NILL){
    m = l;
    if(n->key < l->key){
      l = l->left;
    }
    else{
      l = l->right;
    }
  }
  n->parent = m;

  if(m == NILL){
    tree = n;
  }
  else if(n->key < m->key){
    m->left = n;
  }
  else{
    m->right = n;
  }
}

void TreePreorder(Tree n){
  if(n != NILL){
    printf(" %d",n->key); 
    TreePreorder(n->left);
    TreePreorder(n->right);
  }
}

void TreeInorder(Tree n){
  if(n != NILL){
    TreeInorder(n->left);
    printf(" %d",n->key);
    TreeInorder(n->right);
  }
}

int main(){
  int n,i,j;
  char command[10];
  scanf("%d",&n);

  for(i - 0;i < n;i++){
    scanf("%s",command);
    if(command[0] == 'i'){
      scanf("%d",&j);
      TreeInsert(j);
    }
    else if(command[0] == 'p'){
      TreeInorder(tree);
      printf("\n");
      TreePreorder(tree);
      printf("\n");
    }
  }
  return 0;
}

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

int main(){
    int H, W;
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0){
            break;
        }
        else{
            for(int i = 0; i < H; i++){
                if(i % 2 == 0){
                    for(int j = 0; j < W; j++){
                        if(j % 2 == 0){
                            cout << "#";
                        }
                        else{
                            cout << ".";
                        }
                    }
                    cout << endl;
                }
                else{
                    for(int j = 0; j < W; j++){
                        if(j % 2 == 0){
                            cout << ".";
                        }
                        else{
                            cout << "#";
                        }
                    }
                    cout << endl;
                }
            }
            printf("\n");
        }
    }
    return 0;
}


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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = a; i >= b; i--)

const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    int n;
    cin >> n;
    vector<double> prob(n);
    REP(i, 0, n)
    {
        cin >> prob[i];
    }
    vector<double> dp(n + 1);

    // dp[i] - Probability of i head so far
    dp[0] = 1;
    REP(coin, 1, n + 1)
    {
        RREP(head, coin, 0)
        {
            dp[head] = (head == 0 ? 0 : dp[head - 1]) * prob[coin - 1] + dp[head] * (1 - prob[coin - 1]);
        }
    }
    double ans = 0;
    REP(head, 0, n + 1)
    {
        int tail = n - head;
        if (head > tail)
        {
            ans += dp[head];
        }
    }
    cout << std::setprecision(10) << ans;
    return 0;
}

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

int main(){
	string s;
	cin >> s;
	string div[(int)s.size()];
	int index=1;
	div[0]=s.substr(0,1);
	for(int i=1;i<s.size();i++){
		if(div[index-1]==s.substr(i,1)){
			div[index]=s.substr(i,2);
			i++;index++;
		}else{
			div[index]=s.substr(i,1);
			index++;
		}
	}
	if(div[index-1]==div[index-2])index--;
	puts(index);
}

Measured memory_bytes: 11012
var
	N,i,t,A,acc:Longint;
	cnt,ans:Array[1..300000]of Longint;
	sum:Array[0..300000]of Longint;
begin
	read(N);
	for i:=1 to N do begin
		read(A);
		inc(sum[cnt[A]]);
		inc(cnt[A]);
	end;
	i:=0;
	for t:=N downto 1 do begin
		while acc>=i*t do begin
			inc(acc,sum[i]);
			inc(i);
		end;
		ans[t]:=i-1;
	end;
	for i:=1 to N do writeln(ans[i]);
end.

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

int main(){
  int n;
  string s;
  int ans;
  cin >> n >> s;
  rep(i, n - 2) {
   if(s.substr(i, 3) == "ABC") ans++;
  }
  cout << ans << endl;  
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
  long long A, B, C;
  cin >> A >> B >> C;

  long long result = 0;

  if (B >= C) {
    result = B + C;
  }
  else {
    result = 2*B;
    C = C - B;
    if (A >= C) {
      result += C;
    }
    else {
      result += A + 1;
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  ll s = 0;
  vector<ll> a(n);
  REP(i,n){
    cin >> a[i];
    s ^= a[i];
  }
  REP(i,n) cout << (s ^ a[i]) << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 4748
#define  _CRT_SECURE_NO_WARNINGS
	#include <algorithm>
	#include <iostream>
	#include <iterator>
	#include <numeric>
	#include <sstream>
	#include <fstream>
	#include <cassert>
	#include <climits>
	#include <cstdlib>
	#include <cstring>
	#include <string>
	#include <cstdio>
#include<algorithm>
	#include <vector>
	#include <math.h>
	#include <queue>
	#include<memory>
	#include <deque>
	#include <stack>
	#include <list>
	#include <map>
	#include <set>
	#include <cmath>
	#include <bitset>
	#include<list>
	#include <iomanip>
	using namespace std;
	typedef long long ll;
	const int N = 3005;
	double dp[N][N], p[N];
	int n;
	
	

	int main()
	{

		int n;
		cin >> n;
		for (int i = 1; i <= n; i++)
		{
			cin >> p[i];
		}
		dp[0][0] = 1;
		for (int i = 1; i <= n; i++)
		{
			for (int j = 0; j <= n; j++)
			{
				dp[i][j] = dp[i - 1][j] * (1 - p[i]);
				dp[i][j] += dp[i - 1][j - 1] * p[i];
			}
		}
		double res = 0;
		for (int i = n / 2+1; i <= n; i++)
		{
			res += dp[n][i];

		}
		cout << setprecision(14) << endl;
		cout << res << endl;
		return 0;
	}

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

int w, h;
int field[60][60];

void dfs(int x, int y) {
  field[y][x] = 0;
  for(int i = -1; i <= 1; i++) {
    for(int j = -1; j <= 1; j++) {
      int tx = x+j, ty = y+i;
      if(0 <= tx && tx < w && 0 <= ty && ty < h && field[ty][tx] == 1) dfs(tx, ty);
    }
  }
}

int main() {
  while(cin >> w >> h, w+h) {
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
	cin >>field[i][j];
      }
    }

    int ans = 0;
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
	if(field[i][j]) {
	  ans++;
	  dfs(j, i);
	}
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1316
const MOD = Int64(10^9 + 7)

function main()
  n, m = map(s -> parse(Int64, s), split(readline()))
  answer = Int64(1)
  i = Int64(2)

  while i * i <= m
    if m % i == 0
      count = Int64(0)
      while m % i == 0
        count += 1
        m /= i
      end
      answer *= modcomb(n + count - 1, count)
      answer %= MOD
    end
    i += 1
  end

  if m > 1
    answer *= n
    answer %= MOD
  end

  println(answer)
end

function modcomb(n::Integer, k::Integer)
  if n - k < k return modcomb(n, n - k) end
  numer = one(n)
  denom = one(n)
  for i = 0:k - 1
    numer *= n - i
    denom *= i + 1
    numer %= MOD
    denom %= MOD
  end
  return numer * modpow(denom, MOD - 2) % MOD
end

function modpow(a::Integer, p::Integer)
  if p == 0
    return 1
  elseif p % 2 == 0
    return modpow(a, Int64(p / 2))^2 % MOD
  else
    return a * modpow(a, p - 1) % MOD
  end
end

main()


Measured memory_bytes: 114692
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int in(){int x; scanf("%d",&x); return x;}
static const int MAX = 100;


int main(){
  long long L = in(), R = in();
  long long ans = 2019;
  R = min(R, L+2019);
  for(auto i = L; i <= R; i++){
    for(auto j = i+1; j <= R; j++)
      ans = min(ans,(i*j)%2019);
  }
  

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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 x;
    cin >> x;
    cout << (x / 11) * 2 + (x % 11 ? (x % 11 <= 6 ? 1 : 2) : 0) << endl;
}


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>
#include <random>
#include <ctime>

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 = 4e3 + 10;
int C[N][N];

int main() {
  for (int i = 0; i < N; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
    }
  }
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> ret(m + 1);
  for (int k = 1; k <= m; ++k) {
    if (n - m < k - 1) break;
    ret[k] = (int64)C[m - 1][k - 1] * C[n - m + 1][k] % MOD;
  }
  for (int k = 1; k <= m; ++k) {
    printf("%d\n", ret[k]);
  }
  return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    int2(n, k);
    vi data(n);
    rep(i, n) {
        cin >> data[i];
    }

    vi sum(n, 0), posum(n, 0);
    sum[0] = data[0];
    posum[0] = (data[0] < 0) ? 0 : data[0];
    Rep(i, n) {
        sum[i] = sum[i-1] + data[i];
        posum[i] += posum[i-1] + ((data[i] < 0) ? 0 : data[i]);
    }
    /*
    rep(i, n) {
        std::cout << posum[i] << std::endl;
    }*/

    int ret = 0;
    rep(i, (n - k + 1)) {
      //  std::cout << "==========" << std::endl;
       // std::cout << "start" << i << std::endl;
        // kuro
        int tmp = 0;
        if (i) {
            tmp += posum[i-1];
        //    std::cout << "front: " << tmp << std::endl;
        }
        
       // std::cout << tmp << " ";
        tmp += posum[n-1] - posum[i + k - 1];
       // std::cout << "(" << i + k << "," << n-1 << ")  "
       //      << posum[n-1] - posum[i + k - 1] << std::endl;
        ret = max(ret, tmp);
        if (i) {
            ret = max(ret, tmp + sum[i + k - 1] - sum[i-1]);
        //    cout << sum[i + k - 1] - sum[i-1] << endl;
        } else {
            ret = max(ret, tmp + sum[i + k - 1]);
         //   cout << sum[i + k - 1] << endl;
        }
    }

    cout << ret << endl;
    return 0;
}



Measured memory_bytes: 2560
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple> 

using namespace std;

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

	vector<vector<int>> candyList;

	for (int i = 0; i < 2; i++) {
		vector<int> candys;
		for (int j = 0; j < N; j++) {
			int candyNum = 0;
			cin >> candyNum;
			candys.emplace_back(candyNum);
		}
		candyList.push_back(candys);
	}

	int maxCandySum = 0;

	//下方向へ移動する列
	for (int j = 0; j < N; j++) {
		int nowCandySum = 0;
		//下方向へ移動するまで拾ったキャンディーの総数
		for (int i = 0; i <= j; i++) {
			nowCandySum += candyList[0][i];
		}

		//下方向へ移動してから拾ったキャンディーの総数
		for (int i = j; i < N; i++) {
			nowCandySum += candyList[1][i];
		}

		if (nowCandySum > maxCandySum) {
			maxCandySum = nowCandySum;
		}
	}

	cout << maxCandySum;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct dice{
  int men[6];
} Dice;
  
int main(void)
{
  Dice dice[100], dice_memo;
  int n;
  int ans = 1;
  int i, j, k, l, m, r;

  scanf("%d", &n);
  
  for(i = 0; i < n; i++)
    for(j = 0; j < 6; j++)
    scanf("%d", &dice[i].men[j]);

  for(i = 0; i < 6; i++)
    dice_memo.men[i] = dice[0].men[i];
  
  for(i = 0; i < n - 1; i++){
    for(j = i + 1; j < n; j++){
      for(k = 0; k < 4; k++){
	for(m = 0; m < 4; m++){
	  for(r = 0; r < 4; r++){
	    if(dice[i].men[0] == dice[j].men[0] && dice[i].men[1] == dice[j].men[1] && dice[i].men[2] == dice[j].men[2] && dice[i].men[3] == dice[j].men[3] && dice[i].men[4] == dice[j].men[4] && dice[i].men[5] == dice[j].men[5])
	      ans = 0;
	    
	    else{
	      dice_memo.men[0] = dice[i].men[1];
	      dice_memo.men[1] = dice[i].men[5];
	      dice_memo.men[5] = dice[i].men[4];
	      dice_memo.men[4] = dice[i].men[0];
	    }
	    
	    for(l = 0; l < 6; l++)
	      dice[i].men[l] = dice_memo.men[l];
	  }
	  dice_memo.men[0] = dice[i].men[3];
	  dice_memo.men[3] = dice[i].men[5];
	  dice_memo.men[5] = dice[i].men[2];
	  dice_memo.men[2] = dice[i].men[0];
	  
	  for(l = 0; l < 6; l++)
	    dice[i].men[l] = dice_memo.men[l];
	}
	dice_memo.men[1] = dice[i].men[2];
	dice_memo.men[2] = dice[i].men[4];
	dice_memo.men[4] = dice[i].men[3];
	dice_memo.men[3] = dice[i].men[1];
	
	for(l = 0; l < 6; l++)
	  dice[i].men[l] = dice_memo.men[l];
      }
    }
    for(l = 0; l < 6; l++)
      dice_memo.men[l] = dice[i + 1].men[l];
  }
  
  if(ans)
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;
}

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

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < (int)vec.size(); ++i) {
        os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
void dump_func() {
    cerr << "\n";
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
    cerr << head;
    if (sizeof...(Tail) == 0) {
        cerr << " ";
    } else {
        cerr << ", ";
    }
    dump_func(std::move(tail)...);
}
#define dump(...) cerr << "[" << to_string(__LINE__) << "]"        \
                       << "    " << string(#__VA_ARGS__) << " = ", \
                  dump_func(__VA_ARGS__)

using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<double>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PI = pair<int, int>;
using PL = pair<ll, ll>;
using VPI = vector<PI>;
using VPL = vector<PL>;
using VS = vector<string>;

#define ln '\n'
#define REP(t, n) for (int t = 0; t < (n); ++t)
#define FOR(t, a, b) for (int t = (a); t <= (b); ++t)
#define FORR(t, a, b) for (int t = (a); t >= (b); --t)
#define ALL(c) (c).begin(), (c).end()
#define CAUTO const auto&

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VI v(n), c(n), diff(n);
    REP(i, n)
    cin >> v[i];
    REP(i, n)
    cin >> c[i];
    REP(i, n)
    diff[i] = v[i] - c[i];
    sort(ALL(diff));
    int ans = 0;
    REP(i, n) {
        if (diff[n - i - 1] < 0)
            break;
        else
            ans += diff[n - i - 1];
    }
    cout << ans << ln;

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
AtCoder C
"""
 
# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = int(input()) for _ in range(N) # 1 row N column
 
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
 
def main():
    N = int(input())
    A= N//100
    B= N%100
    if (A==0 and B== 0) or (A==0 and B>12) or (A>12 and B==0)  or (A>12 and B>12):
        print("NA")
    elif ( A>12 or A==0) and(B<13):
        print("YYMM")
    elif(A<13) and(B>12 or B==0):
        print("MMYY")
    elif( A<13 and B<13):
        print("AMBIGUOUS")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int re i=a;i<b;++i)
#define drep(i,a,b) for(int re i=a;i>b;--i)
#define re register
#define ll long long
using namespace std;

inline
ll getint(){
	static ll num;
	static bool f;
	static char c;
	num=0;f=0;
	while(c=getchar(),!isdigit(c))if(c=='-')break;
	if(c=='-')f=1,c=getchar();
	while(isdigit(c))num=(num<<1)+(num<<3)+c-'0',c=getchar();
	return f?-num:num;
}

inline
void outint(ll a){
	if(a>9)outint(a/10);
	putchar(a%10+'0');
}
int n,k;
int pos;
int main(){
	n=getint();k=getint();
	int ans=ceil((double)(n-1)/(k-1));
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];

	ll res = 0;
	ll mincnt = 1e9;
	rep(i,n){
		mincnt = min(mincnt, a[i]);
		if(mincnt == a[i]) res++;
	}

	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 1792
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

const int MAX_N = 1000;

int sx, sy, tx, ty;

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

    cin >> sx >> sy >> tx >> ty;

    string s;

    for (int i = 1; i <= tx - sx; i++) {
        s += 'R';
    }
    for (int i = 1; i <= ty - sy; i++) {
        s += 'U';
    }

    for (int i = 1; i <= tx - sx; i++) {
        s += 'L';
    }

    for (int i = 1; i <= ty - sy; i++) {
        s += 'D';
    }

    s += 'D';

    for (int i = 1; i <= tx - sx + 1; i++) {
        s += 'R';
    }

    for (int i = 1; i <= ty - sy + 1; i++) {
        s += 'U';
    }

    s += "LU";
    for (int i = 1; i <= tx - sx + 1; i++) {
        s += 'L';
    }

    for (int i = 1; i <= ty - sy + 1; i++) {
        s += 'D';
    }

    s += 'R';

    cout << s << "\n";

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<unordered_map>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;


ll Mx = pow(10,18);

int main() {

	ll a;
	double b;

	cin >> a >> b;

	ll bl = b * 100 +0.5;

	ll ans = (a * bl) / 100;

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int maxn = 1e3 + 5;
const int MAX = 10000000;
ll x[maxn],y[maxn],z[maxn];
ll ans=-(1LL<<60);
int n,m;
ll sum;
int main()
{
   cin>>n>>m;
   for(int i=0;i<n;i++)
    cin>>x[i]>>y[i]>>z[i];
   for(int i=0;i<8;i++)
   {
    int o1=(i&1)?1:-1;
    int o2=(i&2)?1:-1;
    int o3=(i&4)?1:-1;
    sum=0;
    vector<ll>vec;
    for(int i=0;i<n;i++)
      vec.push_back(x[i]*o1+y[i]*o2+z[i]*o3);
    sort(vec.rbegin(),vec.rend());
    for(int i=0;i<m;i++)sum+=vec[i];
      ans=max(ans,sum);
   }
   cout<<ans;
}


Measured memory_bytes: 256
def solve():
    n = int(input())
    keta = [0] * (n+1)
    for i in range(2, n+1):
        for j in range(2, int(pow(i, 0.5))+1):
            if i % j: continue
            ex = 0
            while i % j == 0:
                i = i // j
                ex += 1
            keta[j] += ex
        if i != 1:
            keta[i] += 1

    mod = 1000000007
    ans = 1
    for ex in keta:
        ans = ans * (ex + 1)
        ans %= mod
    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3188
"""
dp的な発想で解けるかな？
下の桁から見る。桁を一つずつ
"""
from collections import defaultdict
S = input()
N = len(S)
S = S[::-1]

ans = 0
memo = defaultdict(int)
num = 0
memo[0] = 1
for i in range(N):
    num = (num+(pow(10,i,2019)*int(S[i]))%2019)%2019
    ans += memo[num]
    memo[num] += 1

print(ans)

Measured memory_bytes: 74648
n=int(input())
y=(1+8*n)**0.5
if not y.is_integer():
    print("No")
    exit()
x=int(y)
if x%2==0:
    print("No")
    exit()
print("Yes")

k=(1+x)//2
atama=set()
atama.add(1)
now=1
for i in range(1,1000):
    now+=i
    if now<=n:
        atama.add(now)
    else:
        break
haji=set()
d={}
now=0
for i in range(1,1000):
    now+=i
    if now<=n and now not in haji:
        haji.add(now)
        d[now]=i
    else:
        break
k=len(atama)

ans=[list(atama),list(haji)]
for s in atama:
    if s==1:
        continue
    l=[s]
    while s+1 not in haji:
        l.append(s+1)
        s+=1
    s+=1
    l.append(s)
    c=d[s]
    for i in range(c,1000):
        s+=i
        if s<=n:
            l.append(s)
        else:
            break
    ans.append(l)
print(k+1)
for i in range(k+1):
    print(k,*ans[i])


Measured memory_bytes: 47196
#include<bits/stdc++.h>
using namespace std;
bool vis[105];
int main(){
	int n,num,ans = 0;
	cin>>n;
	for(int i = 1; i <= n; i++){
        cin>>num;
        if(!vis[num]){
        	ans++;
        	vis[num] = 1;
        	}
		}
	printf("%d\n",ans);	
	}

Measured memory_bytes: 256
n = int(input())
an = list(map(int, input().split()))
su = 0
for i in range(n):
  an[i] -= i+1
an.sort()
b = an[n//2]
for i in range(n):
  an[i] -= b
  an[i] = abs(an[i])
print(sum(an))

Measured memory_bytes: 26708
#include<iostream>
#include<cstdio>
using namespace std;
int a[200005];
long long ans=0;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)
	  cin>>a[i];
	int l=1,r=1,sum=a[1],sum2=a[1];
	while(l<=r)
	{
		if((sum==sum2)&&(r<n))
		{
			ans+=r-l+1;
			++r;
			sum+=a[r];
			sum2^=a[r];
		}
		else
		{
			if(sum==sum2) ++ans;
			sum-=a[l];
			sum2^=a[l];
			++l;
		}
	 } 
	 cout<<ans;
	 return 0;
 } 

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int n,a,b;
int ppow(int x,int y)
{
    if (y==0) return 1;
    int ret=ppow(x,y/2);
    ret=ret*ret%mod;
    if (y&1) ret=ret*x%mod;
    return ret;
}

int p[maxn];

int C(int x,int y)
{
    int ret=1;
    for (int i=x;i>x-y;i--) ret=ret*i%mod;
    return ret*ppow(p[y],mod-2)%mod;
}

int32_t main()
{
    IOS
    cin>>n>>a>>b;
    int ans=(ppow(2,n)+mod-1)%mod;
    p[0]=1;
    for (int i=1;i<=1000000;i++) p[i]=p[i-1]*i%mod;
    ans=(ans+mod-C(n,a))%mod;
    ans=(ans+mod-C(n,b))%mod;
    cout<<ans<<endl;
}



Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
  }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a[i] / 2;
    a[i] = a[i] % 2;

    if (i == n-1) break;

    if (a[i] <= a[i+1]) {
      ans += a[i];
      a[i+1] -= a[i];
    } else {
      ans += a[i+1];
      a[i+1] = 0;
    }
  }

  cout << ans << endl;

  return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

ll d[MAXN], v[MAXN];
ll d0[MAXN], v0[MAXN];
ll dp[MAXN];

void solve(){
	int n;
	ll c, ans;
	scanf("%d%lld", &n, &c);
	REPN(i, 1, n) {
		scanf("%lld%lld", &d0[i], &v0[i]);
		d[i] = d0[i];
		v[i] = v0[i];
	}
	ans = 0ll;
	REP(k, 0, 2) {
		ll sum = 0ll;
		REPN(i, 1, n) {
			sum += v[i];
			dp[i] = max(dp[i - 1], sum - 2 * d[i]);
		}
		sum = 0ll;
		for(int i = n; i >= 1; i--) {
			sum += v[i];
			ans = max(ans, sum - (c - d[i]) + dp[i - 1]);
		}
		
		REPN(i, 1, n) {
			d[i] = c - d0[n + 1 - i];
			v[i] = v0[n + 1 - i];
		}
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 6400
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos((R)(-1));

R radNorP(R x) {
    return fmod(fmod(x, 2*PI)+2*PI, 2*PI);
}

const int MN = 330;

P p[MN];
typedef pair<R, int> Pi;

bool solve() {
    int n;
    scanf("%d", &n);
    if (!n) return false;

    for (int i = 0; i < n; i++) {
        R x, y;
        scanf("%lf %lf", &x, &y);
        p[i] = P(x, y);
    }

    int res = 1;
    vector<Pi> v;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (2.0 < abs(p[j]-p[i])) continue;
            R th = acos(abs(p[j]-p[i])/2.0);
            R l = radNorP(arg(p[j]-p[i])-th-EPS);
            R r = radNorP(arg(p[j]-p[i])+th+EPS);
            if (r < l) {
                v.push_back(Pi(l-EPS, 1));
                v.push_back(Pi(2*PI+EPS, -1));
                v.push_back(Pi(0-EPS, 1));
                v.push_back(Pi(r+EPS, -1));
            } else {
                v.push_back(Pi(l-EPS, 1));
                v.push_back(Pi(r+EPS, -1));
            }

        }

        sort(v.begin(), v.end());
        int sm = 1;
        for (Pi p: v) {            
            sm += p.second;
            res = max(res, sm);
        }
        v.clear();
    }
    cout << res << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	string s;
	cin>>s;
	int n,i,j;
	n = s.length();
	string s1 = "", s2 = "";
	bool is0 = false;
	for(i=0;i<n;i++){
		if(is0){
			s1 += '0';
			s2 += '1';
			is0 = false;
		}else{
			s1 += '1';
			s2 += '0';
			is0 = true;
		}
	}
	int ans1 = 0, ans2 = 0;
	for(i=0;i<n;i++){
		if(s1[i] != s[i]){ans1++;}
		if(s2[i] != s[i]){ans2++;}
	}
	printf("%d\n",min(ans1,ans2));
	return 0;
};

Measured memory_bytes: 768
#include<math.h>
#include<string.h>
#include <iostream>
using namespace std;
 
int i,st,ans,si;
string s;
 
 
void solve(void){
	st=0;
	ans=0;
	for(i=0;i<si;i++){
		if(s[i]=='S'){
			st--;
		}
		else{
			st++;
			ans=fmax(ans,st);
		}
	}
	cout<<ans*2<<endl;
}
int main() {
	cin>>s;
	si=s.size();
	solve();
}

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

int main() {
	int i = 0, Case[10000];
	Case[0] = 1;
	while(1) {
		cin >> Case[i];
		if(Case[i] == 0) {
			break;
		}
		i++;
	}
	for(int j = 0; j <= i - 1; j++) {
		cout << "Case " << j + 1 << ": " << Case[j] << endl;
	}
}


Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
    int a,b,c;
    cin >> a >> b >> c;
    for(int i = min(a,b);i > 0;i--){
        if(a%i == 0 && b%i == 0)  c--;
        if(c == 0){
            cout << i << endl;
            break;
        }
    }
    
}




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



Measured memory_bytes: 256
/******************************************
* AUTHOR : ARPIT *
* NICK : arpitfalcon *
* INSTITUTION : BIT MESRA *
* Ab m game m hu. *
******************************************/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 -
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vin                    \
    ll n;                      \
    cin >> n;                  \
    vector<ll> x(n);           \
    for (ll i = 0; i < n; i++) \
    cin >> x[i]
#define vout                   \
    for (ll i = 0; i < n; i++) \
    cout << x[i] << " "
#define T     \
    ll t = 1; \
    cin >> t; \
    while (t--)
#define ain                    \
    ll n, k;                   \
    cin >> n >> k;             \
    ll a[n];                   \
    for (ll z = 0; z < n; z++) \
    cin >> a[z]
#define aout                   \
    for (ll i = 0; i < n; i++) \
    cout << a[i] << " "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define max4(a, b, c, d) max(a, max3(b, c, d))
#define min4(a, b, c, d) min(a, min3(b, c, d))
#define blink                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double PI = 3.141592653589793238463;

#define forn(i, n) for (ll(i) = 0; (i) < (n); ++(i))
#define for1(i, n) for (ll(i) = 1; (i) <= (n); ++(i))
#define forr(i, n) for (ll(i) = (n)-1; (i) >= 0; --(i))
#define forab(i, a, b, c) for (ll(i) = a; (i) <= (b); (i) += (c))

/*
__builtin_ffs(x)
  Number of set bits: __builtin_popcount(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
*/

int main()
{
    blink
#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    // your code goes here
    long long int n;
    cin >> n;
    if (n % 2 == 0)
    {
        cout << n;
    }
    else
    {
        cout << n * 2;
    }

    return 0;
}

Measured memory_bytes: 3588
n,k=map(int,input().split())

h=list(map(int,input().split()))

inf=float('inf')
np=[inf]*n

np[0]=0

for i in range(n-1):
    for j in range(1,k+1):
        if (i+j) < n:
            if np[i+j]>abs(h[i]-h[i+j])+np[i]:
                np[i+j]=abs(h[i]-h[i+j])+np[i]

print(int(np[n-1]))

Measured memory_bytes: 55008
#include <stdio.h>
 
int LinerSearch(int a[], int n, int key)
{
   int i = 0;
   a[n] = key;

   while (a[i] != key) i++;
   if (i == n) return 0;
   return 1;
}
 
int main()
{
   int i, n, a[10000+1], q, key, sum = 0;
     
   scanf("%d", &n);
     
   for (i = 0; i < n; i++) {
       scanf("%d", &a[i]);
    }
     
   scanf("%d", &q);
     
   for (i = 0; i < q; i++) {
       scanf("%d", &key);
       if(LinerSearch(a, n, key)) sum++;
    }
     
   printf("%d\n", sum);
     
   return 0;
}

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

#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    int n;
    cin>>n;
    int p[101],m[101][101];
    rep(i,1,n+1)cin>>p[i-1]>>p[i];
    rep(i,1,n+1)m[i][i]=0;
    rep(l,2,n+1){
        for(int i=1;i<=n-l+1;i++){
            int j=i+l-1;
            m[i][j]=INF;
            for(int k=i;k<=j-1;k++){
                m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
            }
        }
    }
    cout<<m[1][n]<<endl;
    return 0;
}


Measured memory_bytes: 3136
"""
AtCoder :: Beginner Contest 172 :: B :: Minor Change
https://atcoder.jp/contests/abc172/tasks/abc172_b
"""
import sys


def solve(S, T):
    """Solve puzzle."""
    return sum(s != t for s, t in zip(S,T))


def main():
    """Main program."""
    S = sys.stdin.readline().strip()
    T = sys.stdin.readline().strip()
    print(solve(S, T))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9376
def main():
  lucas = [0 for i in range(100)]
  lucas[0] = 2
  lucas[1] = 1
  for i in range(2,100):
    lucas[i] = lucas[i-1] + lucas[i-2]
  print(lucas[int(input())])


if __name__ == "__main__":
  main()

Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int Maxn = 110;
int f[2][Maxn][Maxn][Maxn];
int n, m;
int stx, sty;
char s[Maxn][Maxn];
int a[Maxn][Maxn], row[Maxn][Maxn], col[Maxn][Maxn]; 
void up(int &x, int y) { if(x < y) x = y; }
int _max(int x, int y) { return x > y ? x : y; }
int _min(int x, int y) { return x < y ? x : y; }
int getr(int x, int l, int r) {
	int L = _max(sty-l, r+1), R = _min(sty+r, m-l);
	return L > R ? 0 : row[x][R] - row[x][L-1];
}
int getc(int y, int u, int d) {
	int U = _max(stx-u, d+1), D = _min(stx+d, n-u);
	return U > D ? 0 : col[D][y] - col[U-1][y];
}
int main() {
	int i, j, k;
	scanf("%d%d", &n, &m);
	for(i = 1; i <= n; i++) scanf("%s", s[i]+1);
	for(i = 1; i <= n; i++) for(j = 1; j <= m; j++){
		if(s[i][j] == 'o') a[i][j] = 1;
		if(s[i][j] == 'E') stx = i, sty = j;
	}
	for(i = 1; i <= n; i++){
		for(j = 1; j <= m; j++) row[i][j] = row[i][j-1]+a[i][j], col[i][j] = col[i-1][j]+a[i][j];
	}
	int st = 0, ans = 0;;
	for(int t = 1; t <= n+m; t++){
		st ^= 1;
		for(i = 0; i < stx; i++){
			for(j = 0; j <= n-stx; j++){
				for(k = 0; k < sty; k++){
					up(ans, f[st^1][i][j][k]);
					f[st][i][j][k] = 0;
				}
			}
		}
		for(i = 0; i < stx; i++){
			for(j = 0; j <= n-stx; j++){
				for(k = 0; k < sty; k++){
					int x = t-1-i-j-k;
					if(x < 0 || x > m-sty) continue;
					if(stx-i-1 > j) up(f[st][i+1][j][k], f[st^1][i][j][k]+getr(stx-i-1, k, x));
					if(stx+j+1 <= n-i) up(f[st][i][j+1][k], f[st^1][i][j][k]+getr(stx+j+1, k, x));
					if(sty-k-1 > x) up(f[st][i][j][k+1], f[st^1][i][j][k]+getc(sty-k-1, i, j));
					if(sty+x+1 <= m-k) up(f[st][i][j][k], f[st^1][i][j][k]+getc(sty+x+1, i, j));
				}
			}
		}
	}
	for(i = 0; i < stx; i++){
		for(j = 0; j <= n-stx; j++){
			for(k = 0; k < sty; k++){
				up(ans, f[st][i][j][k]);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 9216
# import itertools
# import math
# import sys
# import numpy as np

# K = int(input())
# S = input()
# n, *a = map(int, open(0))
X, N = map(int, input().split())
P = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()

# d = sorted(d.items(), key=lambda x:x[0]) # keyでsort
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement([i for i in range(1, M + 1)], N))
# print(a[0][0])
# print(conditions[0])

min_ = 999
num = 0
for i in range(102):
    if i in P:
        # print(i)
        continue
    _ = abs(i - X)
    if min_ > _:
        min_ = _
        num = i
print(num)

Measured memory_bytes: 9180
import sys
from functools import reduce
from math import gcd

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    used = [False] * (max(A) + 1)
    pairwise = True
    for a in A:
        for i in range(2, int(a ** 0.5) + 1):
            if a % i == 0:
                if used[i]:
                    pairwise = False
                else:
                    used[i] = True
                    while a % i == 0:
                        a //= i
        if a != 1:
            if used[a]:
                pairwise = False
                break
            else:
                used[a] = True


    g = reduce(gcd, A)

    if pairwise:
        print('pairwise coprime')
    else:
        if g == 1:
            print('setwise coprime')
        else:
            print('not coprime')


if __name__ == '__main__':
    main()


Measured memory_bytes: 184116
import java.util.Scanner;

public class Main {

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

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] values = new int[w];

		for (int i = 0; i < values.length; i++) {
			values[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int tmp = values[a];
			values[a] = values[b];
			values[b] = tmp;
		}

		for (int i = 0; i < values.length; i++) {
			System.out.printf("%d\n", values[i]);
		}
		sc.close();
	}

}

Measured memory_bytes: 15400
#include<stdio.h>
#include<string.h>
int main()
{
   int i,j,temp,height[15];
   for(i=0;i<10;i++){
   scanf("%d",&height[i]);
   }
   for(i=0;i<9;i++){
   for(j=0;j<9-i;j++)
   {
   if(height[j]<height[j+1]){
   temp=height[j];
   height[j]=height[j+1];
   height[j+1]=temp;
   }
   }}
    for(i=0;i<3;i++){
   printf("%d\n",height[i]);}
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pii pair<long long,long long>
using namespace std;

int MOD = (1e9)+7;
const int N = 2005;

pii a[N];
int dp[N][N],n;

int rec(int l,int r)
{
    if(l>r)
        return 0;
    if(dp[l][r]!=-1)
        return dp[l][r];
    int id = n-r+l;
    dp[l][r] = max(rec(l+1,r)+(a[id].ff*abs(a[id].ss-l)),rec(l,r-1)+(a[id].ff*abs(a[id].ss-r)));
    return dp[l][r];
}

signed main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i].ff,a[i].ss=i;
    sort(a+1,a+n+1);
    for(int i=1,j=n; i<j; i++,j--)
        swap(a[i],a[j]);
    cout<<rec(1,n)<<endl;
    return 0;
}


Measured memory_bytes: 35132