akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MOD 998244353

struct BIT {
	std::vector<int> data;
	int n;
	BIT(int n) {
		this->n = n;
		data.resize(n + 1);
	}
	void add(int i, int val) {
		for (i++; i <= n; i += i & -i) data[i] += val;
	}
	int sum(int i) {
		int res = 0;
		for (; i; i -= i & -i) res += data[i];
		return res;
	}
};

#ifdef _WIN32
#	define getchar_fast _getchar_nolock
#else
#	define getchar_fast getchar_unlocked
#endif
int ri() {
	int r = 0, c, s = 0;
	for (;;) {
		c = getchar_fast();
		if (c == '-') {
			s = 1;
			break;
		}
		if (c <= '9' && c >= '0') {
			r = c - '0';
			break;
		}
	}
	for (;;) {
		c = getchar_fast();
		if (c < '0' || c > '9') break;
		r = r * 10 + c - '0';
	}
	if (s) r = -r;
	return r;
}

void radix_sort(std::pair<int, int> *x, int n) {
	int c[256] = { 0 };
	std::pair<int, int> *r0 = (std::pair<int, int> *) malloc(sizeof(std::pair<int, int>) * n);
	assert(r0);
	for (int i = 0; i < n; i++) c[x[i].first & 0xFF]++;
	for (int i = 1; i < 256; i++) c[i] += c[i - 1];
	for (int i = n - 1; i >= 0; i--) r0[--c[x[i].first & 0xFF]] = x[i];
	memset(c, 0, sizeof(c));
	for (int i = 0; i < n; i++) c[r0[i].first >> 8 & 0xFF]++;
	for (int i = 1; i < 256; i++) c[i] += c[i - 1];
	for (int i = n - 1; i >= 0; i--) x[--c[r0[i].first >> 8 & 0xFF]] = r0[i];
	memset(c, 0, sizeof(c));
	for (int i = 0; i < n; i++) c[x[i].first >> 16 & 0xFF]++;
	for (int i = 1; i < 256; i++) c[i] += c[i - 1];
	for (int i = n - 1; i >= 0; i--) r0[--c[x[i].first >> 16 & 0xFF]] = x[i];
	memset(c, 0, sizeof(c));
	for (int i = 0; i < n; i++) c[r0[i].first >> 24 & 0xFF]++;
	for (int i = 1; i < 256; i++) c[i] += c[i - 1];
	for (int i = n - 1; i >= 0; i--) x[--c[r0[i].first >> 24 & 0xFF]] = r0[i];
	// for (int i = 0; i < n; i++) std::cerr << x[i].first << ":" << x[i].second << std::endl;
	// for (int i = 1; i < n; i++) assert(x[i].first >= x[i - 1].first);
	free(r0);
}

int main() {
	int n = ri();
	std::pair<int, int> a[n];
	for (int i = 0; i < n; i++) a[i].first = ri() + 1000000000, a[i].second = ri() + 1000000000;
	
	int b2[n + 3];
	b2[0] = 1;
	for (int i = 1; i <= n + 2; i++) {
		b2[i] = b2[i - 1] + b2[i - 1];
		if (b2[i] >= MOD) b2[i] -= MOD;
	}
	
	std::sort(a, a + n, [](const std::pair<int, int> &a, const std::pair<int, int> &b) { return a.second < b.second; });
	int cnt = 0;
	for (auto &i : a) i.second = cnt++;
	radix_sort(a, n);
	
	BIT tree(cnt);
	int64_t res = 0;
	for (int i = 0; i < n; i++) {
		int v = tree.sum(a[i].second);
		res += b2[v];
		res += b2[i - v];
		res += b2[a[i].second - v];
		res += b2[n - a[i].second - 1 - i + v];
		
		tree.add(a[i].second, 1);
	}
	res += (int64_t) (b2[n] - 1) * n;
	res -= b2[n + 2] - 4;
	std::cout << res % MOD << std::endl;
	
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
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;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, long long M, std::vector<long long> A){
  ll sum=accumulate(A.begin(),A.end(),0LL);
  ll ans;
  if(sum>N){
    ans=-1;
  }else{
    ans=N-sum;
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


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

int main() {
  int i,h,m,s;


scanf("%d", &i);

if(i>=0 && i<=86400){


       h=i/3600;
       m=(i-(h*3600))/60;
        s=i-(h*3600+m*60);

       printf("%d:%d:%d\n", h,m,s);
}
else{}


}


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

int main() {
	int a , b , c ;
    int count = 3;
	cin >> a >> b >> c;
	if(a == b) count -= 1;
    if(a == c) count -= 1;
    if(b == c) count -= 1;
    if(count == 0) count += 1;
    cout << count;
      
	return 0;
}

Measured memory_bytes: 256
class node:
    def __init__(self,nodeid):

        self.parent = None
        self.parentid = -1
        self.c_leftid = -1
        self.c_left = None
        self.c_rightid = -1
        self.c_right = None
        self.nodeid = nodeid
        self.type = "root"
    def setLeftChild(self,cn):
        self.c_left = cn
        self.c_leftid = cn.nodeid
        cn.parent = self
        cn.parentid = self.nodeid
        cn.setNodeType()
        self.setNodeType()
        return
    def setRightChild(self,cn):
        self.c_right = cn
        self.c_rightid = cn.nodeid
        cn.parent = self
        cn.parentid = self.nodeid
        cn.setNodeType()
        self.setNodeType()
        return
    def getDepth(self):
        cnt = 0
        t = self
        while True:
            if (t.parentid == -1 ):
                break
            t = t.parent
            cnt = cnt + 1
        return cnt
    def setNodeType(self):
        if (self.getDepth() == 0):
            self.type = "root"
        else:
            if ( self.c_rightid == -1 and self.c_leftid == -1 ):
                self.type = "leaf"
            else:
                self.type = "internal node" 
    def getNodeType(self):
        return self.type
    def getSibling(self):
        if ( self.parentid == -1):
            return -1
        i = self.parent
        if ( i.c_rightid == self.nodeid ):
            return i.c_leftid
        elif ( i.c_leftid == self.nodeid):
            return i.c_rightid
    def getHeight(self):
        lcnt = 0
        rcnt = 0
        if (self.c_leftid == -1  and self.c_rightid == -1 ):
            return 0
        elif (self.c_rightid  == -1):
            lcnt = lcnt + self.c_left.getHeight() + 1
        elif (self.c_leftid  == -1):
            rcnt = rcnt + self.c_right.getHeight() + 1
        else:
            lcnt = lcnt + self.c_left.getHeight() + 1
            rcnt = rcnt + self.c_right.getHeight() + 1
        if (lcnt >= rcnt):
            return lcnt
        else:
            return rcnt
    def getDegree(self):
        cnt = 0
        if (self.c_leftid != -1):
            cnt += 1
        if (self.c_rightid != -1):
            cnt += 1
        return cnt
    def showNode(self):
        i1 = self.nodeid
        i2 = self.parentid
        i3 = self.getSibling()
        i4 = self.getDegree()
        i5 = self.getDepth()
        i6 = self.getHeight()
        i7 = self.getNodeType()
        print ('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i1,i2,i3,i4,i5,i6,i7))
        return

nl = []
n = int(input())
for i in range(0,n):
    nl.append(node(i))

for i in range(0,n):
    (a,b,c) = map(int,input().split())
    if (b != -1):
        nl[a].setLeftChild(nl[b])
    if (c != -1):
        nl[a].setRightChild(nl[c])

for i in range(0,n):
    nl[i].showNode()



Measured memory_bytes: 5616
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

def get_point(computer, player):
    if computer == 'r' and player == 'p':
        return P
    if computer == 's' and player == 'r':
        return R
    if computer == 'p' and player == 's':
        return S
    return 0

ans = 0

import math
for j in range(K):
    computer = [T[i] for i in range(j, N, K)]
    C = len(computer)
    dp = [{'r': 0, 's': 0, 'p': 0} for _ in range(C)]

    for player in ('r', 's', 'p'):
        dp[0][player] = get_point(computer[0], player)

    for i in range(1, C):
        dp[i]['r'] = max(dp[i-1]['s'], dp[i-1]['p']) + get_point(computer[i], 'r')
        dp[i]['s'] = max(dp[i-1]['r'], dp[i-1]['p']) + get_point(computer[i], 's')
        dp[i]['p'] = max(dp[i-1]['s'], dp[i-1]['r']) + get_point(computer[i], 'p')

    ans += max(dp[C-1]['r'], dp[C-1]['s'], dp[C-1]['p'])

print(ans)

Measured memory_bytes: 43596
import java.util.*;
import java.io.BufferedInputStream;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner (new BufferedInputStream(System.in));
    String s = sc.next();
    int n = s.length();
    boolean res = true;
    for(int i = 0; i < n / 2; ++i) {
      if(s.charAt(i) != s.charAt(n - 1 - i)) {
        res = false;
        break;
      }
    }
    if(res) {
      for(int i = 0; i < n / 4; ++i) {
        if(s.charAt(i) != s.charAt(n / 2 - 1 - i)) {
          res = false;
          break;
        }
      }
    }
    if(res) System.out.println("Yes");
    else System.out.println("No");
  }
}

Measured memory_bytes: 23508
#include<stdio.h>
#include<string.h>

int month2days(int month)
{
	int result=0;
	if(month>1)result+=31;
	if(month>2)result+=29;
	if(month>3)result+=31;
	if(month>4)result+=30;
	if(month>5)result+=31;
	if(month>6)result+=30;
	if(month>7)result+=31;
	if(month>8)result+=31;
	if(month>9)result+=30;
	if(month>10)result+=31;
	if(month>11)result+=30;
	return result;
}

int main()
{
	int month,day,tmp;
	char weekday[10];
	while(1)
	{
		scanf("%d %d",&month,&day);
		if(month==0)break;
		tmp=day+month2days(month);
		switch(tmp%7)
		{
			case 0:
			strcpy(weekday,"Wednesday");
			break;
			case 1:
			strcpy(weekday,"Thursday");
			break;
			case 2:
			strcpy(weekday,"Friday");
			break;
			case 3:
			strcpy(weekday,"Saturday");
			break;
			case 4:
			strcpy(weekday,"Sunday");
			break;
			case 5:
			strcpy(weekday,"Monday");
			break;
			case 6:
			strcpy(weekday,"Tuesday");
			break;
		}
		puts(weekday);
	}
	return 0;
}

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

int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}


	int c[n];
	c[0]=0;
	c[1]=abs(a[1]-a[0]);

	for(int i=2;i<n;i++)
	{
		c[i]=min(c[i-1]+abs(a[i]-a[i-1]),c[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<c[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
def solve(s):
    dp = [0]*(s+1)
    dp[0] = 1
    MOD = 10**9+7
    x = 0
    for i in range(1,s+1):
        for j in range(0,i-3+1):
            dp[i] += dp[j]
            dp[i] %= MOD
    return dp[s]

s = int(input())

print(solve(s))

Measured memory_bytes: 64472
#include <iostream>
#include <queue>
#include <array>
#include <utility>
#include <string>
#include <regex>
#include <vector>

using namespace std;

int
main ()
{
  queue < pair < int, int >>data;
  array < bool, 3 > cup =
  {
  true, false, false};
  string str;
  while (cin >> str)
    {
      vector < string > buf;
      buf.push_back (str.substr (0, 1));
      buf.push_back (str.substr (2, 1));
    for (auto & e:buf)
	{
	  if (e.find ("A") != string::npos)
	    e = "0";
	  else if (e.find ("B") != string::npos)
	    e = "1";
	  else
	    e = "2";
	}
      data.push (make_pair (stoi (buf[0]), stoi (buf[1])));
    }
  while (!data.empty ())
    {
      auto buf = data.front ();
      data.pop ();
      swap (cup[buf.first], cup[buf.second]);
    }
  switch (find (cup.begin (), cup.end (), true) - cup.begin ())
    {
    case 0:
      cout << "A" << endl;
      break;
    case 1:
      cout << "B" << endl;
      break;
    case 2:
      cout << "C" << endl;
      break;
    }
}

Measured memory_bytes: 1204
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

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

const int N = 305;
int D[N][N], d[N][N];
int dp[N][N];
vector<pair<int,pii>> v;
void solve(){
	int n;
	cin >> n;
	fr(i ,1, n){
		fr(j, 1, n){
			cin >> D[i][j];
		}
	}
	fr(i, 1, n){
		fr(j, i + 1, n){
			int dmax = 0;
			fr(k, 1, n){
				dmax = max(dmax, abs(D[k][i] - D[k][j]));
			}
			if(D[i][j] < dmax){
				d[i][j] = d[j][i] = 1e18;
				continue;
			}
			d[i][j] = d[j][i] = dmax;
		}
	}
	fr(i, 1, n){
		fr(j, i + 1, n){
			fr(k, 1, n){
				if(k != i && d[k][j] && D[i][k] + d[k][j] == D[i][j]){
					d[i][j] = 1e18;
				}
			}
		}
	}
	int ans = 0;
	fr(i, 1, n){
		fr(j, i + 1, n){
			if(d[i][j] != 1e18)
			ans += d[i][j];
		}
	}
	fr(k, 1, n){
		fr(i, 1, n){
			fr(j, 1, n){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	fr(i, 1, n){
		fr(j, 1, n){
			if(d[i][j] != D[i][j]){
				cout << -1;
				return;
			}
		}
	}
	cout << ans;
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1664
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt()
	rt := readInt()
	ra := readInt()

	for i := 1; i < n; i++ {
		t := readInt()
		a := readInt()
		if rt <= t && ra <= a {
			rt = t
			ra = a
		} else if rt <= t {
			qa := ra / a
			if ra%a != 0 {
				qa++
			}
			ra = qa * a
			rt = qa * t
		} else if ra <= a {
			qt := rt / t
			if rt%t != 0 {
				qt++
			}
			rt = qt * t
			ra = qt * a
		} else {
			qt := rt / t
			if rt%t != 0 {
				qt++
			}
			qa := ra / a
			if ra%a != 0 {
				qa++
			}
			q := qa
			if qt > qa {
				q = qt
			}
			rt = q * t
			ra = q * a
		}
	}
	println(rt + ra)

}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include <iostream>
#include <string>

int main()
{
  size_t k;
  std::string s;
  std::cin>>k>>s;
  
  if(s.size()<=k)
  {
  }
  else
  {
    s.resize(k);
    s+="...";
  }
  
  std::cout<<s<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fo(i,n) for(ll i=0;i<n;i++)
#define fok(i,k,n) for(ll i=k;i<n;i++)
#define ci(x) cin>>x
#define ci2(x,y) cin>>x>>y
#define co(x) cout<<x<<"\n"
#define co2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define deb1(x) cout<<#x<<" "<<x<<endl
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n"
#define deb3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n"
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;	


int main(){
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("output.txt","w",stdout);
	// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t; t=1;
	//ci(t);
	while(t--){
		int k;
		ci(k);
		int a,b;
		ci2(a,b);
		if(a%k==0){
			co("OK");
		}
		else if(k*((a/k)+1)<=b){
			co("OK");
		}
		else{
			co("NG");
		}
	}
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;

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

    int ans = 0;
    for(int i = 1; i <= N; i += 2){
        int diviser = 0;
        for(int k = 1; k*k <= i; k++){
            if(i % k == 0){
                diviser += 2;
                if(k*k == i) diviser--; 
            }
        }
        if(diviser == 8) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
p=(0,0)
now=0
for _ in range(n):
    t,x,y=map(int,input().split())
    mov=abs(x-p[0])+abs(y-p[1])
    if t-now<mov or (t-now-mov)%2==1:
        print("No")
        break
    p=(x,y)
    now=t
else:print("Yes")

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll N, L; cin >> N >> L;
    ll mi = INF;
    ll sum = 0;
    rep(i, N){
        ll tmp = L+i;
        if(abs(mi) > abs(tmp)) mi = tmp;
        sum += tmp;
    }
    cout << sum-mi << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7664
//██████╗ ██╗   ██╗██╗      ██████╗ ███████╗
//██╔══██╗██║   ██║██║      ██╔══██╗██╔════╝
//██████╔╝██║   ██║██║█████╗██║  ██║█████╗
//██╔══██╗██║   ██║██║╚════╝██║  ██║██╔══╝
//██║  ██║╚██████╔╝██║      ██████╔╝███████╗
//╚═╝  ╚═╝ ╚═════╝ ╚═╝      ╚═════╝ ╚══════╝
#include <iostream>
#include <random>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#include <chrono>
#include <cstdio>


// #pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define sqr(x) ((x) * (x))

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

#define next ajksdslk
#define prev aklsfjk

mt19937_64 mt_rand(chrono::system_clock::now().time_since_epoch().count());

template<typename T1, typename T2> inline bool upmax(T1& a, T2 b) { return (a < b ? (a = b, true) : false); }
template<typename T1, typename T2> inline bool upmin(T1& a, T2 b) { return (b < a ? (a = b, true) : false); }

const int maxn = (int) 1e6 + 100;
const int maxlog = 21;
const int base = 1e9 + 7;
const ld eps = (ld) 1e-9;
const ld PI = acos(-1.);
//const int pp = 41;
const int inf = 2e9;
const ll llinf = 1e18;



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#ifdef LOCAL
  freopen ("input.txt", "r", stdin);
#endif

  int n; cin >> n;
  string s; cin >> s;
  if (n & 1) {
    cout << "No";
    return 0;
  }
  bool ok = true;
  for (int i = 0; i < n / 2; i ++) {
    ok &= s[i] == s[i + n / 2];
  }
  cout << (ok ? "Yes" : "No") << "\n";
  return 0;
}

Measured memory_bytes: 888
a,b,a2,b2 = gets.chomp.split(" ").map(&:to_i)
alice = a..b
bob = a2..b2

if alice.include?(a2)
  if alice.include?(b2)
    puts b2-a2
    exit
  else
    puts b-a2
    exit
  end
else
  if alice.include?(b2)
    puts b2-a
    exit
  end
  if (a2 < a) && (b < b2)
    puts b-a
    exit
  else
    puts 0
    exit
  end
end


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

const int N = 110000;

namespace Dinic {

	using F = int;
	const F INF = 1e9+1e8;

	const int N = 220000;
	const int M = 1100000;

	int fst[N], nxt[M], to[M];
	F cap[M];
	int dis[N], q[N], ptr[N];
	int V, E;

	void init() {
		memset(fst, -1, sizeof fst);
		V = E = 0;
	}
	inline int add_node() { V++; return V-1; }
	inline void add_edge(int u, int v, F c) {
		to[E] = v, cap[E] = c, nxt[E] = fst[u], fst[u] = E++;
		to[E] = u, cap[E] = 0, nxt[E] = fst[v], fst[v] = E++;
	}
	inline bool bfs(int S, int T, int n) {
		memset(dis, -1, sizeof(int) * n);
		int h = 0, t = 0;
		dis[S] = 0, q[t++] = S;
		while (h < t) {
			int u = q[h++];
			for (int e = fst[u]; ~e; e = nxt[e]) if (cap[e] > 0 && dis[to[e]] == -1) {
				dis[to[e]] = dis[u] + 1, q[t++] = to[e];
				if (to[e] == T) return 1;
			}
		}
		return (dis[T] != -1);
	}
	F dfs(int u, int T, F f) {
		if (u == T) return f;
		for (int &e = ptr[u]; ~e; e = nxt[e]) if (cap[e] > 0 && dis[to[e]] > dis[u]) {
			F ret = dfs(to[e], T, min(f, cap[e]));
			if (ret > 0) {
				cap[e] -= ret, cap[e ^ 1] += ret;
				return ret;
			}
		}
		return 0;
	}
	F max_flow(int S, int T, int n = V) {
		F ret = 0;
		while (bfs(S, T, n)) {
			memcpy(ptr, fst, sizeof(int) * n);
			for (F cur; (cur = dfs(S, T, INF)) > 0; ret += cur);
		}
		return ret;
	}
};

int a[2][N], vis[2][N], cnt[2];
vector<int> vec[2][N];
map<int, int> adj[N];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	int ans = 0;
	for (int i : {0, 1}) {
		for (int j = 0; j < n; j++) cin >> a[i][j];
		for (int j = 0; j < n; j++) {
			if (vis[i][j]) continue;
			++cnt[i];
			for (int k = j; !vis[i][k]; k = a[i][k]) {
				vis[i][k] = cnt[i];
				vec[i][cnt[i]].push_back(k);
			}
			if (vec[i][cnt[i]].size() == 1) continue;
			ans += vec[i][cnt[i]].size();
		}
	}
	int S = 0, T = cnt[0] + cnt[1] + 1;
	Dinic::init();
	for (int i = 0; i < n; i++) {
		int u = vis[0][i], v = vis[1][i];
		if (vec[0][u].size() == 1 || vec[1][v].size() == 1) continue;
		adj[u][v]++;
		if (a[0][i] == a[1][i]) adj[u][v]++;
	}
	for (int i = 1; i <= cnt[0]; i++) {
		if (vec[0][i].size() == 1) continue;
		Dinic::add_edge(S, i, vec[0][i].size());
	}
	for (int i = 1; i <= cnt[1]; i++) {
		if (vec[1][i].size() == 1) continue;
		Dinic::add_edge(i + cnt[0], T, vec[1][i].size());
	}
	for (int i = 1; i <= cnt[0]; i++) {
		for (auto t : adj[i]) {
			Dinic::add_edge(i, t.first + cnt[0], t.second);
		}
	}
	cout << ans - Dinic::max_flow(S, T, T + 1) << "\n";
	return 0;
}


Measured memory_bytes: 26752
#include<cstdio>
#include<vector>
const int MaxN=1<<17|10;
int N,ch[MaxN][2],v[MaxN];
long long dep[MaxN];
struct Point{long long x,y;};
void ins(std::vector<Point>&v,long long x,long long y){
	if(!v.size()||y<v[v.size()-1].y)v.push_back((Point){x,y});
}
void find(std::vector<Point>&v,int&p,long long M){
	while(p<v.size()&&v[p].x<=M)p++;
}
std::vector<Point>chk(int i,long long M){
	std::vector<Point>f;
	if(!*ch[i]){
		f.push_back((Point){dep[i],dep[i]});
		return f;
	}
	std::vector<Point>fl=chk(ch[i][0],M),fr=chk(ch[i][1],M);
	for(int pl=0,pr=0,ql=0,qr=0;;pl++){
		for(;pr<fr.size()&&(pl>=fl.size()||fr[pr].x<fl[pl].x);pr++){
			find(fl,ql,M+2*dep[i]-fr[pr].y);
			if(ql)ins(f,fr[pr].x,fl[ql-1].y);
		}
		if(pl>=fl.size())break;
		find(fr,qr,M+2*dep[i]-fl[pl].y);
		if(qr)ins(f,fl[pl].x,fr[qr-1].y);
	}
	return f;
}
int main(){
	scanf("%d",&N);
	for(int i=2,f;i<=N;i++){
		scanf("%d%d",&f,v+i);
		if(*ch[f])ch[f][1]=i;
		else ch[f][0]=i;
		dep[i]=dep[f]+v[i];
	}
	long long l=-1,r=1ll<<61,mid;
	while(r-l>1)chk(1,mid=l+r>>1).size()?r=mid:l=mid;
	printf("%lld\n",r);
}

Measured memory_bytes: 15104
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    n = []
    for _ in range(N):
        n.append(list(readline()[:-1]))
    m = []
    for _ in range(M):
        m.append(list(readline()[:-1]))

    s = N - M
    if s == 0:
        if n == m:
            flag = True
        else:
            flag = False

    for i in range(s):
        for j in range(s):
            flag = True
            for k in range(M):
                if n[i+k][j:j+M] != m[k]:
                    flag = False
                    break
            if flag:
                break
        if flag:
            break
    if flag:
        print('Yes')
    else:
        print('No')
            
if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>
#include<string>
using namespace std;
int main(){
    int a,b;
    string op;
    for(int i=0;i<1000000;i++){
    cin>>a;
    cin>>op;
    cin>>b;
    if(op=="+"){
    cout<<a+b<<endl;
        }
    if(op=="-"){
        cout<<a-b<<endl;
        }
    if(op=="*"){
        cout<<a*b<<endl;
        }
    if(op=="/"){
        cout<<a/b<<endl;
        }
    if(op=="?"){
        break;
        }
                          }
}


Measured memory_bytes: 3144
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			City[] cities = new City[m];
			for (int i = 0; i < m; i++) {
				vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				cities[i] = new City() { no = i, p = vs[0], y = vs[1] };
			}
			int[] cnt = new int[n];
			foreach (var city in cities.OrderBy(p => p.y)) {
				cnt[city.p - 1]++;
				city.num = cnt[city.p - 1];
				//System.Diagnostics.Debug.WriteLine($"{city.no} {city.p} {city.y} {city.num}");
			}
			foreach (var city in cities) {
				Console.WriteLine($"{city.p:000000}{city.num:000000}");
			}


			Console.Out.Flush();
		}
	}

	class City
	{
		public int no;
		public int p;
		public int y;
		public int num;
	}
}


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

ll qexp(ll x, ll y) {
	if (y==0) return 1;
	else if (y==1) return x;
	ll z=qexp(x,y/2);
	z*=z; z%=MOD;
	if (y%2==1) z*=x;
	return z%MOD;
}

int main() {
	ll n;
	scanf("%lld", &n);
	int first[n]; memset(first,-1,sizeof(first));
	int f,s;
	for (int i=0; i<=n; i++) {
		int x;
		scanf("%d", &x);
		if (first[x-1]==-1) first[x-1]=i;
		else {
			f=first[x-1]; s=i;
		}
	}
	ll minv[n+1];
	for (int i=0; i<=n; i++) minv[i]=qexp(i+1,MOD-2);
	ll ans[n+1]; ans[0]=n;
	ll sz=n+1-(s-f+1);
	//printf("%d\n", sz);
	ll norm=n+1, ex=1;
	for (int i=1; i<=n; i++) {
		norm*=(n+1-i); norm%=MOD;
		norm*=minv[i]; norm%=MOD;
		if (i<=sz) {
			ex*=(sz+1-i); ex%=MOD;
			//printf("%lld!\n", ex);
			ex*=minv[i-1]; ex%=MOD;
			//printf("%lld!\n", ex);
		}
		else ex=0;
		ans[i]=norm-ex;
		ans[i]%=MOD; ans[i]+=MOD; ans[i]%=MOD;
		//printf("%lld\n", norm);
	}
	for (int i=0; i<=n; i++) printf("%lld\n",ans[i]);
}


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

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define all(v) v.begin(),v.end()
#define v vector
#define vi vector<int>
#define vi2 vector<vi>
#define vl vector<long long>
#define vl2 vector<vl>

template <class T> T maxAny(T a, T b){
    if(a > b) return a;
    else return b;
}

template <class T> T minAny(T a, T b){
    if(a > b) return b;
    else return a;
}

int main(){
    int k, x;
    cin >> k >> x;
    if(500*k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
  int d; cin >> d;
  if(d == 25) cout << "Christmas" << endl;
  if(d == 24) cout << "Christmas Eve" << endl;
  if(d == 23) cout << "Christmas Eve Eve" << endl;
  if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 256
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000;
#define mod (int)1000000007
#pragma region header
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
#pragma endregion
#pragma endregion



int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s; cin >> s;
	lint a = 0;
	lint b = 0;
	lint ans = 0;
	for (int i = 0; i < s.length(); i++) {
		if (a == b) {
			if (s[i] == 'p') ans--;
			a++;
		}
		else {
			if (s[i] == 'g') ans++;
			b++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
//#define push_back pb
using namespace std;
typedef long long ll;
ll ar[200005]={0};//,h[100005];
vector<int> v[200005];
void dfs(int a,int b)
{
        for(int i=0;i<v[a].size();i++){
         if(v[a][i]!=b){ar[v[a][i]]+=ar[a];
        dfs(v[a][i],a);}
        }
}
int main() {
	int n,q;
	cin>>n>>q;
	//ll ar[n+1]={0};
	int a,b;
	for(int i=0;i<n-1;i++){cin>>a>>b;
	    v[a].push_back(b);
	    v[b].push_back(a);
	}
	while(q-->0)
	{
	    cin>>a>>b;
	    //ar[a]+=(ll)b;
	    ar[a]+=(ll)b;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++)
	cout<<ar[i]<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 27392
# A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
# B = [int(input()) for _ in range(n)]
A = list(map(int, input().split()))
# a, b = map(int, input().split())
# S = input()


def choose2(n):
    return n*(n-1)//2


cnt = [0 for _ in range(n+1)]
for i in range(n):
    cnt[A[i]-1] += 1
total = 0
for i in range(n):
    total += choose2(cnt[i])
for i in range(n):
    ans = total
    ans -= choose2(cnt[A[i]-1])
    ans += choose2(cnt[A[i]-1]-1)
    print(ans)


Measured memory_bytes: 24748
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>

int gcd(int a, int b) {
        if (a < b) {
                int t = b;
                b = a;
                a = t;
        }
        int r = a % b;
        while (r != 0) {
                a = b;
                b = r;
                r = a % b;
        }
        return b;
}

int main() {

        int n, x;
        std::cin >> n >> x;
        std::vector<int> cities(n);

        for (auto& c : cities) {
                std::cin >> c;
                c = std::abs(c - x);
        }

        auto ret = cities[0];
        for (auto i = 1; i < cities.size(); ++i) {
                ret = gcd(ret, cities[i]);
        }

        std::cout << ret << std::endl;

        return 0;
}

Measured memory_bytes: 640
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

k=int(input())+1
s=0
for a in range(1,k):
    if a==1:
        s+=(k-1)**2
    else:
        for b in range(1,k):
            x=gcd(a,b)
            if x==1:
                s+=k-1
            else:
                for c in range(1,k):
                    s+=gcd(x,c)
print(s)

Measured memory_bytes: 9632
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PL;
typedef pair<P, LL> PP;
typedef pair<P, LL> PP;
typedef long long LL;

#define xx first
#define yy second

int main()
{
  //freopen("input", "r", stdin);
  // freopen("output", "w", stdout);
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n;
  multiset<int> si;
  int fl = 1;
  cin>>n;
  for(int i=0;i<(1<<n);i++){
    int t;cin>>t;
    si.insert(t);
  }
  auto eit = si.end();
  eit--;
  vector<int> vp{*eit};
  si.erase(eit);
  while(vp.size()!=(1<<n)){
    vector<int> tp;
    for(auto i:vp){
      tp.push_back(i);
      auto it = si.lower_bound(i);
      if(it==si.begin()){fl = 0;break;}
      it--;
      tp.push_back(*it);
      si.erase(it);
    }
    vp = tp;
    // cout<<fl<<endl;
    // for(auto cc:tp)
    //   cout<<cc<<" ";
    // cout<<endl;
    if(fl==0)break;
  }
  if(fl)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}


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


int main() {
    int n;
    cin >> n;
    string s[n];
    int cnt[n][26];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 26; j++) {
            cnt[i][j] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        for (int j = 0; j < s[i].size(); j++) {
            cnt[i][s[i][j] - 'a']++;
        }
    }
    string ans = "";
    for (int i = 0; i < 26; i++) {
        int mn = 1e9;
        for (int j = 0; j < n; j++) {
            mn = min(mn, cnt[j][i]);
        }
        for (int j = 0; j < mn; j++) {
            ans += ('a' + i);
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

#define ANS_MAX 1000000000000000000LL

int main(void)
{
	int n;
	while(scanf("%d", &n)==1)
	{
		vll a(n);

		for(int i=0;i<n;i++) scanf("%lld", &a[i]);

		ll ans=1;
		for(int i=0;i<n;i++)
		{
			if(a[i]==0) ans=0;
		}

		for(int i=0;i<n;i++)
		{
			if(a[i]==0)
			{
				ans=0;
				break;
			}
			if(ANS_MAX/a[i]<ans)
			{
				ans=-1;
				break;
			}
			ans*=a[i];
		}
		if(ans>ANS_MAX) ans=-1;
		printf("%lld\n", ans);
	}
	return 0;
}


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

int red[500][500],blue[500][500];

signed main(){
  int h,w;cin>>h>>w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(i&1){
        if(j<w-1)red[i][j]=1;
      }
      else{
        if(j>0)blue[i][j]=1;
      }
      if(j==0)red[i][j]=1;
      if(j==w-1)blue[i][j]=1;
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      char a;cin>>a;
      if(a=='#')red[i][j]=blue[i][j]=1;
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<(red[i][j]?'#':'.');
    }cout<<endl;
  }
  cout<<endl;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<(blue[i][j]?'#':'.');
    }cout<<endl;
  }
}


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

int main() {
  int x, y, z;
  cin >> x >> y >> z;

  if(x == 7 && y == 5 && z == 5) {
    cout << "YES" << endl;
  } else if(x == 5 && y == 7 && z == 5) {
    cout << "YES" << endl;
  } else if(x == 5 && y == 5 && z == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define loop(i,n) for(int i = 0; i < (n); ++i)
#define loops(i,f,n) for(int i = (f); i < (n); ++i)
#define INF 999999999
#define llint long long int
#define vec vector<int>
#define vec2 vector<vector<int>>

int main()
{
    cin.tie(0);                                                                 
    ios::sync_with_stdio(false);
    vector<bool> index(30,false);
    loop(i,28)
    {
    	int t;
    	cin>>t;
    	index[t-1] = true;
    }
    loop(i,30)
    {
    	if(index[i]==false)
    	{
    		cout<<i+1<<endl;
    	}
    }
    return 0;
}


Measured memory_bytes: 3172
#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 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        int n;
        string s;
        cin >> n >> s;
        if (n < 3200) {
            cout << "red" << endl;
        } else {
            cout << s << endl;
        }

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>

using namespace std;


int main(int argc, char *argv[]) {
  int x, y;

  while (cin >> x >> y) {
    int tmp;

    if (x < y) {
      tmp = y;
      y = x;
      x = tmp;
    }
    while (x % y != 0) {
      tmp = x % y;
      x = y;
      y = tmp;
    }
    cout << y << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
using namespace std;
int l[1005]={};
int r[1005]={};
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

    int N;
    int result=0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> l[i];
        cin >> r[i];
    }
    for(int i=0;i<N;i++){
        result+=r[i]-l[i]+1;
    }
        
	cout << result << "\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		int sum = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
			sum += a[i];
		}
		if (sum >= 22) {
			System.out.println("bust");
		} else {
			System.out.println("win");
		}
	}
}

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

using namespace std;

typedef long long ll;

#define newline cout<<"\n"
#define deb(x) cout<<#x<<" "<<x<<endl;

template<typename... T>
void read(T&... args){
    ((cin>>args), ...);
}

template<typename... T>
void write(T... args){
    ((cout<<args<<" "), ...);
}

void printarr(vector<ll> &v){
    for(ll x: v){
        cout<<x<<" ";
    }
    newline;
}

const ll MOD = 1e9+7;
const ll nax = 1e7+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    
    ll n, m; cin>>n>>m;

    vector<pair<ll, ll> > v(n);

    for(ll i=0; i<n; i++){
        ll a, b; cin>>a>>b;
        v[i] = {a,b};
    }

    sort(v.begin(), v.end());

    ll ans = 0;

    ll ptr = 0;
    
    while(m>0){
        ll here = min(m, v[ptr].second);
        m -= here;
        ans += here*v[ptr].first;
        ptr++;
    }

    cout<<ans<<endl;

    return 0;
}

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

#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define sum(n) accumulate((n).begin(), (n).end(), 0)
using namespace std;


int main(){
	long long int n, k, x[100001],right = 0,left = -1,ans = 214748364000,memo = 0;

	cin >> n >> k;
	rep(i, n) cin >> x[i];

	rep(i,n) {
		if (x[i] >= 0) {
			break;
		}
		else {
			right++;
			left++;
		}
	}


	rep(i,n-k+1) {
		memo = 0;
		if (x[i] < 0 && x[i + k - 1] < 0) {
			memo = abs(x[i]);
		}
		else if (x[i] < 0 && x[i+k-1] >= 0) {
			memo = max(abs(x[i]), abs(x[i + k - 1])) + min(abs(x[i]), abs(x[i + k - 1]))*2;
		}
		else if (x[i] >= 0 && x[i+k-1] >=0) {
			memo = x[i + k - 1];
		}

		if (i <= right && i+k-1 >= left) {
			ans = min(ans, memo);
		}
	}

	cout << ans << endl;
}

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

int main() {
  int n, i; 
  long li, li1=1, li2=2;
  cin >> n;
  
  if (n==1) cout << li1 << endl;
  if (n>1) {
    for (i=2; i<=n; i++) {
      li = li1 + li2;
      li2 = li1;
      li1 = li;
    }
    cout << li << endl;
  }
    
  return 0;
}

Measured memory_bytes: 256
n,m,X,Y=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
x.sort()
y.sort()
ans=0
for z in range(X+1,Y+1):
    if x[-1]<z and y[0]>=z:
        ans+=1
if ans==0:
    print("War")
else:
    print("No War")

Measured memory_bytes: 3064
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};


int main(void){
  int N;
  cin >> N;
  vector<int> P(N);
  for(int i = 0; i < N; i++){
    cin >> P[i];
    P[i];
  }
  vector<int> cnt(N);
  map<int, int> all;
  for(int i = 0; i < N; i++){
    if(all[P[i]-1] != 0){
      cnt[i] = all[P[i]-1] + 1;
      all[P[i]] = all[P[i]-1] + 1;
    }else{
      cnt[i] = 1;
      all[P[i]] = 1;
    }
  }
  cout << N - *max_element(cnt.begin(), cnt.end()) << endl;



}


Measured memory_bytes: 11136