akhauriyash/Code-Regression huggingface dataset:
#define KAKUSUKO
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 20;
int N;
int p[MAX_N];

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

  cin >> N;
  rep(i, N) cin >> p[i];

  int ans = 0;
  for (int i = 1; i < N-1; ++i) {
    if ((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1])) {
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define N (100009)
using namespace std;

int n,ans;
char s[N];

int main()
{
	cin>>s+1; n=strlen(s+1);
	for (int i=1; i<=n; ++i)
		if (i%2==1 && s[i]=='p') ans--;
		else if (i%2==0 && s[i]=='g') ans++;
	cout<<ans<<endl;
}

Measured memory_bytes: 384
n,m,x = gets.chomp.split(" ").map(&:to_i);
ary = []
cost=[]
ok = 0

n.times do |j|
ary[j] = gets.chomp.split(" ").map(&:to_i);
end
require 'matrix'

(1 << n).times do |bit|
sum = Array.new(m+1,0)
	n.times do |t|
	 	if bit[t] == 1
	 		sum =  (Vector.elements(sum) + Vector.elements(ary[t])).to_a
		end
	end

	(1..m).each do |i|
	if sum[i] >= x
		ok = 0
		else
			ok = -1
			break
	end
	end

	cost << sum[0] if ok == 0
	end
if cost == []
	puts -1
else
puts cost.min
end

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

int main() {
  int64_t n;
  cin >> n;
  int64_t ans = 0;
  
  for(int i = 1; i < n+1; i++){
    int64_t m = n / i;
    int64_t add = i * m * (m+1) /2;
    ans += add;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3584
#include<stdio.h>
int main(void)
{
	int x,a,b,c,d;
	scanf("%d %d %d",&x,&a,&b);
	c=x-a;
	d=x-b;
	if(c<0) {
		c=c*-1;
	}
	if(d<0) {
		d=d*-1;
	}
	if(c<d) {
		printf("A\n");
	}
	else {
		printf("B\n");
	}
	return 0;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

constexpr int K = 1005;
vvint s(2 * K, vint(2 * K, 0));
vvint table(2 * K, vint(2 * K, 0));
// [x1, x2), [y1, y2)
int query(int x1, int y1, int x2, int y2)
{
    return s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1];
}

void Main()
{
    int n, k;
    cin >> n >> k;
    rep(i, n)
    {
        int x, y;
        char c;
        cin >> x >> y >> c;
        if (c == 'W')
        {
            y += k;
        }
        x %= k * 2;
        y %= k * 2;
        ++table[x][y];
    }

    rep(x, 2 * k) rep(y, 2 * k)
    {
        s[x + 1][y + 1] = s[x][y + 1] + s[x + 1][y] - s[x][y] + table[x][y];
    }

    int ans = 0;
    rep(i, k) rep(j, k)
    {
        int ra = query(0, 0, i, j);
        int rb = query(i + k, 0, 2 * k, j);
        int rc = query(i, j, i + k, j + k);
        int rd = query(0, j + k, i, 2 * k);
        int re = query(i + k, j + k, 2 * k, 2 * k);
        ans = max(ra + rb + rc + rd + re, ans);
        ans = max(query(0, 0, 2 * k, 2 * k) - (ra + rb + rc + rd + re), ans);
    }
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 32000
#include <bits/stdc++.h>
/*
#include <cstdio>
#include <cstring>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <algorithm>
 */
using namespace std;
#define LSON            id << 1 , l , mid
#define RSON            id << 1 | 1 , mid + 1 , r
#define LS              id << 1
#define RS              id << 1 | 1
#define ROOT            1 , 1 , n
#define CLR(x , y)      memset(x , y , sizeof(x))
#define LOWBIT(x)       x & (-x)
#define FORN(i , a , n)  for(int i = (a) ; i <= (n) ; ++i)
#define FORP(i , n , a)  for(int i = (n) ; i >= (a) ; --i)
#define CASE(x)		printf("Case %d: ", x)
#define CASE#(x) printf("Case #%d: " , x)
#define SFD(x)      scanf("%lf" , &x)
#define SFC(x)      scanf(" %c" , &x)
#define SFS(x)      scanf(" %s" , x)
#define SFI(x)      scanf("%d" , &x)
//#define SFL(x)      scanf("%lld" , &x)
#define SFI64(x)    scanf("%I64d" , &x)
#define PFF(x)         printf("%f" , x)
#define PFD(x)         printf("%lf" , x)
#define PFI(x)         printf("%d" , x)
#define PFC(x)         printf("%c" , x)
#define PFS(x)         printf("%s" , x)
#define PFI64(x)       printf("%I64d" , x)
//#define PFL(x)         printf("%lld" , x)
#define SPACE          printf(" ")
#define PUT            puts("")
#define TEST           printf("pass\n");
#define LPUP(i , j , k) for(int i = j ; i <= k ; ++i)
#define LPDW(i , j , k) for(int i = j ; i >= k ; --i)
#define PB(x)          push_back(x)
#define ALL(A)         A.begin(), A.end()
#define SZ(A)          int((A).size())
#define LBD(A, x)      (lower_bound(ALL(A), x) - A.begin())
#define UBD(A, x)      (upper_bound(ALL(A), x) - A.begin())
//#define LOCAL
static const double PI = acos(-1.0);
static const double EPS = 1e-8;
static const int SEED = 131;
static const int OO = 0X3fffffff;
typedef unsigned long long ULL;
typedef long long LL;
typedef double DB;
inline int read1()
{
    int x = 0;
    int f = 1 ; char ch = getchar();
    while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') {x = (x << 1) + (x << 3) + (ch - '0'); ch = getchar();}
    x *= f;
    return x;
}

struct buf
{
	operator int()
	{
		int x = 0 , y = 0 , c = getchar();
		while(c < 48)
			y = c == 45 , c = getchar();
		while(c > 47)
			x = (x << 1) + (x << 3) + (c - 48) , c = getchar();
		return y ? -x : x;
	}
}read;



inline void write(int x)
{
    int y = 10 , len = 1;
	if(x < 0)
	{
		putchar('-');
		x = -x;
	}
    while(y <= x)
    {
        y *= 10;
        ++len;
    }
    while(len--)
    {
        y /= 10;
        putchar(x / y + 48);
        x %= y;
    }
}

/************************Little Pea****************************/

int n;
int main()
{
#ifdef LOCAL
    freopen("G:\\desktop\\littlepea\\in.data" , "r" , stdin);
#endif
    scanf("%d" , &n);
	printf("ABC%d" , n);

#ifdef LOCAL
    fclose(stdin);fclose(stdout);
#endif
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
               
#define pb push_back  
#define PII pair<int,int>   
               
#define VS vector<string>   
#define VI vector<int>
#define ll long long int    
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {      
    int h,w; cin >> h >> w;
    vector<vector<char> > v(h+2);
    REP(i,w+2) v[0].pb('#');
    REP(i,h) v[i+1].pb('#');
    char a=0;  
    REP(i,h) { 
        REP(j,w) {
            cin >> a;
            v[i+1].pb(a);
        }      
    }          
    REP(i,h) v[i+1].pb('#');
    REP(i,w+2) v[h+1].pb('#');
               
    REP(i,h+2) {
        REP(j,w+2) {                                                                                                                 
            cout << v[i][j];
        }      
        cout << endl; 
    }          
}

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

int main() {
  int a, b;
  int mid;
  
  cin >> a >> b;
  if ((a + b) % 2 == 0){
     mid = (a + b) / 2;
  }
  else {
    mid = (a + b) / 2 + 1; 
  }
  
  cout << mid << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long x = sc.NextLong();

        long up = x / 100;
        long down = x % 100;

        long count = 0;
        while (down > 0)
        {
            if (down > 5)
            {
                down -= 5;
            }
            else
            {
                down = 0;
            }
            count++;
        }

        long answer = (up >= count) ? 1 : 0;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27108
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N, K;
  cin >> N >> K;
  long long q = 0;
  long long w = 0;
  long long e = 0;
  long long r = 0;
  if(N > K) {
    q += N / K;
    w += N - K * q;
    e += K - w;
    r += min(w, e);
  }
  else {
    q += N;
    w += K - N;
    r += min(q, w);
  }
  cout << r << endl;
}

Measured memory_bytes: 256
import queue

def dijkstra(s):
    color = ["white"]*n
    d = [float('inf')]*n
    d[s] = 0
    
    pq = queue.PriorityQueue()
    
    pq.put((0,s))
    
    while not pq.empty():
        u = pq.get()
        color[u[1]] = "black"
        
        if d[u[1]] < u[0]:
            continue
            
        for v,w in zip(Adj[u[1]][2::2],Adj[u[1]][3::2]):
            if color[v] != "black":
                if d[u[1]] + w < d[v]:
                    d[v] = d[u[1]]+w
                    color[v] = "gray"
                    pq.put((d[v],v))
                    
    return d

n = int(input())
Adj = [list(map(int,input().split())) for _ in range(n)]
ans = dijkstra(0)

for i in range(n):
    print('{} {}'.format(i,ans[i]))


Measured memory_bytes: 41504
// Written by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <vector>

// Delete the debugging information!
#define debug(x) std::cerr << #x << " = " << x << std::endl;

const int BUFFER_SIZE = 1 << 24 | 1;
struct InputOutputStream {
  char ibuf[BUFFER_SIZE], obuf[BUFFER_SIZE], *s, *oh;
  InputOutputStream() : s(ibuf), oh(obuf) {
    ibuf[fread(ibuf, 1, BUFFER_SIZE, stdin)] = '\0';
  }
  ~InputOutputStream() { fwrite(obuf, 1, oh - obuf, stdout); }
  template <typename T>
  inline InputOutputStream &operator>>(T &x) {
    while (!isdigit(*s)) ++s;
    for (x = 0; isdigit(*s); ++s)
      x = x * 10 + (*s ^ '0');
    return *this;
  }
  template <typename T>
  inline InputOutputStream &operator<<(T x) {
    static char buf[23];
    register char *top = buf;
    if (x) {
      for (T t; x; )
        t = x / 10, *top++ = x - t * 10 + 48, x = t;
      while (top != buf)
        *oh++ = *--top;
    }
    else
      *oh++ = '0';
    *oh++ = '\n';
    return *this;
  }
}IO;

template <typename lhs, typename rhs>
inline lhs min(const lhs &x, const rhs &y) { return x < y ? x : y; }
template <typename lhs, typename rhs>
inline lhs max(const lhs &x, const rhs &y) { return x > y ? x : y; }

const int MAXN = 500003;
int n, k, p[MAXN], q[MAXN];

const int MAXT = 2000003;
#define mid ((l + r) >> 1)
#define lSon (k << 1)
#define rSon (k << 1 | 1)
struct SegmentTree {
  int mx[MAXT];
  void modify(int k, int l, int r, int x, int v) {
    mx[k] = max(mx[k], v);
    if (l == r)
      return ;
    x <= mid ? modify(lSon, l, mid, x, v) : modify(rSon, mid + 1, r, x, v);
  }
  int query(int k, int l, int r, int x, int y) {
    if (x <= l && r <= y)
      return mx[k];
    int o = 0;
    if (x <= mid)
      o = max(o, query(lSon, l, mid, x, y));
    if (mid < y)
      o = max(o, query(rSon, mid + 1, r, x, y));
    return o;
  }
}tree;
#undef mid
#undef lSon
#undef rSon

std::vector<int> g[MAXN];
int deg[MAXN];

std::priority_queue<int> que;

int main() {
  IO >> n >> k, --k; // k = k - 1
  for (int i = 1; i <= n; ++i)
    IO >> p[i], q[p[i]] = i;
  for (int i = 1; i <= n; ++i) {
    int temp = tree.query(1, 1, n, q[i] - k, q[i]);
    if (temp)
      g[q[i]].push_back(q[temp]), ++deg[q[temp]];
    temp = tree.query(1, 1, n, q[i], q[i] + k);
    if (temp)
      g[q[i]].push_back(q[temp]), ++deg[q[temp]];
    tree.modify(1, 1, n, q[i], i);
  }
  
  static int ans[MAXN], cnt = 0;
  for (int i = 1; i <= n; ++i)
    if (!deg[i])
      que.push(i);
  while (!que.empty()) {
    int x = que.top();
    que.pop(), ans[++cnt] = x;
    for (int y : g[x])
      if (--deg[y] == 0)
        que.push(y);
  }
  std::reverse(ans + 1, ans + n + 1);
  for (int i = 1; i <= n; ++i)
    p[ans[i]] = i;
  for (int i = 1; i <= n; ++i)
    IO << p[i];
  return 0;
}


Measured memory_bytes: 56832
# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def check(B, C):
    def _check(A):
        return sum([A[i] * B[i] for i in range(len(B))]) + C > 0
    return _check


def main():
    N, M, C = MI()
    B = MIL()
    A = []
    for i in range(N):
        A.append(MIL())
    return sum(map(check(B, C), A))


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 5268
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/22/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int H,W,K; cin>>H>>W>>K;
  vector<string> choco(H); for(auto& l : choco) cin>>l;
  vector<vector<int>> acc(H, vector<int>(W, 0));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i > 0) acc[i][j] = acc[i-1][j];
      if (i > 0 and j > 0) acc[i][j] -= acc[i-1][j-1];
      if (j > 0) acc[i][j] += acc[i][j-1];
      acc[i][j] += choco[i][j]=='1';
    }
  }
  auto sum = [&](int x0, int y0, int x1, int y1) {
    auto res = acc[x1][y1];
    if (x0 > 0)
      res -= acc[x0-1][y1];
    if (y0 > 0)
      res -= acc[x1][y0-1];
    if (x0 > 0 and y0 > 0)
      res += acc[x0-1][y0-1];
    return res;
  };

  int ans = (H-1)+(W-1);
  for (int i = 0; i < (1<<(H-1)); i++) {
    vector<int> vl={0};
    for (int k = 0; k < H-1; k++) {
      if (i&(1<<k)) {
        vl.push_back(k+1);
      }
    }
    vl.push_back(H);
    int d = vl.size()-2;
    auto solve = [&](int left, int right) {
      for (int k = 0; k < vl.size()-1; k++) {
        if (sum(vl[k], left, vl[k+1]-1, right-1) > K)
          return false;
      }
      return true;
    };
    int l = 0, r = 0;
    while (r <= W) {
      if (not solve(l, r)) {
        if (r-l <= 1) {
          d = H+W;
          break;
        }
        d++;
        l = r-1;
      }
      ++r;
    }
    ans = min(ans, d);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
import java.util.*;


public class Main {
	
	int n, m, k, start, goal, r;
	int[][] cost, time;
	
	final int INF = Integer.MAX_VALUE;
	int[] min;
	
	int dijkstra(int[][] V) {
		int[] min = new int[m + 1];
		Arrays.fill(min, INF);
		min[start] = 0;
		
		Queue<int[]> que = new LinkedList<int[]>();
		que.offer(new int[]{start, 0});
		while (!que.isEmpty()) {
			int[] p = que.poll();
			int from = p[0];
			if (min[from] < p[1]) continue;
			for (int to = 1; to <= m; to++) {
				int v = V[from][to];
				if (v != INF && min[from] + v < min[to]) {
					min[to] = min[from] + v;
					que.offer(new int[]{to, min[to]});
				}
			}
		}
		return min[goal];
	}
	
	int solve() {
		if (r == 0) {
			return dijkstra(cost);
		} else {
			return dijkstra(time);
		}
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		String output = "";
		while (sc.hasNext()) {
			n = sc.nextInt();
			m = sc.nextInt();
			if (n == 0 && m == 0) {
				break;
			} else {
				cost = new int[m + 1][m + 1];
				time = new int[m + 1][m + 1];
				for (int i = 1; i <= m; i++) {
					Arrays.fill(cost[i], INF);
					Arrays.fill(time[i], INF);
				}
				for (int i = 0; i < n; i++) {
					int a = sc.nextInt();
					int b = sc.nextInt();
					int c = sc.nextInt();
					int t = sc.nextInt();
					cost[a][b] = c;
					cost[b][a] = c;
					time[a][b] = t;
					time[b][a] = t;
				}
				k = sc.nextInt();
				for (int i = 0; i < k; i++) {
					start = sc.nextInt();
					goal = sc.nextInt();
 					r = sc.nextInt();
					output += solve() + "\n";
				}
			}
		}
		sc.close();
		System.out.print(output);
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 158104
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(10) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<lli,lli>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K;
  Vec(V,lli,N,0);
  rep(i,0,N)cin >> V[i];
  rep(i,0,min(N,K)+1)rep(j,0,min(N,K)+1){
    if(i+j>min(N,K))continue;
    Vec(P,lli,0,0);
    sum=0;
    rep(l,0,i)if(V[l]<0)P.pb(V[l]);else sum+=V[l];
    rep(r,0,j)if(V[N-r-1]<0)P.pb(V[N-r-1]);else sum+=V[N-r-1];
    Sort(P);Rev(P);
    X=P.size();
    rep(g,0,max((lli)0,X-K+i+j))sum+=P[g];
    chmax(num,sum);
  }
  Out(num);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int made=0;
	int mn=9999999;
	int n,money;
	cin>>n>>money;
	while(n--)
	{
		int price;
		cin>>price;
		money-=price;
		if(price<mn)
		{
			mn=price;
		}
		made++;
	}
	if(money>0)
	{
		made+=(money/mn);
	}
	cout<<made<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const double PI=acos(-1.0);
signed main(){
	int n;	cin>>n;
	printf("%.10lf\n",2.0*PI*n);
	return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
#include <vector>
#include <set>
#include <deque>
using namespace std;
int main()
{
	string s;
	cin>>s;
	map<char,int> a;
	for (int i=0;i<s.size();i++){
		a[s[i]]++;
	}
	for (int i=0;i<s.size();i++){
		if (a[s[i]]%2==0){
			continue;
		}
		else {
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 256
import  java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(true){
      int n = Integer.parseInt(sc.next());
      if(n == 0) break;
      int a[] = new int[n];
      double sum = 0;
      double sum2 = 0;
      for(int i = 0; i < n; i++){
        a[i] = Integer.parseInt(sc.next());
        sum += a[i];
        sum2 += a[i] * a[i];
      }
      double a1 = sum2 / n;
      double a2 = (sum / n) * (sum / n);
      System.out.printf("%f\n", Math.sqrt(a1 - a2));
    }
  }
}


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

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

int main()
{
    int a, b;
    cin >> a >> b;

    int res = a - b * 2;
    if (res >= 0)
    {
        cout << res << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
template<class T> inline void chmin(T& a, T b) {if (a>b) a=b; }
template<class T> inline void chmax(T& a, T b) {if (a<b) a=b; }
inline void print() { cout << endl; }
template <class Head, class... Tail> inline void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...);}
template <class T> inline void print(vector<T>& vec) { for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " "; } cout << endl;}
template <class T> inline void print(vector<vector<T>>& df) { for (auto& vec : df) { print(vec); }}
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;


int main() { 
    int N, K; cin >> N >> K;
    vector<int> H(N, 0);
    int res = 0;
    REP(i, N) {
        // cin >> H[i];
        int h; cin >> h;
        if(h>= K) res++;
    }

    print(res);
    
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

int main()
{
    int a, b, x;
    cin >> a >> b >> x;

    if (a <= x && x <= a + b) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


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

#define int long long

using namespace std;
const int inf = 1e18;
int x[111111], dp[111111], st[444444] = {inf};
int upd(int l, int r, int cur, int ind, int val)
{
    if(ind < l or r < ind or r < l)
        return inf;
    if(l == r)
        return st[cur] = val;
    int mid = (l+r)/2;
    upd(mid+1, r, cur*2+2, ind, val);
    upd(l, mid, cur*2+1, ind, val);
    return st[cur] = min(st[cur*2+1], st[cur*2+2]);
}
int mn(int l, int r, int sl, int sr, int cur)
{
    if(sr < l or r < sl or r < l or sr < sl)
        return inf;
    if(sl <= l and r <= sr)
        return st[cur];
    if(l == r)
        return st[cur];
    int mid = (l+r)/2;
    return min(mn(l, mid, sl, sr, cur*2+1), mn(mid+1, r, sl, sr, cur*2+2));
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n, t, e;
    cin >> n >> e >> t;
    for(int i = 1; i <= n; i++)
        cin >> x[i];

    upd(0, n, 0, 0, -2*x[1]);

    for(int i = 1; i <= n; i++)
    {
        int j = lower_bound(x+1, x+n+1, x[i]-t/2.0)-x;
        if((x[i]-x[j])*2 < t)
            j--;
        dp[i] = min(dp[j]+t, mn(0,n,0,j-1,0)+2*x[i]);
        //cout << i << ' ' << j << ' ' << dp[i] << endl;

        upd(0, n, 0, i, dp[i]-2*x[i+1]);
    }
    cout << dp[n]+e << endl;
    return 0;
}


Measured memory_bytes: 3968
def solve(): # 072C- Together
    N = int(input())
    a = list(map(int, input().split(" ")))
    mode = [0] * 1000000

    for element in a:
        mode[element-1] += 1
        mode[element] += 1
        mode[element+1] += 1

    print(max(mode))
    
   
solve()

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

int main(){
  long long N, K;
  cin >> N >> K;
  vector<long long> a(N);
  for (int i=0; i<N; i++) cin >> a[i];
  vector<long long> sums;
  for (int i=1; i<N; i++){
    a[i] += a[i-1];
  }
  for (int i=0; i<N; i++){
    for (int j=i; j<N; j++){
      if (i==0) sums.push_back(a[j]);
      else sums.push_back(a[j]-a[i-1]);
    }
  }
  // for (auto k: sums) cout << k << endl;
  long long check = 1;
  for (int i=0; i<60; i++) check *= 2;
  long long ans = 0;
  while(check){
    int count = 0;
    vector<long long> nxtsums;
    for (auto k: sums){
      if (k&check){
        count++;
        nxtsums.push_back(k);
        // cout << (check&k) << endl;
      }
    }
    if (count>=K){
      ans += check;
      sums = nxtsums;
    }
    check /= 2;
    // cout << sums.size() << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 6388
#dual link list
from collections import deque
box = deque()
n = int(input())
for _ in range(n):
    a = input()
    if a[0] == "i":
        box.appendleft(a[7:])
    else:
        if a[6] == " ":
            num = a[7:]
            if num in box:box.remove(num)
        elif a[6] == "F":box.popleft()
        else:box.pop()
            
print(*box)


Measured memory_bytes: 69724
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)


int main(){ FastIO;

int i,n,j;cin>>n;
string s;cin>>s;
int c=1;char cur=s[0];
for(i=1;i<n;i++)
{
	if(s[i]!=cur)
	{
		cur=s[i];c++;
	}
}
cout<<c;



return 0;
}


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

using namespace std;

inline int read()
{
    int x=0;char ch=getchar();
    while(ch<'0' || '9'<ch)ch=getchar();
    while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
    return x;
}

const int N=1e5+9;

int n,m,top,q[N];
int to[N<<1],nxt[N<<1],beg[N],tot;
bool vis[N];

inline void add(int u,int v)
{
	to[++tot]=v;
	nxt[tot]=beg[u];
	beg[u]=tot;
}

inline void dfs(int u)
{
	vis[q[++top]=u]=1;
	bool f=0;
	for(int i=beg[u];i;i=nxt[i])
		if(!vis[to[i]] && !f)
		{
			dfs(to[i]);
			f=1;
		}
}

int main()
{
	n=read();m=read();
	for(int i=1,u,v;i<=m;i++)
	{
		u=read();v=read();
		add(u,v);add(v,u);
	}
		
	dfs(1);
	reverse(q+1,q+top+1);
	top--;
	dfs(1);
	printf("%d\n",top);
	for(int i=1;i<=top;i++)
		printf("%d ",q[i]);

    return 0;
}


Measured memory_bytes: 4096
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

constexpr ll MOD = ll(1e9 + 7ll);

class Factorial {
public:
	Factorial() = delete;
	static ll myPow(ll x, ll n, ll m) {
		if (n == 0)
			return 1LL;
		if (n % 2LL == 0)
			return myPow(x * x % m, n / 2LL, m);
		else
			return x * myPow(x, n - 1, m) % m;
}

	Factorial(ll N) : N(N) {
		// 1 ... N までの
		FAC.resize(N+1LL);
		DEFAC.resize(N+1LL);

		FAC[0] = FAC[1] = 1LL;
		FOR(i, N)
			(FAC[i + 1] = FAC[i] * (i + 1ll)) %= MOD;

		DEFAC[N] = myPow(FAC[N], MOD - 2, MOD);
		FOR(_i, N) {
			auto i = N - _i;
			(DEFAC[i - 1] = DEFAC[i] * i) %= MOD;
		}
	}
	ll getComb(ll N, ll B) {
		if (N < B) {
			throw "[Factorial]::getComb  nCb  b is larger than b.";
		}
		return (FAC[N] * DEFAC[N - B])%MOD * (DEFAC[B]) % MOD;
	}
	vector<ll> FAC;
	vector<ll> DEFAC;
	ll N;
};

int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	ll N; cin >> N; N += 1; vector<ll> A(N); FOR(i, N) cin >> A[i]; Factorial FAC(N + 1);
	set<ll> cnt; ll double_val = -1;
	for (auto av : A) {
		if (cnt.find( av) != cnt.end()) { double_val = av; break; }
		else {
			cnt.insert(av);
		}
	} ll a=-1, b;
	FOR(i, N) {
		auto av = A[i]; if (av == double_val) {
			if (a == -1) a = i;
			else { b = i; break; } }	}
	// 2回出てくる要素のインデックスをa,bに入れた。
	
	const ll kinds = N - 1;
	FOR(_i, N) {
		auto i = _i + 1;

		if (i == 1) 	cout << kinds << endl;
		else if (i == N) cout << 1 << endl;
		else {
				ll ans = FAC.getComb(N, i) % MOD;

				// 真ん中以外のみから選択する場合。片側だけ入った場合から、区別できないケースを引く。
				//ans -= (N - 2 - (b - a - 1) >= i - 1ll) ? FAC.getComb(N - 2 - (b - a - 1), i - 1ll) : 0;
				
				ll remain_cnt = N - 2 - (b - a - 1);
				if (remain_cnt >= i-1)
					ans -=  FAC.getComb( remain_cnt, i - 1LL) ;
				while (ans < 0) ans += MOD;
				cout << ( ans ) % MOD << endl;
		}
		
	}

	return 0;
}


Measured memory_bytes: 8192
#include<algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void){
	string a,b;
	int i=0;
	cin>>a>>b;
	if(a.size()>b.size())cout<<"GREATER\n";
	else if(a.size()<b.size())cout<<"LESS\n";
	else if(a==b)cout<<"EQUAL\n";
	else{
		while(1){
			if(a[i]>b[i]){
				cout<<"GREATER\n";
				break;
			}
			else if(a[i]<b[i]){
				cout<<"LESS\n";
				break;
			}
			i++;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = 10**9

def main():
    S = input()
    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    count = 0
    for s in alphabet:
        if s not in S:
            print(s)
            return
        if len(set(alphabet)- set(S)) == 0:
            print(None)
            return


if __name__ == '__main__':
    main()


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

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

    int ans = 0;
    for (int i = 0; i < N; i++){
        if (x[i] <= fabs(K - x[i])){
            ans += x[i] * 2;
        }else{
            ans += (K - x[i]) * 2;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>


using namespace std;


int N,M;
const int SIZE = 500005;
int c[SIZE];
int A[SIZE];
int Next[SIZE];
int res[500005];
int show[1000005];
bool fir[SIZE];


struct Q {
    int l, r;
    int pos;
}q[500005];


int lowbit(int k) {
  return k & (-k);
}

void modify(int n,int v) {
  while (n <= N) {
    c[n] += v;
    n += lowbit(n);
  }
}

int sum(int n) {
  int ans = 0;
  while (n > 0) {
    ans += c[n];
    n -= lowbit(n);
  }
  return ans;
}


int cmp(Q a, Q b) {
  return a.l < b.l;
}


int main() {

  scanf("%d %d", &N,&M);
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);

  for (int i = N; i >= 1; i--) {
    if (!show[A[i]]) {
      show[A[i]] = i;
      fir[i] = true;
    } else {
      Next[i] = show[A[i]];
      fir[Next[i]] = false;
      fir[i] = true;
      show[A[i]] = i;
    }
  }

  for (int i = 1; i <= M; i++) {
    scanf("%d%d", &q[i].l, &q[i].r);
    q[i].pos = i;
  }
  sort(q + 1, q + 1 + M, cmp);


  for (int i = 1; i <= N; i++)
    if (fir[i]) {
      modify(i, 1);
    }
  int qtemp = q[1].l;
  int ptr = 1;
  for (int i = 1; i <= M; i++) {
    for (; ptr < q[i].l; ptr++) {
      if (fir[ptr]) {
        modify(ptr, -1);
        fir[ptr] = false;
        if (Next[ptr]) {
          fir[Next[ptr]] = true;
          modify(Next[ptr], 1);
        }
      }
    }
    ptr = q[i].l;
    qtemp = q[i].l;
    res[q[i].pos] = sum(q[i].r) - sum(q[i].l - 1);
  }
  for (int i = 1; i <= M; i++) printf("%d\n", res[i]);
  return 0;
}

Measured memory_bytes: 19332
using System;

namespace atbc_115
{
    class Program
    {
        static void Main(string[] args)
        {
            int cnt = int.Parse(Console.ReadLine());

            int sum = 0;
            int max = 0;

            for (int i = 0; i < cnt; i++)
            {
                int tmp = int.Parse(Console.ReadLine());
                sum += tmp;
                if (max < tmp)
                {
                    max = tmp;
                }
            }
            sum -= max / 2;

            Console.WriteLine(sum);
        }
    }
}


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

using namespace std;
const int MAXN=1e5+10,INF=1<<30;
struct edge{int nxt,to;}e[MAXN<<2];
int n,k,x,y,fst,head[MAXN],dep[MAXN],l[MAXN],r[MAXN],val[MAXN],tot=0;

void add(int from,int to)
{e[++tot].nxt=head[from];e[tot].to=to;head[from]=tot;}

void cal_dep(int x,int anc)
{
	for(int i=head[x];i;i=e[i].nxt)
	{
		if(e[i].to==anc) continue;
		dep[e[i].to]=dep[x]+1;cal_dep(e[i].to,x);
	}
}

void dfs(int x,int anc)
{
	if(val[x]!=INF) l[x]=r[x]=val[x];
	else l[x]=-INF,r[x]=INF;
	
	for(int i=head[x];i;i=e[i].nxt)
	{
		if(e[i].to==anc) continue;
		dfs(e[i].to,x);
		l[x]=max(l[x],l[e[i].to]-1);
		r[x]=min(r[x],r[e[i].to]+1);
	}
	
	if(l[x]>r[x]){puts("No");exit(0);}
}

void print(int x,int anc)
{
	if(val[x]==INF)
	{
		if(val[anc]+1>=l[x]&&val[anc]+1<=r[x]) val[x]=val[anc]+1;
		else val[x]=val[anc]-1;
	}
	for(int i=head[x];i;i=e[i].nxt)
		if(e[i].to!=anc) print(e[i].to,x);
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
		scanf("%d%d",&x,&y),add(x,y),add(y,x);
	cal_dep(1,0);
	for(int i=1;i<=n;i++) val[i]=INF;
	
	scanf("%d",&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d%d",&x,&y);val[x]=y;
		if(i==1) fst=(dep[x]&1)^(val[x]&1);
		else if((dep[x]&1)^(val[x]&1)!=fst) return !puts("No");
	}
	
	dfs(1,0);
	if(val[1]==INF) val[1]=l[1];
	puts("Yes");print(1,0);
	for(int i=1;i<=n;i++) printf("%d\n",val[i]);
	
	return 0;
}

Measured memory_bytes: 9856
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

s=input()
n=len(s)
lst=[0]*n
for i in range(n):
    lst[i]=s[i]


ans=0
cnt=0
i=0
while i<n-2:
    if lst[i]=="A":
        cnt+=1
    else:
        cnt=0
    if lst[i]=="A" and lst[i+1]=="B" and lst[i+2]=="C":
        ans+=cnt
        cnt-=1
        lst[i+2]="A"
        i+=1
    # print(lst)
    # print(i,ans,cnt)
    i+=1
print(ans)
# print(lst)

Measured memory_bytes: 85692
import math
nk = list(map(int,input().split()))
s = 0
for n in range(1,nk[0]+1):
    if n >= nk[1]:
        s += 1/nk[0]
    else:
        s += 0.5**math.ceil(math.log2(nk[1]/float(n)))/nk[0]
print(s)

Measured memory_bytes: 3060
#include<iostream>                                                                    
#include<cmath>                                                                       
using namespace std;                                                                  
                                                                                      
int getDp( int* dp, int i, int* h ) {                                                 
   if( dp[ i ] != -1 ) {                                                              
      return dp[ i ];                                                                 
   }                                                                                  
   dp[ i ] = min( getDp( dp, i - 1, h ) + abs( h[ i - 1 ] - h[ i ] ),                    
                  getDp( dp, i - 2, h ) + abs( h[ i - 2 ] - h[ i ] ) );               
   return dp[ i ];                                                                    
}                                                                                     
                                                                                      
int main() {                                                                             
   int N;                                                                                
   cin >> N;                                                                             
   int h[ N ];                                                                           
   for( int i = 0; i < N; i++ ) {                                                        
      cin >> h[ i ];                                                                     
   }                                                                                     
   int dp[ N ];                                                                          
   dp[ 0 ] = 0;                                                                          
   dp[ 1 ] = abs( h[ 1 ] - h[ 0 ] );                                                     
   for( int i = 2; i < N; i++ ) {                                                        
      dp[ i ] = -1;                                                                      
   }                                                                                     
   cout << getDp( dp, N - 1, h );                                                        
   return 0;                                                                             
}                                             

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin>>n;
    vector<string> a(n);
    for (int i=0; i<n; ++i){
        cin>>a[i];
        sort(a[i].begin(), a[i].end());
    }
    sort(a.begin(), a.end());
    vector<pair<string, long long>> ans;
    ans.push_back({a[0], 1ll});
    for (int i=1; i<n; ++i){
        if (a[i] == ans.back().first) ans.back().second++;
        else ans.push_back({a[i], 1});
    }
    long long  c=0;
    for (auto i : ans)  c+= ((i.second-1ll)*i.second)/2ll;
    cout<<c;
    return 0;
}


Measured memory_bytes: 7928
#include <stdio.h>

int main(void)
{
	int count[101] = {0};
	int value,i,max;
	while(scanf("%d",&value) != EOF)
	{
		count[value]++;
	}
	max = count[0];
	for(i = 0; i<100;i++)
	{
		if(max < count[i]) max = count[i];
	}
	for(i=0;i<100;i++)
	{
		if(max == count[i]) printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>

#define ALL(a)  (a).begin(),(a).end()

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main() {
    ll n;
    ll ans = 0;

    vector<int> l;

    cin >> n;

    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0 && (n / i) < 10) ans++;
    }
    
    (ans > 0) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}


Measured memory_bytes: 256
//
// Created by 10034 on 2020/7/30.
//

#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
const int N=1000010;
typedef pair<int,int> PII;

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int main(){
    int n,m,k,x1,x2,y1,y2;
    cin>>n>>m>>k;
    vector<string> g(n);
    vector<vector<int>> d(n,vector<int>(m,1e9));
    queue<PII> q;
    cin>>x1>>y1>>x2>>y2;
    x1--,y1--,x2--,y2--;
    d[x1][y1]=0;
    for(int i=0;i<n;++i){
        cin>>g[i];
    }
    q.push({x1,y1});
    while(q.size()){
        int xx=q.front().first,yy=q.front().second;
        q.pop();
        for(int i=0;i<4;++i){
            for(int j=1;j<=k;++j) {
                int nx = xx + dx[i] * j, ny = yy + dy[i] * j;
                if (nx < 0 || ny < 0 || nx >=n || ny >=m ||g[nx][ny]=='@'| d[nx][ny] <= d[xx][yy]) break;
                if(d[nx][ny]>d[xx][yy]+1) {
                    d[nx][ny] = d[xx][yy] + 1;
                    q.push({nx, ny});
                }
                if(nx==x2&&ny==y2) {
                    cout<<d[nx][ny]<<endl;
                    return 0;
                }
            }
        }
    }
    puts("-1");

    return 0;
}

Measured memory_bytes: 10680
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        input_inner!{$s, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($exp_input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                let start = std::time::Instant::now();
                let input = solve($exp_input);
                let end = start.elapsed();
                assert_eq!(input, $output, "{}.{:03}", end.as_secs(), end.subsec_millis());
                assert!(end.as_secs() <= 2, "expected_sec: {}sec, actual_sec: {}sec", 2, end.as_secs());
                assert!(end.as_secs() <= 1, "expected_sec: {}sec, actual_sec: {}sec", 1, end.as_secs());
                assert!(end.subsec_millis() <= 10, "expected_ms: {}ms, actual_ms: {}ms", 10, end.subsec_millis());
                assert!(end.subsec_millis() <= 2, "expected_ms: {}ms, actual_ms: {}ms", 2, end.subsec_millis());
            )*
        }
    };
}

test! {
r#"6
abcabc"# => r#"Yes"#,

r#"6
abcadc"# => r#"No"#,

r#"1
z"# => r#"No"#,
}

fn solve(src: &str) -> String {
    let mut src_iter = src.split_whitespace();
    input! {
        source = src_iter,
        n: usize,
        s: chars,
    }

    if n % 2 == 0 && s[0..n / 2] == s[n / 2 ..] {
        "Yes"
    } else {
        "No"
    }.to_string()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
int p[20010];
int a[20010], b[20010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }  
  for (int i = 0; i < N; i++) {
    a[i] = b[N - 1 - i] = 1 + N * i;
  }
  for (int i = 0; i < N; i++) {
    a[p[i] - 1] += i;
  }
  for (int i = 0; i < N; i++) {
    cout << a[i] << " \n"[i + 1 == N];
  }
  for (int i = 0; i < N; i++) {
    cout << b[i] << " \n"[i + 1 == N];
  }

  return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int a[100005],n,i,mid;
	long long sum=0;
	cin>>n;
	for(i=0;i<n;++i)
		scanf("%d",&a[i]);
	if(n==2)
	{
		cout<<abs(a[0]-a[1]);
		return 0;
	}
	sort(a,a+n);
	mid=n/2;
	if(n%2)
	{
		if(a[mid]-a[mid-1]<a[mid+1]-a[mid])
		{
			for(i=0;i<mid-1;++i)
				sum-=2*a[i];
			sum-=a[mid]+a[mid-1];
			for(i=mid+1;i<n;++i)
				sum+=2*a[i];
		}
		else
		{
			for(i=0;i<=mid-1;++i)
				sum-=2*a[i];
			sum+=a[mid+1]+a[mid];
			for(i=mid+2;i<n;++i)
				sum+=2*a[i];
		}
		cout<<sum;
	}
	else
	{
		int k=0;
		sum=2*a[n-1]-a[0]-a[1];
		for(i=n-2;i>mid;--i)
		{
			sum+=2*a[i]-a[k]-a[k+2];
			++k;
		}
		sum+=a[mid]-a[mid-2];
		cout<<sum;
	}
	return 0;
}

Measured memory_bytes: 640
n = int(input())
d = list(map(int, input().split()))

m = int(input())
t = list(map(int, input().split()))

memo = {}
for i in range(n):
    if d[i] not in memo:
        memo[d[i]] = 1
    else:
        memo[d[i]] += 1

for i in range(m):
    if t[i] not in memo:
        print("NO")
        exit()
    if memo[t[i]] == 0:
        print("NO")
        exit()
    memo[t[i]] -= 1
print("YES")


Measured memory_bytes: 127828
F = 2*10**5+2
mod = 10**9+7
fact = [1]*F
inv = [1]*F
for i in range(2,F):
    fact[i]=(fact[i-1]*i)%mod
inv[F-1]=pow(fact[F-1],mod-2,mod)
for i in range(F-2,1,-1):
    inv[i] = (inv[i+1]*(i+1))%mod

n,a,b = map(int, input().split())

c1=1
for i in range(n,n-a,-1):
    c1=(c1*i)%mod
c2=1
for i in range(n,n-b,-1):
    c2=(c2*i)%mod
c1=(c1*inv[a])%mod
c2=(c2*inv[b])%mod

ans=pow(2,n,mod)
ans=(ans-1-c1-c2)%mod

print(ans)

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n;cin>>n;
  int res=0;
  for(int i=0;i<n;i++){
    int t;cin>>t;
    res += t-1;
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256
mod = 2019
l, r = map(int, input().split())

if r//mod - l//mod > 0:
  print(0)
else:
  l %= mod
  r %= mod
  ans = mod
  for i in range(l, r):
    for j in range(i+1, r+1):
      ans = min(i*j%mod, ans)
    if ans == 0:
      break
  print(ans)

Measured memory_bytes: 3064