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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n; std::cin >> n;
  vi d(n); rep(i, n) std::cin >> d[i];
  sort(rng(d));
  int l = d[n/2-1], r = d[n/2];
  std::cout << r - l << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
        #include<iostream>
        #include<cstdio>
        #include<vector>
        #include<queue>
        #include<map>
        #include<cstring>
        #include<string>
        #include <math.h>
        #include<algorithm>
    //    #include <boost/multiprecision/cpp_int.hpp>
        #include<functional>
      #define int long long
        #define inf  1000000007
        #define pa pair<int,int>
#define ll long long
        #define pal pair<ll,ll>
        #define ppa pair<int,pa>
        #define  mp make_pair
        #define EPS (1e-10)
        #define equals(a,b) (fabs((a)-(b))<EPS)

        using namespace std;

        class Point{
        	public:
        	double x,y;
        	Point(double x=0,double y=0):x(x),y(y) {}
        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
        	Point operator * (double a) {return Point(x*a,y*a);}
        	Point operator / (double a) {return Point(x/a,y/a);}
        	double absv() {return sqrt(norm());}
        	double norm() {return x*x+y*y;}
        	bool operator < (const Point &p) const{
        		return x != p.x ? x<p.x: y<p.y;
        	}
        	bool operator == (const Point &p) const{
        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
        	}
        };
        typedef Point Vector;

        struct Segment{
        Point p1,p2;
        };

    double hen(Vector a){
    if(fabs(a.x)<EPS && a.y>0) return acos(0);
    else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
    else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
    else if(fabs(a.y)<EPS && a.x>0) return 0.0;
    else if(a.y>0) return acos(a.x/a.absv());
    else return 2*acos(0)+acos(-a.x/a.absv());

    }

        double dot(Vector a,Vector b){
        	return a.x*b.x+a.y*b.y;
        }
        double cross(Vector a,Vector b){
        	return a.x*b.y-a.y*b.x;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        //----------------kokomade temple------------


signed main(){
	int a[110]={0};
	int z,zz,zzz;
	cin>>z>>zz>>zzz;
	a[z]++;
	a[zz]++;
	a[zzz]++;
	
	int ans=0;
	for(int i=0;i<107;i++) if(a[i]!=0) ans++;
	cout<<ans<<endl;
	return 0;
}

//printf("%.10f\n",ans);


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

int main(){
  ll h; cin >> h;
  ll t=1;
  if(h==1){
      cout << t;
      return 0;
  }
  ll x=1;
  while(true){
    x*=2;
    if(x>h){
      cout << t;
      return 0;
    }
    t=1+2*t;
  }

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String data;
        String[] cmd;
        int count, j = 0, from, to;

        try {
            data = br.readLine();
            count = Integer.parseInt(br.readLine());
            sb.append(data);
            while (count-- > 0) {
                cmd = br.readLine().split(" ");
                from = Integer.parseInt(cmd[1]);
                to = Integer.parseInt(cmd[2]);
                // logic
                // print a b print from a to b
                // reverse a b reverse charter from a to b
                // replace a b c replace charecter from a to b as c
                if (cmd[0].equals("print")) {
                    System.out.println(sb.substring(from, to + 1));
                    continue;
                } else if (cmd[0].equals("reverse")) {
                    rev(sb, from, to);
                    continue;
                } else if (cmd[0].equals("replace")) {
                    for (int i = from; i <= to; i++) {
                        sb.setCharAt(i, cmd[3].charAt(j++));
                    }
                    j = 0;
                    continue;
                } else {
                    return;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

   public static void rev(StringBuilder data, int from, int to) {
        char tmp;

        for (int i = 0; i < (to - from + 1) / 2; i++) {
			tmp = data.charAt(from + i);
			data.setCharAt(from + i , data.charAt(to - i));
			data.setCharAt(to - i, tmp);
			/*
			tmp = data.charAt(from);
            data.setCharAt(i, data.charAt(to));
            data.setCharAt(to--, tmp);
			*/
        }
    }
}



Measured memory_bytes: 24780
N = int(input())
def rk(n, memo):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    if memo[n] != 0:
        return memo[n]
    else:
        memo[n] = rk(n-1,memo) + rk(n-2,memo)
        return memo[n]
memo = [0 for i in range(87)]
print(rk(N, memo))

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back


vector<pair<ll,ll>> pfact(ll n)
{
    vector<pair<ll,ll>> pf;
    ll t = n, cnt;
    
    for(ll i=2; i*i<=t; ++i) {
        cnt = 0;
        if(t % i != 0) continue;
        while(t % i == 0) {
            t /= i;
            ++cnt;
        }
        pf.pb(make_pair(i, cnt));
    }
    
    if(t != 1) pf.pb(make_pair(t, 1));
    
    return pf;
}

int main()
{
    ll N, P;
    cin >> N >> P;

    auto pf = pfact(P);
    ll g = 1;
    FORR(p,pf) {
        ll d = 1;
        REP(i,0,p.second/N) d *= p.first;
        g *= d;
    }
    PR(g);

    return 0;
}

/*



*/

Measured memory_bytes: 3624
#include<stdio.h>

typedef long long ll;

int main(void){
    ll L, R;
    ll i, j;
    ll min = 2018*2017;
    ll Lp, Lq, Rp, Rq; 

    scanf("%lld %lld", &L, &R);

    for(i = L; i < R; i++){
        for(j = i+1; j <= R; j++){
            if(min > (i*j)%2019){
                min = (i*j)%2019;
            }
            if(j > i+1+2019){
                break;
            }
        }
        if(i > L+2019)
            break;
    }

    printf("%d", min);
    return 0;


/*
    Lq = L%2019;
    Rq = R%2019;



    if(R - L >= 2019){
        printf("0");
        return 0;
    }else if(Lq > Rq){
        printf("0");
        return 0;
    }else if(Lq == 0){
        printf("0");
        return 0;
    }else{
        printf("%lld", Lq*(Lq+1));
        return 0;
    }

*/
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        String[] sl = s.split("");
        if (sl[k-1].equals("A")) {
            sl[k-1] = "a";
        } else if (sl[k-1].equals("B")) {
            sl[k-1] = "b";
        } else if (sl[k-1].equals("C")) {
            sl[k-1] = "c";
        }
        System.out.println(String.join("", sl));
    }

}


Measured memory_bytes: 21844
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    s = input()
    MOD = 2019
    d = [ 0 for i in range(MOD)]
    ans = 0
    k = 0
    d[0] = 1
    s = s[::-1]
    p = 1
    for i in s:
        k = (p * int(i) + k) % MOD
        ans += d[k]
        d[k] += 1
        p = (p * 10) % MOD
    print(ans)
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 9288
from time import time
t = time()
count = 0
a,b,c = map(int,input().split())
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(count)
        exit()
    count += 1
    a1 = b//2+c//2
    b1 = c//2+a//2
    c1 = a//2+b//2
    a = a1
    b = b1
    c = c1
    if time()-t >= 1.8:
        print(-1)
        exit()

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
using namespace std;
vector<vector<int>>V; int H, W, cnt, vx, vy;
void solve(vector<vector<int>> &p, int x, int y, int cr) {
	int dx[4] = { 1,0,-1,0 };
	int dy[4] = { 0,1,0,-1 };
	int cx = x, cy = y;
	if (cr == 0) { if (x == vx || y == vy)cnt++; return; }
	for (int i = 0; i < 4; i++) {
		cx = x; cy = y;
		while (true) {
			if (cx < 0 || cx >= H || cy < 0 || cy >= W)break;
			if (p[cx][cy] == 3) {
				p[cx][cy] = 1;
				solve(p, cx, cy, cr - 1);
				p[cx][cy] = 3;
				break;
			}
			cx += dx[i]; cy += dy[i];
		}
	}
}
int main() {
	while (true) {
		cin >> W >> H; if (H == 0)break; cnt = 0; int vr = 0;
		vector<vector<int>> a(H, vector<int>(W));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> a[i][j];
				if (a[i][j] == 2) { vx = i; vy = j; }
				if (a[i][j] == 1) { a[i][j] = 3; vr++; }
			}
		}
		solve(a, vx, vy, vr);
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;




int main(){
    int D;
    cin >> D;
    string ans;
    if (D==25){
        ans = "Christmas";
    }else if(D==24){
        ans = "Christmas Eve";
    }else if(D==23){
        ans = "Christmas Eve Eve";
    }else{
        ans = "Christmas Eve Eve Eve";
    }
    cout << ans << endl;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

long Even(vector<int> a){
    long res = 0;
    long temp = 0;

    REP(i, a.size()){
        temp += a[i];
        if (i % 2 == 0){
            while (temp <= 0){
            temp += 1;
            res += 1;
            }
        }
        else{
            while (temp >= 0){
            temp += -1;
            res += 1;
            }
        }
    }
    return res;
}

long Odd(vector<int> a){
    long res = 0;
    long temp = 0;

    REP(i, a.size()){
        temp += a[i];
        if (i % 2 == 0){
            while (temp >= 0){
            temp += -1;
            res += 1;
            }
        }
        else{
            while (temp <= 0){
            temp += 1;
            res += 1;
            }
        }
    }
    return res;
}

int main() {
    int n, ans;
    cin >> n;
    vector<int> a(n);
    REP(i, n){
        cin >> a[i];
    }
    
    cout << min(Even(a), Odd(a)) << endl;
}

Measured memory_bytes: 1408
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define i_inf int(1e9)
#define i_half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define reprone(i, n) for(ll i = n - 1; i >= 1; i--)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

string s;
unordered_map<char, vector<int> > mp;

bool all_same(string s, char target) {
    rep(i, s.length()) {
        if (s[i] != target) return false;
    }
    return true;
}

void solve() {
    int ans = i_inf;
    for (int i = 'a'; i <= 'z'; ++i) {
        string s1(s);
        int temp = 0;
        while (s1.length() != 0 && !all_same(s1, char(i))) {
            reprone(j, s1.length()) {
                if (s1[j] == char(i) && s1[j - 1] != char(i)) {
                    s1[j - 1] = char(i);
                    j--;
                    if (j == 0) break;
                }
            }
            temp++;
            s1.erase(s1.end() - 1);
        }
        if (all_same(s1, char(i))) ans = min(ans, temp);
    }
    cout << ans << endl;
}

int main() {
    cin >> s;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} // input vector


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

int H, N; cin>> H >> N;
VI A(N), B(N); rep(i, 0, N) cin >> A[i] >> B[i];

VI magic(H+1, 0);
rep(h, 1, H+1){
    magic[h] = magic[h-1] + B[0];
    rep(i, 0, N){
        magic[h] = min(magic[h], magic[max((i64)0, h - A[i])] + B[i]);
    }
}
cout << magic[H] << "\n";
}
// 書いて考える．場合分け．情報整理．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define     bolt     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     text     freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define     F        first
#define     S        second
#define     pb       push_back
#define     lb       lower_bound
#define     ub       upper_bound
#define     endl     "\n"
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7 ;
const ld pi=3.1415926535897932384626433;
const ll inf = 1e18;
ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}

int main()
{
   bolt;
   ll n;
   cin>>n;
   ll ans=0;
   for (ll i=1;i<=n;i++)
   {
      if (i%3!=0 and i%5!=0)
         ans+=i;
   }
   cout<<ans;
}


Measured memory_bytes: 3648
#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];
  vector<int> b={};
  for(int i=0;i<n;i++){
    auto itr=b.begin();
    if(n%2==0){
      if(i%2==0) b.push_back(a[i]);
      else b.insert(itr,a[i]);
    }
    else{
      if(i%2==1) b.push_back(a[i]);
      else b.insert(itr,a[i]);
    }
      
  }
  for(int i=0;i<n-1;i++) cout<<b[i]<<" ";
  cout<<b[n-1]<<endl;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define reps(i,a,b) for(long long int i=a;i<b;i++)
#define rep(i,a) for(long long int i=0;i<a;i++)
typedef long long int ll;
using namespace std;
ll MOD = 1000000007;

const int MAX = 510000;

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



int main(){
    string S;
    cin>>S;
    vector<vector<int>> a(200000);
    ll ans = 0;
    int imabasho=0;
    rep(i,S.size()){
        if(S[i]=='A'){
            a[imabasho].push_back(1);
        }
        else{
            if(S[i]=='B' && S[i+1]=='C'){
                a[imabasho].push_back(2);
                i++;
            }
            else{
                if(S[i]=='B'){
                    imabasho++;
                }
                else{
                    imabasho++;
                }
            }
        }
    }

    rep(i,imabasho+1){
        int count=0;
        rep(j,a[i].size()){
            if(a[i][j]==2){
                ans +=ll(j)-count;
                count++; 
            }
        }
       
    }

    cout<<ans<<endl;

    return 0;
}

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

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int N=sc.nextInt();
		pw.println(N/3);
		pw.close();
	}

	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    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;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    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 int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <regex>
#include <initializer_list>
#define DBL_MIN 0.000000000000001
 
#define A_P(n,a,d) (n/2)*(2*a + (n-1)*d)
using namespace std;
 
//ちゃんとlong型でやってる？
 
int main(void){
    long N;
    cin >> N;
    long table[10001] = {0};
    for(long a =1; a <= 101; a++){
        for(long b =1; b <= 101; b++){
            for(long c =1; c <= 101; c++){
                long index = a*a + b*b + c*c + a*b + b*c + a*c;
                if(index <= 10000)
                    table[index]++;
            }
        }
    }
 
    for(int i =1; i <= N; i++){
        cout << table[i] << endl;    
    }
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]==',')
            s[i]=' ';
    }
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 3612
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf("%lld", &(n))
#define scd(n) scanf("%Ld", &(n))
typedef long long LL;
typedef pair<LL, LL> PLL;
LL getdist(PLL& a, PLL& b) {
	return (abs(a.second - b.second) + abs(a.first - b.first));
}

int main(void)
{
	LL n, m;
	vector<pair<LL, LL> > st, chk;
	sci(n); sci(m);
	st.resize(n); chk.resize(m);
	for (int i = 0; i < n; i++) { sci(st[i].first); sci(st[i].second);}
	for (int i = 0; i < m; i++) { sci(chk[i].first); sci(chk[i].second);}

	for (int i = 0; i < st.size(); i++) {
		LL sht = 1e9;
		LL shtidx = -1;
		for (int j = 0; j < chk.size(); j++) {
			LL dist = getdist(st[i], chk[j]);
			if (dist < sht) { 
				sht = dist; 
				shtidx = j;
			}
		}
		printf("%lld\n", shtidx+1);
	}
	return 0;
}

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

class link_vector{
	std::vector<int> vec;
	std::vector<int> &ind;
public:
	link_vector(std::vector<int> &ind): ind(ind) {}
	void print(){
		for(int i : vec){
			std::cout << i << " ";
		}
		std::cout << std::endl;
		for(int i : ind){
			std::cout << i << " ";
		}
		std::cout << std::endl;
	}
	void enlarge(){
		vec.push_back(int());
	}
	void reduce(){
		vec.pop_back();
	}
	void substitute(const int &i, const int &x){
		vec[i] = x;
		ind[x] = i;
	}
	int operator[](const int &i){
		return vec[i];
	}
	int size(){
		return vec.size();
	}
	int front(){
		return vec.front();
	}
	int back(){
		return vec.back();
	}
	bool empty(){
		return vec.empty();
	}
};

class heap{
	link_vector vec;
	std::function<bool(int, int)> fnc;
public:
	heap(std::vector<int> &ind, std::function<bool(int, int)> fnc): vec(ind), fnc(fnc) {}
	void push(int x){
		vec.enlarge();
		chmin(vec.size() - 1, x);
	}
	bool empty(){
		return vec.empty();
	}
	int top(){
		return vec.front();
	}
	void pop(){
		int x = vec.back();
		int i = 0;
		vec.reduce();
		for(;;){
			int j = i * 2 + 1;
			if(j + 1 < vec.size() && fnc(vec[j + 1], x) && fnc(vec[j + 1], vec[j])) ++j;
			else if(j >= vec.size() || fnc(x, vec[j])) break;
			vec.substitute(i, vec[j]);
			i = j;
		}
		vec.substitute(i, x);
	}
	void chmin(int i, int x){
		while(i != 0){
			int j = (i - 1) / 2;
			if(fnc(vec[j], x)) break;
			vec.substitute(i, vec[j]);
			i = j;
		}
		vec.substitute(i, x);
	}
	void print(){
		vec.print();
	}
};

struct edge{
	int to;
	int cost;
};

std::vector<int> dijkstra(std::vector<std::vector<edge>> e){
	std::vector<int> ret(e.size(), 0);
	std::vector<int> ind(e.size(), -1);
	std::vector<bool> fin(e.size(), false);

	heap h(ind, [&ret](int l, int r){ return ret[l] < ret[r]; });

	h.push(0);

	while(!h.empty()){
		int cur = h.top();
		h.pop();
		fin[cur] = true;
		for(edge i : e[cur]){
			if(!fin[i.to]){
				if(ind[i.to] == -1){
					ret[i.to] = ret[cur] + i.cost;
					h.push(i.to);
				}else if(ret[i.to] > ret[cur] + i.cost){
					ret[i.to] = ret[cur] + i.cost;
					h.chmin(ind[i.to], i.to);
				}
			}
		}
	}

	return ret;
}

int main(){
	int n;
	std::cin >> n;

	std::vector<std::vector<edge>> e(n);

	for(int i = 0; i < n - 1; ){
		std::cin >> i;
		int k;
		std::cin >> k;
		e[i].resize(k);
		for(int j = 0; j < k; ++j){
			std::cin >> e[i][j].to >> e[i][j].cost;
		}
	}

	std::vector<int> ans = dijkstra(e);

	for(int i = 0; i < n; ++i){
		std::cout << i << " " << ans[i] << std::endl;
	}
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e6+5;

int n, A, b;
int a[N];
int x=0, y=0, z=0;

int32_t main()
{
	IOS;
	cin>>n>>A>>b;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		x+=(a[i]<=A);
		y+=((a[i]>A)&&a[i]<=b);
		z+=(a[i]>b);
	}	
	int ans=min({x, y, z});
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

int main()
{
  long long N;
  cin >> N;
  vector<long long> A(N);
  rep(i, N)
  {
    cin >> A[i];
  }
  vector<long long> dp(N, 0);
  dp[0] = 1000;
  rep(ni, N) rep(i, N)
  {
    if (ni <= i)
      continue;

    long long buy_count = dp[i] / A[i];
    long long next_money = dp[i];
    next_money -= buy_count * A[i];
    next_money += buy_count * A[ni];
    dp[ni] = max({dp[ni], next_money, dp[i]});
  }

  long long ans = 0;
  rep(i, N)
  {
    ans = max(dp[i], ans);
  }

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


Measured memory_bytes: 3624
import math
a,b,C=map(int,input().split())
s=math.sin(math.radians(C))
S=(a*b*s)/2
c=math.cos(math.radians(C))
x=a*a+b*b-2*a*b*c
d=math.sqrt(x)
L=a+b+d
h=(2*S)/a

print(S)
print(L)
print(h)


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  int64_t K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i]--;
  }
  vector<int> B(N, -1);
  int cur = 0, dist = 0;
  while (B[cur] == -1) {
    B[cur] = dist++;
    cur = A[cur];
    K--;
    if (K == 0) {
      cout << cur + 1 << '\n';
      return 0;
    }
  }
  K %= dist - B[cur];
  while (true) {
    if (K == 0) {
      cout << cur + 1 << '\n';
      return 0;
    }
    cur = A[cur];
    K--;
  }
  return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++

int main() {
    char a ,b;
    cin >> a >> b;
    if (a == 'H') {
        cout << b;
    }
    else if (a == 'D') {
        if (b == 'H') cout << 'D' << endl;
        else if (b == 'D') cout << 'H' << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, A, i, j, ans = 0;
  cin >> N >> K;
  vector<int> num(N);
  for (i = 0; i < N; i++) {
    cin >> A;
    num.at(A - 1)++;
  }
 
  sort(num.begin(), num.end());
  reverse(num.begin(), num.end());
  
  for (i = K; i < N; i++) ans += num.at(i);
  cout << ans << endl;
}


Measured memory_bytes: 4052
#include<stdio.h>
int f[3001][3001];
const int MOD=998244353;
int main(void)
{
  int A,B,C,D,ans=0,temp;
  if(!scanf("%d %d %d %d",&A,&B,&C,&D))return 0;
  f[A][B]=1;
  for(int i=A+1;i<=C;i++)
  {
    temp=0;
    for(int j=B;j<=D;j++)
    {
      f[i][j]=(temp+1ll*f[i-1][j]*j)%MOD;
      temp=(1ll*(temp+f[i-1][j])*(i-1))%MOD;
    }
  }
  for(int j=B;j<=D;j++){ans=(1ll*ans*C+f[C][j])%MOD;}
  return printf("%d\n",ans),0;
}

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

int main(){
    int n,m,q; cin >> n >> m >> q;
    int a[q],b[q],c[q],d[q];
    for(int i=0; i<q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];

    //全ての数列を作る
    ll ans = 0;
    for(int i1=1; i1<m+1; i1++){
        for(int i2=i1; i2<m+1; i2++){
            for(int i3=i2; i3<m+1; i3++){
                for(int i4=i3; i4<m+1; i4++){
                    for(int i5=i4; i5<m+1; i5++){
                        for(int i6=i5; i6<m+1; i6++){
                            for(int i7=i6; i7<m+1; i7++){
                                for(int i8=i7; i8<m+1; i8++){
                                    for(int i9=i8; i9<m+1; i9++){
                                        for(int i10=i9; i10<m+1; i10++){
                                            ll sum = 0;
                                            int array[11] = {0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10};

                                            for(int j=0; j<q; j++){
                                                if(array[b[j]] - array[a[j]] == c[j]) sum += d[j];
                                            }

                                            ans = max(ans,sum);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3604
// ~/BAU/ACM-ICPC/Teams/Rampage/MMZA
// ~/sudo apt-get verdict Accepted
// practice...
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<pair<int, int>> vp;
typedef vector<vector<pair<int, int>>> vvp;
typedef unsigned long long ull;
typedef long double ld;
const int Mod = 1000000007;
int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
int r;
scanf("%d",&r);
if(r<1200)
puts("ABC");
else if(r<2800)
puts("ARC");
else puts("AGC");
    return 0;
}

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

int main(){
  long long int n,k,x;
  cin>>n>>k>>x;
  int g;
  if((n-1)%(k-1)==0){
    g=(n-1)/(k-1);
  } else{
  n-=(n-1)%(k-1);
  n+=(k-1);
  g=((n-1)/(k-1));
  }
  cout<<g<<endl;
  return 0;
}
  

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int ans = 0;
		int len = s.length() / 2;
		int i;
		for(i = 0; i < len; i++) {
			if(!s.substring(i, i + 1).equals(s.substring(s.length() - 1 - i, s.length() - i))) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}


int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
int ans;
int cnt[100];

signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int k = 0;
		while (k * 10 <= i) {
			k = max((int)1, k * 10);
		}
		cnt[(i / k) * 10 + i % 10]++;
	}
	for (int i = 11; i <= 99; i++) {
		ans += cnt[i] * cnt[(i % 10) * 10 + i / 10];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int M, T, P, R;
    cin >> M >> T >> P >> R;
    if (M == 0 && T == 0 && P == 0 && R == 0){
      break;
    }
    vector<vector<int>> s(T, vector<int>(P, -1));
    vector<vector<int>> wa(T, vector<int>(P, 0));
    for (int i = 0; i < R; i++){
      int m, t, p, j;
      cin >> m >> t >> p >> j;
      t--;
      p--;
      if (j == 0){
        if (s[t][p] == -1){
          s[t][p] = m + wa[t][p] * 20;
        }
      } else {
        wa[t][p]++;
      }
    }
    vector<tuple<int, int, int>> score(T);
    for (int i = 0; i < T; i++){
      int ac = 0;
      int time = 0;
      for (int j = 0; j < P; j++){
        if (s[i][j] != -1){
          ac++;
          time += s[i][j];
        }
      }
      score[i] = make_tuple(ac, - time, i + 1);
    }
    sort(score.rbegin(), score.rend());
    for (int i = 0; i < T; i++){
      cout << get<2>(score[i]);
      if (i < T - 1){
        if (get<0>(score[i]) == get<0>(score[i + 1]) && get<1>(score[i]) == get<1>(score[i + 1])){
          cout << '=';
        } else {
          cout << ',';
        }
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 3096
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        char[][] map = Enumerable.Repeat(0, 8).Select(_ => Enumerable.Repeat('.', 8).ToArray()).ToArray();
        bool[] hContains = new bool[8];
        bool[] wContains = new bool[8];
        bool[] hpwContains = new bool[15];
        bool[] hmwp7Contains = new bool[15];
        for (int i = 0; i < n; i++)
        {
            var rc = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var r = rc[0];
            var c = rc[1];
            map[r][c] = 'Q';
            hContains[r] = true;
            wContains[c] = true;
            hpwContains[r + c] = true;
            hmwp7Contains[r - c + 7] = true;
        }
        if (!IsPossible(map, hContains, wContains, hpwContains, hmwp7Contains)) goto end;
        Console.WriteLine(string.Join("\n", res.Select(x => string.Join("", x))));
        return;
        end:;
        Console.WriteLine("No Answer");
    }
    static char[][] res = null;
    static bool IsPossible(char[][] c, bool[] hContains, bool[] wContains, bool[] hpwContains, bool[] hmwp7Contains)
    {
        if (hContains.All(x => x) && wContains.All(x => x))
        {
            res = c;
            return true;
        }
        int hindex = -1;
        for (int i = 0; i < 8; i++)
        {
            if (!hContains[i])
            {
                hindex = i;
                break;
            }
        }
        if (hindex == -1) return false;
        for (int i = 0; i < 8; i++)
        {
            if (!wContains[i] && !hpwContains[hindex + i] && !hmwp7Contains[hindex - i + 7])
            {
                var newc = c.Select(x => x.ToArray()).ToArray();
                var newhc = hContains.ToArray();
                var newwc = wContains.ToArray();
                var newhpwc = hpwContains.ToArray();
                var newhmwp7c = hmwp7Contains.ToArray();
                newc[hindex][i] = 'Q';
                newhc[hindex] = true;
                newwc[i] = true;
                newhpwc[hindex + i] = true;
                newhmwp7c[hindex - i + 7] = true;
                if (IsPossible(newc, newhc, newwc, newhpwc, newhmwp7c)) return true;
            }
        }
        return false;
    }
}



Measured memory_bytes: 18396
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(void) {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
  }

  vector<ll> sunuke(n);
  sunuke[0] = a[0];
  for (int i = 1; i < n; ++i) {
    sunuke[i] = sunuke[i - 1] + a[i];
  }
  vector<ll> arai(n);
  arai[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; --i) {
    arai[i] = arai[i + 1] + a[i];
  }

  ll ans = abs(sunuke[0] - arai[1]);
  for (int i = 1; i < n - 1; ++i) {
    ans = min(ans, abs(sunuke[i] - arai[i + 1]));
  }

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

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    vll X(N);
    rep(i, N) cin >> X.at(i);

    ll ans = 0;
    rep(i, N-1) {
        ans += min((X[i+1]-X[i])*A, B);
    }

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

Measured memory_bytes: 3956
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var r = sc.nextInt();
        WriteLine(3 * Pow(r, 2));
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

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

  reverse(a.begin(), a.end());
  rep(i, n) printf("%d%c", a[i], (i == n - 1) ? '\n' : ' ');
}


Measured memory_bytes: 3088
import java.util.*;
public class Main {
    static int counter = 0;
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] ls = new int[n];
        for(int x = 0; x < n; x++){
            ls[x] = scan.nextInt();
        }
        merge_sort(ls, 0, n);
        for(int x = 0; x < n; x++){
            if(x == n -1){
                System.out.println(ls[x]);
            }
            else{
                System.out.print(ls[x] + " ");
            }
        }
        System.out.println(counter);
    }
    public static void merge_sort (int[] lst, int left, int right){
        if(left + 1 < right){
            int mid = (left + right)/2;
            merge_sort(lst, left, mid);
            merge_sort(lst, mid, right);
            merge(lst, left, mid, right);
        }
    }
    public static void merge(int[] A, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;
        int[] L = new int[n1];
        int[] R = new int[n2];
        for (int i = 0; i < n1; i++) {
            L[i] = A[left + i];
        }
        for (int i = 0; i < n2; i++) {
            R[i] = A[mid + i];
        }
        int l = 0;
        int r = 0;
        for(int i = left; i < right; i++){
            counter++;
            if(l >= n1){
                A[i] = R[r];
                r++;
            }
            else if(r >= n2){
                A[i] = L[l];
                l++;
            }
            else if (L[l] <= R[r]){
                A[i] = L[l];
                l++;
            }
            else{
                A[i] = R[r];
                r++;
            }
        }
    }
}


Measured memory_bytes: 169128
//#define M_PI 3.14159265358979323846
#define _USE_MATH_DEFINES

//#define _GLIBCXX_DEBUG
//#define all(x) (x).begin(),(x).end()

#include <bits/stdc++.h>

#define TASK ""
#define sqr(x) ((x)*(x))
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
const ll INFLL = numeric_limits<int>::max();
const ll INFINT = numeric_limits<int>::max();
const ld EPS = 1e-7;
const ll MOD = 1000000000;
const ll MAXN = 123456;

void run()
{
    ll n;
    cin >> n;
    cout << n * (n + 1) / 2;
}

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

#ifdef LOCAL
//#define STRESS
#ifdef STRESS
    freopen("input.txt", "w", stdout);
    cout << "1000 50\n";
    for (int i = 0; i < 999; i++)
    {
        for (int j = 0; j < 999; j++) cout << ".";
        cout << "X\n";
    }
    for (int j = 0; j < 1000; j++)
        if (j != 1000 / 50)cout << "X";
        else cout << ".";
    return 0;

#endif
    if (strcmp(TASK, "-") != 0)
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
#else
    if (strcmp(TASK, "")   != 0)
    {
        freopen(TASK".in", "r", stdin)  ;
        freopen(TASK".out", "w", stdout)  ;
    }
#endif
    run();

    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	ll n,m; cin >> n >>m;
	if(n>m) swap(n,m);
	if(n==1) {
		if(m==1){
		cout << 1 << endl;
		return 0;
	}
		cout << m-2 << endl;
		return 0;
	}
	ll ans = (m-2)*(n-2);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int N, M;
	cin >> N >> M;
	int MIN = 1, MAX = N;
	for(int i=0;i<M;i++)
	{
		int min, max;
		cin >> min >> max;
		if (min > MIN)MIN = min;
		if (max < MAX)MAX = max;
	}
	if (MIN <= MAX)cout << MAX - MIN + 1;
	else { cout << "0"; }
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double EPS = 1e-9;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

/* ????????????
????????¨??±??????????????????n?????¨m???????????????????????£?????????
??????????????????????????????????????????
????????¨??±???????????????????????????????¨????1??????????????????????????????????????????
???????????????????????????????????????
 */

/* ?§£???
????????????????¨?????±???????
?????????????¨???????t[i](??????????????????i?????????)??????????????????h[j](??±???????????????j?????????)????????????????????¨
??±??????????¨???????t[i]???????????????h[j]?????????????????????????????§????????¨??????????????????t[i]??¨h[j]?????????
2??????????¨??????????????????????????????????????????°????????´?????????t[i]??¨h[i]???????¨????????°?????????????????????¨???????????§

 */

int n, m;

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	while (cin >> n >> m, n || m) {
		int t[n + 1], h[m + 1];
		int sum1 = 0, sum2 = 0;
		REP(i, 1, n + 1) {
			cin >> t[i];
			sum1 += t[i];
		}
		REP(i, 1, m + 1) {
			cin >> h[i];
			sum2 += h[i];
		}
		int ans1 = 100, ans2 = 100;
		int tmp = 1000;
		REP(i, 1, n + 1) REP(j, 1, m + 1) {
			if (sum1 - t[i] + h[j] == sum2 + t[i] - h[j]) {
				if (tmp > t[i] + h[j]) {
					ans1 = t[i];
					ans2 = h[j];
					tmp = t[i] + h[j];
				}
			}
		}
		if (ans1 != 100 && ans2 != 100) {
			cout << ans1 << ' ' << ans2 << endl;
		} else {
			cout << -1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1156
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include<map> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)
#define  max(x,y) ((x)>(y)?(x):(y))
#define  min(x,y) ((x)>(y)?(y):(x))

//C++で提出



// string s="AAA";    s.size() =3    (sのサイズ) ...1
// vector <int> a;    配列a(サイズは0) ...2
// a.push_back(10);   配列のサイズが一つ増えて一番後ろに10を代入 ...2
// A.pop_back();   最後の要素が消去される
// sort(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)より前までを小さい順に並び替えてa[0]から代入していく...3
// reverse(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)までを逆の順にしてa[0]から代入していく
// s.substr(3,2)   配列s[3]から2個の文字を抜き出した文字列 (s[3]とs[4]) ...4
// strcmp(s1,s2)  文字列が等しければ0を出力　s1>s2なら1 s1<s2なら-1を出力　C言語用なので配列は、s1[100]にする...5





int main()
{
	int x, a, b;
	cin >> x >> a >> b;
	
	if (a >= b) cout << "delicious";
	else if (a < b && b <= a + x) cout << "safe";
	else if (b > a + x) cout << "dangerous";

	return 0;
}
	




Measured memory_bytes: 256
A, B = map(int, input().split())
ans = 0
i = 2
while i > 0:
    if i==2 and A == B:
        ans = 2 * A
        break

    elif A > B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
    i -= 1
print(ans)


Measured memory_bytes: 2940