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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

  int n; cin >> n;
  set<int> st;
  for(int i=0;i<n;++i) {
    int a; cin >> a;
    st.insert(a);
  }
  cout << st.size() << endl;

}



Measured memory_bytes: 7888
import sys
input = sys.stdin.readline

H, W = list(map(int, input().split()))
N = int(input())
A = list(map(int, input().split()))

na = 0
ia = 0
for h in range(H):
    l = []
    for w in range(W):
        if na==0:
            na = A[ia]
            ia += 1
        l.append(ia)
        na -= 1
    if h%2==1: l = l[::-1]
    print(*l)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vi stray(n, 1);
    rep(i, n){
        if(s[i] == '(' && stray[i] == 1){
            repr(j, i+1, n){
                if(s[j] == ')' && stray[j] == 1){
                    stray[i] = 0;
                    stray[j] = 0;
                    break;
                }
            }
        }
        if(s[i] == ')' && stray[i] == 1){
            for(int j = i-1; j >= 0; j--){
                if(s[j] == '(' && stray[j] == 1){
                    stray[i] = 0;
                    stray[j] = 0;
                    break;
                }
            }
        }
    }
    dump(stray);
    ll lsc = 0, rsc = 0;
    rep(i, n){
        if(s[i] == '(' && stray[i] == 1) lsc++;
        if(s[i] == ')' && stray[i] == 1) rsc++;
    }
    dump(lsc, rsc);
    cout << string(rsc, '(')+s+string(lsc, ')') << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define LL long long
#define mod 1000000007
using namespace std;
int n,k,s,t=0,cu,cv;
LL dp[3002],arr[200002],inv[200002];
struct aaa
{
	int u,v;
}cro[3002];
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0' || ch>'9')f|=(ch=='-'),ch=getchar();
	while(ch>='0' && ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x=f? -x:x;return ;
}
int min(int a,int b)
{
	return a<b? a:b;
}
LL pow(LL a,LL b)
{
	if(b==1)return a;
	LL c=pow(a,(b>>1));
	c=(c*c)%mod;
	if(b&1)c=(c*a)%mod;
	return c;
}
bool cmp(aaa a,aaa b)
{
	return (a.v==b.v)? (a.u<b.u):(a.v<b.v);
}
LL C(LL a,LL b)
{
	return (((arr[b]*inv[b-a])%mod)*inv[a])%mod;
}
int main()
{
	arr[0]=inv[0]=1;
	read(n),read(k),read(s);
	n--,k--,t=n+k;
	for(int i=1;i<=s;i++)
		read(cro[i].u),read(cro[i].v),cro[i].u--,cro[i].v--;
	for(int i=1;i<=t;i++)
		arr[i]=(arr[i-1]*i)%mod;
	inv[t]=pow(arr[t],mod-2);
	for(int i=t;i>1;i--)
		inv[i-1]=(inv[i]*i)%mod;
	sort(cro+1,cro+s+1,cmp);
	cro[++s]=(aaa){n,k};
	for(int i=1;i<s;i++)
	{
		dp[i]=C(min(cro[i].u,cro[i].v),cro[i].u+cro[i].v);
		for(int j=1;j<i;j++)
		{
			cu=cro[i].u-cro[j].u;
			if(cu>=0)
			{
				cv=cro[i].v-cro[j].v;
				dp[i]=(dp[i]+mod-((dp[j]*C(min(cu,cv),cu+cv))%mod))%mod;
			}
		}
	}
	for(int i=1;i<s;i++)
	{
		cu=cro[s].u-cro[i].u;
		cv=cro[s].v-cro[i].v;
		dp[s]=(dp[s]+((dp[i]*C(min(cu,cv),cu+cv))%mod))%mod;
	}
	printf("%lld",(C(min(n,k),n+k)+mod-dp[s])%mod);
	return 0;
}

Measured memory_bytes: 3456
import sys

n = int(input())
a = list(map(int, input().split()))
total = 1

if 0 in a:
  print(0)
  sys.exit()

for i in range(n):
  total *= a[i]
  if total > 1000000000000000000:
    print(-1)
    sys.exit()

print(total)

Measured memory_bytes: 21652
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s,t;
	cin >> s >> t;
	int ans = 0;
	for(int i = 0 ; i < s.size() ; i += 1){
		if(s[i] != t[i]){
			ans += 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
int a,b,k;
int main(){
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	    if(i%k==0) {cout<<"OK";return 0;}
	cout<<"NG";
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>

#define MAX_N 52
#define MOD 1000000007

int main(){
	int N,i = 0;
	long long int ans;
	char s1[MAX_N], s2[MAX_N];
	int before;

	scanf("%d", &N);
	scanf("%s", s1);
	scanf("%s", s2);

	if(s1[i] == s2[i]){
		ans = 3;
		before = 0;
		i += 1;
	} else {
		ans = 6;
		before = 1;
		i += 2;
	}

	while(i < N){
		if(s1[i] == s2[i]){
			if(before == 0){
				ans = (ans*2) % MOD;
			} else {
				ans = (ans*1) % MOD;
			}
			before = 0;
			i += 1;
		} else {
			if(before == 0){
				ans = (ans*2) % MOD;
			} else {
				ans = (ans*3) % MOD;
			}
			before = 1;
			i += 2;
		}
	}

	printf("%lld\n", ans);

	return 0;
}

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

int main() {
  
  int n,k,m,y,z,i;
  string s;
  cin >> n >> s;
  
  k=0;
  m=n-2;
  
  for(i=0;i<m;i++){
    y=i+1;
    z=i+2;
   if(s.at(i)=='A'&&s.at(y)=='B'&&s.at(z)=='C'){
     k=k+1;
   }
  }
  
  cout << k <<endl;

  
}
  
    
  




Measured memory_bytes: 256
using System;

class Program
{
    static void Main()
    {
       int n = int.Parse(Console.ReadLine());
       var p = new int[101];
       var m = new int[101,101];
       for(int i = 1; i <= n; i++)
       {
           var a = scan();
           p[i-1]=a[0];
           p[i]=a[1];
       }
       
       for(int l = 2; l<=n; l++)
       {
           for(int i=1;i <= n - l + 1;i++)
           {
               int j = i + l - 1;
               m[i,j] = 2000000000;
               for(int k = i; k <= j-1; k++)
               {
                   m[i,j]= Math.Min(m[i,j],
                   m[i,k]+m[k+1,j]+p[i-1]*p[k]*p[j]);
               }
           }
       }
       Console.WriteLine(m[1,n]);
    }
    static int[] scan()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
    }
    
}

Measured memory_bytes: 9292
#include <bits/stdc++.h>
using namespace std;
int main() {
    int H, W, A, B; cin >> H >> W >> A >> B;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << "01"[(j < A) ^ (i < B)];
        }
        cout << '\n';
    }
    return 0;
}


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

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

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}


int main() {
    ll s;
    cin >> s;
    int count = 0;
    ll tmp = 0;

    while (s) {
        tmp = s % 10;
        if (tmp == 1) count++;
        s = s / 10;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

lst = [-1, -1, -1]
for x in range(N+1):
    for y in range(N-x+1):
      if N-x-y<0:continue
      s = x*10000 + y * 5000 + (N-x-y)*1000
      if s == Y:
          lst = [x, y, N-x-y]
          break
print(*lst)

Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=1000000007;
constexpr ll mod=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll n;
V<string> s;
void dfs(string str,int cnt,char bfo){
    if(cnt==n){
        s.emplace_back(str);
        return ;
    }
    str.push_back('a');
    for(char i='a';i<=bfo;i++){
        str[cnt]=i;
        dfs(str,cnt+1,(bfo==i?char(bfo+1):bfo));
    }
}
int main(){
cin>>n;
string t="a";
dfs(t,1,'b');
sort(all(s));
for(string &str:s){
    cout<<str<<"\n";
}
}

Measured memory_bytes: 7796
fun main(args: Array<String>) {
    val n = readLine()!!
    val list = readLine()!!.split(" ").map(String::toInt).toMutableList()
    var breakFrag = false
    var num = 0
    while(true) {
        num += 1
        for((index, value) in list.withIndex()) {
            if(value % 2 == 0) {
                list[index] = value /2
            } else if(value % 2 != 0) {
                num -= 1
                breakFrag = true
                break
            }
        }
        if(breakFrag) {
            break
        }
    }
    println(num)
}

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	string s;
	cin>>s;
	set<char> st(all(s));
	if(st.size()!=2) ret("No")
	map<char,ll> mm;
	rep(i,0,4) mm[s[i]]++;
	for(auto it:mm) {
		if(it.S!=2) ret("No")
	}
ret("Yes")
	
	return 0;
}

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

#define int long long

using namespace std;

const int maxn = 70, mod = 1e9 + 7;
int a[maxn][maxn], n, k;

struct matrix
{
    int mat[maxn][maxn], n;

    matrix(int n = 0) : n(n) { memset(mat, 0, sizeof mat); }

    void identity()
    {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                mat[i][j] = i == j;
    }

    matrix operator*(const matrix T)
    {
        matrix R(n);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k < n; k++)
                    (R.mat[i][j] += mat[i][k] * T.mat[k][j] % mod) %= mod;
        return R;
    }

    matrix operator^(const int t)
    {
        matrix R(n), T = *this;
        R.identity();

        int power = t;
        while (power)
        {
            if (power & 1)
                R = R * T;

            T = T * T;
            power >>= 1;
        }

        return R;
    }
};

signed main()
{
    ios::sync_with_stdio(false);
    cin >> n >> k;

    matrix dp(n);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> dp.mat[i][j];

    dp = dp ^ k;

    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            (ans += dp.mat[i][j]) %= mod;

    cout << ans;

    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static int V;
    static int[][] G = new int[105][105];
    static final int INF = 1 << 31 - 1;

    public static void main(String[] args) {
        V = sc.nextInt();

        int v;
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                v = sc.nextInt();
                G[i][j] = v != -1 ? v : INF;
            }
        }

        int ans = solvePrim();
        System.out.println(ans);
    }

    /*
    This function find the Minimum Spanning Tree (MST) in O(V^2).

      V: Number of vertexes.
      G: Costs between two vertexes (values of edges). If the edge does not exists, INF should be set.

    Return the total cost of the MST, T.


    EXAMPLE
    -------

    V = 5
    G =
      INF   2   3   1 INF
        2 INF INF   4 INF
        3 INF INF   1   1
        1   4   1 INF   3
      INF INF   1   3 INF

    Ans = 5
    */
    static int solvePrim() {

        int[] cost = new int[V];  // the cost for adding vertex v in G - T to T
        boolean[] used = new boolean[V];  // whether the vertex v exists in T

        for (int i = 0; i < V; i++) {
            cost[i] = INF;
            used[i] = false;
        }

        cost[0] = 0;
        int ret = 0;

        while (true) {
            int v = -1;
            for (int u = 0; u < V; u++) {
                if (used[u]) {
                    continue;
                }
                if (v == -1 && cost[u] != INF) {
                    v = u;
                    continue;
                }
                if (v != -1 && cost[u] < cost[v]) {
                    v = u;
                }
            }

            if (v == -1) {
                break;
            }

            used[v] = true;
            ret += cost[v];

            for (int u = 0; u < V; u++) {
                cost[u] = Math.min(cost[u], G[u][v]);
            }
        }

        return ret;
    }
}

Measured memory_bytes: 41228
#include<stdio.h>
#include<math.h>


int main(){

  double x1,x2,x3,y1,y2,y3,xp,yp,A,B,C,D,E,F,G,H,I;
  double S,S1,S2,S3,SS,SS1,SS2,SS3,s,t;
 
 while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
   A=(x2-x1)*(y3-y1) - (x3-x1)*(y2-y1);
   B=(xp-x1)*(y3-y1) - (x3-x1)*(yp-y1);
   C=(x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);

   s=B/A;
   t=C/A;

   if(s>0 && t>0 && 0<s+t && s+t<1){printf("YES\n");}
   else{printf("NO\n");}
   
  }
  return 0;
}

Measured memory_bytes: 612
def solve(h, w, grid):
    result = []
    for row in grid:
        curSring = "".join(row)
        result.append(curSring)
        result.append(curSring)
    for row in result:
        print(row)


H, W = map(int, input().split())
grid = []
for _ in range(H):
    grid.append(list(input()))
solve(H, W, grid)

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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    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 COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
void ruisekiwa(ll A,vector<int>& digitA){
    int i=1;
    ll amari;
    ll k;
    if(A%4==3||A%4==0){
        digitA.push_back(0);
    }else{
        digitA.push_back(1);
    }
    while(pow(2,i)<=A){
        k=pow(2,i+1);
        amari=A%k;
        if(amari<pow(2,i)){
            digitA.push_back(0);
        }else{
            if(A%2==0){
                digitA.push_back(1);
            }else{
                digitA.push_back(0);
            }
        }
        i++;
    }
}
int main() {
    ll A=in<ll>();
    ll B=in<ll>();
    if(A==0){
        print(B);
        return 0;
    }
    A--;
    //ull B=in<ull>();
    //ull Num=B-A+1;
    vector<int> digitA;
    vector<int> digitB;
    ruisekiwa(A,digitA);
    ruisekiwa(B,digitB);
    vector<int> ans;
    REP(i,digitB.size()){
        if(i<digitA.size()){
            ans.push_back((digitA[i]+digitB[i])%2);
        }else{
            ans.push_back(digitB[i]);
        }
    }
    ll ans10;ans10=0;
   
    REP(i,ans.size()){
        if(ans[i]==1){
            ans10+=pow(2,i);
        }
    }
    print(ans10);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
//
#include <bits/stdc++.h>
//
using namespace std;
//
#define krep(i,k,n)      for(int i=k;i<n;++i)
#define rep(i,n)         for(int i=0;i<n;++i)
#define toupp(s)         transform(s.begin(),s.end(),s.begin(),::toupper) // string
#define tolow(s)         transform(s.begin(),s.end(),s.begin(),::tolower) // string
#define pb(v)            push_back(v)
#define all(v)           v.begin(),v.end()
#define mp               make_pair
#define __sort(v)        sort(v.begin(),v.end()) // vector
#define __stable_sort(v) stable_sort(v.begin(),v.end()) // vector
#define __exists(c,v)    (find(all(c), (v)) != (c).end()) // vector
#define __unique(v)      __sort(v);v.erase(unique(v.begin(),v.end()),v.end()) // vector
#define __swap(a, b, tmp)  tmp=a;a=b;b=tmp;
#define __memset(a)      memset(a,0,sizeof(a));
//
#define dumpVar(v)       cout<<setw(30)<<#v" = ["<<v<<"]"<<endl
#define dumpArr(v, n)    for(int i=0;i<n;++i){cout<<v[i]<<", ";} cout<<endl
#define dumpPair(p)      cout<<"<"<<p.first<<", "<<p.second<<">"<<endl
//
typedef long long              ll;
typedef vector<string>         vs;
typedef vector<double>         vd;
typedef vector<int>            vi;
typedef pair<int, int>         pii;
typedef pair<double, double>   pdd;
//
int main ()
{
	ios::sync_with_stdio ( false );
	//
	/* code start */
	int N;
	vi A_arr;
	
	int max = 0,max2 = 0;
	int flag = 0;
	int max_tag = -1;
	
	cin >> N;
	rep(i,N){
		int tmp;
		cin >> tmp;
		A_arr.pb(tmp);
		
		if(max > tmp && tmp > max2 )max2 = tmp;
		
		if(tmp > max){
			max2 = max;
			max = tmp;
			flag = 0;
			max_tag = i;
		}else if ( tmp == max) {
			flag = 1;
		}
	}
	
	if(flag){
		rep(i,N)cout << max << endl;
	}else{
		rep(i,N){
			if(i == max_tag) cout << max2 << endl;
			else cout << max << endl;
		}
	}
	
	
	/* code end   */
	//
	return 0;
}


Measured memory_bytes: 2548
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::collections::HashMap;

fn main() {
    let _n = get!(usize);
    let mut ll = HashMap::new();
    for c in get!(String).split_whitespace() {
        let a = c.parse::<i64>().unwrap();
        let e = ll.entry(a).or_insert(0);
        *e += 1;
    }
    let mut kk = ll.keys().collect::<Vec<_>>();
    kk.sort();
    kk.reverse();
    let mut l = 0;
    for k in kk.into_iter() {
        if ll[k] >= 2 {
            if l == 0 {
                if ll[k] >= 4 {
                    println!("{}", k * k);
                    return;
                }
                l = *k;
            } else {
                println!("{}", l * k);
                return;
            }
        }
    }
    println!("0");
}

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


int main() {
  int n , k ;
  cin >> n >> k ;
  
  int d=k*2+1;
  
  if(n%d==0){
    cout << n/d << endl;
  }
  else{
    cout << n/d+1 << endl;
  }
}
    

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL K; cin >> K;
  priority_queue<LL, vector<LL>, greater<LL>> que;
  for (int i = 1; i < 10; ++i) que.push(i);

  LL v = 0;
  for (int i = 0; i < K; ++i) {
    v = que.top(); que.pop();
    if (v % 10 == 0) {
      que.push(10LL*v);
      que.push(10LL*v+1LL);
    } else if (v % 10 == 9) {
      que.push(10LL*v+8LL);
      que.push(10LL*v+9LL);
    } else {
      LL a = v % 10;
      que.push(10LL*v+a-1LL);
      que.push(10LL*v+a);
      que.push(10LL*v+a+1LL);
    }
  }
  cout << v << endl;
}


Measured memory_bytes: 5364
#include <iostream>
#include <string>
using namespace std;
string s="",ss;
int main(){
	cin>>ss;
	for(int i=0;i<ss.length();i++){
		if(ss[i]=='0')s=s+"0";
		else if(ss[i]=='1')s=s+"1";
			else if(s!="")s.replace(s.length()-1,1,"");
	}
	cout<<s<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000

void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  int x=-1,y=-1,z=-1;
int n,m;

cin>>n>>m;

for(int i=0;i<=n;i++){
for(int j=0;i+j<=n;j++){
  int k = n-i-j;
  if(i*10000+j*5000+k*1000==m){
    x=i; y=j; z=k;
    break;
  }
}
}
cout<<x<<" "<<y<<" "<<z<<endl;

}

int main(){
  solve();
  return 0;
}


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


int main(void){
        int i,j;
        string s;
        int k;
        int n[200];
        int x;

        cin >> s;
        cin >> k;

        long long ans=0;
        int a; //����
        a = s.length();

        for(i=0;i<a;i++){
                n[i] = s[i]-'0';
        }

        if(k==3){
                ans += 9*9*9*(a-1)*(a-2)*(a-3)/6;
                ans += 9*9*(n[0]-1)*(a-1)*(a-2)/2;
                x=1;
                
                while(x<a && n[x]==0){
                        x++;
                }
                if(x==a){
                        printf("%lld\n",ans);
                        return 0;
                }
                for(i=x;i<a;i++){
                        n[i-x]=n[i];
                }
                a = a-x;
                k--;
        }

        if(k==2){
                ans += 9*9*(a-1)*(a-2)/2;
                ans += 9*(n[0]-1)*(a-1);
                x=1;
                while(x<a && n[x]==0){
                        x++;
                }
                if(x==a){
                        printf("%lld\n",ans);
                        return 0;
                }
                for(i=x;i<a;i++){
                        n[i-x]=n[i];
                }
                a=a-x;
                k--;
        }

        if(k==1){
                ans += 9*(a-1);
                ans += n[0];
        }
        printf("%lld\n",ans);
        return 0;
}



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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int a,b;
	char c;
	scanf("%d %c %d",&a,&c,&b);
	cout << (c == '+'?a + b:a-b) << '\n';		
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  int n;
  int k;
  stringstream ss;
  cin >> n;
  cin >> k;
  int ans = n%k==0?0:1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

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())

a, b = li()
if a < 10 and b < 10:
    print(a*b)
else:
    print(-1)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#define mod 1000000007
typedef long long ll;
using namespace std;

ll dp[205][205];
int R[10];
const ll INF = 1000000000;
int main(){
  int n,m,r; cin >> n >> m >> r;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      dp[i][j] = INF;
    }
  }
  for(int i=0;i<n;i++) dp[i][i] = 0;

  for(int i=0;i<r;i++){
    cin >> R[i];
    R[i]--;
  }
  sort(R,R+r);

  for(int i=0;i<m;i++){
    ll a,b,c; cin >> a >> b >> c;
    a--; b--;
    dp[a][b] = c;
    dp[b][a] = c;
  }

  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }

  ll ans = 10000000000000000;
  do{
    ll tmp = 0;
    for(int i=0;i<r-1;i++){
      tmp += dp[R[i]][R[i+1]];
    }
    ans = min(ans,tmp);
  }while(next_permutation(R,R+r));

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

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String a = s.substring(0, 2);
		String b = s.substring(2, 4);
		int ai = Integer.parseInt(a);
		int bi = Integer.parseInt(b);

		if (ai >= 1 && ai <= 12 && bi >= 1 && bi <= 12) {
			System.out.println("AMBIGUOUS");
		} else if (ai >= 1 && ai <= 12) {
			System.out.println("MMYY");
		} else if (bi >= 1 && bi <= 12) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
}


Measured memory_bytes: 21844
package main

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

func main() {
	n := nextInt()
	h := nextIntArray()
	down, up := h[n-1], h[0]
	for i := 1; i < n; i++ {
		if d := h[i] - h[i-1]; d < 0 {
			down -= d
		} else {
			up += d
		}
	}
	fmt.Println(max(down, up))
}

func lcm(a, b int64) int64 {
	return (a / gcd(a, b)) * b
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

const size = 1000000

var reader = bufio.NewReaderSize(os.Stdin, size)

func nextLine() string {
	var line, buffer []byte
	isPrefix := true
	var err error
	for isPrefix {
		line, isPrefix, err = reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
	}
	return string(buffer)
}
func nextStringArray() []string {
	return strings.Split(nextLine(), " ")
}
func nextInt() int {
	n, _ := strconv.Atoi(nextLine())
	return n
}

func nextIntArray() []int {
	s := strings.Split(nextLine(), " ")
	n := len(s)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}

func min(i, j int) int {
	if i > j {
		return j
	}
	return i
}

func max(i, j int) int {
	if i < j {
		return j
	}
	return i
}


Measured memory_bytes: 640
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, N = map(int, readline().split())
dic=[str(H)*N,str(N)*H]
dic.sort()
print(dic[0])

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	int a,b;
	scanf("%*d%d%d",&a,&b);
	puts((a*10+b)%4==0?"YES":"NO");
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//#include "atcoder/all"
//using namespace atcoder;

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

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

int main(){
    long long n,d,a,b,ans=0;
    cin >> n >> d;
    for(int i=0;i<n;i++){
        cin >> a >> b;
        if(d*d>=a*a+b*b)ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int lli;

void dfs(int v, vector<int> &dist, vector<vector<int> > &g){
    for(int next: g[v]){
        if(dist[next] == -1){
            dist[next] = dist[v]+1;
            dfs(next, dist, g);
        }
    }
}
int diameter(vector<vector<int> > &g){
    int n = g.size();
    vector<int> d(n, -1);
    d[0] = 0;
    dfs(0, d, g);
    int idx = max_element(d.begin(), d.end()) -d.begin();
    d = vector<int>(n, -1);
    d[idx] = 0;
    dfs(idx, d, g);
    return *max_element(d.begin(), d.end());
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> adj(n);
    for(int i=0; i<n-1; i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    int d = diameter(adj);
    if(d%3==1){
        cout << "Second" << endl;
    }else{
        cout << "First" << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;

struct point{
    ll x, y;
};

/*FUNCs=================================================*/



/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    ll n, answer = 15;
    cin >> n;
    for(ll p = 1; p * p <= n; p++){
        if(n % p == 0){
            ll q = n / p;
            string a = to_string(p), b = to_string(q);
            ll keta = max(a.size(), b.size());
            answer = min(answer, keta);
        }
    }
    cout << answer <<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>

#define NUM_MAX (200)

int main(void)
{
  int n, l[NUM_MAX], i,j,temp,sum;

  scanf("%d", &n);
  
  for(i = 0; i < 2*n; i++){
    scanf("%d", &l[i]);
  }


  for(i=0;i<2*n;i++){
    for(j=2*n-1;j>i;j--){
      if(l[j]>l[j-1]){
	temp=l[j];
	l[j]=l[j-1];
	l[j-1]=temp; 
      }
    }
  }

  sum=0;
  for(i=0;i<n;i++){
    sum+=l[2*i+1];
  }
  printf("%d\n", sum);
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

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

  int ans = 0;
  for (int i = 0; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      for (int k = 0; k <= c; k++) {
        if (i * 500 + j * 100 + k * 50 == x)
          ans++;
      }
    }
  }
  cout << ans << endl;
}


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

int main() {
    ll n,m; cin>>n>>m;
    if(n > m) swap(n,m);
    
    if(n==1){
        if(m==1) cout<<"1";
        else cout<<m-2;
    }
    else{
        ll total = m*n;
        ll bound = 2*m + 2*n - 4;
        cout<<total-bound;
    }
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

struct MyStruct {
	int a, b;
};

bool comp(const MyStruct& s, const MyStruct& t) {
	if (s.b != t.b)
		return s.b < t.b; //syoujunn
	return s.a > t.a;
}


int main() {
	int n;
	cin >> n;
	vector<MyStruct> v(n);
	REP(i, n) {
		cin >> v[i].a >> v[i].b;
	}

	sort(v.begin(), v.end(), comp);
	long long sum = 0;
	REP(i, n) {
		sum += v[i].a;
		if (sum > v[i].b) {
			ANS("No");
			return 0;
		}
	}
	ANS("Yes");

	return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define rg register
#define ll long long
using namespace std;
char s[15];
int n,a[15];
ll ans;
inline ll calc(int start,int end){
	ll val=0ll,p=9ll;
	for(rg int i=end;i>=start;--i)
		val+=a[i]*p,p=p*10;
	return val;
}
inline void dfs(int sit,ll val,int last){
	if(sit==n){
		ans+=val;
		return;
	} 
	dfs(sit+1,val+a[sit+1]*1ll,sit+1);
	dfs(sit+1,val+calc(last,sit)+a[sit+1]*1ll,last);
	return;
}
int main(){
	scanf("%s",s);
	n=strlen(s);
	for(rg int i(1);i<=n;++i)
		a[i]=s[i-1]-'0';
	dfs(1,a[1]*1ll,1);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (int)(n); (i)++)
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define For(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b, c, k; cin >> a >> b >> c >> k;
    int cnt = 0;

    while(a >= b) b *= 2, cnt++;
    while(b >= c) c *= 2, cnt++;

    cout << (cnt <= k ? "Yes" : "No") << endl;
return 0;
}


Measured memory_bytes: 3608
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if(b -a == c-b) cout << "YES" << endl;
	else cout << "NO" << endl;
return 0;
}


Measured memory_bytes: 256
//This Code was made by Chinese_zjc_.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <ctime>
#include <atcoder/lazysegtree>
// #include<windows.h>
#define int long long
#define double long double
using namespace std;
const double PI = acos(-1);
const double eps = 0.0000000001;
const int INF = 0x3fffffffffffffff;
int n, k, a[300005], dp[300005];
int return0()
{
    return 0;
}
int Max(int a, int b)
{
    return a > b ? a : b;
}
atcoder::lazy_segtree<int, Max, return0, int, Max, Max, return0> tree(300001);
signed main()
{
    ios::sync_with_stdio(false);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        dp[i] = tree.get(a[i]) + 1;
        tree.apply(max(0ll, a[i] - k), min(300000ll, a[i] + k) + 1, dp[i]);
    }
    cout << tree.all_prod() << endl;
    return 0;
}

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

int main() {

	int n; cin >> n;
	const int p = 100001;
	vector<int> num(p, 0);
	for (int i = 0; i < n; i++) {
		int a;  cin >> a;
		num[a]++;
	}
	int existCnt = 0;
	int num_even_Cnt = 0;
	for (int i = 0; i < p; i++) {
		if (0 < num[i]) existCnt++;
		if (0 < num[i] && num[i] % 2 == 0) {
			num_even_Cnt++;
		}
	}
	if (num_even_Cnt % 2 == 0) {
	}
	else if (num_even_Cnt % 2 == 1) {
		existCnt--;
	}
	cout << existCnt << endl;
	return 0;
}

Measured memory_bytes: 3796
// C - Sum of product of pairs
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int N; cin>>N;
	vector<int> A(N); for(auto& a:A) cin>>a;
	vector<int64_t> S(N+1, 0);
	int MOD = (1e9) + 7;
	rep(i, N) S[i+1] = (S[i] + A[i]) % MOD;
	int64_t ans = 0;
	rep(i, N) ans = (ans + A[i] * (S.back() - S[i+1]) % MOD) % MOD;
	cout<< (ans + MOD) % MOD <<endl;
}


Measured memory_bytes: 5572
#include<bits/stdc++.h>
using namespace std;
#define w(t) int t;cin>>t;while(t--)
#define pb   push_back
#define mk   make_pair
#define u_s  unordered_set
#define endl "\n"
#define prDouble(x) cout<<fixed<<setprecision(10)<<x
#define ll long long int
#define ipair pair<int,int>
#define all(x) (x).begin(), (x).end()

const int mod=pow(10,9)+7;

bool compare(pair<int,int>p1,pair<int,int>p2){
    return p1.second<p2.first;
}
void open_file(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
void fast_io(){
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
      
}
/*
  ll C(ll n,ll k){
  
  if(k>n)return 0;
  
  ll ans=1;

  if(k>n-k)
    k=n-k;
  for(ll i=1;i<=k;i++)
    ans*=(n-i+1),ans/=i;

  return ans;
  }
  unsigned long long fact(long long a)
  {
  unsigned long long res=1;
  for(long long i=a;i>0;i--)
    res*=i;
  return res;
  }
  unsigned long long comb(long long a,long long b)
  {
  if((a-b)<b) b=a-b;
  if(a<=19) return fact(a)/(fact(a-b)*fact(b));
  if(a==b||b==0) return 1;
  if(b==1) return a;
  return comb(a-1,b-1)+comb(a-1,b);
  }
*/

struct item{

  ll wt,val;
};

void solve(){

  ll n,k; cin>>n>>k;
  vector<item>A(n+1);
  for(int i=1;i<=n;i++)cin>>A[i].wt>>A[i].val;
  
  ll dp[n+1][k+1];
  memset(dp,0,sizeof dp);
  dp[1][A[1].wt]=A[1].val;

  for(int i=2;i<=n;i++){

      for(int w=0;w<=k;w++){

        dp[i][w]=dp[i-1][w];
        if(A[i].wt>w)continue;

        dp[i][w]=max(A[i].val+dp[i-1][w-A[i].wt],dp[i-1][w]);
      }
  }
  cout<<*max_element(dp[n],dp[n]+k+1);
}

int main(){

  //open_file();
  fast_io();
  
  solve();
  
  return 0;  
    
}


Measured memory_bytes: 82408
#include <iostream>
#include <vector>
using namespace std;
 
class Dice{
public:
    long r[6];
    Dice(){};
    void roll(long a, long b, long c, long d){swap(r[a], r[b]);swap(r[b], r[c]);swap(r[c], r[d]);}
    void spin(char c){if (c == 'W') roll(0, 2, 5, 3); else roll(0, 1, 5, 4);}
};
 
int main(){
    char SWS[8]={"NNNWNNN"};
    int n;
    cin >> n;
    vector<Dice> D(n);
    for (int i = 0; i < n ; i++) for (int j = 0; j < 6; j++) cin >> D[i].r[j];
    for (int i = 0; i < n - 1; i++){
        for (int j = i + 1; j < n; j++){
            for (int k = 0; k < 8; k++){
                if (D[i].r[1] == D[j].r[1]) break;
                D[j].spin(SWS[k]);
            }
            for (int k = 0; k < 4; k++){
                if (D[i].r[0] == D[j].r[0]){
                    int ans = 0;
                    for (int l = 1; l < 6; l++) if (D[i].r[l] == D[j].r[l]) ans++;
                    if (ans == 5){cout << "No" << endl; return 0;}
                }
                D[j].spin('W');
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1196