akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        char c;
        cin >> c;
        c++;
        cout << c << endl;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

int main() {
  int N, L;
  cin >> N >> L;
  priority_queue<string, vector<string>, greater<string>> strs;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    strs.push(s);
  }
  string ans = "";
  while (!strs.empty()) {
    ans += strs.top();
    strs.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int size = s.size();
    ll b=0;
    ll ans=0;
    rep(i,size){
        if(s[i]=='B')b++;
        if(s[i]=='W')ans+=b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ph push
#define ptc putchar
#define enter putchar('\n')
#define mod 1000000007
using namespace std;
typedef pair<int,int> pii;
typedef double db;
typedef long double ldb;
typedef long long ll;
typedef long long lnt;
inline int read(){
	   int x = 0;char c = getchar();
	   while (!isdigit(c)) c = getchar();
	   while (isdigit(c)) x = (x << 1) + (x << 3) + c - '0' , c = getchar();
	   return x;
}
inline void write(int x){
	   if (!x){
          ptc('0');
          return;
	   }
	   int dg[20] , len = 0;
	   while (x) dg[len++] = x % 10 , x /= 10;
	   while (len--) ptc(dg[len]+'0');
}
inline void writeln(int x){
	   write(x);
	   ptc('\n');
}

inline int add(int x,int y){
	x += y;
	if (x >= mod) x -= mod;
	return x;
}
inline int sub(int x,int y){
	x -= y;
	if (x < 0) x += mod;
	return x;
}
const int N = 20;


int n , m , k;
int must[N + 1][N + 1];

int nextone(int mask,int pos){
	for (int i = pos + 1;i <= n;i++)
	if (mask & (1 << (i - 1))) return 1 << (i - 1);
	return 1 << (pos - 1);
}

int f[N + 1][1 << N] , g[N + 1][1 << N];

int main(){
	
	scanf("%d%d%d",&n,&m,&k);
	memset(must , -1 , sizeof must);
	for (int i = 1;i <= k;i++){
		int A , B , C;
		scanf("%d%d%d",&A,&B,&C);
		must[A][B] = C;
	}
	n--;
	f[n][0] = 1;
	
	for (int i = 1;i <= m;i++){
		
		for (int mask = 0;mask < (1 << n);mask++){
			f[0][mask] = f[n][mask];
		}
		for (int j = 1;j <= n;j++){
			memset(f[j] , 0 , sizeof f[j]);
			
			for (int mask = 0;mask < 1 << n;mask++){
				int dm = ( mask >> (j - 1) ) & 1;
				
					
				if (must[i][j] != -1){
					
					
					for (int di = must[i][j];;){
						if (dm == 1 && di == 0) break;			
						if (dm == di){
							f[j][mask] = add(f[j][mask] , f[j - 1][mask]);
						}else{
							int trans = (mask & ( ((1 << n) - 1) ^ nextone(mask , j) ) ) | (1 << (j - 1));	
							f[j][trans] = add(f[j][trans] , f[j - 1][mask]);
						}
						break;
					}
					
					
				}else{
					for (int di = 0;di < 2;di++){
						if (dm == 1 && di == 0) continue;				
						if (dm == di){
							f[j][mask] = add(f[j][mask] , f[j - 1][mask]);
						}else{
							int trans = (mask & ( ((1 << n) - 1) ^ nextone(mask , j) ) ) | (1 << (j - 1));					
//							printf("[%d %d %d] %d\n",mask,j,trans,nextone(mask,j));
							f[j][trans] = add(f[j][trans] , f[j - 1][mask]);
						}
					}
				}
			
			}
		}
		
	}
	
	int answer = 0;
	for (int i = 0;i < 1 << n;i++) answer = add(answer , f[n][i]);
	cout<<answer;		
	return 0;
}

Measured memory_bytes: 84224
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#include <cassert>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;

int n, m, q;
int dmax = 0;
vector<vector<int>> param;

void rec(vector<int> a)
{
	if (a.size() == 0) {
		for(int i = 1; i <= m; ++i) {
			vector<int> next = a;
			next.push_back(i);
			rec(next);
		}
	}
	else if (a.size() == n) {
		int d = 0;
		rep(i, q) {
			if (a[param[i][1]] - a[param[i][0]] == param[i][2]) d += param[i][3];
		}
		dmax = max(dmax, d);
		return;
	}
	else {
		for (int i = a.back(); i <= m; ++i) {
			vector<int> next = a;
			next.push_back(i);
			rec(next);
		}
	}
}
int main()
{
	// ABC165-C, 1197, 
	cin >> n >> m >> q;
	param.resize(q);
	rep(i, q) {
		param[i].resize(4);
		rep(j, 4) cin >> param[i][j];
		param[i][0]--; param[i][1]--;
	}
	vector<int> a;
	rec(a);
	cout << dmax << endl;

	return 0;
}

Measured memory_bytes: 3632
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    if (n == m) cout << "Yes";
    else cout << "No";
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;
typedef double scalar;
class point{
	public:
	scalar x;
	scalar y;
	void print(){
		cout << x << " " << y; 
	}
	scalar norm2(void){
		return x * x + y * y;
	}
	scalar norm(void){
		return sqrt(norm2());
	}
	point operator =(point a){
		this->x = a.x;
		this->y = a.y;
		return *this;
	}
	point operator +(point a){
		point r;
		r.x = this->x + a.x;
		r.y = this->y + a.y;
		return r;
	}
	point operator -(point a){
		point r;
		r.x = this->x - a.x;
		r.y = this->y - a.y;
		return r;
	}
};

point operator *(scalar t, point a){
	point r;
	r.x = t * a.x; 
	r.y = t * a.y; 
	return r;
}

void projection(point p, point q, point r, point &x){
	point qp = q - p;
	point pr = p - r;
	scalar k = (qp.x * pr.x + qp.y * pr.y)/qp.norm2();
	x = p - (k * qp);
	
}

void reflection(point p, point q, point r, point &s){
	point x;
	projection(p,q,r,x);
	s = 2.0 * x - r;
}

int main(){
	point p1, p2, p, x;
	int q;
	cout.precision(20);
	cin >> p1.x >> p1.y >> p2.x >> p2.y;
	cin >> q;
	for(int i = 0;i < q;i++){
		cin >> p.x >> p.y;
		reflection(p1, p2, p, x);
		x.print();
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1296
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

a = LIST()
to = max(a)
sm = sum(a)

if to % 2 != sm % 2:
    to += 1
ans = 0
for i in range(3):
    ans += to - a[i]
ans //= 2
print(ans)


Measured memory_bytes: 60268
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int a,b,c;

  cin>>a>>b>>c;

  vi x;

  REP(i,1,min(a,b)+1) if(a%i==0 && b%i==0) x.pb(i);

  sort(rALL(x));

  cout<<x[c-1]<<endl;

  return 0;

}


Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((a (read))
         (b (read)))
    (println
     (cond ((<= (* a b) 0) "Zero")
           ((and (< b 0)
                 (evenp (- b a))) "Negative")
           (t "Positive")))))

#-swank(main)


Measured memory_bytes: 16352
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

long long n;
vector<long long> data[3];
long long memo[100005] = {0};

long long solve();

int main() {
  cin >> n;
  for(long long i = 0; i < 3; ++i)
    for(long long j = 0; j < n; ++j) {
      long long x;
      cin >> x;
      data[i].push_back(x);
    }
  for(int i = 0; i < 3; ++i)
    sort(data[i].begin(), data[i].end());
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = n - 1; i >= 0; --i) {
    if(i != n - 1) memo[i] = memo[i + 1];
    long long now = upper_bound(data[2].begin(),
                                data[2].end(), data[1][i]) -
                    data[2].begin();
    memo[i] += (n - now);
  }
  for(int i = 0; i < n; ++i) {
    long long now = upper_bound(data[1].begin(),
                                data[1].end(), data[0][i]) -
                    data[1].begin();
    ans += memo[now];
  }
  return ans;
}

Measured memory_bytes: 3444
import sys
from itertools import permutations
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
MOD = pow(10, 9) + 7

N, K = map(int, read().split())

l = range(0, N + 1)
sum_ = sum(l)
if K > N:
    print(1)
    sys.exit()

ans = 0
for i, k in enumerate(range(K, N + 2), 0):
    small = (i - 1) * i // 2
    large = (2 * N - i + 1) * i // 2
    acc = large - small + 1
    acc %= MOD
    ans += acc
    #break
print(ans % MOD)


Measured memory_bytes: 9216
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
using namespace boost::multiprecision;  
using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
//#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}

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

    int h,w,d;
    cin >> h >> w >> d;

    vector<vector<int> > a(h,vector<int>(w)), cost(d+1);
    vector<pii> pos(h*w+1);

    rep(i,h){
        rep(j,w){
            cin >> a[i][j];
            pos[a[i][j]] = pii(i,j);
        }
    }

    reps(i,d){
        for(int j = i; j <= h*w; j += d){
            if(j == i){
                cost[i].emplace_back(0);
            }else{
                int tmp = abs(pos[j-d].first - pos[j].first) + abs(pos[j-d].second - pos[j].second);
                int pos = j - i;
                cost[i].emplace_back(cost[i][pos/d-1] + tmp);
            }
        }
    }

    int q;
    cin >> q;
    rep(i,q){
        int l,r;
        cin >> l >> r;
        int sub = updiv(l,d) - 1;
        int s = l % d;
        if(s == 0) s = d;
        int g = (r - s) / d;
        cout << cost[s][g] - cost[s][sub] << '\n';
    }

    return 0;
}


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

int main() {
	string s;
	int n;
	int count[30];
	int store[200];
	int ans = -1;
	cin >> n >> s;
	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < 30; j++)count[j] = 0;
		store[i] = 0;
		for (int j = 0; j < n; j++) {
			if (j <= i) {
				count[s[j] - 'a']++;
			}
			if (i < j && count[s[j] - 'a']>0) {
				count[s[j] - 'a'] = 0;
				store[i]++;
			}
		}
		if (store[i] > ans)ans = store[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a_list=[int(i) for i in input().split()]

ans=10**20
for flg in (-1,1):
    c=0
    s=0
    for a in a_list:
        s+=a
        if s==0:
            c+=1
            s=flg
        if s//abs(s)!=flg:
            c+=abs(s)+1
            s=flg
        flg*=-1
    ans=min(ans,c)
print(ans)

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

int main()
{
    vector<pair<int, int> > v;
    int n;
    cin >> n;

    while (n--)
    {
        int x, y;
        cin >> x >> y;
        v.push_back(make_pair(x, y));
    }
    sort(v.begin(), v.end());

    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i].first << " " << v[i].second << endl;
    }
}


Measured memory_bytes: 3844
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
    int n;
    while(1){
        double l=0,s=0;
        double a=0,c=0,b=0,m=0;
        cin>>n;
        double S[n]={};
        if(n==0){
            break;
        }
        else{
            for(int i=0;i<n;i++){
                cin>>S[i];
                l+=S[i];
            }
            m = l/n;
            for(int k=0;k<n;k++){
                a+=(m-S[k])*(m-S[k])/n;
            }
                printf("%.8lf\n", sqrt(a)); 
        }
    }
return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  ll n;
  cin >> n;
  map<ll, ll> m;
  rep(i, 0, n) {
    ll x;
    cin >> x;
    m[x]++;
  }
  
  ll ans = 0;
  for(const auto& e : m) {
    ll f = e.first;
    ll s = e.second;
    if(s > f) ans += (s-f);
    else if(s < f) ans += s;
  }
  
  cout << ans << "\n";
}

Measured memory_bytes: 6272
fun main(args: Array<String>){
    val isSosu = mutableListOf<Boolean>()
    for (tmp in 1..200005){
        isSosu.add(true)
    }
    isSosu[0] = false
    isSosu[1] = false
    for (i in 2..200000){
        if (!isSosu[i]) continue
        for (j in (2*i)..200000 step i){
            isSosu[j] = false
        }
    }

    val x = readLine()!!.toInt()
    for(i in x..200000){
        if(isSosu[i]){
            println(i)
            return
        }
    }
}


Measured memory_bytes: 38548
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
// #include <numeric>
// #include <string>
// #include <queue>
// #include <set>
// #include <map>
// #include <iomanip>
// #include <list>
// #include <cassert>

#define MOD 1000000007
// #define INF 1000000001
#define S 100001

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

void p_() {
    cout << "\n";
}
template<class Head, class... Body>
void p_(Head head, Body... body) {
    cout << head << ",";
    p_(body...);
}

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    for (const auto& i : v) {
        os << i << " ";
    }
    os << "]";
    return os;
}

int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }

    vector<ll> s1(N+1), s2(N+1);
    s1[0] = s2[0] = 0;
    for (int i = 0; i < N; ++i) {
        s1[i+1] = s1[i] + a[i];
        s2[i+1] = s2[i] + a[N-i-1];
    }
    // cout << s1 << endl;
    // cout << s2 << endl;

    ll ans = abs(s1[1] - s2[N-1]);
    for (int i = 2; i < N; ++i) {
        ans = min(ans, abs(s1[i] - s2[N-i]));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4096
N, M = map(int, input().split())
A = list(map(int, input().split()))
d = {}
for a in A:
    if not a in d: d[a] = 0
    d[a] += 1
for i in range(M):
    B, C = map(int, input().split())
    if not C in d: d[C] = 0
    d[C] += B
T = sorted(d.items(), key=lambda x:x[0], reverse=True)
ans = 0
cnt = 0
for t in T:
    if t[1] <= N - cnt:
        ans += t[0] * t[1]
        cnt += t[1]
    else:
        ans += t[0] * (N - cnt)
        break
print(ans)


Measured memory_bytes: 43168
N=input("")
l_str=N.split()
l=[int(s) for s in l_str]

#l[0]が1,l[1]が0,l[2]が-1,l[3]がkの枚数
max;


if l[0]>=l[3]:
    max=1*l[3]
elif l[0]+l[1]>=l[3]:
    max=1*l[0]
else:
    max=1*l[0]-1*(l[3]-(l[0]+l[1]))

print(max)


Measured memory_bytes: 9228
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a;
		String alpha="abcdefghijklmnopqrstuvwxyz";
		Map <String,Integer> mapA = new TreeMap<String,Integer>();
		Map <String,Integer> mapB = new TreeMap<String,Integer>();
		Map <String,Integer> mapC = new HashMap<String,Integer>();
		
			// 整数の入力
		int n,index,index2,index3,count;
		long answer,count2;
		String s,s2;
		
		n = sc.nextInt();
		for(index=0;index<n;index++) {
			s = sc.next();
			mapA.clear();
			for(index2=0;index2<10;index2++) {
				s2=s.substring(index2,index2+1);
				if(mapA.containsKey(s2)){
					count=mapA.get(s2);
					mapA.put(s2,count+1);
				}
				else {
					mapA.put(s2,1);
				}
			}
			s2="";
			for(String s3:mapA.keySet()) {
				count=mapA.get(s3);
				for(index3=0;index3<count;index3++) {
					s2=s2.concat(s3);
				}
			}
			//System.out.println("/"+s2+"/");
			if(mapB.containsKey(s2)) {
				count=mapB.get(s2);
				mapB.put(s2,count+1);
			}
			else {
				mapB.put(s2,1);
			}
		}
		sc.close();
		
		answer=0;
		for(String s4:mapB.keySet()) {
			count=mapB.get(s4);
			//System.out.print(count);
			if(count>1) {
				count2=count;
				count2=count2*(count2-1)/2;
				if(answer==0) {
					answer=count2;
				}
				else {
					answer=answer+count2;
				}
			}
		}
		System.out.print(answer);

			// 出力
 
	}
}	

Measured memory_bytes: 101308
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

template<typename T, typename F> struct segment_tree {
private :
	int N; // the number of leaves
	std::vector<T> V;
	const F op; // binary operation
	const T id; // identity element
public :
	segment_tree(const std::vector<T>& v, const F& f, const T& t) : op(f), id(t) {
		int n = 1, sz = v.size();
		while (n < sz) n *= 2;
		N = n;
		V.resize(N * 2, id);
		for (int i = 0; i < sz; i++) V[N + i] = v[i];
		for (int i = N - 1; i > 0; i--) V[i] = op(V[i * 2], V[i * 2 + 1]);
	}
	segment_tree(const int& sz, const F& f, const T& t) : op(f), id(t) {
		int n = 1;
		while (n < sz) n *= 2;
		N = n;
		V.resize(N * 2, id);
	}
	const T& operator[](const int& i) {return V[N + i];}
	void point_update(const int& k, const T& t) {
		V[N + k] = t;
		for (int i = (N + k) / 2; i > 0; i /= 2) V[i] = op(V[i * 2], V[i * 2 + 1]);
	}
	T range_fold(const int& L, const int& R, const int& i = 1, const int& l = 0, int r = -1) {
		if (r == -1) r = N;
		if (L <= l && r <= R) return V[i];
		T ret = id;
		int mid = (l + r) / 2;
		if (L < mid) ret = op(ret, range_fold(L, R, i * 2, l, mid));
		if (mid < R) ret = op(ret, range_fold(L, R, i * 2 + 1, mid, r));
		return ret;
	}
	int lower_bound(const int& L, const int& R, const T& t, const int& i = 1, const int& l = 0, int r = -1) {
		if (r == -1) r = N;
		if (V[i] < t) return R;
		if (l + 1 == r) return l;
		int mid = (l + r) / 2;
		if (L < mid && V[i * 2] >= t) {
			int ret = lower_bound(L, R, t, i * 2, l, mid);
			if (ret < R) return ret;
		}
		if (mid < R && V[i * 2 + 1] >= t) return lower_bound(L, R, t, i * 2 + 1, mid, r);
		return R;
	}
	int kth_smallest(const int& k, const int& i = 1, const int& l = 0, int r = -1) {
		if (r == -1) r = N;
		if (V[i] < k) return N;
		if (l + 1 == r) return l;
		int mid = (l + r) / 2;
		if (V[i * 2] >= k) return kth_smallest(k, i * 2, l, mid);
		return kth_smallest(k - V[i * 2], i * 2 + 1, mid, r);
	}
};

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

	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<int> dp(300001, 0);
	auto f = [] (int a, int b) {return max(a, b);};
	segment_tree<int, decltype(f)> st(dp, f, 0);
	for (int i = 0; i < n; i++) {
		int m = st.range_fold(a[i] - k, a[i] + k + 1);
		st.point_update(a[i], m + 1);
	}
	cout << st.range_fold(0, 300001) << endl;
}

Measured memory_bytes: 9736
# https://atcoder.jp/contests/hitachi2020/tasks/hitachi2020_b
a, b, m = map(int, input().split())

A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

ans = float('inf')
for _ in range(m):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    t = A[x] + B[y] - c
    ans = min(ans, t)

MIN = min(A) + min(B)
ans = min(ans, MIN)
print(ans)

Measured memory_bytes: 66776
#include<bits/stdc++.h>
#include<numeric>
#include<cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod=1e9+7;
const int INF=1001001001;
//const int inf=100000;
//const ll ful=1e18;
using namespace std;
//namespace mp = boost::multiprecision;
int main() 
{
	string s;
	cin>>s;
	if(s[s.size()-1]=='s')
	{
		s+="es";
	}
	else
	{
		s+="s";
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<unordered_map>
#include<cmath>
#include<iterator>
using namespace std;

int main()
{
    long long int N, K, i, j, left, right;
    cin>>N>>K;
    vector<long long int> L(K);
    vector<long long int> R(K);
    for(i=0;i<K;i+=1)
    {
        cin>>L[i]>>R[i];
    }
    vector<long long int> ans(N+1, 0);
    vector<long long int> sum(N+1);
    sum[0] = 0;
    sum[1] = 1;
    ans[1] = 1;
    for(i=2;i<=N;i+=1)
    {
        for(j=0;j<K;j+=1)
        {
            left = max((long long int)1, i-R[j]);
            if(i-L[j]>=1)
            {
                right = i-L[j];
                ans[i]=((ans[i] + sum[right]-sum[left-1])%998244353 + 998244353)%998244353;
            }
        }
        sum[i] = (sum[i-1]+ans[i])%998244353;
    }
    cout<<ans[N]<<endl;
}


Measured memory_bytes: 6416
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main(){

    ll N, X;
    cin >> N >> X;
    vector<ll>A, B;
    A.push_back(X);
    B.push_back(X);
    for(ll i = 0; i < N; i++){
        ll x;
        cin >> x;
        if(X < x)B.push_back(x);
        else A.push_back(x);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    ll ans = 0;
    if(A.size() > 1)ans = A[1] - A[0];
    else ans = B[1] - B[0];
    for(ll i = 1; i < A.size(); i++){
        ans = gcd(ans, A[i] - A[i-1]);
    }
    for(ll i = 1; i < B.size(); i++){
        ans = gcd(ans, B[i] - B[i-1]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1528
N, M = map(int, input().split())
X = list(map(int, input().split()))

if M <= N:
  ans = 0
else:
  X.sort()
  li = []
  for i in range(M-1):
    li.append(X[i+1]-X[i])
  li.sort()
  li = li[:M-N]
  ans = sum(li)
  
print(ans)

Measured memory_bytes: 20556
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int prefix[500005];
int zerosum[500005]; // number of zeroes <= index
vector<int> found[1 << 20];
const int MOD = 1000000007;
int n;

ll solve(int xorAmt, bool wantZero) {
  assert(found[xorAmt].size());
  ll zeros = 1;
  ll other = 1;
  for(int i = 1; i < found[xorAmt].size(); i++) {
    int zeroInbetween = zerosum[found[xorAmt][i]] - zerosum[found[xorAmt][i-1]];
    zeros += other * zeroInbetween;
    zeros %= MOD;
    other += zeros;
    other %= MOD;
  }
  if(wantZero) return zeros;
  else return other;
}

void solve() {
  cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> prefix[i];
    prefix[i] ^= prefix[i-1];
    zerosum[i] = zerosum[i-1];
    if(prefix[i] == 0) zerosum[i]++;
    else found[prefix[i]].push_back(i);
  }
  ll ret = 0;
  if(prefix[n] != 0) {
    ret += solve(prefix[n], true);
    ret %= MOD;
  }
  else {
    int amt = zerosum[n]-1;
    {
      ll curr = 1;
      while(amt--) {
        curr *= 2;
        curr %= MOD;
      }
      ret += curr;
      ret %= MOD;
    }
    for(int i = 1; i < (1<<20); i++) {
      if(found[i].size()) {
        ret += solve(i, false);
        ret %= MOD;
      }
    }
  }
  cout << ret << "\n";
}

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


Measured memory_bytes: 37760
K,N = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for i in range(N)]
S = 0
B[0] = A[0] + K - A[N-1]
for i in range(1,N-1):
    B[i] = A[i+1] - A [i]
print(K - max(B))

Measured memory_bytes: 26444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, odd = 0;

	cin >> N;
	rep(i, N) {
		int A;
		cin >> A;
		if (A % 2 == 1) odd++;
	}

	if (odd % 2 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


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

using namespace std;

int main() {
    vector<int> vec(3);
    for(int i=0; i<3; i++) {
        cin >> vec[i];
    }
    
    sort(vec.begin(), vec.end());

    cout << vec[2]-vec[0] << endl;

}

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

const int maxn = 2e5+2;
int A[3];

int B[105];

void get(int x)
{
	A[1] = x%10;
	int i=0;
	while(x>=10)
	{
		x/=10;
		i++;
	}
	A[2] = x;
}

int dp[maxn];
int main()
{
	

	int n;
	//for(int i=1;i<=9;i++) dp[i] = i;
	while(cin>>n)
	{
		//if(n<=9) cout<<dp[i]<<"\n" , continue;
		memset(dp,0,sizeof(dp));
		memset(B,0,sizeof(B));
		int ans = 0;
		for(int i=1;i<=n;i++)
		{
			get(i);
			if(A[1] == 0) 
			{
				dp[i] = dp[i-1];continue;
			}
			int p = A[1]*10+A[2];
			int q = A[2]*10+A[1];
			//cout<<A[1]<<" "<<A[2]<<" ";
			
			dp[i] = dp[i-1] + 2*B[p] ; 
			B[q]++;
			if(A[1]==A[2]) dp[i]++;
			//cout<<dp[i]<<"\n";
			
		}
		cout<<dp[n]<<"\n";
	}
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {

  int a, b;
  scanf("%d %d", &a, &b);
  if(a < b){
    printf("a < b\n");
  } else if(a > b){
    printf("a > b\n");
  } else {
    printf("a == b\n");
  }

  return 0;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 100001
using namespace std;

int main() {
  int N,i;
  cin >> N;
  bool four=false;
  for(i=0;i<N;i++) {
    char s;
    cin >> s;
    if(s=='Y') {
      four=true;
      break;
    }
  }
  if(four) cout("Four");
  else cout("Three");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>
#include <time.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) {
  while (a && b) {
    if (a >= b) a %= b;
    else b %= a;
  }
  return a + b;
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
	ll s;
	if(k > 1){
		s = k*facctorialMethod(k-1);
	} else {
		s = 1;
	}
	return s;
}

map< int64_t, ll > prime_factor(int64_t n) {
  map< int64_t, ll > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
// dp[i] := 長さが i の増加部分列として最後尾の要素のとりうる最小値
template<class T> int LIS(vector<T> a,  bool is_strong = true) {
    const T INF = 1<<30; // to be set appropriately
    int n = (int)a.size();
    vector<T> dp(n, INF);
    for (int i = 0; i < n; ++i) {
        if (is_strong) *lower_bound(dp.begin(), dp.end(), a[i]) = a[i];
        else *upper_bound(dp.begin(), dp.end(), a[i]) = a[i];
    }
    return lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
const ll mod = 1000000007;
const ll INF = 1e9;

// 変数定義start(vectorはresizeしようね)
ll r;
// 変数定義end

void solve(){
	cin >> r;
	cout << r * r << endl;
}

int main(){

    //clock_t start = clock();

    cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	//clock_t end = clock();

    //const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    //printf("time %lf[ms]\n", time);
}


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

using namespace std;

typedef long long  ll;

#define SIZ 1000000000

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
		
	ll n,m,k;
	cin >> n >> m >> k;
	
	ll cnt = 0;
	
	for(ll i = n; i <= m; i++){
		if(i%k == 0)
			cnt++;
	}
	
	cout << cnt << "\n";
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int k;
bool y[123456];
vector<pair<int,int> >a;
void ta(int aa,int b){
  b++;
  if(b>k)return;
  if(a[aa].second>b){
    a[aa].second=b;
    y[aa]=1;
    ta(a[aa].first,b);
  }
  else return;
}
  
int main(){
  int n;
  int co=0;
  cin >> n >> k;
  bool x[123456]={};
  a=vector<pair<int,int> >(n,pair<int,int>(0,1234567));
  for(int i=0;i<n;i++){
    cin >> a[i].first;
    if(a[i].first!=0){
      a[i].first--;
      x[a[i].first]=1;
    }
    else{
      y[i]=1;
    }
  }
  
  //
  for(int i=0;i<n;i++){
    //cout << x[i] << endl;
    if(!x[i]){
      y[i]=1;
      ta(i,0);
    }
  }
  for(int i=0;i<n;i++){
    //cout << y[i] << endl;
    if(y[i]==1){
      co++;
    }
  }
  cout << co << endl;
  return 0;
  
}

Measured memory_bytes: 4412
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int w, h; char c;
    cin >> w >> h >> c;
    vector<string> ans(h, string(w, '.'));
    for (int i = 1; i < w-1; ++i) {
        ans[0][i] = ans[h-1][i] = '-';
    }
    for (int i = 1; i < h-1; ++i) {
        ans[i][0] = ans[i][w-1] = '|';
    }
    ans[0][0] = ans[0][w-1] = ans[h-1][0] = ans[h-1][w-1] = '+';
    ans[h/2][w/2] = c;
    for (auto &&j : ans) {
        cout << j << "\n";
    }
    return 0;
}


Measured memory_bytes: 3184
N,M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
    l,r,d = map(int, input().split())
    E[l-1].append((r-1, d))
    E[r-1].append((l-1, -d))

from collections import deque
human = ["0"]*N
ans = "Yes"
for i in range(N):
    if ans == "No":
        break
    if len(E[i]) == 0:
        continue
    if human[i] == "0":
        human[i] = 0
        q = deque([i])
        while q:
            temp = q.popleft()
            for e in E[temp]:
                if human[e[0]] == "0":
                    human[e[0]] = human[temp]+e[1]
                    q.append(e[0])
                elif human[e[0]] != human[temp]+e[1]:
                    ans = "No"
                    break
    else:
        for e in E[i]:
            if human[e[0]] != human[i]+e[1]:
                ans = "No"
                break

print(ans)

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

typedef long long int ll;

int main() {
    string s;
    cin>>s;
    for(int i=1;i<s.length();i++){
        if(s[i]==s[i-1]){
            cout<<"Bad";
            return 0;
        }
    }
    cout<<"Good";

}

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

int main(){
  ll x,k,d,ans=0;cin>>x>>k>>d;
  if(x<0) x*=-1;
  if(x/d<=k){
    ans=x%d;
    k-=x/d;
    if(k%2)ans=abs(ans-d);
  }else{
    ans=x-d*k;
  }

  cout<<ans;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        string a, b, c;
        in >> a;
        in >> b;
        in >> c;
        char cmd = a.front();
        a.erase(0, 1);
        char ans = '\0';
        while (ans == '\0') {
            switch (cmd) {
            case 'a':
                if (a == "") {
                    ans = 'A';
                    break;
                }
                cmd = a.front();
                a.erase(0, 1);
                break;
            case 'b':
                if (b == "") {
                    ans = 'B';
                    break;
                }
                cmd = b.front();
                b.erase(0, 1);
                break;
            case 'c':
                if (c == "") {
                    ans = 'C';
                    break;
                }
                cmd = c.front();
                c.erase(0, 1);
                break;
            default:
                break;
            }
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
N, K =map(int,input().split())
K = [tuple(map(int,input().split())) for i in range(K)]
M = 998244353

dp = [0] * N
dp[1] = 1
prefix = [1] * N

for i in range(1, N):
    cur = 0
    for L, R in K:
        a = i - R
        b = i - L
        if b < 0:
            continue
        cur += prefix[b] - (prefix[a - 1] if a - 1 >= 0 else 0)
    dp[i] = cur % M
    prefix[i] = prefix[i - 1] + dp[i]
    prefix[i] %= M
print(dp[N - 1])

Measured memory_bytes: 24504
import sys
from itertools import permutations
readline = sys.stdin.readline

N = int(readline())

P = tuple(map(int, readline().split()))
Q = tuple(map(int, readline().split()))

cnt = 0
for k in permutations(list(range(1, N+1))):
    cnt += 1
    if P == k:
        p = cnt
    if Q == k:
        q = cnt
print(abs(p-q))        


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

int main(){
  int n;
  cin >> n;
  map<string,int> s;
  for(int i = 0; i < n; i++){
    string a;
    cin >> a;
    s[a]++;
  }
  int ma = 0;
  for(auto t: s) ma = max(ma, t.second);
  for(auto t: s){
    if(t.second == ma){
      cout << t.first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 25216
num = list(map(int, input().split()))
n = num[0]
m = num[1]
students = [list(map(int, input().split())) for i in range(n)]
points = [list(map(int, input().split())) for i in range(m)]

ans = [0] * n
for i, student in enumerate(students):
    for j, point in enumerate(points):
        distance = abs(student[0] - point[0]) + abs(student[1] - point[1])
        if j == 0:
            mini = distance
        elif distance < mini:
            mini = distance
            ans[i] = j

for num in ans:
    print(num + 1)


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

int N;

void solve() {
    cin >> N;
    vector<ll> a(N);
    ll ans = 0;
    for (auto& i : a) cin >> i;
    for (int i = N - 1; i >= 0; --i) {
		if (a[i] > i) {
			cout << -1;
			return;
		}
		
		ans += a[i];
		// cout << "Adding " << a[i] << " " << i << "\n";
		ll dist = a[i];
		int o = i;
		for (int j = 1; j < dist && o - j >= 0; j++) {
			if (a[o - j] + 1 == a[o - j + 1]) {
				// cout << "hi";
				--i;
			} else if (a[o - j] >= a[o - j + 1]) {
				break;
			} else {
				cout << -1;
				return;
			}
		}
	}
	cout << ans;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 1792
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cmath>
#include <vector>
#include <stack>
using namespace std;


int main() {
  int N, M, K;
  cin >> N >> M >> K;

  vector<long long> A(N+1, 0), B(M+1, 0);
  for (int i = 1; i <= N; i++) {cin >> A[i];A[i] += A[i-1];}
  for (int i = 1; i <= M; i++) {cin >> B[i];B[i] += B[i-1];}

  int ans = 0;
  long long life;
  int l, r, m;
  for (int i = 0; i <= N; i++) {
    life = K;
    life -= A[i];
    if (life < 0) break;
    l = 0; r = M;
    if (life - B[M] >= 0) { l = M; r = M + 1; }
    // l is ok, r is ng
    while (r > l+1) {
      m = l + (r-l)/2;
      if (life - B[m] >= 0) l = m;
      else r = m;
    }
    assert(life - B[l] >= 0);
    ans = max(ans, i + l);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6440
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)


double calc(int a){
    double tmp = (double)(a*(a+1)/2);
    tmp /= (double)a;
    return tmp;
}

int main(){
    int N,K;cin >> N >> K;
    vector<int> p(N);
    rep(i,N)cin >> p[i];
    double ans = 0;
    vector<double> E(N);
    vector<double> rui(N+1);
    rui[0] = 0;

    rep(i,N){
        double tmp = calc(p[i]);
        E[i] = tmp;
    }
    rep(i,N){
        rui[i+1] = rui[i] + E[i];
    }

    rep(i,N-K+1){
        double tmp2 = 0;
        tmp2 = rui[i+K] - rui[i];

        ans = max(ans,tmp2);
    }

    cout << std::fixed << std::setprecision(15) << ans << endl;
}


Measured memory_bytes: 4096