akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

#include<string.h>
int main (void){
  
 long int a,b,c,max=0,n=0,i,k,flag=0,sum=0,count;
scanf("%ld%ld",&a,&b);

   printf("%ld",2*(b-a)+a);

return 0;
    
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    long long ans=0;
    for(int i=1;i<=n;i++){
        if(i%3 != 0 && i%5 != 0){
            ans += i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define iterator IT
#define SIZ(V) V.size()
#define FS(a) fixed<<setprecision(a)
using namespace std;
namespace STARTER {
	int MAX(int a,int b) {return a>b?a:b;}
	int MIN(int a,int b) {return a<b?a:b;}
	int ABS(int a) {return a<0?-a:a;}
	int GCD(int a,int b) {return !b?a:GCD(b,a%b);}
	int LCM(int a,int b) {return a/GCD(a,b)*b;}
	int QSM(int a,int b,int p) {int ret=1;while (b) (b&1)&&(ret=ret*a%p),a=a*a%p,b>>=1;return ret;}
	int ROUND(double a) {return a+0.5;}
}
using STARTER::MAX;
using STARTER::MIN;
using STARTER::ABS;
using STARTER::GCD;
using STARTER::LCM;
using STARTER::QSM;
using STARTER::ROUND;
const int maxN=2005;int n,x,y,/*dis[maxN][maxN],*/s[maxN][maxN],ans[maxN],t[maxN*maxN];
int main() {
	cin>>n>>x>>y/*,dis[x][y]=1*/;
	//for (int i=1;i<n;i++) dis[i][i+1]=1; 
	//for (int i=1;i<n;i++)
	//	for (int j=i+1;j<=n;j++) dis[i][j]=1;
	for (int i=1;i<n;i++)
		for (int j=i+1;j<=n;j++) //{
			//if (i<=x&&j>=y) s[i][j]=x-i+1+j-y;
			//else s[i][j]=j-i;
			s[i][j]=min(j-i,ABS(x-i)+1+ABS(y-j));
		//}
	//for (int i=1;i<n;i++) {
	//	for (int j=i+1;j<=n;j++) printf("s[%d][%d]=%d ",i,j,s[i][j]);
	//	puts("");
	//}
	for (int i=1;i<n;i++)
		for (int j=i+1;j<=n;j++) t[s[i][j]]++;
	for (int k=1;k<n;k++) cout<<t[k]<<'\n';
}

Measured memory_bytes: 17024
#include<iostream>
#include<string>
using namespace std;
string s;
int main(){
    int l;
    cin>>s;
    l=s.size();
    for(int i=0;i<l;i++){
        if(s[i]=='C'){
            for(int j=i+1;j<l;j++){
                if(s[j]=='F'){
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
local n = io.read("*n")
local k = io.read("*n"
)
io.read("*l")
local towns = {}
for i = 1, n do 
	towns[i] = io.read("*n")
end
io.read("*l")
local visited = {}
local step = 1
local idx = 1
local period
local periodstart
local steps = {}
while(step <= k) do 
	if visited[towns[idx]] then
		period = step - visited[towns[idx]]
		periodstart = visited[towns[idx]]
		break
	end
	visited[towns[idx]] = step
	steps[step] = towns[idx]
	idx = towns[idx]
	step = step + 1
end
if period then 
	local resttimes = k - step
	resttimes = resttimes % period
	print(steps[periodstart + resttimes])
else
	print(idx)
end

Measured memory_bytes: 20672
import itertools


def f(A):
    A = A[::-1]
    ret = 0
    for c, a in enumerate(A):
        ret += int(a) * 10 ** int(c)

    return ret


S = input()
ans = f(S)

# +の数
for n in range(1, len(S)):
    for k in itertools.combinations(range(1, len(S)), r=n):
        st = 0
        q = 0
        for i in k:
            q += f(S[st:i])
            st = i
        q += f(S[st:])
        ans += q

print(ans)


Measured memory_bytes: 74376
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x) {
    S[++top] = x;
}

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

int main() {
    int a, b;
    top = 0;
    char s[100];
    while(scanf("%s", s) != EOF) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());
    return 0;
}



Measured memory_bytes: 2100
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanTextSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = scanText()
	}
	return a
}

func scanSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanFloatSlice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = scanFloat()
	}
	return a
}

// var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	k := scanInt()
	x := scanInt()

	if k*500 >= x {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n, d;
	cin >> n >> d;
	int x[10][10];
	REP(i, n) {
		REP(j, d) {
			cin >> x[i][j];
		}
	}
	int ans = 0, sum, b;
	double a;
	REP(i, n) {
		for (int k = i + 1; k < n; k++) {
			sum = 0;
			REP(j, d) {
				sum += (x[i][j] - x[k][j]) * (x[i][j] - x[k][j]);
			}
			a = sqrt(abs(sum));
			b = sqrt(abs(sum));
			if (a - (double)b == 0)
				ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
INF = 10**8
N, M = gets.split.map(&:to_i)
bridges = []
M.times do
  bridges << gets.split.map(&:to_i)
end
bridges.sort_by!{|x| x[1]}
# p bridges
t = -INF
count = 0
bridges.each do |bridge|
  next if t > bridge[0]
  count += 1
  t = bridge[1]
end
puts count


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

int main()
{
	int N;
	std::cin >> N;
	double mean = 0.0;
	int X[100];
	for (int i=0; i<N; i++) {
		std::cin >> X[i];
		mean += (double)X[i];
	}
	mean /= (double)N;
	int P = (int)std::round(mean);
	int min_sum = 0;
	for (int i=0; i<N; i++) min_sum += (X[i]-P)*(X[i]-P);
	std::cout << min_sum << std::endl;
	return 0;
}


Measured memory_bytes: 3528
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0, tmp = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
        if (i % 2 == 1) {
            tmp += a[i];
        }
    }

    vector<ll> x(n);
    x[0] = sum - tmp * 2;

    REP(i, 1, n) {
        x[i] = (a[i - 1] - x[i - 1] / 2) * 2;
    }

    rep(i, n) {
        cout << x[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
int asc(const void *a, const void *b) {
  long *A = (long *)a;
  long *B = (long *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}
int main(int argc, char* argv[]){
  int a=0,b=0,ans=0;
  char  t[10],s[10],c[10];
  scanf("%d",&a);
  long int k[a];
  for (int i = 0; i < a; i++) {
    scanf("%ld",&k[i]);
  }
  long int kn[a];
  qsort(k, sizeof(k) / sizeof(long int), sizeof(long int), asc);
  for (int i = 1; i < a; i++) {
    if (k[i]==k[i-1]) {
      ans=1;
    }
  }
  if (ans==1) {
    printf("NO");
  }else{
    printf("YES");
  }
}


Measured memory_bytes: 3324
#include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N, D, X, P[20][20];

int step(int d) {
  int *w = P[d];
  int *v = P[d + 1];

  int dp[20][100001];
  REP(i, 0, N) REP(j, 0, 100001) dp[i][j] = 0;
  for(int i = 0; w[0] * i <= X; i++) dp[0][w[0] * i] = v[0] * i;
  REP(i, 0, N - 1) REP(j, 0, X + 1) {
    dp[i + 1][j] = dp[i][j];
    if(j - w[i + 1] >= 0) {
      dp[i + 1][j] = max(dp[i + 1][j], dp[i + 1][j - w[i + 1]] + v[i + 1]);
    }
  }

  int ret = X;
  REP(i, 0, X + 1) ret = max(ret, X - i + dp[N - 1][i]);
  return ret;
}

int main(void) {
  cin >> N >> D >> X;
  REP(i, 0, D) REP(j, 0, N) cin >> P[i][j];
  REP(i, 0, D - 1) X = step(i);
  cout << X << endl;

  return 0;
}

Measured memory_bytes: 7004
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  ll ans = 0;
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    if(i%2==0 && a%2)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll p = 3;
  vector<ll> s(3);
  in3(s[0], s[1], s[2]);
  sort(all(s));
  if(s[0] == s[1])
    p--;
  if(s[1] == s[2])
    p--;
  out(p);
  memi;
}

Measured memory_bytes: 256
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
P = LIST()
Q = LIST()

import itertools

for i, l in enumerate(itertools.permutations(range(1, N+1), N)):
    if list(l) == P:
        a = i+1
    if list(l) == Q:
        b = i+1

print(abs(a-b))

Measured memory_bytes: 41584
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int A = sc.nextInt();
		
		if(X < A) {
			System.out.println(0);
		} else {
			System.out.println(10);
		}
	}
}


Measured memory_bytes: 22100
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while(true) {
      int n = sc.nextInt();
      int m = sc.nextInt();
      int s = sc.nextInt();
      int g1 = sc.nextInt();
      int g2 = sc.nextInt();

      if(n == 0 && m == 0 && s == 0 && g1 == 0 && g2 == 0) break;

      s = s-1;
      g1 = g1-1;
      g2 = g2-1;

      int[][] cost = new int[n][n];


      int b1, b2;

      for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
          if(i == j) cost[i][j] = 0;
          else cost[i][j] = Integer.MAX_VALUE / 10;
        }
      }

      for(int i = 0; i < m; i++) {
        b1 = sc.nextInt()-1;
        b2 = sc.nextInt()-1;
        cost[b1][b2] = sc.nextInt();
      }
      
      for(int k = 0; k < n; k++) {
        for(int i = 0; i < n; i++) {
          for(int j = 0; j < n; j++) {
              cost[i][j] = Math.min(cost[i][j] , cost[i][k] + cost[k][j]);
          }
        }
      }

      int p4 = Integer.MAX_VALUE / 10;

      for(int k = 0; k < n; k++) {
        p4 = Math.min(p4, cost[s][k] + cost[k][g1] + cost[k][g2]);
      }

      System.out.println(p4);
  
    }
  }
}

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

const int mod = 1000000007;
ll dp[2020][2020];
ll sum[2020][2020];

int main(void){
    int n, m;
    cin >> n >> m;
    vector<ll> s(n);
    vector<ll> t(m);
    for(int i = 0; i < n; i++){
        cin >> s[i];
    }
    for(int i = 0; i < m; i++){
        cin >> t[i];
    }

    memset(dp, 0, sizeof(dp));
    memset(sum, 0, sizeof(sum));

    dp[0][0] = 1; // 空文字どうしなので
    // sum[0][0] = 1;(冗長)

    // 絶対ここだわ、nまでしか足してなかった。
    for(int i = 0; i <= 2020; i++){sum[0][i] = 1; sum[i][0] = 1;}

    ll ret = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(s[i-1] == t[j-1]){
                dp[i][j] = sum[i-1][j-1]%mod;
            }
            sum[i][j] = (sum[i][j-1] + sum[i-1][j] + mod - sum[i-1][j-1] + dp[i][j])%mod;
        }
    }
    cout << sum[n][m]%mod << endl;
    // for(int i = 0; i <= n; i++){
    //     for(int j = 0; j <= m; j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;
    // for(int i = 0; i <= n; i++){
    //     for(int j = 0; j <= m; j++){
    //         cout << sum[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    return 0;
}


Measured memory_bytes: 67408
def North(dice):
    w = dice[0]
    dice[0] = dice[1]
    dice[1] = dice[5]
    dice[5] = dice[4]
    dice[4] = w
    return dice
def East(dice):
    w = Dice[0]
    dice[0] = dice[3]
    dice[3] = dice[5]
    dice[5] = dice[2]
    dice[2] = w
    return dice
def South(dice):
    w = dice[0]
    dice[0] = dice[4]
    dice[4] = dice[5]
    dice[5] = dice[1]
    dice[1] = w
    return dice
def West(dice):
    w = dice[0]
    dice[0] = dice[2]
    dice[2] = dice[5]
    dice[5] = dice[3]
    dice[3] = w
    return dice

Dice = input().split()
Roll = list(input())

for roll in Roll:
    if roll == 'N':
        Dice = North(Dice)
        continue
    if roll == 'E':
        Dice = East(Dice)
        continue
    if roll == 'S':
        Dice = South(Dice)
        continue
    if roll == 'W':
        Dice = West(Dice)
        continue

print(Dice[0])

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


int main(){

  string s;
  cin >> s;

  string odd;
  int counter = 0;
  while(s[counter]){
    if(counter%2 == 0){
        odd.push_back(s[counter]);
    }
    ++counter;
  }

  cout << odd << endl;

  return 0; 
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define FLOAT setprecision(16)
#define INSIDE(i,j,H,W) ((i) >= 0 && (i) < (H) && (j) >= 0 && (j) < (W))
#define YesNo(b) (b ? "Yes" : "No")
#define YESNO(b) (b ? "YES" : "NO")
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }

// all_of
// partial_sum, adjacent_difference

#if _DEBUG
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#endif

#if 1234567891
#include <array>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N;
string S;
int X, Y, Z;
int main() {
	cin >> S;
	cout << S.substr(0,S.size() - 8) << endl;
	return 0;
}

Measured memory_bytes: 764
#include <stdio.h>

int main()
{
  int x, m, n, i;
  char c[101];
  scanf("%d", &n);
  scanf("%s", c);
  x=0;
  m=0;
  for(i=0; i<n; i++){
    x += (c[i]=='I' ? 1 : -1);
    if(x>m) m=x;
  }

  printf("%d", m);
  return 0;
}

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

int main() {
    string S;
    int Q;
    cin >> S >> Q;

    deque<char> dq;
    for (char c : S) dq.push_back(c);

    bool rev = false;
    for (int i = 0; i < Q; i++) {
        int T;
        cin >> T;
        if (T == 1) {
            rev = !rev;
        } else {
            int F;
            char C;
            cin >> F >> C;
            if (rev) F = 3 - F;
            if (F == 1) dq.push_front(C);
            else dq.push_back(C);
        }
    }
    if (rev) reverse(dq.begin(), dq.end());

    string ans = "";
    for (char c : dq) ans += c;

    cout << ans << endl;
}

Measured memory_bytes: 1412
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>
# include <set>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

ll f[200005], invf[200005], mod = 1e9+7;

ll mul(ll a, ll b){
    return ((a%mod)*(b%mod))%mod;
}

ll pw(ll b, ll e){
    if(e==0) return 1;
    ll t = pw(b,e/2);
    if(e&1) return mul(b,mul(t,t));
    return mul(t,t);
}

ll inverse(ll x){
    return pw(x,mod-2);
}

void precompute(){
    f[0] = invf[0] = 1;
    FOR(i,200000){
        f[i] = mul(i, f[i-1]);
        invf[i] = inverse(f[i]);
    }
}

vector<int> color[200005];
int minWgt = 1<<30, secMinWgt = 1<<30, minCol = 1<<30;
int main(){

    ios :: sync_with_stdio(false);
    precompute();
    int N, X, Y;
    cin >> N >> X >> Y;

    FOR(i,N){
        int col, wgt;
        cin >> col >> wgt;
        color[col].push_back(wgt);
        if(wgt < minWgt){
            secMinWgt = minWgt;
            minWgt = wgt;
            minCol = col;
        }
        else if(wgt < secMinWgt && col != minCol){
            secMinWgt = wgt;
        }
    }

    ll ans = 1, cur = 0;
    FOR(i,N){
        if(color[i].empty()) continue;
        int mn = 1<<30, sum = 0;
        REP(j, color[i].size()) mn = min(mn, color[i][j]);
        if(mn + minWgt <= Y){
            if(i == minCol){
                REP(k, color[i].size()){
                    sum += (color[i][k] + mn <= X) || (color[i][k] + secMinWgt <= Y); 
                }
            }
            else{
                REP(k, color[i].size()){
                    sum += (color[i][k] + mn <= X || (color[i][k] + minWgt <= Y));
                }
            }

            cur += sum;
            ans = mul(ans, invf[sum]);
        }
    }

    ans = mul(ans, f[cur]);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12416
/*
    In the name of Allah

    MohammadErfan Gooneh

*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

#define endl                        '\n'
#define all(a, n)                   for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define IOS                         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
int main() {
    IOS ;
    int a, b;
    cin >> a  >> b ;
    if((a+b)%2 == 0)
    cout << (a+b)/2 ;
    else cout <<"IMPOSSIBLE" ;





















return 0 ;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());




int n;
int niz[200005];

priority_queue<int> pq;


int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);

    cin >> n;
    ff(i,0,n - 1)cin >> niz[i];
    sort(niz, niz + n);
    reverse(niz, niz + n);
    ll sum = 0;
    if(n == 2){
        cout << niz[0] << "\n";
        return 0;
    }
    sum += niz[0];
    pq.push(niz[1]);
    pq.push(niz[1]);
    ff(i,2,n - 1){
        ll sta = pq.top();
        pq.pop();
        sum += sta;
        pq.push(niz[i]);
        pq.push(niz[i]);
    }
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 5060
l=[]
for i in range(5):
  l.append(int(input()))
k=int(input())
ans = 0
for i in range(5):
  for j in range(5):
    if l[i]-l[j]>k:
      ans +=1
if ans>0:
  print(":(")
else:
  print("Yay!")

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
 
int main(void) {
  char s[201], p[101];
 
  scanf("%s", s);
  scanf("%s", p);
 
  sprintf(s, "%s%s", s, s);
 
  puts(strstr(s, p) == NULL ? "No" : "Yes");
 
  return 0;
}

Measured memory_bytes: 560
N = int(input())
M = int(input())
T = [int(i) - 1 for i in input().split()]
P = [0] * N
for i in range(M):
    t = T[i]
    E = [int(_) - 1 for _ in input().split()]
    ap = 0
    for j in range(N):
        if E[j] == t:
            P[j] += 1
        else:
            ap += 1
    P[t] += ap

for p in P:
    print(p)


Measured memory_bytes: 5632
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize, // 500
        b: usize, // 100
        c: usize, // 50
        x: i32, // total
    }

    let mut patterns = 0;
    for n500 in 0..(a + 1) {
        for n100 in 0..(b + 1) {
            for n50 in 0..(c + 1) {
                let total = (n500 * 500 + n100 * 100 + n50 * 50) as i32;
                if total == x {
                    patterns += 1;
                }
            }
        }
    }

    println!("{}", patterns);
}


Measured memory_bytes: 4352
n,q=map(int,input().split())
query=[list(input().split()) for _ in range(q)]
from bisect import bisect_right as bl
ax=[-n]
vx=[n-2]
ay=[-n]
vy=[n-2]
ans=(n-2)**2
for t,i in query:
  i=int(i)
  if t=='1':
    idx=bl(ax,-i)
    if idx==len(ax):
      ax.append(-i)
      vx.append(vx[-1])
      vy[-1]=i-2
    ans-=vx[idx-1]
  else:
    idx=bl(ay,-i)
    if idx==len(ay):
      ay.append(-i)
      vy.append(vy[-1])
      vx[-1]=i-2
    ans-=vy[idx-1]
print(ans)


Measured memory_bytes: 132964
N = int(input())
cntAB = 0
cntA = 0
cntB = 0
BcntA = 0
for i in range(N):
  s = input()
  if s[0] == "B" and s[-1] == "A":
    BcntA += 1
  elif s[0] == "B" and s[-1] != "A":
    cntB += 1
  elif s[0] != "B" and s[-1] == "A":
    cntA += 1
  for j in range(1,len(s)):
    if s[j-1] == "A" and s[j] == "B":
      cntAB += 1
if BcntA!=0:
  if cntA+cntB>0:
    print(cntAB+min(cntA,cntB)+BcntA)
  else:
    print(cntAB+BcntA-1)
else:  
  print(cntAB+min(cntA,cntB))

Measured memory_bytes: 3064
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from itertools import permutations

n,m = li()
graph = [[False]*n for _ in range(n)]

for _ in range(m):
    a,b = li_()
    graph[a][b] = True
    graph[b][a] = True
    
cands = list(permutations([i for i in range(1,n)]))

ans = 0

for c in cands:
    cand = [0] + list(c)
    ok = True
    for i in range(n-1):
        if not graph[cand[i+1]][cand[i]]:
            ok = False
    
    if ok:   
        ans += 1
    
print(ans)

Measured memory_bytes: 3572
url = "https://atcoder.jp//contests/abc073/tasks/abc073_b"

def main():
    n = int(input())
    t = []
    for i in range(n):
        t.append(list(map(int, input().split())))

    count = 0
    for li in t:
        count += (li[1] - li[0]) + 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
ll slide(vector<ll>& v, ll a, ll b) {
	ll azv = abs(v[0] - a);
	ll bzv = abs(v[0] - b);
	ll aov = abs(v[1] - a);
	ll bov = abs(v[1] - b);
	v[0] = a;
	v[1] = b;
	return max((azv + bov), (bzv + aov));
}


void solv() {

	ll x, y, z, k;
	cin >> x >> y >> z >> k;
	ll ai[3];
	ai[0] = x;
	ai[1] = y;
	ai[2] = z;
	ll a[3][1010];
	for (size_t i = 0; i < x; i++)
		cin >> a[0][i];
	for (size_t i = 0; i < y; i++)
		cin >> a[1][i];
	for (size_t i = 0; i < z; i++)
		cin >> a[2][i];

	sort(a[0], a[0] + x, greater<ll>());
	sort(a[1], a[1] + y, greater<ll>());
	sort(a[2], a[2] + z, greater<ll>());
	priority_queue<pair<ll, vector<int>>> q;

	q.push(pair<ll, vector<int>>(a[0][0] + a[1][0] + a[2][0], { 0,0,0 }));
	ll res[10000];
	int rc = 0;
	map<vector<int>,bool> m;
	while (!q.empty() && rc < k)
	{
		pair<ll, vector<int>> p = q.top();
		q.pop();
		res[rc++] = p.first;
		for (size_t i = 0; i < 3; i++)
		{
			if (p.second[i] + 1 < ai[i]) {
				ll na = p.first - a[i][p.second[i]] + a[i][p.second[i] + 1];
				vector<int> cp = p.second;
				cp[i]++;
				if (m.count(cp)) continue;
				m[cp] = true;
				q.push(pair<ll, vector<int>>(na, cp));
			}
		}

	}

	sort(res, res + k,greater<ll>());
	for (size_t i = 0; i < k; i++)
	{
		cout << res[i] << endl;
	}
}


int main() {
	//COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 1408
import java.io.*;
import java.util.Scanner;


public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
 
        do{
            String line1 = scanner.next();
            String line2 = scanner.next();
            int h = Integer.parseInt(line1);
            int w = Integer.parseInt(line2);
            if(h == 0 && w == 0){
                break;
            }
            for(int i =0;i < h; i++){
                for(int j = 0; j < w; j++){
                    if(j == 0 || j == w - 1 || i == 0 || i == h - 1){
                    System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.print("\n");
            }

            System.out.print("\n");
 
        }while(true);
       
    }

}




Measured memory_bytes: 36452
using System;
using System.Collections.Generic;

namespace ALDS1_3_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var porland = new Stack<int>();
            string[] str = Console.ReadLine().Split();
            for (int i = 0; i < str.Length; i++)
            {
                if (str[i] == "+")
                {
                    porland.Push(porland.Pop() + porland.Pop());
                }
                else if (str[i] == "-")
                {
                    porland.Push(-1 * (porland.Pop() - porland.Pop()));
                }
                else if (str[i] == "*")
                {
                    porland.Push(porland.Pop() * porland.Pop());
                }
                else if (str[i] == "/")
                {
                    porland.Push(porland.Pop() / porland.Pop());
                }
                else
                {
                    porland.Push(int.Parse(str[i]));
                }
            }
            Console.WriteLine(porland.Pop());
        }
    }
}

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

int main()
{
	int a[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> a[i][j];
		}
	}
	int s{ a[0][0] };
	int t{ a[1][0] };
	int u{ a[2][0] };
	int v{ a[0][1] };
	int w{ a[0][2] };
	if (t + v - s == a[1][1] && t + w - s == a[1][2] && u + v - s == a[2][1] && u + w - s == a[2][2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int a; cin >> a;
    int b, c, d; cin >> b >> c >> d;
    out(max(a * b, c * d));
}



Measured memory_bytes: 764
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto W = new long[](N);
    auto V = new int[](N);
    foreach (i; 0..N) {
        s = readln.split.map!(to!int);
        W[i] = s[0];
        V[i] = s[1];
    }

    const int MAX = 10^^5 + 1;
    auto dp = new long[][](N+1, MAX);
    foreach (i; 0..N+1) fill(dp[i], (1L<<59));
    dp[0][0] = 0;

    foreach (i; 0..N) {
        dp[i+1] = dp[i].dup;
        foreach (j; 0..MAX) {
            if (j + V[i] >= MAX) break;
            dp[i+1][j+V[i]] = min(dp[i+1][j+V[i]], dp[i][j] + W[i]);
        }
    }

    int ans = 0;
    foreach (j; 0..MAX) if (dp[N][j] <= M) ans = j;

    ans.writeln;
}


Measured memory_bytes: 145660
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        // 整数の入力
        List<Integer> list = new ArrayList<>();
        int num = sc.nextInt();
        int count = 0;

        for(int i=0;i<num;i++){
            list.add(sc.nextInt());
        }
        
        for(int i=0;i<num;i++){
            if(list.get(i) % 2 == 1){
            }else{
                if(list.get(i) % 3 == 0 || list.get(i) % 5 == 0){
                } else{
                    count++;
                }
            }
        }
       
        if(count == 0){
            System.out.println("APPROVED");
        }else{
            System.out.println("DENIED");
        }


    
	}
}

Measured memory_bytes: 21588
N = int(input())
A = [int(a)-1 for a in input().split()]
X = [0] * N
for a in A:
	X[a] += 1
s = 0
for x in X:
	s += x * (x-1) // 2
for a in A:
	print(s - (X[a] - 1))


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

#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

//Pasos para el desarrollo
//1) Nos damos cuenta de que al crecer el valor de K, el número de operaciones es decreciente
//2) Vamos a resolver el problema al revés: para un número de operaciones fijos, buscamos el mayor K
//3) Luego para un valor de k, buscamos cuál es el máx. número de op. que tuve el valor de k asociado mayor

using namespace std;

int rep[3*(int)1e5 + 1];
int opToMaxK[3*(int)1e5 + 1];
int rem[3*(int)1e5 + 1];

int main(){
	optimizar_io;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		int v;
		cin >> v;
		rep[v-1]++;
	}
	sort(rep, rep + N, greater<int>());
	for (int i = N - 1; i >= 0; i--){
		rem[i] = rem[i+1] + rep[i];
	}
	for (int op = 1; op <= N; op++){
		//Buscamos la cantidad de cartas con op o mas apariciones
		int geq = (upper_bound(rep, rep + N, op, greater<int>()) - rep);
		int max_k = geq + rem[geq] / op;
		opToMaxK[op] = max_k;
	}
	for (int k = 1; k <= N; k++){
		//Tenemos que busca la mayor operación que tuve valor mayor o igual que k
		int geq = (upper_bound(opToMaxK + 1, opToMaxK + N + 1, k, greater<int>()) - (opToMaxK + 1));
		cout << geq << endl;
	}
	return 0;
}


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

    using namespace std;
    typedef long long ll;
    void __print(int x) {cerr << x;}
    void __print(long x) {cerr << x;}
    void __print(long long x) {cerr << x;}
    void __print(unsigned x) {cerr << x;}
    void __print(unsigned long x) {cerr << x;}
    void __print(unsigned long long x) {cerr << x;}
    void __print(float x) {cerr << x;}
    void __print(double x) {cerr << x;}
    void __print(long double x) {cerr << x;}
    void __print(char x) {cerr << '\'' << x << '\'';}
    void __print(const char *x) {cerr << '\"' << x << '\"';}
    void __print(const string &x) {cerr << '\"' << x << '\"';}
    void __print(bool x) {cerr << (x ? "true" : "false");}

    template<typename T, typename V>
    void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
    template<typename T>
    void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
    void _print() {cerr << "]\n";}
    template <typename T, typename... V>
    void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
    #ifndef ONLINE_JUDGE
    #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
    #else
    #define debug(x...)
    #endif
    const long long INF  = 1e18;
    int md = 1e9+7;
    ll powmod(ll x,ll y){
        ll res=1;
        for(ll i=0;i<y;i++){
            res=res*x%md;
        }
        return res;
    }
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        long long n;
        cin>>n;
        if(n==1)
        {
            cout<<"0";
            exit(0);
        }
        ll ans = powmod(10,n) - powmod(9,n)- powmod(9,n) + powmod(8,n);
        ans %=md;
        ans = (ans + md)%md;
        cout<<ans;
        
    }
    //https://www.youtube.com/watch?v=ZQqccia8bVo

Measured memory_bytes: 3652
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

int main()
{
    map<string,int> mp;
    map<string,int>::iterator  it;
    int tp,q,val;
    string key;
    string r,l;
    cin>>q;
    while(q--){
        cin>>tp;
        if(tp==1)
        {
            cin>>key;
            if((it=mp.find(key))!=mp.end())cout<<it->second<<"\n";
            else  cout<<"0\n";
        }
        else if(tp==0){
            cin>>key>>val;
            mp[key]=val;
        }
        else if(tp==2){
            cin>>key;
            if(mp.find(key)!=mp.end())mp.erase(key);
        }
        else if(tp==3){
            cin>>l>>r;
            it=mp.lower_bound(l);

            while(it!=mp.end()&&it->first<=r){
                cout<<it->first<<" "<<it->second<<"\n";
                it++;
            }
        }
    }
}


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

using namespace std;

int main(){
	
	int n;
	
	cin>>n;
	
	int h[n+1],dp[n+1];
	
	for(int i=1; i<=n; i+=1){
		
		cin>>h[i];
		
		dp[i] = -1;
	}
	
	dp[1] = 0;
	
	for(int i=1; i<=n; i+=1){
		
		int j = i+1;
		
		int k = j+1;
		
		if(j<=n){
			
			if(dp[j] == -1){
				
				dp[j] = dp[i] + abs(h[j]-h[i]);
			}
			
			else{
				
				dp[j] = min(dp[j] , dp[i] + abs(h[j]-h[i]));
			}
		}
		
		if(k<=n){
			
			if(dp[k] == -1){
				
				dp[k] = dp[i] + abs(h[k]-h[i]);
			}
			
			else{
				
				dp[k] = min(dp[k] , dp[i] + abs(h[k]-h[i]));
			}
		}
	}
	
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include <cmath>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define ITER(c) __typeof((c).begin())
#define PB(e) push_back(e)
#define FOREACH(i, c) for(ITER(c) i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define PARITY(n) ((n) & 1)

typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-10;

const int maxm = 100000;

bool is_prime[maxm + 2];
vector<int> primes;

void sieve(){
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false;
  for(int i = 2; i * i <= maxm; i++){
    if(is_prime[i]){
      for(int j = i * 2; j <= maxm; j += i){
        is_prime[j] = false;
      }
    }
  }
  REP(i, maxm + 1) if(is_prime[i]) primes.push_back(i);
}

int main(){
  int m, a, b;
  sieve();
  
  while(cin >> m >> a >> b && (m + a + b) > 0){
    ll best = 0;
    ll bestp = 0;
    ll bestq = 0;
    
    REP(i, primes.size()){
      REP(j,i + 1){
        int p = primes[j];
        int q = primes[i];
        if(p * q > m) break;
        if((ll)a * q <= (ll)p * b && p * q >= best){
          best = p * q;
          bestp = p;
          bestq = q;
        }
      }
    }
    cout << bestp << " " << bestq << endl;
  }
  return 0;
}

Measured memory_bytes: 1420
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;// 1000000007;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, X, Y;
	cin >> N >> X >> Y;
	X--; Y--;
	VLL ans(N, 0);
	for (LL i = 0; i < N; i++) {
		for (LL j = i + 1; j < N; j++) {
			LL temp = j - i;
			temp = min(temp, abs(i - X) + 1 + abs(Y - j));
			temp = min(temp, abs(i - Y) + 1 + abs(X - j));
			ans[temp]++;
		}
	}
	for (LL k = 1; k < N; k++) {
		cout << ans[k] << "\n";
	}
	return 0;
}

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

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

  if (a!=b && a!=c) {
    cout << a << endl;
  } else if (b!=a && b!=c) {
    cout << b << endl;
  } else {
    cout << c << endl;
  }
}

Measured memory_bytes: 256
<?php
$input = trim(fgets(STDIN));
List($h, $w) = explode(" ", $input);

while(($h+$w) > 0) {

  $s1 = substr(str_repeat("#.", ceil($w/2)), 0, $w);
  $s2 = substr(str_repeat(".#", ceil($w/2)), 0, $w);

  for ($i=0; $i<$h; $i++) {
    if (($i % 2) == 0) {
      echo $s1.PHP_EOL;
    } else {
      echo $s2.PHP_EOL;
    }
  }

  echo PHP_EOL;

  $input = trim(fgets(STDIN));
  List($h, $w) = explode(" ", $input);
}

Measured memory_bytes: 15240
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();
		
		if (a + b >= x && a <= x){
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 21716
using System;
using System.Collections.Generic;
using System.Linq;

namespace id_0592cs
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> points = new List<int>();
            foreach(var _ in Enumerable.Range(0, 5))
            {
                var x = int.Parse(Console.ReadLine());
                points.Add(x < 40 ? 40 : x);
            }
            Console.WriteLine(points.Average());
        }
    }
}



Measured memory_bytes: 18332
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; 
typedef pair<ll,bool> P;
ll w,h;
ll ans;
vector<P> v;
int main(){
  cin>>w>>h;
  for(int i=0,p;i<w;i++)cin>>p,v.push_back(P(p,0));
  for(int i=0,q;i<h;i++)cin>>q,v.push_back(P(q,1));
  sort(v.begin(),v.end());
  ll t=0,y=0;
  for(int i=0;i<v.size();i++)
    if(!v[i].second){
      ll k=h+1-y;
      t++;
      ans+=k*v[i].first;
    }
    else{
      ll k=w+1-t;
      y++;
      ans+=k*v[i].first;
    }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4464
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 1e5 + 7;
const ld pi = 3.14159265359;
const int INF = 1e9 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

ll n, k;

bool u[N];

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> n;

  if(n < 4){
    cout << "No";
    return 0;
  }

  if(n % 4 == 0 || n % 7 == 0){
    cout << "Yes";
    return 0;
  }

  for(int i = 1; i <= 40; i++){
    for(int j = 1; j <= 40; j++){
      u[i * 4 + j * 7] = 1;
    }
  }

  if(u[n]){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}

int main(){
    int n;
    ll d;
    cin >> n >> d;
    ll x, y;
    int ans = 0;

    FOR0(i, n){
        cin >> x >> y;
        if (x*x + y*y <= d*d) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
a=input()
n=len(a)
ans=n*(n-1)//2+1
d=dict()
for i in range(n):
  if a[i] not in d:
    d[a[i]]=1
  else:
    d[a[i]]+=1
d=list(d.items())
for i,j in d:
  ans-=j*(j-1)//2
print(ans)

Measured memory_bytes: 3500
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K,Q;
	ll A[2001];
	vpll Asort;
	bool pickok[2001];
	ll minsa=INFl;
	scan(N);scan(K);scan(Q);
	rep(i,N){
		scan(A[i]);
		Asort.push_back(mp(A[i],i));
		pickok[i]=true;
	}
	pickok[N]=false;
	sort(Asort.begin(),Asort.end());
	ll nextfalse;
	rep(i,N){
		ll X=Asort[i].first;
		if(i!=0) pickok[nextfalse]=false;
		nextfalse=Asort[i].second;
		//printf("i:%d X:%lld nextfalse:%lld\n",i,X,nextfalse);
		vll stock;
		vll stockall;
		int retusize=0;
		rep(j,N+1){
			//printf("i:%d j:%d\n",i,j);
			if(pickok[j]){
				stock.push_back(A[j]);
				retusize++;
			}
			else{
				//printf("i:%d j:%d retusize:%d\n",i,j,retusize);
				if(retusize>=K){
					sort(stock.begin(),stock.end());
					rep(k,stock.size()-K+1){
						stockall.push_back(stock[k]);
					}
				}
				retusize=0;
				stock.clear();
			}
		}
		if(stockall.size()<Q) continue;
		sort(stockall.begin(),stockall.end());
		ll Y=stockall[Q-1];
		minsa=min(minsa,Y-X);
		//printf("i:%d stockallsize:%d Y:%lld minsa:%lld\n",i,stockall.size(),Y,minsa);
	}
	prin(minsa);
	return 0;
}


Measured memory_bytes: 384
using System;

namespace ABC143
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B;
            string[] ss = Console.ReadLine().Split(' ');
            A = int.Parse(ss[0]);
            B = int.Parse(ss[1]);
            if (A - B * 2 > 0)
                Console.WriteLine(A - B * 2);
            else
                Console.WriteLine(0);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 13140