akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

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

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;}

/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q,l,r;
ll x[500005],y[500005],z[1200005];
char s[500005],t[500005];
bool flag,dame;

int main(){
	cin >> s;
	a = (s[0] - '0') * 10 + (s[1] - '0');
	b = (s[2] - '0') * 10 + (s[3] - '0');
	if(1 <= a && a <= 12 && 1 <= b && b <= 12){
		p("AMBIGUOUS");
	}else if(1 <= a && a <= 12){
		p("MMYY");
	}else if(1 <= b && b <= 12){
		p("YYMM");
	}else{
		p("NA");
	}
	
	
		return 0;
	}

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


int main(){
    int a, b;
     char op;
    
    while(1){
   
    cin >> a >> op >> b ;
    if ( op  == '?' ) break;
        
    if ( op == '+') cout << a + b << endl;
    else if ( op == '-') cout << a - b << endl;
    else if (op == '*') cout << a*b << endl;
    else if ( op  == '/' ) cout << a/b << endl;

        }
    
    return 0;
    
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int n,a[101010];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n;
	fo(i,0,n)cin>>a[i];
	sort(a,a+n);
	cout<<a[n/2]-a[n/2-1]<<endl;
	return 0;
}


Measured memory_bytes: 640
require 'pp'

n = gets.chomp!.to_i
a_n = gets.chomp!.split(" ").map(&:to_i)

memo = {}
a_n.each do |a|
    memo[a] ||= 0
    memo[a] += 1
end

sticks = []
memo.each do |k, v|
    next if v < 2

    if v >= 4
        sticks << k
        sticks << k
    else
        sticks << k
    end
end

sticks.sort!
if sticks.length < 2
    puts 0
else
    puts sticks[-1] * sticks[-2]
end


Measured memory_bytes: 15224
import Control.Monad
import Data.Array
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine
getIntListN n = map readInt <$> replicateM (fromIntegral n) BS.getLine

calc :: Array Int Int -> Int -> Int -> Int -> Int
calc hs i k m
  | i < k = m
  | m == 0 = 0
  | otherwise = calc hs (i -1) k m'
  where
    x = hs ! i - hs ! (i - (k -1))
    m'
      | m > x = x
      | otherwise = m

main = do
  [n, k] <- getIntList
  hs <- getIntListN n
  let hs' = sort hs
  let hs'' = listArray (1, length hs') hs'
  print $ calc hs'' (length hs'') k (10 ^ 9 + 1)


Measured memory_bytes: 30252
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=998244353;
const int MAX = 510000;
const int INF = 1e9;
const double pi=acos(-1);
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  COMinit();
  int k,s;
  cin >> k >> s;
  ll sum=0;
  rep(x,k+1){
    rep(y,k+1){
      if(0<=(s-x-y) && (s-x-y)<=k)sum++;
    }
  }
  cout << sum << endl;
  return 0;
  
}

Measured memory_bytes: 12160
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var a = Enumerable.Repeat(0, 5).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        var k = int.Parse(Console.ReadLine());
        Console.WriteLine(a[4] - a[0] <= k ? "Yay!" : ":(");
    }
}


Measured memory_bytes: 11348
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

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

 double deg = C;
 double pi = 2.0*asin(1.0);
 double unit = pi/180.0;
 double deg_r = deg*unit;

 double s=0;
 s = 0.5*a*b*sin(deg_r);
 cout << fixed << setprecision(8) << s << endl;

 double l=0;
 double c=pow(a,2.0)+pow(b,2.0)-2*a*b*cos(deg_r);
 l = a+b+sqrt(c);
 cout << fixed << setprecision(8) << l << endl;

 double h=0;
 h = (2*s)/a;
 cout << fixed << setprecision(8) << h << endl;

 return 0;
}


Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
map<LL,LL>mp;
int main()
{

    LL N;
    std::ios::sync_with_stdio(false);
    cin>>N;
    LL num = N;
    LL n_sqrt = sqrt(N);
    for(LL i=2;i<=n_sqrt;i++)
    {

        if(N%i==0)
        {
            //cout<<i<<endl;
             while(N%i==0)
             {
                 mp[i]++;
                 N/=i;
             }
        }
    }
   // cout<<"a"<<endl;
    if(N!=1)
    {
        mp[num]++;
    }
    map<LL,LL>::iterator i;
    LL ans = 0;
    for(i = mp.begin();i!=mp.end();i++)
    {
        LL e = i->second;
        LL  j = 1;
        while(e>=0)
        {
            e-=j;
            if(e>=0) ans++;
            j++;
        }

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


Measured memory_bytes: 3624
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n = int(readline())
  info = []
  for i in range(n):
    a = int(readline())
    for _ in range(a):
      x, y = map(int, readline().split())
      info.append((i, x-1, y))
  A = np.array(list(product([0,1], repeat=n)),np.bool)
  for i, x, y in info:
    bl = (~A[:,i]) | (A[:,x]==bool(y))
    A = A[bl]
  print(A.sum(axis=1).max())
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 28588
program aaa
implicit none
integer :: i,j,k,n,a,b,len,w

character(len=1000) :: s
character(len=1000) :: s2

read(*,*) s
read(*,*) w

s2=""
a=1

do while(a <= len_trim(s))
s2 = s2(1:len_trim(s2))//s(a:a)

a = a + w
enddo

write(*,*) s2(1:len_trim(s2))

end program

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

using namespace std;

int main() {

	int a, b, c; 
	cin >> a >> b >> c;

	if (a == b and b != c) {
		cout << "Yes\n";
	} else if (a == c and a != b) {
		cout << "Yes\n";
	} else if (c == b and a != c) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
using namespace std;
typedef long long ll;
ll ans1=0,ans2=0;
int n;
vector <pair<ll,pair<ll,ll> > > v;
int main(){
	cin>>n;
	for (int i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		v.push_back(make_pair(a+b,make_pair(a,b)));
	}
	sort (v.begin(),v.end());
	reverse (v.begin(),v.end());
	for (int i=0;i<v.size();i++){
		if (i%2==0) ans1+=v[i].second.first;
		else ans2+=v[i].second.second;
	}
	cout<<ans1-ans2;
}

Measured memory_bytes: 4724
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main(){
double x;

cin >> x;

cout << fixed << setprecision(5) << M_PI*x*x << " " <<  fixed << setprecision(5) << M_PI*2*x << endl;

return 0;


}

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vector<ll> a(n); cin >> a;
    map<ll, ll> m;
    rep(i, n) {
        m[a[i]+1]++;
        m[a[i]]++;
        m[a[i]-1]++;
    }
    ll ans = 0;
    each(p, m) chmax(ans, p.second);
    cout << ans << endl;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
#include <vector>
 
typedef long long ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
const double PI=3.14159265358979323846;
 
using namespace std;
 
int main() {

	int n = 3;

	int a[n];

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

	sort(a, a+n);

	cout << a[0] << ' ' << a[2] << endl; 
}


Measured memory_bytes: 3160
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll M =1e9+7;
const int N = 2e5+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)


int main()
{
   
   int n;
   scf(n);
   
   ll a[n],b[n];
   
   rep(i,0,n)
   {lscf(a[i]);
  
    b[i]=a[i];}   
   
    rep(i,1,n)
    {
        b[i]+=b[i-1];
    
        b[i]%=M;
    }
    
    
    ll sum=0;
    
    rep(i,0,n)
    {
        ll v=(a[i]*(b[n-1]-b[i]+M))%M;
        
        sum+=v;
        
        sum%=M;
        
    }
    
    lprin(sum%M);
    

    
}

Measured memory_bytes: 6908
n,K = map(int,input().split())
p = min(n,K-1)
ans = 0
chk = [1]*(K-1)
k = K
for i in range(16):
  k /= 2
  if k == int(k):
    q = int(k*2-k-1)
  else:
    q = int(k*2-k)
  for i in range(q):
    chk[i] += 1
  if k <= 1:
    break
    
#print(chk)
for i in range(p):
  ans += float(1/(2**chk[i]*n))
  #print(ans)
ans += max(0,(n-K+1)/n)
print(ans)

Measured memory_bytes: 3828
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


orders = [a,b,c,d,e]

def nokori(az, sitei):
	tmp = []
	flag = 0
	for a in az:
		if a == sitei and flag == 0 :
			flag = 1
		else:
			tmp.append(a)
	return tmp

def calcOrder(order):
	time = 0
	for o in order:
		if time % 10 != 0:
			time += 10 - time % 10
		time += o
	return time

time = 0
mintime = 1000
res = ''

for fst in orders:
	
	az = nokori(orders, fst)
	for sec in az:
		ax = nokori(az, sec)
		for thd in ax:
			aw = nokori(ax, thd)
			for fth in aw:
				af = nokori(aw, fth)
				for fif in af:
					time = calcOrder([fst,sec,thd,fth,fif])
					if time < mintime:
						mintime = time
						res = str([fst,sec,thd,fth,fif])

print(mintime)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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 (b < a) { a = b; return true; } return false; }

int dp[10010] = {};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, W; cin >> N >> W;
	vector<int> v(N), w(N); rep(i, 0, N) { cin >> v[i] >> w[i]; }
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	rep(i, 0, N) {
		rrep(j, 0, 10001) {
			if (dp[j] == INF)continue;
			chmin(dp[j + v[i]], dp[j] + w[i]);
		}
	}
	rrep(i, 0, 10001) {
		if (dp[i] != INF&&dp[i] <= W) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3252
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> bingo(3, vector<int>(3));
vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;

	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

ll getGcd(ll a, ll b) {
	if (a < b) {
		ll temp = b;
		b = a;
		a = temp;
	}

	ll r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}

int main() {

	int K;
	cin >> K;

	ll ans = 0;
	for (int i = 1; i <= K;++i) {
		for (int j = 1; j <= K;++j) {
			ll first = getGcd(i, j);
			for (int k = 1; k <= K;++k) {
				ans += getGcd(first, k);
			}
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 5444
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,k;
  cin>>n>>k;
  int p[n];
  rep(i,n) cin>>p[i];
  sort(p,p+n);
  int ans=0;
  rep(i,k){
    ans+=p[i];
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
#define CLR(a)     memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)    cerr << #x << " = " << (x) << endl;//debug
#define debug(x)   cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define EPS        1e-10//sample:if((double)>=(double)+EPS)
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;

vector<int> G[200001];
int color[200001];
int s[1000000],head,tail;
void dfs(int r,int c){
  head=tail=0;
  s[tail++]=r;
  color[r]=c;
  while(head!=tail){
    int u=s[head++];
    for(int i=0;i<(int)G[u].size();i++){
      int v=G[u][i];
      if(color[v]==-1){
	s[tail++]=v;
	color[v]=c;
      }
    }
  }
}
int main(){
  int n,m,ia,ib,p,id=1;
  rep(i,200000)color[i]=-1;
  cin>>n>>p;
  rep(i,p){
    cin>>ia>>ib;
    G[ia].push_back(ib);
    G[ib].push_back(ia);
  }
  rep(i,n)if(color[i]==-1)dfs(i,id++);
  cin>>m;
  rep(i,m){
    cin>>ia>>ib;
    if(color[ia]==color[ib])cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }

  return 0;
}



Measured memory_bytes: 12128
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const int MAX= 1e6+10;
const ll inf =9;
 

int main(){
	fastio;
	ll tc,n,a,b,h,m;
	string s;
	cin>>a>>b>>h>>m;
	ld ang = 0.5*11*((60*h+m));
	if(ang>180.0) ang=ang;
	cout<<fixed<<setprecision(15);
	cout<<sqrt(1.0*a*a+1.0*b*b - 2*(1.0*a)*(1.0*b)*cos(ang*acos(-1)/180.0))<<endl; 
}

Measured memory_bytes: 4152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int n,k,cnt=0;
string s;
int main(int argc, char const *argv[]) {

  cin >> n >> k >> s ;
  vector<int> nums ;
  if(s[0]=='0') nums.pb(0);
  for(int i=0; i<sz(s); ){
    int j=i;
    while(j<sz(s) && s[j]==s[i]) j++;
    nums.pb(j-i);
    i=j;
  }
  if(s.back()=='0') nums.pb(0);

  vector<int> sums((int)(sz(nums)+1),0);
  rep(i,sz(nums)) sums[i+1] = sums[i] + nums[i];

  int res = 0;
    for (int left = 0; left < sums.size(); left += 2) {
        int right = left + k*2+1;
        if (right >= sums.size()) right = (int)sums.size() - 1;
        res = max(res, sums[right] - sums[left]);
    }
    cout << res << endl;
  return 0;
}


Measured memory_bytes: 1272
#include<cstdio>
int a[200005]={0},n,t;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		scanf("%d",&t);
		a[t]++;
	}
	for(int i=1;i<=n;i++)
	printf("%d\n",a[i]);
}

Measured memory_bytes: 2492
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int a, b, c;

int main()
{
	cin >> a >> b >> c;
	set<int> st;
	st.insert(a);
	st.insert(b);
	st.insert(c);

	cout << st.size() << endl;

	return 0;
}


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

const int MAX = 1000;
char mp[MAX][MAX+1];
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};

int H, W;

void dfs(int x, int y) {
    char pos = mp[x][y];
    mp[x][y] = '.';
    for (int i = 0; i < 4; i++)
    {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (0 <= nx && nx < W && 0 <= ny && ny < H && mp[nx][ny] == pos)
        {
            dfs(nx, ny);
        }
    }
}

int main(void) {
    while (cin >> H >> W) {
        if (H == 0 && W == 0)
            break;
        for (int y = 0; y < H; y++)
        {
            for (int x = 0; x < W; x++)
            {
                cin >> mp[x][y];
            }
        }

        int ans = 0;
        for (int y = 0; y < H; y++)
        {
            for (int x = 0; x < W; x++)
            {
                if (mp[x][y] == '.')
                    continue;
                dfs(x, y);
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll L;
	cin >> L;
	vector<ll> A(L);
	REP(i, L) cin >> A[i];

	ll dp[201010][5];
	ll INF = LLONG_MAX/3;
	REP(i, 201010)REP(j, 5) dp[i][j] = INF;
	REP(j, 5) dp[0][j] = 0;

	REP(i, L){
		ll add[5];
		add[0] = A[i];
		add[1] = (A[i]==0?2:(A[i]%2));
		add[2] = ((A[i]+1)%2);
		add[3] = (A[i]==0?2:(A[i]%2));
		add[4] = A[i];
		REP(j, 5){
			REP(k, j+1){
				dp[i+1][j] = min(dp[i+1][j], dp[i][k] + add[j]);
			}
		}
	}
	ll res = INF;
	REP(i, 5) res = min(res, dp[L][i]);
	cout << res << endl;

	/*
	REP(i, 5){
		REP(j, L+1){
			cout << dp[j][i] << " ";
		}
		cout << endl;
	}
	*/
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <string>
using namespace std;
int main(){
int a;
string s;
cin >>a>>s;
int ma = 0, now = 0;
for(char c : s){
if(c == 'I'){
now++;
}else{
now--;
}
ma = max(ma, now);
}
cout << ma << endl;
return 0;
}

Measured memory_bytes: 256
def yumiri(L, n):
  for i in range(len(L)):
    if L[i] > n:
      return i - 1

def naobou(d, q):
  rd = t[d - 1] - 1
  rq = yumiri(ZL[rd], d)
  ans += SUMD[ZL[rd][rq] - ZL[rd][rq - 1] - 1] * c[rd]
  ans += SUMD[ZL[rd][rq + 1] - ZL[rd][rq] - 1] * c[rd]
  ans -= SUMD[ZL[rd][rq + 1] - ZL[rd][rq - 1] - 1] * c[rd] 
  ZL[rd].remove(d)
  
  nd = q - 1
  nq = yumiri(ZL[nd], d)
  ans += SUMD[ZL[nd][nq + 1] - ZL[nd][nq] - 1] * c[nd]
  ans -= SUMD[d - ZL[nd][nq] - 1] * c[nd]
  ans -= SUMD[ZL[nd][nq + 1] - d - 1] * c[nd]
  ZL[nd].insert(nq + 1, d)

  ans -= s[d - 1][rd]
  ans += s[d - 1][nd]

  t[d - 1] = q

  return ans

def rieshon(t):
  ans = 0
  for i in range(D):
    ans += s[i][t[i] - 1]
    for j in range(26):
      if t[i] - 1 == j:
        L[j] = 0
        ZL[j].append(i + 1)
      else:
        L[j] += 1
        ans -= L[j] * c[j]
  for i in range(26):
    ZL[i].append(D + 1)
  return ans

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

L = [0] * 26
ZL = [[0] for _ in range(26)]
SUMD = [0] * (D + 1)
for i in range(1, D + 1):
  SUMD[i] = SUMD[i - 1] + i

t = [0] * D
for i in range(D):
  ma = s[i][0]
  man = 0
  for j in range(1, 26):
    if s[i][j] == ma:
      if c[j] < c[man]:
        ma = s[i][j]
        man = j
    elif s[i][j] > ma:
      ma = s[i][j]
      man = j
  t[i] = man + 1

for i in range(D):
  print(t[i])


Measured memory_bytes: 68364
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, h = IR(3)
    print((a+b)*h//2)
    return

#B
def B():
    d = defaultdict(int)
    d["a"] = deque(S())
    d["b"] = deque(S())
    d["c"] = deque(S())
    tern = "a"
    while d[tern]:
        tern =  d[tern].popleft()
    print(str.capitalize(tern))
    return

#C
def C():
    n, x = LI()
    a = LI()
    ans = 0
    for i in range(n-1):
        if a[i] + a[i + 1] > x:
            if x > a[i]:
                ans += a[i] + a[i + 1] - x
                a[i + 1] = x - a[i]
            else:
                ans += a[i] + a[i + 1] - x
                a[i + 1] = 0
    print(ans)
    return

#D
def D():
    h, w, n = LI()
    ans = [(h - 2) * (w - 2)] + [0] * 9
    d = defaultdict(int)
    for _ in range(n):
        a, b = LI()
        for mb in range(-1, 2):
            mb += b
            for ma in range(-1, 2):
                if mb == ma == 0:
                    continue
                ma += a
                if 2 <= ma < h and 2 <= mb < w:
                    d[(ma, mb)] += 1
    for _, value in d.items():
        ans[value] += 1
        ans[0] -= 1
    print("\n".join(map(str, ans)))
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 152956
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;


int main()
{
    ll x, k;
    cin >> x >> k;
    x %= k;
    cout << min(x, min(abs(k - x), abs(abs(k - x) - k)));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  ll index,maax,miin=1000;
  for (ll i=0;i<26;i++) {
    index=-1;
    maax=0;
    for (ll j=0;j<s.size();j++) {
      if (s[j]-'a'==i) {
        if (maax<j-index-1) maax=j-index-1;
        index=j;
      }
      if (j==s.size()-1 && maax<j-index) maax=j-index;
    }
    if (miin>maax) miin=maax;
  }
  cout<<miin<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (n == 1) {
			System.out.println("Hello World");
		} else {
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(a + b);
		}
	}
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void debug_out() {cerr << endl;}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {cerr << " " << to_string(H), debug_out(T...);}

int main() {
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
#define debug(...) 3
    fastIO;
#endif
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=-2e18;
    ans=max(ans,a*c);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MaxN = 200003;
const LL INF = 0x7fffffffffffffffLL;
LL ans;
int n,a[MaxN];

int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",a+i);
	ans=INF;
	LL x=0,y=0;
	for (int i=1;i<=n;++i) y+=a[i];
	for (int i=1;i<n;++i) {
		x+=a[i],y-=a[i];
		ans=min(ans,abs(x-y));
	}
	cout << ans << endl;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e3 + 10;
const int MOD = 1e9 + 7;


int32_t main(){
    boost;
    
    //code
    int a[3];

    for(int i = 0  ; i < 3 ;++i){
    	cin >> a[i];
    }
    sort(a,a+3);


    cout << ((a[0] + a[1] != a[2]) ? "No" : "Yes");
    return 0;
}

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            long n = Input();
            long[] h = Input3();
            var ans = "Yes";

            for (long i = n-1; i >0; i--)
            {
                if (h[i - 1] - h[i] > 1) ans = "No";
                if (h[i - 1] - h[i] == 1) h[i - 1]--;

                /*if (h[i] - h[i + 1] >= 2) ans = "No";
                else
                {
                    if (h[i] - h[i + 1] == 1)
                    {
                        if (i != 0)
                        {
                            if (h[i - 1] >= h[i]) ans = "No";
                            else h[i]--;
                        }
                        else
                        {
                            h[i]--;
                        }
                    }
                    else
                    {
                        h[i]--;
                    }

                    }*/
               // Console.WriteLine(ans);
            }
            
            Console.WriteLine(ans);
                
                





        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }

        
       
    }
}


Measured memory_bytes: 27484
#include<bits/stdc++.h>
using namespace std;int main(){int n,i;bool s=true;string a[100];set<string> b;cin>>n;for(i=0;i<n;i++){cin>>a[i];b.insert(a[i]);}for(i=0;i<n-1;i++){if(a[i].at(a[i].size()-1)!=a[i+1].at(0)){s=false;}}cout<<(b.size()/n&&s?"Yes":"No");}

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

const int MAX_N = 100;
const int MAX_W = 1000000000;
const int MAX_VALUE_SUM = 100000;

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

	long long dp[MAX_VALUE_SUM+1];
	for(int i = 0; i <= MAX_VALUE_SUM; i++)
		dp[i] = -1;
	dp[0] = 0;

	for(int i = 0; i < N; i++){
		int w,v;
		cin >> w >> v;
		for(int j = MAX_VALUE_SUM - v; j >= 0; j--){
			if(dp[j] != -1){
				if(dp[j+v] != -1){
					dp[j+v] = min(dp[j+v], dp[j] + w);
				}else{
					dp[j+v] = dp[j] + w;
				}
			}
		}
	}

	for(int i = MAX_VALUE_SUM; i >= 0; i--){
		if(dp[i] != -1 && dp[i] <= W){
			cout << i << "\n";
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 1152
import numpy as N;n,_=map(int,input().split());a=0;M=[N.array(list(map(int,input().split()))) for i in range(n)]
for i in range(n):
	for j in range(i+1,n):
		if N.linalg.norm(M[i]-M[j]).is_integer():a+=1
print(a)

Measured memory_bytes: 12496
#include <iostream>
#include <cstdlib> //for atoi function
using namespace std;

int top, S[1000];

void push(int x){       //push?????????????¨????????????°????????\????????¨?????????
        top++;
        S[top] = x;
}

int pop(){
        top--;
        return S[top+1];
}

int main() {
        top = 0; //initialize
        int cal,cal2;
        char str[1000];

        while (cin >> str) {

        if (str[0] == '+') {
        cal = pop();
        cal += pop();
        push(cal);
        }
        else if (str[0] == '-') {
        cal = pop();
        cal2 = pop();
        push(cal2 - cal);
        }
        else if (str[0] == '*') {
        cal = pop();
        cal *= pop();
        push(cal);
        }
        else push(atoi(str));

        } //3??????????????¨?????????????????????

        int ans = pop();
        cout << ans << endl;    //cout << pop()?????????????????????
        return 0;
}

Measured memory_bytes: 3064
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
X = LI()
sort_X = sorted(X)
ans1,ans2 = sort_X[(N-1)//2],sort_X[N//2]
for x in X:
    if x>=ans2:
        print(ans1)
    else:
        print(ans2)


Measured memory_bytes: 25868
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#include<cstdio>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<string>
#include<iostream>
#include<map>
#include<set>
#include<queue>
#include<set>
#define READ                freopen("in.txt", "r", stdin)
#define WRITE               freopen("out.txt", "w", stdout)
#define INF9                1000000010
#define INF18               1000000000000000010
#define dist(ax,ay,bx,by)   sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by))
#define gcd(a,b)            __gcd(a,b)
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define m_p(a,b)            make_pair(a,b)
#define sqr(a)              ((a)*(a))
#define pb                  push_back
#define bpll(a)             __builtin_popcountll(a)
#define MX                  1000000
#define PI                  acos(-1)
#define mod                  1000000007
#define cnt_bin(n)          __builtin_clzll(0ll) - __builtin_clzll(n)

typedef long long lli;
using namespace std;

vector<lli>per;
vector<lli>cost;
vector<lli>series;
bool ara[5005];
void rset()
{
    for(lli i=0; i<5005; i++) ara[i]=false;
}

int main()
{
    lli n, k;
    scanf("%lld %lld", &n, &k);

    for(lli i=0; i<n; i++)
    {
        lli a;
        scanf("%lld", &a);
        a--;
        per.push_back(a);
    }

    for(lli i=0; i<n; i++)
    {
        lli a;
        scanf("%lld", &a);
        cost.push_back(a);
    }

    lli ans=-INF18;

    for(lli x=0; x<n; x++)
    {
        rset();
        series.clear();
        lli cur=x;

        lli sum=0;

        while(true)
        {
            ara[cur]=true;
            cur= per[cur];
            series.push_back(cost[cur]);
            sum+= cost[cur];

            if(ara[cur]==true) break;
        }


        if(sum<0)
        {
            lli maxi=series[0];
            lli ss=series[0];
            for(lli i=1; i<series.size() && i<k; i++)
            {
                ss+=series[i];

                maxi= max(maxi, ss);
            }

            ans= max(ans, maxi);
        }
        else
        {
            lli len= series.size();
            lli div= k/len;
            lli rem= k%len;

            lli ans1=div*sum;

            lli maxi=series[0];
            lli ss=series[0];

            for(lli i=1; i<series.size() && i<rem; i++)
            {
                ss+=series[i];

                maxi= max(maxi, ss);
            }

            if(div==0 || (div && rem)) ans1+=maxi;

            lli ans2=0;

            if(div)
            {
                ans2= (div-1)*sum;

                maxi=series[0];
                ss=series[0];
                for(lli i=1; i<series.size(); i++)
                {
                    ss+=series[i];

                    maxi= max(maxi, ss);
                }

                ans2+=maxi;
            }


            ans= max(ans, max(ans1, ans2));
        }

    }

    cout<<ans<<endl;

    return 0;
}


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

int main(int argc, char* argv[]) {
    int n, cnt = 0;
    cin >> n;
    int array[n];
    for (int i = 0; i < n; i++) cin >> array[i];

    for (int i = 1; i < n; i++){
        for (int j = 1; j < n; j++){
            if (array[j-1] > array[j]){
                int tmp = array[j-1];
                array[j-1] = array[j];
                array[j] = tmp;
                cnt++;
            }
        }
    }
    for (int i = 0; i < n-1; i++) cout << array[i] << " ";
    cout << array[n-1] << "\n";
    cout << cnt << "\n";
    return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define ll long long int
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define rep(i,a,n)   for(int i=a;i<n;i++)
#define pb           push_back
#define ff           first
#define ss           second
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define all(v)       v.begin(),v.end()
#define rall(v)      v.rbegin(),v.rend()
#define Pi           2*acos(0.0)
#define pii          pair<int,int>
#define pll          pair<ll,ll>
#define mem(a,b)     memset(a, b, sizeof(a))
#define fill_(a,b)   fill(a,a+n,b);
using namespace std;

ll expo(ll a,ll b,ll m = mod){
	a%=mod;
	ll res = 1;
	while(b){
		if(b&1)
			res = (res*a)%m;
		a = (a*a)%m;
		b>>=1;
	}
	return res;
}
ll gcd(ll a,ll b){
	while(b>0){
		ll r = a%b;
		a = b; b = r;
	}
	return a;
}
int main()
{
	 
   boost
   #ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t=1;
// 	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int A[n+1];
	    int dp[n+1];
	    rep(i,1,n+1){
	        cin>>A[i];
	    }
	    dp[1] = 0;
	    if(n==1)
	    {
	        cout<<"0\n";
	        continue;
	    }
	    dp[2] = abs(A[1]-A[2]);
	    for(int i=3;i<=n;i++){
	        dp[i] = min(abs(A[i]-A[i-1])+dp[i-1],abs(A[i]-A[i-2])+dp[i-2]);
	    }
	    cout<<dp[n]<<"\n";
	}
    return 0;
}


Measured memory_bytes: 4444
from collections import deque
n, m = map(int, input().split())
l = [list() for _ in range(n)]

for _ in range(m):
  a, b = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

dist = [float('inf')]*n
dist[0] = 0
pre = [0]*n
pre[0] = 1

queue = deque([0])
while queue:
  x = queue.popleft()
  for y in l[x]:
    if dist[y] == float('inf') and pre[y] == 0:
      dist[y] = dist[x] + 1
      pre[y] = x
      queue.append(y)

print('Yes')
for i in pre[1:]:
  print(i+1)

Measured memory_bytes: 35616
N = int(input())
Ai = list(map(int,input().split()))
Bi = [0] * N

M=0
for i in range(N,0,-1):
	sum = 0
	for j in range(i*2,N+1,i):
		sum += Bi[j-1]
	if sum % 2 == Ai[i-1]:
		Bi[i-1] = 0
	else:
		Bi[i-1] = 1
		M += 1

print(M)
for i in range(N):
	if Bi[i] == 1:
		print(i+1)


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

long long dp[405][405];

long long solution(int* arr , int n){
    
    for(int k=1 ; k<n ; k++){
        int i=0;
        int j=k;
        while(j<n){
            long long sum = 0;
            for(int p=i ; p<=j ; p++){
                sum += arr[p];
            }
            long long mini = LONG_MAX;
            for(int p=i ; p<j ; p++){
                mini = min(mini , dp[i][p] + dp[p+1][j]);
            }
            dp[i][j] = sum + mini;
            i++;
            j++;
        }
    }
    return dp[0][n-1];
}



int main(){

    int n;
    cin>>n;

    int* arr = new int[n];
    for(int i=0 ; i<n ; i++){
        cin>>arr[i];
    }

    cout<<solution(arr , n)<<endl;

}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> c[i][j];
        }
    }

    int a[3], b[3];
    a[0] = 0;
    for (int i = 0; i < 3; i++)
    {
        b[i] = c[0][i];
    }
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];
    bool t = true;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            if(c[i][j] != a[i] + b[j]) t = false;
        }
    }

    if(t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

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; }
constexpr int INF = 1001001001;
constexpr long long INFL = (1LL<<60);
constexpr double eps = (1e-9);

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

  int a, b; cin >> a >> b;

  cout << a * b << endl;

  return 0;
}


Measured memory_bytes: 3652
using System;

namespace ABC115_A_Christmas_Eve_Eve_Eve
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int d = int.Parse(Console.ReadLine());
			
			if(d == 25) Console.WriteLine("Christmas");
			else if(d == 24) Console.WriteLine("Christmas Eve");
			else if(d == 23) Console.WriteLine("Christmas Eve Eve");
			else if(d == 22) Console.WriteLine("Christmas Eve Eve Eve");
		}
	}
}

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

int main() {
  int K;
  cin >> K;
  // 偶数の数 奇数の数
  int even, odd;
  even = K / 2;
  odd = (K+1) / 2;
  // 中学レベルの組み合わせ問題 Aから1つBから一つ取り出す時の場合の数は
  int out = even * odd;
  cout << out <<  endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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

    vector<int> b(N, 0);
    b[0] = (s[0] == '(')? 1:-1;
    int minv = b[0];
    for(int i=1; i<N; ++i){
        if(s[i] == '('){
            b[i] = b[i-1]+1;
        } else {
            b[i] = b[i-1]-1;
            minv = min(minv, b[i]);
        }
    }

    if(minv < 0){
        for(int i=0; i<abs(minv); ++i) s = '(' + s;
        b[N-1] -= minv;
    }

    for(int i=0; i<b[N-1]; ++i) s += ')';
    cout << s << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

int main(){
   ll A; cin >> A;
   cout << pow(A,2);
}

Measured memory_bytes: 256