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

struct data{
  int p[10];
};

data A,B;

#define SZ (1<<17)

struct segtree{
  data t[SZ*2];
  data u[SZ*2];
  void init(int k=0,int l=0,int r=SZ){
    for(int i=0;i<10;i++){
      t[k].p[i]=0;
      u[k].p[i]=i;
    }
    
    if(r-l==1){
      t[k].p[0]=1;
      return;
    }
    
    int m=(l+r)/2;
    init(k*2+1,l,m);
    init(k*2+2,m,r);
    for(int i=0;i<10;i++){
      t[k].p[i]+=t[k*2+1].p[i];
      t[k].p[i]+=t[k*2+2].p[i];
    }
  }
  
  void add(data &td,data &ud,data &x){
    int tt[10];
    int uu[10];
    for(int i=0;i<10;i++){
      tt[i]=0;
      uu[i]=i;
    }
    for(int i=0;i<10;i++){
      tt[ x.p[i] ]+=td.p[i];
      uu[i]=x.p[ ud.p[i] ];
    }
    for(int i=0;i<10;i++){
      td.p[i]=tt[i];
      ud.p[i]=uu[i];
    }
  }
  
  
  void compute(int k,int l,int r){
    if(r-l==1)return;
    int L=k*2+1;
    int R=k*2+2;

    add(t[L],u[L],u[k]);
    add(t[R],u[R],u[k]);
    
    for(int i=0;i<10;i++){
      t[k].p[i]=t[L].p[i]+t[R].p[i];
      u[k].p[i]=i;
    }
  }

  data Get(int a,int b,int k=0,int l=0,int r=SZ){
    if(b<=l || r<=a)return A;
    compute(k,l,r);
    if(a<=l && r<=b){
      return t[k];
    }else{
      int m=(l+r)/2;
      data lc=Get(a,b,k*2+1,l,m);
      data rc=Get(a,b,k*2+2,m,r);
      for(int i=0;i<10;i++)lc.p[i]+=rc.p[i];
      return lc;
    }
  }
  
  void dfs(int a,int b,data d,int k=0,int l=0,int r=SZ){
    if(b<=l || r<=a)return;
    compute(k,l,r);
    if(a<=l && r<=b){
      add(t[k],u[k],d);
    }else{
      int m=(l+r)/2;
      dfs(a,b,d,k*2+1,l,m);
      dfs(a,b,d,k*2+2,m,r);
      for(int i=0;i<10;i++)
        t[k].p[i]=t[k*2+1].p[i]+t[k*2+2].p[i];
    }
  }
};

int N,Q;
vector<int> G[MAX_N];
int v[MAX_N],size[MAX_N],cc=0;

void dfs(int pos){
  v[pos]=cc++;
  size[pos]=1;
  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i];
    dfs(to);
    size[pos]+=size[to];
  }
}


segtree T;
int main(){
  for(int i=0;i<10;i++){
    A.p[i]=0;
    B.p[i]=i;
  }
  
  scanf("%d %d",&N,&Q);
  for(int i=0;i<N-1;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    G[a].push_back(b);
  }
  
  dfs(0);
  T.init();
  
  while(Q--){
    int type;
    int r,x,y;
    scanf("%d %d %d %d",&type,&r,&x,&y);
    
    if(type==1){
      data key=T.Get(v[r],v[r]+size[r]);
      int sum=0;
      for(int i=x;i<=y;i++)sum+=key.p[i];
      printf("%d\n",sum);
    }else if(type==2){
      data key;
      for(int i=0;i<10;i++)key.p[i]=i;
      key.p[x]=y;
      T.dfs(v[r],v[r]+size[r],key);
    }

  }
  return 0;
}

Measured memory_bytes: 34608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

vector<ll> v;
ll c;
ll sum;
bool b[100];
void jisyo(ll n){
    if(c==n){
        v.pb(sum);
    }
    rep(i,1,n){
        if(b[i]){
            
        }else{
            b[i]=true;
            sum=sum*10+i;
            c++;
            jisyo(n);
            c--;
            sum=(sum-i)/10;
            b[i]=false;
        }
    }
    
}

int main(){
    ll n;cin>>n;
    ll p[n],q[n];
    ll pp=0;
    ll qq=0;
    jisyo(n);
     rep(i,0,n-1){
        cin>>p[i];
         pp=pp*10+p[i];
    }
    rep(i,0, n-1){
        cin>>q[i];
        qq=qq*10+q[i];
    }
    ll aa,bb;
    //cout<<pp<<qq<<endl;
    rep(i,0,v.size()-1){
        //cout<<v[i]<<endl;;
        
        if(v[i]==pp){
            aa=i;
        }
        if(v[i]==qq){
            bb=i;
        }
    }
    
    cout<<abs(aa-bb)<<endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 892
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=2e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15), sINF = ll(1e9);

struct node{
    ll l, r;
    node *lc, *rc;
    ll tg, mx;
    node(ll li, ll ri, node *lci = 0, node *rci = 0):l(li), r(ri), lc(lci), rc(rci), tg(0), mx(-INF){}
    ll gd(){return mx + tg;}
    void ins(ll x,ll k)
    {
        if(l == r-1)mx = k;
        else
        {
            if(x < (l+r) / 2)lc->ins(x, k);
            else rc->ins(x, k);
            mx = max(lc->gd(), rc->gd());
        }
    }
    void add(ll li, ll ri, ll k)
    {
        if(li >= r || ri <= l)return;
        else if(li <= l && ri >= r)tg += k;
        else lc->add(li, ri, k), rc->add(li, ri, k), mx = max(lc->gd(), rc->gd());
    }
} *rt;

node *build(ll l,ll r)
{
    if(l == r-1)return new node(l, r);
    else return new node(l, r, build(l, (l+r)/2), build((l+r)/2, r));
}

struct tg{
    ll l, r, c;
};
vector<tg> dt;
ll d[MAXn];


int main()
{
    IOS();
    ll n, m;
    cin>>n>>m;
    REP(i, m)
    {
        ll l, r, c;
        cin>>l>>r>>c;
        dt.pb({l, r, c});
    }
    sort(ALL(dt), [](auto a, auto b){return a.r < b.r;});
    rt = build(1, n+1);
    ll it = 0;
    REP1(i, n)
    {
        ll x = max(0LL, rt->gd());
        rt->ins(i, x);
        while(it < SZ(dt) && dt[it].r <= i)rt->add(dt[it].l, dt[it].r+1, dt[it].c), it++;
    }
    cout<<max(0LL, rt->gd())<<endl;
}


Measured memory_bytes: 31340
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n,m = map(int, input().split())
from collections import defaultdict
ns = defaultdict(set)
es = []
for i in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].add((c,v))
    ns[v].add((c,u))
    es.append((u,v,c))
    
def dijkstra(start):
    import heapq
    vals = [None] * n
    h = [(0, start)] # (距離, ノード番号)
    vals[start] = 0
    while h:
        val, u = heapq.heappop(h)
        for d, v in ns[u]:
            if vals[v] is None or vals[v]>val+d:
                vals[v] = val+d
                heapq.heappush(h, (vals[v], v))
    return vals
unused = [True]*m
for u in range(n):
    vals = dijkstra(u)
    for i,(a,b,c) in enumerate(es):
        if abs(vals[a]-vals[b])==c:
            unused[i] = False
ans = sum(unused)
print(ans)

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

int main() {
  
  string a,b;
  int k=0;
  cin>>a;
  for(int i; i<5;i++){
    b+="hi";
    if(b==a){
      k++;
      break;
    }
  }
  if(k==0)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int n, r;
    cin >> n >> r;

    if (10 <= n) cout << r;
    else cout << (r + (100 * (10 - n)));
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>

using namespace std;

int main()
{
	priority_queue<int> pq;
	string s;
	int k;
	while(cin>>s){
		if(s[0]=='i'){
			cin>>k;
			pq.push(k);
		}else if(s=="extract"){
			cout<<pq.top()<<endl;
			pq.pop();
		}else if(s=="end"){
			break;
		}
	}
	return 0;	
}


Measured memory_bytes: 7052
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a.back() - a.front() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int dp[10000];
void chmin(int &a, int b){
a = a > b ? b : a;
}
int main(){
int N,M,ans=0;
long Inf = 1e9;
cin >> N >> M;
long a[M],b[M],d[M];
long c[M][12];
rep(i,M) d[i]=0;
rep(i,10000) dp[i] = Inf;
dp[0] = 0;
rep(i,M) {
  cin >> a[i] >> b[i];
  rep(j,b[i]) cin >> c[i][j];
  rep(j,b[i]) d[i] += pow(2,c[i][j]);
}
rep(j,M) rep(i,8192){
 chmin(dp[i|d[j]], dp[i] + a[j]);
}
for(int i=1; i<=N; i++) ans += pow(2,i);
if(dp[ans]==Inf) cout << "-1" << endl;
else cout << dp[ans] << endl;
return 0;
}


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

using namespace std;

int main (){
    
    int N;
    cin >> N;
    long long a[310000];
  	int k = 3 * N;
    for(int i = 0; i < k; i++){
        cin >> a[i];
    }
    sort(a, a+k, greater<int>());
    long long max2 = 0;
    int l = 2 * N;
    for(int i = 1; i < l ; i+=2){
        max2 += (long long) a[i];
    }
    cout << max2 << endl;
    return 0;
}


Measured memory_bytes: 2560
import Data.List
import Data.Array
import Data.Maybe
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt
 
solve :: Int -> Int -> [Int] -> Int
solve n k ls = sum $ take (length v - k) v
    where v = sort $ map length $ group (sort ls)
 
main :: IO ()
main = do
    [n, k] <- getInts
    ls <- getInts
    print (solve n k ls)

Measured memory_bytes: 32124
/**
 * Created by hiramekun at 20:44 on 2019-12-08.
 */
#include <bits/stdc++.h>

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

int main() {
    ll h, w;
    cin >> h >> w;
//    vector<vector<ll>> a(h, vector<ll>(w)), b(h, vector<ll>(w));
    int a[h][w], b[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) cin >> b[i][j];

    ll max_diff = 2 * 80 * 160;
//    vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(max_diff)));
    bool dp[h][w][max_diff];
    rep(i, h) rep(j, w) rep(l, max_diff) dp[i][j][l] = false;

    ll mid = max_diff / 2;
    dp[0][0][b[0][0] - a[0][0] + mid] = true;
    dp[0][0][-b[0][0] + a[0][0] + mid] = true;

    rep(i, h) {
        rep(j, w) {
            rep(l, max_diff) {
                if (!dp[i][j][l]) continue;
                if (i + 1 <= h - 1) {
                    dp[i + 1][j][l + b[i + 1][j] - a[i + 1][j]] = true;
                    dp[i + 1][j][l - b[i + 1][j] + a[i + 1][j]] = true;
                }
                if (j + 1 <= w - 1) {
                    dp[i][j + 1][l + b[i][j + 1] - a[i][j + 1]] = true;
                    dp[i][j + 1][l - b[i][j + 1] + a[i][j + 1]] = true;
                }
            }
        }
    }
    ll ans = 1e18;
    rep(i, max_diff) {
        if (dp[h - 1][w - 1][i]) ans = min(ans, abs(i - mid));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 160256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    fact();
    cin >> n >> m;
    if(abs(n - m) > 1) {
        cout << 0 << endl;
    } else if(abs(n - m) == 1) {
        cout << Mul(F[n], F[m]) << endl;
    } else {
        cout << Mul(2, Mul(F[n], F[m])) << endl;
    }
  
    return 0;
}


Measured memory_bytes: 16640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MOD 1000000007
#define ll long long
#define MAX 10001

int cmpfunc(const void *a, const void *b){
    return (*(int*)a - *(int*)b);
}

int main(void){
    int n,i,j;
    scanf("%d",&n);
    char s1[n];
    scanf("%s",s1);
    char s[n];
    for(i=0;i<n;i++) s[i]=s1[i];
    if(n==1){
        printf("()\n");
        return 0;
    }
    if(n==2){
        if(s[0]=='(' && s[1]==')'){
            printf("()\n");
            return 0;
        }
        if(s[0]=='(' && s[1]=='('){
            printf("(())\n");
            return 0;
        }
        if(s[0]==')' && s[1]==')'){
            printf("(())\n");
            return 0;
        }
        if(s[0]==')' && s[1]=='('){
            printf("()()\n");
            return 0;
        }
    }
    //n>=3
    i=0;
    int u=n-1;
    while(u>0 && i<u){
        if(s[i]=='(' && s[i+1]==')'){
            for(j=i;j<u-1;j++) s[j]=s[j+2];
            //printf("s=%s\n",s);
            u-=2;
            if(i!=0) i--;
        }
        else i++;
        //printf("u=%d\n",u);
    }
    int left=0,right=0;
    for(j=0;j<=u;j++){
        if(s[j]=='(') right++;
        else left++;
    }
    //printf("left=%d,right=%d\n",left,right);
    for(j=0;j<left;j++) printf("(");
    printf("%s",s1);
    for(j=0;j<right;j++) printf(")");
    putchar('\n');
    return 0;
}


Measured memory_bytes: 128
'use strict'
const d = require("fs").readFileSync("/dev/stdin", "utf8"),
      arr = d.split(" "),
      a = parseInt(arr[0], 10),
      b = parseInt(arr[1], 10);
if (a < b) {
  console.log(b + (b-1));
} else if (a == b) {
  console.log(a + b);
} else {
  console.log(a + (a-1));
}

Measured memory_bytes: 11468
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

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

	private void solve() throws IOException {
		try {
			//			solveA();
			solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numA = nextInt();
		int numB = nextInt();

		if (numA + numB >= 10) {
			out.println("error");
		} else {
			out.println(numA + numB);
		}

	}

	private void solveB() {
		char[] wkC = next().toCharArray();

		int[] wk = new int[26];

		for (int i = 0; i < wkC.length; i++) {
			int index = wkC[i] - (char) 'a';
			wk[index] += 1;
		}

		Arrays.sort(wk);

		out.println(wk[25] > 1 ? "no" : "yes");

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

int main() {

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

	vector<vector<char>> c(h + 2, vector<char>(w + 2, '-1'));
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> c[i][j];
		}
	}

	vector<bool>isWhiteRow(h + 2, true);
	vector<bool>isWhiteColumn(w + 2, true);

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (c[i][j] == '#') isWhiteRow[i] = false;
		}
	}

	for (int j = 1; j <= w; j++) {
		for (int i = 1; i <= h; i++) {		
			if (c[i][j] == '#') isWhiteColumn[j] = false;
		}
	}

	for (int i = 1; i <= h; i++) {
		if (isWhiteRow[i]) continue;
		for (int j = 1; j <= w; j++) {
			if (isWhiteColumn[j]) continue;
			cout << c[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;

int main(){
    long long N;
    cin >> N;
    vector<long long> D(N + 1, 0);
    for(long long i = 2; i <= N; i++){
        long long A = i;
        long long div = 2;
        while(A > 1){
            if(A % div == 0){
                A /= div;
                D[div]++;
            }else{
                div++;
            }
        }
    }
    
    long long ans = 1;
    for(long long i = 2; i <= N; i++){
        ans *= (D[i] + 1);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	int n;
	cin >> n;
	vector<ll> p(n), q(n), s(n);
	rep(i, n)
	{
		s[i] = i + 1;
		cin >> p[i];
	}
	rep(i, n)
	{
		cin >> q[i];
	}

	int pn = 0;
	int qn = 0;
	int nn = 0;
	do
	{
		rep(i, n)
		{
			if (s[i] == p[i])
			{
				if (i == n - 1)
					pn = nn;
			}
			else break;
		}
		rep(i, n)
		{
			if (s[i] == q[i])
			{
				if (i == n - 1)
					qn = nn;
			}
			else break;
		}
		nn++;
	} while (next_permutation(all(s)));

	cout << abs(pn - qn) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int H, W;
int map[20][20];
int c;
using namespace std;

void printArray();
void check(int, int);

int main() {
  while (true) {
    cin  >> W >> H;
    if ((W | H) == 0) {
      break;
    }
    int sy, sx;
    for (int i = 0; i < H; i++) {
      string line;
      cin >> line;
      for (int j = 0; j < W; j++) {
        if (line[j] == '@') {
          sy = i;
          sx = j;
          map[i][j] = 0;
        } else if (line[j] == '.') {
          map[i][j] = 0;
        } else if (line[j] == '#') {
          map[i][j] = 1;
        }
      }
    }
    // printArray();
    c = 0;
    check(sy, sx);
    // printArray();
    cout << c << endl;
  }
  return 0;
}

void check(int y, int x) {
  if (y < 0 || x < 0 || y >= H || x >= W || map[y][x] == 1) {
    return;
  }
  map[y][x] = 1;
  c++;
  check(y + 1, x);
  check(y - 1, x);
  check(y, x + 1);
  check(y, x - 1);
}

void printArray() {
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << map[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 1212
#include <stdio.h>

int main(void) {

  int d;
  scanf("%d", &d);
  long c[26];
  for (int i = 0; i < 26; i++) {
    scanf("%ld", &c[i]);
  }
  long s[d][26];
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      scanf("%ld", &s[i][j]);
    }
  }
  int t[d];
  for (int i = 0; i < d; i++) {
    scanf("%d", &t[i]);
  }
  int last[26];
  for (int i = 0; i < 26; i++) {
    last[i] = -1;
  }
  long score = 0;
  for (int i = 0; i < d; i++) {
    score += s[i][t[i]-1];
    last[t[i]-1] = i;
    for (int j = 0; j < 26; j++) {
      if (j == t[i]-1) {
        continue;
      }
      score -= c[j]*(i-last[j]);
    }
    printf("%ld\n", score);
  }

  return 0;
}

Measured memory_bytes: 1748
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
void solve(){
    int n , m ;
    cin >> n >> m ;
    vector < string > grid(n) ;
    for( int i = 0 ; i < n ; i++) cin >> grid[i] ;
    vector < vector < int > > dp(n,vector<int>(m));
    if(grid[0][0]=='#') dp[0][0] = 1 ;
    for( int i = 1 ; i < m ; i++){
        dp[0][i] = dp[0][i-1];
        if(grid[0][i-1]=='.' && grid[0][i]=='#')
            dp[0][i]++;
    }
    for( int i = 1 ; i < n ; i++){
        dp[i][0] = dp[i-1][0] ;
        if(grid[i-1][0]=='.' && grid[i][0]=='#')
            dp[i][0]++;
    }
//    for( int i = 0 ; i < n ; i++) cout << dp[i][0] << " " ;
//    cout << '\n' ;
    for( int i = 1 ; i < n ; i++){
        for( int j = 1 ; j < m ; j++){
            int x = dp[i-1][j] + (grid[i][j]=='#' && grid[i-1][j]=='.'?1:0);
            int  y = dp[i][j-1] + (grid[i][j]=='#' && grid[i][j-1]=='.'?1:0);
            dp[i][j] = min(x,y);
        }
    }
//    for( int i = 0 ; i < n ; i++){
//        for( int j = 0 ; j < m ; j++){
//            cout << dp[i][j] << " " ;
//        }
//        cout << '\n' ;
//    }
    cout << dp[n-1][m-1] ;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1 ;
    //cin >> t ;
    while(t--){
        solve( );
    }
}


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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  else if(ch == 'C') return 2;
  else if(ch == 'G') return 3;
  else if(ch == 'T') return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum = 0,p = 1,i;
  for(i=0;i<strlen(str);i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1 + (key % (M-1));}

int find(char str[]){
  long long key,i,h;
  key = getKey(str);
  for(i=0;;i++){
    h = (h1(key) + i*h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key = getKey(str); // 文字列を数字に変換

  for(i=0;;i++){
    h = (h1(key) + i*h2(key)) % M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],com[9];

  for(i=0;i<M;i++) H[i][0] = '\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);

    if(com[0] == 'i'){
      insert(str);
    }else{
      if(find(str)){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 16112
#include<iostream>
#include<set>

using namespace std;

int main() {
  int N,K;
  cin >> N >> K;
  set<int> hasSet;
  for(int i=0;i<K;i++){
    int d;
    cin >> d;
    for(int j=0;j<d;j++){
      int A;
      cin >> A;
      hasSet.insert(A);
    }
  }
  cout << N-hasSet.size() << endl;
}


Measured memory_bytes: 3636
import sys
s = input()
l = len(s)
k = 'keyence' # len(k)==7
if l < 7:
    print('NO')
    sys.exit()
diff = l - 7
flag = False
for i,kk in enumerate(k):
    #print(s[:i+1],k[:i+1],s[i+diff+1:],k[i+1:])
    if s[:i+1] == k[:i+1] and s[i+diff+1:] == k[i+1:]:
        flag = True
if flag:
    print('YES')
else:
    print('NO')

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

using namespace std;
using ll = long long;

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

    if (a == 'H') {
        if (b == 'H') cout << 'H' << endl;
        else cout << 'D' << endl;
    } else {
        if (b == 'H') cout << 'D' << endl;
        else cout << 'H' << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll ZERO = 0;
const ll INF = 1e14;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

int main() {
    int N;
    cin >> N;
    vector<P> vec(N);
    for(int i = 0;i < N;i++) {
        ll A,B;
        cin >> A >> B;
        vec.at(i) = P(A, B);
    }
    ll A = 1;
    ll B = 1;
    for(int i = 0;i < N;i++) {
        ll C = max((A + vec[i].first - 1) / vec[i].first,(B + vec[i].second - 1) / vec[i].second);
        A = vec[i].first * C;
        B = vec[i].second * C;
    }
    cout << A + B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n")
using P = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
using ll = long long;
const int dx4[4] = {1,0,-1,0};
const int dy4[4] = {0,1,0,-1};
const int dx8[8] = {-1,0,1,1,1,0,-1,-1};
const int dy8[8] = {1,1,1,0,-1,-1,-1,0};



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

  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  rep(i,m) cin >> x[i];
  sort(all(x));
  if(n >= m){
    cout << 0 << endl;
    return 0;
  }
  int sum = x[m-1]-x[0];
  vector<int> dist(m-1);
  REP(i,m){
    dist[i-1] = x[i]-x[i-1];
  }
  sort(rall(dist));
  rep(i,n-1){
    sum -= dist[i];
  }

  cout << sum << endl;

}

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

/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using ll = long long;
using PAIR = pair<int, int>;
using Graph = vector<vector<int>>;
// const ll INF = (1LL << 60);
const double pi=acos(-1.0);
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/**************************************/

/******** User-defined Function *******/

/**************************************/

/********** Main()  function **********/
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    if(n>=400 && n<=599) cout << 8 << endl;
    else if(n>=600 && n<=799) cout << 7 << endl;
    else if(n>=800 && n<=999) cout << 6 << endl;
    else if(n>=1000 && n<=1199) cout << 5 << endl;
    else if(n>=1200 && n<=1399) cout << 4 << endl;
    else if(n>=1400 && n<=1599) cout << 3 << endl;
    else if(n>=1600 && n<=1799) cout << 2 << endl;
    else if(n>=1800 && n<=1999) cout << 1 << endl;




}
/********  Main() Ends Here *************/


Measured memory_bytes: 3688
#include<iostream>
#include<string>
typedef long long ll;
using namespace std;
int main(){
  string s;
  cin>>s;
  ll ans=0;
  int n=s.size();
  
  for(int bit=0;bit<(1<<n-1);bit++){
    string ss="";
    for(int i=0;i<n;i++){
      ss+=s[i];
      if(bit>>i&1){
        ans+=stoll(ss);
        ss="";
      }
    }
    ans+=stoll(ss);
    ss="";
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int A[11][11];

int main() {
  int n,m;
  S2(n,m);
  rep(i,0,10) rep(j,0,10) S(A[i][j]);

  rep(k,0,10) rep(i,0,10) rep(j,0,10) {
    A[i][j] = min(A[i][j], A[i][k] + A[k][j]);
  }
  int ans = 0;
  rep(i,0,n) rep(j,0,m) {
    int x;
    S(x);
    if(x != 1 && x != -1) {
      ans += A[x][1];
    }
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
#define int ll
#define INF 100000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
using namespace std;
using pii = pair<int,int>;
vector<bool>used;
vector<vector<pii>>edge;
vector<int>d;
bool judge=true;

void dfs(int v,int val){
    used[v]=true;
    rep(i,edge[v].size()){
        int next=edge[v][i].first;
        int cost=edge[v][i].second;
        if(d[next]==INF){
            d[next]=val+cost;
            if(!used[next])dfs(next,d[next]);
        }else if(d[next]!=cost+val){
            judge=false;
        }
    }
}
signed main(){
    int n,m; cin>>n>>m;
    
    edge = vector<vector<pii>>(n);
    used = vector<bool>(n,false);
    d    = vector<int>(n,INF);
    
    rep(i,m){
        int a,b,c;cin>>a>>b>>c;
        --a,--b;
        edge[a].push_back(make_pair(b,c));
        edge[b].push_back(make_pair(a,-c));
    }
    rep(i,n)if(!used[i])dfs(i,0);
    cout << (judge ? "Yes" : "No") << endl;
}


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

const int MAX = 1e6+5;
int dp1[MAX];
int dp2[MAX];

void init(int n){
    int INF = 1e9;
    for(int j=0;j<=n;j++){
        dp1[j] = INF;
        dp2[j] = INF;
    }
    dp1[0] = 0;
    dp2[0] = 0;
}

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

    vector<int> a;
    vector<int> b;
    for(int i=1;i<100000;i++){
        int ret = i*(i+1)*(i+2)/6;
        if(ret > 1e6) break;
        a.push_back(ret);
        if(ret %2 == 1) b.push_back(ret);

    }
    init(1e6);
    for(int i=0;i<180;i++){
        if(a[i] > 1e6) break;
        for(int j=0;j<=1e6;j++){
            int p = j+a[i];
            if(p > 1e6) break;
            dp1[p] = min(dp1[p], dp1[j]+1);
        }
    }
    for(int i=0;i<b.size();i++){
        if(b[i] > 1e6) break;
        for(int j=0;j<=1e6;j++){
            int p = j+b[i];
            if(p > 1e6) break;
            dp2[p] = min(dp2[p], dp2[j]+1);
        }
    }





    int n;
    while(cin>>n){
        if(n==0) break;
        cout << dp1[n] << " ";
        cout << dp2[n] << "\n";
    }
}


Measured memory_bytes: 10904
def calc(s):
    t=s.split()
    a=int(t[0])
    b=int(t[2])
    op=t[1]
    if op=="+":
        return ("{0}".format(a+b))
    if op == "-":
        return ("{0}".format(a - b))
    if op == "*":
        return ("{0}".format(a * b))
    if op == "/":
        return ("{0}".format(a // b))
w="yj s npi"
a=[]
while(w.split()[1]!="?"):
    w=input()
    a.append(w)
a.pop()
for st in a:
    print("{0}".format(calc(st)))

Measured memory_bytes: 5600
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(long long a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

ll INF = 10000000;
ll mod = 1000000007;//10^9+7

int light[2000][2000] = {0};

//番号ズレ注意！！
int main() {
    int N, A, B;
    cin >> N;
    if (N == 1) {
        cout << "Hello World" << endl;
    }
    if (N == 2) {
        cin >> A >> B;
        cout << A + B << endl;
    }
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = ll(1e10)+1;

void Main() {
  int n;
  cin >> n;
  cout << (n+1)/2 << endl;
}

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


Measured memory_bytes: 256
from collections import Counter

n = int(input())
v = list(map(int,input().split()))
even1 = v[0::2]
odd1 = v[1::2]
even2 = Counter(even1)
odd2 = Counter(odd1)
a = even2.most_common()[0][0]
b = odd2.most_common()[0][0]
c = even2.most_common()[0][1]
d = odd2.most_common()[0][1]
if a != b:
 print(len(even1)-c+len(odd1)-d)
else:
 if len(list(set(even1))) == 1 and len(list(set(odd1))) == 1:
  print(len(even1))
 elif len(list(set(even1))) == 1:
  print(len(odd1)-odd2.most_common()[1][1])
 elif len(list(set(odd1))) == 1:
  print(len(even1)-even2.most_common()[1][1])
 else:
  e = even2.most_common()[1][1]
  f = odd2.most_common()[1][1]
  if c-e >= d-f:
   print(len(even1)*2-c-f)
  else:
   print(len(even1)*2-d-e)

Measured memory_bytes: 19968
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

N, M =getMN()
print(N-M+1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define int long long int
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define MOD 1000000007
#define MAX 200005
#define sz size()
ll power(ll n,ll x)
{
    if(x==0)   return 1;
    if(x%2==0) return power(n*n,x/2);
    else       return n*power(n*n,x/2);
}
bool prime(ll n)
{
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
ll powermode(ll n,ll x)
{
    if(x==0) return 1;
    ll y=((n%MOD)*(n%MOD))%MOD;
    if(x%2==0)  return powermode(y,x/2)%MOD;
    else    return ((n%MOD)*(powermode(y,x/2)%MOD))%MOD;
}
ll inv(ll a){ return powermode(a,MOD-(ll)2);}
ll mul(ll x,ll y) { return ((x%MOD)*(y%MOD))%MOD; }
ll sum(ll x,ll y) { return ( x%MOD+ y%MOD) %MOD;}
ll sub(ll x,ll y) {  return ((x%MOD)-(y%MOD)+MOD)%MOD;}
ll divide(ll x,ll y) { return mul(x,inv(y));}
ll N;
ll dfs(ll n, vector<ll>&v, vector< vector<ll> > &adj, vector<ll> &vis)
{
    ll cnt=0;
    vis[n]=true;
    for(auto x:adj[n])
    {
        if(!vis[x])
        {
            ll xx=dfs(x,v,adj,vis);
            cnt+=xx;
            v.pb( xx*(N-xx));
        }
    }
    return cnt+1;
}
ll i,j;
   void solve()
   {
       string s;
       cin>>s;
       ll cnt=0;
       for(auto x:s)
       {
           cnt=(cnt+(x-'0'))%9;
       }
       if(cnt==0)
       {
           cout<<"Yes\n";
       }
       else
       cout<<"No";
   }
   
            signed main()
            {
               FAST;
               ll q=1;
            //    cin>>q;
	            while(q--)
                {
                   solve();
                }
            }



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

int main() {
    int n, l; cin >> n >> l;
    int ans=1000, ans_n, sum=(2*l + n - 1) * n / 2;
    for(int i=1; i<n+1; i++) {
        if (ans > abs(l + i - 1)) {
            ans = abs(l + i - 1);
            ans_n = l + i - 1;
        }
    }
    cout << sum - ans_n << endl;
}

Measured memory_bytes: 256
/*やったぜ。　投稿者：変態糞土方 (8月16日（水）07時14分22秒)

昨日の8月15日にいつもの浮浪者のおっさん（60歳）と先日メールくれた汚れ好きの土方のにいちゃん

（45歳）とわし（53歳）の3人で県北にある川の土手の下で盛りあったぜ。

今日は明日が休みなんでコンビニで酒とつまみを買ってから滅多に人が来ない所なんで、

そこでしこたま酒を飲んでからやりはじめたんや。

3人でちんぽ舐めあいながら地下足袋だけになり持って来たいちぢく浣腸を3本ずつ入れあった。

しばらくしたら、けつの穴がひくひくして来るし、糞が出口を求めて腹の中でぐるぐるしている。

浮浪者のおっさんにけつの穴をなめさせながら、兄ちゃんのけつの穴を舐めてたら、

先に兄ちゃんがわしの口に糞をドバーっと出して来た。

それと同時におっさんもわしも糞を出したんや。もう顔中、糞まみれや、

3人で出した糞を手で掬いながらお互いの体にぬりあったり、

糞まみれのちんぽを舐めあって小便で浣腸したりした。ああ～～たまらねえぜ。

しばらくやりまくってから又浣腸をしあうともう気が狂う程気持ちええんじゃ。

浮浪者のおっさんのけつの穴にわしのちんぽを突うずるっ込んでやると

けつの穴が糞と小便でずるずるして気持ちが良い。

にいちゃんもおっさんの口にちんぽ突っ込んで腰をつかって居る。

糞まみれのおっさんのちんぽを掻きながら、思い切り射精したんや。

それからは、もうめちゃくちゃにおっさんと兄ちゃんの糞ちんぽを舐めあい、

糞を塗りあい、二回も男汁を出した。もう一度やりたいぜ。

やはり大勢で糞まみれになると最高やで。こんな、変態親父と糞あそびしないか。

ああ～～早く糞まみれになろうぜ。

岡山の県北であえる奴なら最高や。わしは163*90*53,おっさんは165*75*60、や

糞まみれでやりたいやつ、至急、メールくれや。

土方姿のまま浣腸して、糞だらけでやろうや。*/
#include "bits/stdc++.h"
#include <numeric>
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define llMIN numeric_limits<long long>::min()
#define intMIN numeric_limits<int>::min()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double

ll digitpower(ll a,ll b){//aのb乗を計算
  if(b==1){
    return a;
  }else if(b==0){
    return 1;
  }
  if(b%2==1){
    ll tmp = digitpower(a,(b-1)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    tmp*=a;
    return (tmp)%d9_7;
  }else{
    ll tmp = digitpower(a,(b)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    return (tmp)%d9_7;
  }
}
//階乗
vl facs(1000000,-1);
ll Factrial(ll num){
  if(facs[num]!=-1){
    return facs[num];
  }
  if(num==1||num<=0){
    return 1;
  }else if(num<0){
    printf("ERROR_minus\n");
    return 0;
  }else{
    facs[num]=(num*Factrial(num-1))%d9_7;
    return facs[num];
  }
}
long long modinv(long long a, long long m) {//modの逆元
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
ll linercomb(ll n,ll k, ll mod){//n,kの線形時間で求める
  ll ans=Factrial(n);
  ans*=modinv(Factrial(k),mod);
  ans%=d9_7;
  ll k1=Factrial(k);
  k1%=mod;
  ans*=modinv(k1,mod);
  ans%=mod;
  return ans;
}
struct datas{
  ll x;
  ll l;

};
bool cmp(const datas &a, const datas &b)
{
    return a.x < b.x;
}

int main(void){
  int n;
  cin>>n;
  vector<string> s(n);
  rep(i,n){
    cin>>s[i];
  }
  int cnt=0;
    rep(j,n){
      int flag=0;
      for(int i2=0;i2<n-1 && flag == 0;i2++){
        for(int j2=i2+1;j2<n&&flag==0;j2++){
          if(s[(i2+j)%n][(j2)%n]!=s[(j2+j)%n][(i2)%n]){
            flag=1;
          }
        }
      }
      if(flag==0)cnt+=n;
    }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 8192
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;


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



int main() {
	string S;
	int w;
	cin >> S;
	cin >> w;
	for (int i = 0; i < S.length(); i = i + w) {
		cout << S[i];
	}
}

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

using namespace std;

int main(){
	int n, k;
	cin>>n>>k;
	if(n==1) cout<<k;
	else{
		int res = 1;
			res= k*pow(k-1, n-1);
			cout<<res;
		}
	
	
	return 0;
	}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int c, d, ans;
    c = n / (a + b);
    d = n - c * (a + b);
    if (d >= a) {
        ans = c * a + a;
    } else {
        ans = c * a + d;
    }

    cout << ans << endl;
}

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

const double EPS = 1e-12;
int K, L, R;
double P, E, T;

double dfs(int i, double L, double R) {
  if (i == K) return abs((L + R) / 2 - T) < E;
  if (R + EPS < T - E || T + E < L - EPS) return 0;
  else if (T - E < L - EPS && R + EPS < T + E) return 1;
  double H = (L + R) / 2, res = 0;
  res += dfs(i + 1, L, H) * (T < H + EPS ? 1 - P : P);
  res += dfs(i + 1, H, R) * (T > H + EPS ? 1 - P : P);
  return res;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> K >> L >> R >> P >> E >> T;
  cout << dfs(0, L, R) << endl;

  return 0;
}


Measured memory_bytes: 3296
from bisect import bisect
import sys

d = {}
p = []
for s in sys.stdin:
    t,n = map(int,s.split(","))
    if [t,n] == [0,0]: break
    d[t] = n
    p.append(n)

p = sorted(list(set(p)))
for s in sys.stdin:
    print len(p)+1 -bisect(p, d[int(s)])

Measured memory_bytes: 4292
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#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;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define CLR2d(x,m,n) memset(x, -1, sizeof(x[0][0]) * m * n)
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
ll po(ll b,ll p){
    ll res=1;
    while(p){
        res*=b;
        p--;
    }
    return res;
}
ll lg2(ll x){
    ll res=0;
    while(x>1){
        res++;
        x/=2ll;
    }
    return res;
}
void solve(){
    ll n;
    cin>>n;
    n--;
    cout<<(((1+n)*n)/2ll)<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("input.txt","r",stdin);
        freopen ("output.txt","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




Measured memory_bytes: 3648