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

int main(){
string s;
cin>>s;
string t="keyence";
string u="ecneyek";
int l=s.size();
int a=0,b=0;
for(int i=0;i<l;i++){
if(s[i]==t[i]) a++;
else break;
}
for(int i=0;i<l;i++){
if(s[l-1-i]==u[i]) b++;
else break;
}
if(a+b>=7) cout << "YES" << endl;
else cout <<"NO" <<endl;
}

Measured memory_bytes: 256
def d_non_decreasing(N, A):
    a_max = max(A)
    a_argmax = A.index(a_max) + 1
    a_min = min(A)
    a_argmin = A.index(a_min) + 1  # +1するのは問題の数列が1-indexedだから

    if abs(a_max) >= abs(a_min):
        plus_index = a_argmax
        cumsum_range = range(1, N)
        cumsum_direction = +1
    else:
        plus_index = a_argmin
        cumsum_range = range(N, 1, -1)
        cumsum_direction = -1

    ans = [str(2 * N - 1)]  # 2N-1回の操作でソートされた数列になる
    for k in range(1, N + 1):
        ans.append('{} {}'.format(plus_index, k))  # 各要素に一律に加算
    for k in cumsum_range:
        ans.append('{} {}'.format(k, k + cumsum_direction))  # 累積和を取る
    ans = '\n'.join(ans)
    return ans
  
N = int(input())
A = [int(i) for i in input().split()]
print(d_non_decreasing(N, A))

Measured memory_bytes: 3064
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()
C = input()

# 石を二つ選ぶ
# 1こ選んで色を変える

# 最小回数を求める
# 効率がいい方法を考える

# Rを左に寄せ、Wを右に寄せる

R_cnt = 0
for i in range(N):
    if C[i] == 'R':
        R_cnt += 1

ans = 0
for i in range(R_cnt):
    if C[i] == 'W':
        ans += 1
print(ans)

Measured memory_bytes: 78540
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    G = [[] for i in range(N)]
    for i in range(M):
        x, y = (int(i)-1 for i in input().split())
        G[x].append(y)
        G[y].append(x)

    for i in range(N):
        if len(G[i]) % 2:
            return print("NO")
    else:
        return print("YES")


if __name__ == '__main__':
    main()


Measured memory_bytes: 55328
S, T = input(), input()
sLen, tLen = len(S), len(T)
dp = [[0 for _ in range(tLen+1)] for _ in range(sLen+1)]
for i in range(sLen):
    for j in range(tLen):
        if S[i] == T[j]:
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j], dp[i][j + 1])
i, j = sLen, tLen
ans = ''
while i != 0 and j != 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = S[i-1] + ans
        i -= 1
        j -= 1
print(ans)

Measured memory_bytes: 120540
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

const int bound = 100000;
const int kanal = 30;
int a[bound+100][kanal];

int main(){
	int n, k; cin >> n >> k;
	for( int i = 0; i < n; ++i ){
		int s, t, c; cin >> s >> t >> c;
		--c;
		a[s][c] += 1;
		a[t][c] -= 1;
	}
	for( int j = 0; j < kanal; ++j ){
		for( int i = 0; i <= bound; ++i ){
			a[i+1][j] += a[i][j];
		}
	}
	for( int j = 0; j < kanal; ++j ){
		for( int i = 0; i <= bound; ++i ){
			if( a[i][j]+1 == a[i+1][j] ){
				a[i][j] = a[i+1][j];
			} 
		}
	}
	int m = 0;
	for( int i = 0; i <= bound; ++i ){
		int sum = 0;
		for( int j = 0; j < kanal; ++j ){
			sum += a[i][j];
		}
		// cout << sum << endl;
		m = max(m, sum);
	}
	cout << m << endl;
}

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

const int N = 100 + 20;
int a[N];

int main() {
	int n, m, sum = 0, cnt = 0;
  	cin >> n >> m;
  	for (int i = 0; i < n; i++)
		cin >> a[i];
 	for (int i = 0; i < n; i++)
		sum += a[i];
  	for (int i = 0; i < n; i++)
    	if (a[i] * 4 * m >= sum)
        	cnt++;
  	cout << (cnt >= m? "Yes": "No") << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	int A, B;
	cin >> A >> B;
	if (A <= B) {
		for (int i = 0; i < B; i++) {
			cout << A;
		}
		cout << endl;
		return 0;
	}
	else if (A > B) {
		for (int i = 0; i < A; i++) {
			cout << B;
		}
		cout << endl;
		return 0;
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    static long[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        long[] intarray = new long[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    static void array_sout(int[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
    }

    static void array_sout(long[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) throws Exception {
        int N = Integer.parseInt(br.readLine().trim());
        long[] arr = inputval();
        long maxabs=0;
        int mindex=0;
        long mval=0;
        int c = 0;
        List<Integer> x = new ArrayList<>();
        List<Integer> y = new ArrayList<>();

        for(int i=0; i<arr.length; i++){
            if(Math.abs(arr[i]) > maxabs){
                maxabs = Math.abs(arr[i]);
                mindex = i;
                mval = arr[i];
            }
        }
        if(mval == 0) {
            System.out.println(0);
            return;
        } else {
            for (int i = 0; i < arr.length; i++) {
                if (i != mindex) {
                    arr[i] += mval;
                    x.add(mindex+1);
                    y.add(i+1);
                    c++;
                }
            }
        }
        if(mval > 0){
            for(int i=0; i<arr.length-1; i++){
                arr[i+1] += arr[i];
                x.add(i+1);
                y.add(i+2);
                c++;
            }
        }else {
            for(int i=arr.length-1; i>0; i--){
                arr[i-1] += arr[i];
                x.add(i+1);
                y.add(i);
                c++;
            }
        }
        System.out.println(c);
        for(int i=0; i<x.size(); i++){
            System.out.println(x.get(i) + " " + y.get(i));
        }
        //array_sout(arr);
    }
}

Measured memory_bytes: 23252
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-19 20:13:58
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template <class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '(' << p.first << ", " << p.second << ')'; }
template <class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { int flag = 0; for (auto e : vec) os << (flag++ ? ", " : "{") << e; return os << '}'; }
template <class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { int flag = 0; for (auto e : st) os << (flag++ ? ", " : "{") << e; return os << '}'; }
template <class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { int flag = 0; for (auto e : mp) os << (flag++ ? ", " : "{") << e; return os << '}'; }
template <class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { for (T& e : vec) is >> e; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int n, m; cin >> n >> m;
  vector<int> a(m); cin >> a;

  int sum = accumulate(all(a), int());

  if (sum > n) {
    cout << -1 << endl;
  } else {
    cout << n - sum << endl;
  }

  return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define int long long
#define fir first
#define sec second
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
#define N 100005
#define ls (u<<1)
#define rs (u<<1|1)
int n;
struct Edge
{
	int v,w,nxt;
};
Edge edge[N*4];
struct Node
{
	int pl,dat;
	bool operator < (const Node &x) const
	{
		return dat>x.dat;
	}
};
int fir[N],ss;
int dis[N];
bool inq[N];
void add(int u,int v,int w)
{
	ss++;
	edge[ss].v=v,edge[ss].w=w,edge[ss].nxt=fir[u];
	fir[u]=ss;
}
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n,m;
	cin>>n>>m;
	for(int i=1;i<n;i++) add(i+1,i,0);
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read(),w=read();
		add(u,v,w);
	}
	for(int i=2;i<=n;i++) dis[i]=1.5e15;
	priority_queue<Node> q;
	q.push((Node){1,0});
	while(!q.empty())
	{
		Node x=q.top();
		q.pop();
		int u=x.pl;
		if(dis[u]!=x.dat) continue;
		inq[u]=0;
		for(int i=fir[u];i!=0;i=edge[i].nxt)
		{
			int v=edge[i].v;
			if(dis[v]>dis[u]+edge[i].w)
			{
				dis[v]=dis[u]+edge[i].w;
				q.push((Node){v,dis[v]});
			}
		}
	}
	if(dis[n]!=1.5e15) cout<<dis[n]<<endl;
	else cout<<"-1\n";
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



Measured memory_bytes: 9464
#include <iostream>
#include <vector>
#include <cstring>
#include <utility>
#include <map>
#include <set>

using namespace std;

enum Direction {
    EAST, WEST, NORTH, SOUTH
};

struct Home {
    int index;
    Home *neighbor[4];
};

const int GOAL = 100;

Home homes[10][10];

int dfs(Home *cur, int mask, int rem) {
    int sum = 0;

    for(int dir = 0; dir < 4; ++dir) {
        Home *next = cur->neighbor[dir];
        while(next) {
            if(rem == 0) {
                if(next->index == GOAL) return 1;
            }
            if(next->index != GOAL && !(mask&(1<<next->index))) {
                sum += dfs(next, mask|(1<<next->index), rem-1);
                break;
            }
            next = next->neighbor[dir];
        }
    }
    return sum;
}

int main() {
    while(true) {
        int N, M;
        cin >> M >> N;
        if(!N && !M) break;

        memset(homes, 0, sizeof(homes));
        for(int i = 0; i < 10; ++i) {
            for(int j = 0; j < 10; ++j) {
                homes[i][j].index = -1;
            }
        }

        int home_idx = 0;
        int rem = 0;
        int sr, sc;
        for(int i = 0; i < N; ++i) {
            for(int j = 0; j < M; ++j) {
                int val;
                cin >> val;
                if(val != 0) {
                    if(val == 1) {
                        homes[i][j].index = home_idx++;
                        ++rem;
                    }
                    else {
                        homes[i][j].index = GOAL;
                        sr = i;
                        sc = j;
                    }

                    for(int jj = j-1; jj >= 0; --jj) {
                        if(homes[i][jj].index != -1) {
                            homes[i][jj].neighbor[EAST] = &homes[i][j];
                            homes[i][j].neighbor[WEST] = &homes[i][jj];
                            break;
                        }
                    }
                    for(int ii = i-1; ii >= 0; --ii) {
                        if(homes[ii][j].index != -1) {
                            homes[ii][j].neighbor[SOUTH] = &homes[i][j];
                            homes[i][j].neighbor[NORTH] = &homes[ii][j];
                            break;
                        }
                    }
                }
            }
        }

        cout << dfs(&homes[sr][sc], 0, rem) << endl;
    }
    return 0;
}

Measured memory_bytes: 868
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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



int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b;
	cin >> a >> b;
	if(abs(a - b) <= 1)puts("Yay!");
	else puts(":(");
	return 0;
}



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

int main(void){

    int H,W; cin>>H>>W;
    vector<vector<char>> S(H,vector<char>(W));
    int dx[8]={0,1,1,1,0,-1,-1,-1};
    int dy[8]={1,1,0,-1,-1,-1,0,1};

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cin>>S[i][j];
        }
    }

    vector<vector<char>> ans(H,vector<char>(W, 0));
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if(S[i][j]=='#'){
                cout<<'#';
                continue;
            }
            int count=0;
            for (int k = 0; k < 8; ++k) {
                int ni = i + dx[k];
                int nj = j + dy[k];

                if(ni<0 or ni>=H or nj<0 or nj>=W) continue;
                if(S[i+dx[k]][j+dy[k]]=='#'){
                    count++;
                }
            }
            cout<<count;
        }
        cout<<endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 998244353;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;


bool solve(){
	char c;cin>>c;
	if('A'<=c and c<='Z')cout<<"A"<<endl;
	else cout<<"a"<<endl;
  	return false;
}

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


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

int main() {
  int n, a, b;
  string s;
  cin >> n >> a >> b >> s;

  int cntf = 0, cntb = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i-1] == 'b')
      cntb++;
    if (((s[i-1] == 'a') && (a + b > cntf)) ||
        ((s[i-1] == 'b') && (a + b > cntf) && (cntb <= b))) {
      cout << "Yes" << endl;
      cntf++;
    } else
      cout << "No" << endl;
  }
}


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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 058 C / Link: http://abc058.contest.atcoder.jp/tasks/abc058_c  ----- */


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

	LL N; 
	cin >> N;
	vector<string> s(N);
	for (int i = 0; i < N; ++i) {
		cin >> s[i];
	}
	map<char, int>m;
	for (auto c : s.front()) {
		m[c]++;
	}

	FOR(i, 1, N) {
		map<char, int>nx;
		for (auto c : s[i]) {
			nx[c]++;
		}
		FOR(c, 'a', 'z' + 1) {
			m[c] = min(m[c], nx[c]);
		}
	}
	FOR(c, 'a', 'z' + 1) {
		string s(m[c], c);
		cout << s;
	}
	
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 105
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

int main() {
	go;
    cin >> N;
    ll sum = 0;
    ll minVal = 100005;
    fi(i, 0, N, 1) {
    	cin >> arr[i];
    	sum += arr[i];
    	if(arr[i] % 10) {
    		minVal = min(minVal, arr[i]);
    	}
    }
    if(sum % 10) {
    	cout << sum << "\n";
    	quit;
    }
    else {
    	if(minVal == 100005) {
    		minVal = sum;
    	}
    	cout << sum - minVal << "\n";
    }

	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 256
def main():
    N=int(input())
    S=input()
    c=1
    for i in range(N):
        if i==0:
            s=S[i]
        else:
            if s==S[i]:
                pass
            else:
                s=S[i]
                c+=1
    print(c)
if __name__=="__main__":
    main()

Measured memory_bytes: 3316
n,k=[int(i) for i in input().strip().split(" ")]

def renzoku(m):
    return pow(0.5,m)

def get_r(j):
    c = 0
    while True:
        if j >= k:
            return c
        c += 1
        j *= 2

result = 0
for i in range(n):
    i += 1
    result += (1.0/n) * renzoku(get_r(i))
print(result)


Measured memory_bytes: 39408
<?php
  $n = trim(fgets(STDIN));
  $cnt = array("AC" => 0, "WA" => 0, "TLE" => 0, "RE"=>0);
  for($i=0; $i<$n; $i++){
      $s = trim(fgets(STDIN));
      $cnt[$s]++;
  }
  foreach($cnt as $k=> $d){
      echo $k." x ".$d."\n";
  }

Measured memory_bytes: 16264
#include <bits/stdc++.h>
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
木はn-1ノード
関数単位で調べる
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    int k,a,b;
    cin >> k >> a >> b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";

    
}

/*
*/

Measured memory_bytes: 3600
/**
 *    author:  FromDihPout
 *    created: 2020-08-15
**/

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


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;

	if (s[0] == s[1] && s[0] == s[2] && s[0] == 'R') {
		cout << 3 << endl;
	}
	else if ((s[1] == s[0] || s[1] == s[2]) && s[1] == 'R') {
		cout << 2 << endl;
	}
	else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
}


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

int main(){
 int a, b, count=0;
  
  cin >> a >> b;
  for(int i=1; i <= 9; i++){
   for(int j=0; j <=9; j++){
     for(int k=0; k <=9; k++){
      int target  = i * 10001 + j * 1010 + k * 100 ;
       if (target >=a && target <= b)
         count++;
     }
    }
  }
  cout << count << endl;
}  

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b, c, d, n, cnt;

  while (scanf("%d", &n) != EOF) {
    cnt = 0;
    for (a = 0; a < 10; a++)
      for (b = 0; b < 10; b++)
        for (c = 0; c < 10; c++)
          for (d = 0; d < 10; d++)
            if (a+b+c+d == n) cnt++;
    printf("%d\n", cnt);
  }
  return 0;
}

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

using namespace std;

typedef long long int64;
typedef vector<int,int> vec;
#define read(a) scanf("%d",&a)
#define printarr(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" ";

const int rmax = 1e5 + 10;
const int inf = INT_MAX;

int pow(int n,int p)
{
    int ans = 1;
    for(int i=0;i<p;i++)
        ans = ans * n;

    return ans;
}

vector<int> psqr;

int main()
{
    int x,value;
    cin>>x;

    //pre_calculation
    psqr.push_back(1);
    for(int i=2;i<33;i++)
    {
        value = pow(i,2);
        if(value <= 1000)
            psqr.push_back(value);
        int k = 3;
        while(value <= 1000)
        {
            value = pow(i,k);
            if(value <= 1000)
                psqr.push_back(value);
            k++;
        }
    }

    sort(psqr.begin(),psqr.end());
    int res;
    for(int i=0;i<psqr.size();i++)
    {
        if(psqr[i] <= x)
            res = psqr[i];
    }

    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int len=s.length();
	for(int i=0;i<len;i++){
		if(s[i]=='?'){
			cout<<"D";
		}
		else {
			cout<<s[i];
		}
	}
	cout<<endl;
	return 0;
}

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

vector< vector<int> > edg;
vector< bool > vsd;

void f(int v){
    vsd[v] = true;
    for(int i=0;i<edg[v].size();i++){
        int x = edg[v][i];
        if(!vsd[x]) f(x);
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    edg.assign(n, vector<int>());
    for(int i=0;i<m;i++){
        int x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        edg[x].push_back(y);
        edg[y].push_back(x);
    }
    vsd.assign(n, false);
    int ans = 0;
    for(int i=0;i<n;i++){
        if(!vsd[i]){
            f(i);
            ans++;
        }
    }
    cout << ans << endl;
	return 0;
}

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

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

    //good luck kittu!
    ll a, b; cin>>a>>b;
    ll x = __gcd(a, b);
    x = (a*b)/x;
    cout<<x<<"\n";
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
   
public class Main {
    
    public static void main(String[] args) throws IOException {
//    	long l = System.currentTimeMillis();
        new Main().exec();
//    	long l2 = System.currentTimeMillis();
//    	System.out.println(l2 - l);
    }
      
    public void exec() throws IOException {
        InputUtil in = new InputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] S = in.nextInt(new int[n]);
        int q = in.nextInt();
        int C = 0;
        for(int i=0; i<q; i++) {
            C += binarySearch(S, in.nextInt(), 0, n);
        }
        out.println(C);
        out.flush();
    }
     
    private int binarySearch(int[] S, int key, int from, int to) {
        if(from == to) return 0;
        int mid = (from + to) /2;
        if (key < S[mid]) 
            return binarySearch(S,key,from,mid);
        if (S[mid] < key)
            return binarySearch(S,key,mid+1,to);
        return 1;
    }
}

class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 50000;
	
	//Fields
	protected InputStream in;
	private char[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private BufferedReader br = null;
	
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}
	protected void initBuf(int bufsiz) {buf = new char[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && br.ready()) {
			max = br.read(buf);
			ptr = 0;
		}
	}
	//Number Input Reader/Parser
	private boolean isNum(char b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(char b) {return b=='-'; }

	private int _nextInt() throws IOException {
		int sign = 1;
		int res = 0;
		char c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public int nextInt() throws IOException {
		readBuf();
		return _nextInt();
	}

	public int[] nextInt(int[] result) throws IOException {
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextInt();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

Measured memory_bytes: 28348
import math
K,A,B=map(int,input().split())

if B-A>1:
    if K<=A:
        print(K+1)
    else:
        print((B-A)*max(0,math.floor((K-(A-1))/2))+A+1-((K+A)%2))
else:   #B-A<=0
    print(1+K)


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <vector>

#define ll long long

int yakusu(int n) {
    int count = 1;
    for(int i=2; i <= std::sqrt(n); i++) {
        int cnt = 0;
        while(n % i == 0) {
            cnt++;
            n /= i;
        }
        count *= (cnt + 1);
        if(n == 1) break;
    }
    if(n != 1) count *= 2;
    return count;
}

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

    int ans = 0;
    int tmp_N = N;
    for(int i=1; i < N; i++) {
        tmp_N = N - i; // 現在の求める値
        // tmp_Nに対しての約数の数を求める
        ans += yakusu(tmp_N);
    }
    std::cout << ans << std::endl;
    
    return 0;
}

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

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 long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

int main(void){
    int N,M; cin >> N >> M;
    vector<P> v(N); REP(i,N) cin >> v[i].first >> v[i].second;
    SORT(v); REVERSE(v);
    priority_queue<int> q;
    int ans = 0;
    REP(i,M){
        while(v.size() && v.back().first <= i+1){
            q.push(v.back().second);
            v.pop_back();
        }
        if(q.size()){
            ans += q.top(); q.pop();
        }
    }
    cout << ans << en;
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  int n=s.size();
  int ans;
  for(int i=2; i<=n; i+=2){
    bool flag=1;
    rep(j,(n-i)/2){
      if(s[j]!=s[(n-i)/2+j])flag=0;
    }
    if(flag){
      ans=n-i;
      break;
    } 
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[100010];
vector<P> v;
signed main(){
	int n;
	cin>>n;
	f(i,n){
		cin>>x[i];
	}
	sort(x,x+n);
	int z=x[0];
	for(int i=lower_bound(x,x+n,0)-x;i<n-1;i++){
		if(i){
			v.push_back(P(z,x[i]));
			z-=x[i];
		}
	}
	v.push_back(P(x[n-1],z));
	z=x[n-1]-z;
	for(int i=1;i<lower_bound(x,x+n,0)-x&&i<n-1;i++){
		v.push_back(P(z,x[i]));
		z-=x[i];
	}
	cout<<z<<endl;
	f(i,v.size()){
		cout<<v[i].F<<" "<<v[i].S<<endl;
	}
}


Measured memory_bytes: 4336
N = int(input())
judge = [input() for i in range(N)]

N_ac = judge.count('AC')
N_wa = judge.count('WA')
N_tl = judge.count('TLE')
N_re = judge.count('RE')

print('AC x ' + str(N_ac))
print('WA x '+str(N_wa))
print('TLE x '+str(N_tl))
print('RE x '+str(N_re))


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

int main(){

	int n;
	cin >> n;
	long long int ans=1;
    vector<long long int> a(n);

	for(int i=0; i<n; i++){
		cin >> a[i];
		if(a[i]==0){
			cout << "0" << endl;
			return 0;
		}
	}

	for(int i=0; i<n; i++){
		if((log10(ans))+(log10(a[i]))>18){
			cout << "-1" << endl;
			return 0;
		}
		ans = ans*a[i];
		if(1000000000000000000<ans){
			cout << "-1" << endl;
			return 0;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >>S;
    if(S=="Sunny"){
        cout << "Cloudy"<<endl;
    }
    if(S=="Cloudy"){
        cout <<"Rainy"<<endl;
    }
    if(S=="Rainy"){
        cout<<"Sunny"<<endl;
    }
}


Measured memory_bytes: 256
N = gets.to_i
txy = N.times.map { gets.split.map(&:to_i)}

nowX = 0
nowY = 0
nowT = 0
nxtX = 0
nxtY = 0

isFailed = false
(0...N).each do |i|
  nxtT = txy[i][0]
  nxtX = txy[i][1]
  nxtY = txy[i][2]

  leastCost = (nxtX - nowX).abs + (nxtY - nowY).abs
  time = nxtT - nowT

  nowX = nxtX
  nowY = nxtY
  nowT = nxtT

  if leastCost.even? != time.even?
    isFailed = true
    break
  end

  if time < leastCost
    isFailed = true
    break
  end
end

if isFailed
  puts 'No'
else
  puts 'Yes'
end

Measured memory_bytes: 9596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace AtCoder.ABC057
{
    class DigitsInMultiplication
    {
        static long MaxDivisorUnderSQRT(long n)
        {
            for (long i = (long) Math.Sqrt(n); 0 < i; --i)
            {
                if (n % i == 0) return i;
            }
            return 1;
        }
        static int CalDigit(long n)
        {
            if (n == 0) return 0;
            else return 1 + CalDigit(n / 10);
        }
        public static void Main()
        {
            var n = long.Parse(ReadLine().Trim());
            WriteLine(CalDigit(n / MaxDivisorUnderSQRT(n)));
        }
    }
}


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

typedef long  long ll;
#define FF first
#define SS second
#define INF 2000000000


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

    int n, m;
    cin >> n >> m;

    int arr[m];
    int ans = 0;
    for(int i = 0; i < m; ++i){
        cin >> arr[i];
        ans += arr[i];
    }

    if(ans > n){
        cout << -1;
    }
    else{
        cout << n - ans;
    }



}



Measured memory_bytes: 3656
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main(void){
  	string s;
  	ll ans = 0;
  	ll a,n,b;
  	cin >> n >> a >> b;
  	
  	ll x = n / (a+b);
  	ans += x * a;
  	x = n - x*(a+b);
  	if(x>=a)ans += a;
  	else ans += x;
  	
      cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char a[3];
    cin>>a[0]>>a[1]>>a[2];
    string ans="";
    sort(a,a+3);
    ans+=a[2];
    ans+=a[1];
    int x = stoi(ans);
    x+=a[0]-'0';
    cout<<x;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#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 PB push_back
#define MP make_pair
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() {
  string s;
  cin>> s;

  if(s=="Sunny") cout << "Cloudy" << endl;
  else if(s=="Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    cin>>n;
    int q;
    cin>>q;
    string s;
    cin>>s;
    vector<int> v(s.size(),0);
    for(int i=0;i<s.size()-1;i++){
        if(s[i]=='A' && s[i+1]=='C') v[i+1]=v[i]+1;
        else v[i+1]=v[i];
    }
    vector<int> vv(q,0);
    for(int i = 0;i < q; i++){
        int l,r;
        cin>>l>>r;
        l--;
        r--;
        vv[i]=v[r]-v[l];
    }
    rep(i,q) cout<<vv[i]<<endl;
    return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define PI (acos(-1))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAXN 1123456
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

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

  int k, x;
  cin>>k>>x;

  int left = max(x-k+1, -1000000);
  int right = min(x+k-1, 1000000);

  rep(i,left,right+1) {
    cout << i << " ";
  }
  cout << endl;
}


Measured memory_bytes: 256
from collections import deque

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

tree = [[] for _ in range(n)]

for i in range(n - 1):
    tree[i].append(i + 1)
    tree[i + 1].append(i)
x -= 1
y -= 1
tree[x].append(y)
tree[y].append(x)

ans = [0] * (n - 1)
# 全頂点からBFSする
for i in range(n-1):
    # 頂点xの距離をdistに格納していく
    dist = [-1] * n
    dist[i] = 0
    q = deque([i])
    while len(q):
        v = q.pop()
        for next_v in tree[v]:
            if dist[next_v] != -1:
                continue
            q.appendleft(next_v)
            dist[next_v] = dist[v] + 1
    for j in range(i+1, n):
        ans[dist[j] - 1] += 1

for i in range(n - 1):
    print(ans[i])


Measured memory_bytes: 47936
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;
void solve()
{
    int a;
    cin>>a;
    int ans=a+pow(a,2)+pow(a,3);
    cout<<ans<<endl;
}

int main()
{
    fast;
    int t;
    solve();
}


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

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

typedef long long ll;
typedef pair<ll,ll> pll;

int N;
ll A[1010];
ll INF = 1001001001001001001;
int mem;
vector<pll> V;
vector<int> ans;

void popfront()
{
    for(int i = 0; i < V.size() - 1; i++)V[i] = V[i + 1];
    V.pop_back();
    return;
}

void pop(int id)
{
    V[id - 1].se += V[id + 1].se;
    for(int i = id; i + 2 < V.size(); i++)V[i] = V[i + 2];
    V.pop_back();V.pop_back();
    return;
}

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)scanf("%lld",A + i);

    if(N == 1){printf("%lld\n",A[0]);return 0;}

    ll sum1 = 0,MAX1= -INF;
    for(int i = 0; i < N; i += 2)
    {
        MAX1 = max(MAX1,A[i]);
        if(A[i] >= 0)sum1 += A[i];
    }
    if(MAX1 < 0)sum1 = MAX1;
    ll sum2 = 0,MAX2 = -INF;
    for(int i = 1; i < N; i += 2)
    {
        MAX2 = max(MAX2,A[i]);
        if(A[i] >= 0)sum2 += A[i];
    }
    if(MAX2 < 0)sum2 = MAX2;

    if(sum1 >= sum2)mem = 0,printf("%lld\n",sum1);
    else mem = 1,printf("%lld\n",sum2),MAX1 = MAX2;

    for(int i = 0; i < N; i++)V.push_back(mk(i % 2,A[i]));

    bool up = true;
    int flag = 0;
    while(up)
    {
        up = false;
        flag = 0;
        for(int i = 0; i < V.size(); i++)
        {
            if(V[i].fi == mem && ((MAX1 >= 0 && V[i].se < 0) || (MAX1 < 0 && (V[i].se != MAX1 || flag++ != 0))))
            {
                if(i == 0)popfront();
                else if(i == V.size() - 1)V.pop_back();
                else pop(i);
                ans.push_back(i + 1);
                up = true;
                break;
            }
        }
    }
    if(V.size() > 1 && V[0].fi != mem)
    {
        popfront();
        ans.push_back(1);
    }
    while(V.size() != 1)
    {
        if(V.size() == 2)V.pop_back();
        else pop(1);
        ans.push_back(2);
    }

    printf("%d\n",ans.size());
    for(int i = 0; i < ans.size(); i++)printf("%d\n",ans[i]);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int H,W; cin >> H >> W;
    vector<vector<char>> mat(H,vector<char>(W));
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            cin >> mat.at(i).at(j);
        }
    }
    vector<vector<char>> mata(H+2,vector<char>(W+2)); //matの周りをaで囲んだ行列mata
    for(int i = 0; i < W; i++) //1行目,(H+2)行目にaを代入
    {
        mata.at(0).at(i) = 'a';
        mata.at(H+1).at(i) = 'a';
    }
    for(int i = 1; i < H + 2; i++) //1列目,(W+2)行目にaを代入
    {
        mata.at(i).at(0) = 'a';
        mata.at(i).at(W+1) = 'a';
    }
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            mata.at(i+1).at(j+1) = mat.at(i).at(j);
        }
    }
    //matの補完行列mataの入力終了
    for(int i = 1; i < H + 1; i++)
    {
        for(int j = 1; j < W + 1; j++)
        {
            if(mata.at(i).at(j) == '.')
            {
                int cnt = 0;
                for(int k = j-1; k <= j+1; k++)
                {
                    if(mata.at(i-1).at(k) == '#'){cnt++;}
                    if(mata.at(i+1).at(k) == '#'){cnt++;}
                }
                if(mata.at(i).at(j-1) == '#'){cnt++;}
                if(mata.at(i).at(j+1) == '#'){cnt++;} 
                mat.at(i-1).at(j-1) = '0' + cnt;
            }
        }
    }
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            cout << mat.at(i).at(j);
        }
        cout << endl;
    }
}

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

using namespace std;

int main() {
  long long int w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << (w*h)/2;
  if(w*h%2) cout << ".5 ";
  else cout << ' ';
  if(x*2==w && y*2==h) cout << 1 << '\n';
  else cout << 0 << '\n';
}

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

map < string, int > mp;
map < string, int > chk;

int main()
{
    int n;

    cin >> n;

    string s[n + 5];

    for(int i = 0; i < n; i++) cin >> s[i], mp[s[i]]++;

    int mx = mp[s[0]];
    sort(s, s + n);

    for(int i = 1; i < n; i++) mx = max(mp[s[i]], mx);

    for(int i = 0; i < n; i++){
        if(mp[s[i]] == mx && chk[s[i]] == 0){
            cout << s[i] << endl;
            chk[s[i]] = 1;
        }
    }

    return 0;
}


Measured memory_bytes: 39296
#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){


}

Node treeMaximum(Node x){


}

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

Node treeSuccessor(Node x){


}

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



}

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){
  int i=0;
  if(u != NIL)
    {
      inorder(u->left);
      printf(" %d", u->key);
      inorder(u->right);
    }
}

void preorder(Node u){
  int i=0;
  if(u != NIL)
    {
      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: 20484
#include <iostream>
#include <stack>
#include <queue>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main()
{
	queue<pair<string, int> > Q;
	int n, q, time, a, answer = 0;
	string name;
	pair<string, int> u;

	cin >> n >> q;
	
	for (int i = 0; i < n; i++) {
		cin >> name >> time;
		Q.push(make_pair(name, time));
	}

	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		if (u.second > q) {
			time = u.second - q;
			answer += q;
			Q.push(make_pair(u.first, time));
		}
		else {
			answer += u.second;
			cout << u.first << " " << answer << endl;
		}
	}
}


Measured memory_bytes: 6252