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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;
const int mxn = 5e5+7;

int t[mxn<<2];
int n, q, a[mxn], ans[mxn];
vector<pii>qr[mxn];
map<int, int>m;

void update(int p, int vl, int i=1, int l=0, int r=n-1){
	if (l == r){
		t[i] = vl;
		return;
	}
	int m = (l+r)>>1;
	if (p <= m) update(p, vl, i<<1, l, m);
	else update(p, vl, i<<1|1, m+1, r);
	t[i] = t[i<<1]+t[i<<1|1];
}

int query(int pl, int pr, int i=1, int l=0, int r=n-1){
	if (r < pl || l > pr) return 0;
	if (l >= pl && r <= pr) return t[i];
	int m = (l+r)>>1;
	return query(pl, pr, i<<1, l, m)+query(pl, pr, i<<1|1, m+1, r);
}

int main(){
	setIO();
	cin >> n >> q;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < q; i++){
		int x, y; cin >> x >> y;
		x--, y--;
		qr[y].emp(x, i);
	}
	for (int i = 0; i < n; i++){
		update(i, 1);
		if (m.find(a[i]) != m.end())
			update(m[a[i]], 0);
		m[a[i]] = i;
		for (pii x : qr[i])
			ans[x.snd] = query(x.fst, i);
	}
	for (int i = 0; i < q; i++)
		cout << ans[i] << endl;
}

Measured memory_bytes: 56848
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

ll n, m;
ll a[105];
ll sum;

int main()
{
    scanf("%lld%lld", &n, &m);
    for(ll i = 0; i < n; i++)
    {
        scanf("%lld", &a[i]);
        sum += a[i];
    }
    sort(a, a + n, greater<ll>());
    if(a[m - 1] * 4 * m < sum) printf("No\n");
    else printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  int tmp = 0;
  int cnt = 1;
  rep(i, N) {
    cin >> L[i];
    tmp += L[i];
    if(tmp <= X) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

int main() {
  int A,B,M;
  cin>>A>>B>>M;
  vector<int>a(A);
  vector<int>b(B);
  int am=100000;
  int bm=100000;
  for(int i=0;i<A;i++){
    cin>>a.at(i);
    am=min(am,a.at(i));
  }
  for(int i=0;i<B;i++){
    cin>>b.at(i);
    bm=min(bm,b.at(i));
  }
  int p=200000;
  int x,y,c;
  for(int i=0;i<M;i++){
    cin>>x>>y>>c;
    p=min(a.at(x-1)+b.at(y-1)-c,p);
  }
  cout<<min(am+bm,p)<<endl;
}

Measured memory_bytes: 1024
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());

        if (n == 1)
        {
            Console.WriteLine(1);
            return;
        }

        var max = 0;
        for (int i = 2; ; i++)
        {
            var any = false;
            for (int j = 2; ; j++)
            {
                var p = (int)Math.Pow(i, j);
                if (p <= n)
                {
                    any = true;
                    max = Math.Max(max, p);
                }
                else
                {
                    break;
                }
            }
            if (!any)
            {
                break;
            }
        }

        Console.WriteLine(max);
    }
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    int T=1;
    //cin >> T;
    while(T--){
        string s;
        cin>>s;
        ll n=s.length();
        int f=1;
        rep(i,n){
            if(s[i]!=s[n-1-i]) f=0;
        }
        rep(i,n/2){
            if(s[i]!=s[n/2-1-i]) f=0;
        }
        rep(i,n/2){
            if(s[i+n/2+1]!=s[n-1-i]) f=0;
        }
        if(f) cout<<"Yes"<<el;
        else cout<<"No"<<el;

    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define gif(a,b) (a/b +(a%b?1:0))
#define pi 3.14159265358
#define watch(x) cout<<(#x)<<" is "<<(x)<<"\n";
#define float long double
using namespace std;

int32_t main()
{   
    cin.tie(NULL);
    std::ios::sync_with_stdio(false);
  	int y , m , d;
  	char a , b;
  	string s;
  	cin >> s;
    stringstream ss(s);
    ss >> y >> a >> m >> b >> d;
    int flag = 0;
    if(y > 2019)
    	flag = 1;
    else if(y == 2019 && m > 04)
    	flag = 1;
  	if(flag == 1)
  		cout << "TBD";
  	else
  		cout <<"Heisei";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
const int ININF = 1000000;
int d[510][510];
int c[510][510];
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, 0, N) { cin >> A[i]; }
    long long count = 0;
    int sum = 0;
    int r = 0;
    rep(l, 0, N) {
        while(r < N && ((sum ^ A[r]) == (sum + A[r]))) {
        sum+=A[r];
        r++;
        }
        count+=r-l;
        if(l==r){
            r++;
        }else{
            sum-=A[l];
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;


int main() {
    int N; cin >> N;
    vector<int> A(N);
    int S = 0;
    for(int &a:A){
        cin >> a;
        S += a;
    }
    
    int mn = 1e9;
    int ans = 0;
    for(int i=0; i<N; i++){
        if(abs(S - N * A[i]) < mn){
            mn = abs(S - N * A[i]);
            ans = i;
        }
    }
    
    cout << ans << endl;
    return 0;
}





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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;

using StrView = string_view;

auto solve(StrView S) -> void {
  if (S == "ABC") {
    puts("ARC");
  } else {
    puts("ABC");
  }
}

auto main() -> int {
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,m;
	cin >> n >> m;
	multiset <int> s;
	for(int i=0;i<n;i++){
		int x;
		cin >> x;
		s.insert(x);
	}
	while(m--){
		auto it=s.end();
		it--;
		int x=*it;
		s.erase(it);
		x/=2;
		s.insert(x);
	}
	int sum=0;
	for(int i:s)
		sum+=i;
	cout << sum << endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
void rotat(string &s){
	int len=s.size();
	char rear=s[len-1];
	string s1=s.substr(0,len-1);
	s=rear+s1;
}
int main(){
	string s,t;
	cin>>s;
	cin>>t;
	if(s==t){
		printf("Yes\n");
		return 0; 
	} 
	int len=s.size();
	for(int i=0;i<len-1;++i){//i为开头
		rotat(s);
		//cout<<s<<endl;
		if(s==t){
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a<10 && b<10) cout << a*b << endl;
    else cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define iikae auto&
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

int main(){
  kyopro;
  ll N;
  cin >> N;
  vector<ll> W(N);
  ll sum{};
  for(auto&& i : W){
    cin >> i;
    sum += i;
  }
  ll temp{}, ans{sum};
  for(auto&& i : W){
    temp += i;
    ans = min(abs(sum - 2 * temp), ans);
  }
  cout << ans << rt;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int a, b;
  cin >> a >> b;
  int x = a + b;
  int y = a - b;
  int z = a * b;
  cout << max(max(x, y), z);
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    if ( s[0] != 'A' ) {
        cout << "WA" << endl;
        return 0;
    }
    bool C_flg = false;
    for ( int i = 1; i < s.length(); i++ ) {
        if ( i == 1 ) {
            if ( s[i] >= 'A' && s[i] <= 'Z' ) {
                cout << "WA" << endl;
                return 0;
            }
        }
        else if ( i == s.length() - 1 ) {
            if ( s[i] >= 'A' && s[i] <='Z' || !C_flg ) {
                cout << "WA" << endl;
                return 0;
            }
        }
        else {
            if ( C_flg && s[i] == 'C' || s[i] >= 'A' && s[i] < 'C' || s[i] >= 'D' && s[i] <= 'Z' ) {
                cout << "WA" << endl;
                return 0;
            }
            if ( !C_flg && s[i] == 'C' ) {
                C_flg = true;
            }
        }
//        cout << i << endl;
    }
    cout << "AC" << endl;
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

struct Point { 
    int n, x, begin;
    bool operator<(const Point &rhs) const { return x < rhs.x; }
};

int R, C, N;

int to_1d(int x, int y)
{
    if (y == 0) return (R - x);
    if (x == 0) return R + y;
    if (y == C) return R + C + x;
    if (x == R) return 2*R + C + (C - y);
    return -1;
}

int main()
{
    ios::sync_with_stdio(false);

    cin >> R >> C >> N;
    vector<Point> points;

    rep(i, N) {
        int X1, Y1, X2, Y2;
        cin >> X1 >> Y1 >> X2 >> Y2;
        int pos1_1d = to_1d(X1, Y1), pos2_1d = to_1d(X2, Y2);
        if (pos1_1d < 0 || pos2_1d < 0) continue;

        if (pos1_1d > pos2_1d) swap(pos1_1d, pos2_1d);
        points.push_back({i, pos1_1d, 1});
        points.push_back({i, pos2_1d, 0});
    }

    sort(ALL(points));

    stack<int> S;
    bool ans = true;
    for (auto p : points) {
        if (p.begin) {
            S.push(p.n);
        } else {
            int n = S.top(); S.pop();
            if (p.n != n) {
                ans = false;
                break;
            }
        }
    }

    cout << (ans ? "YES" : "NO") << endl;
}

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

int main() {
    int k, n;
    cin >> k >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> b(n);
    rep(i, n) {
        if (i == n-1) b[i] = k - a[i] + a[0];
        else b[i] = a[i+1] - a[i];
    }

    ll max_val = *max_element(b.begin(), b.end());
    ll sum_val = accumulate(b.begin(), b.end(), 0);
    ll ans = sum_val - max_val;

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void){
  int n,i,j,k,o,u;
  ll kb[10][10]={};
  
  cin >> n;
  
  for (i=1;i<=n;i++){
    o=i%10;
    k=i;
    while (k>=10) k/=10;
    u=k;
    kb[o][u]++;
  }
  
  ll ans=0;
  for (i=1;i<10;i++) for (j=1;j<10;j++){
    ans+=kb[i][j]*kb[j][i];
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
template <typename T>
vector<vector<T> > nCk_init(int val) {
  vector<vector<T> > nCk(val + 1, vector<T>(val + 1, 0));
  REP(i, val + 1) {
    nCk[i][0] = 1;
    FOR(j, 1, i + 1) nCk[i][j] = nCk[i - 1][j - 1] + nCk[i - 1][j];
  }
  return nCk;
}

int main() {
  int n, a, b; cin >> n >> a >> b;
  vector<vector<long long> > nCk = nCk_init<long long>(n);
  map<long long, int> mp;
  while (n--) {
    long long v; cin >> v;
    ++mp[v];
  }
  long double mx = 0;
  long long ans = 0;
  FOR(cnt, a, b + 1) {
    long long rem = cnt, pat = 0;
    long double sum = 0;
    for (auto it = prev(mp.end()); ; --it) {
      if (rem <= (*it).second) {
        pat = nCk[(*it).second][rem];
        sum += (*it).first * rem;
        break;
      } else {
        rem -= (*it).second;
        sum += (*it).first * (*it).second;
      }
      if (it == mp.begin()) break;
    }
    long double tmp = sum / cnt;
    if (tmp > mx) {
      mx = tmp;
      ans = pat;
    } else if (tmp == mx) {
      ans += pat;
    }
  }
  cout << mx << '\n' << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    int ans = 1;
    for(int i=2;i<=N;i*=2){
        ans = max(ans,i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    d,t,s = LI()
    ans = d<=t*s
    print("Yes" if ans else "No")
main()            


Measured memory_bytes: 68176
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;

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

       int t=1;
       //cin>>t;
       while(t--)
       {
            int n,k;
            cin>>n>>k;
            int x,y;
            cin>>x>>y;
            ll sum=0;
            for(int i=1;i<=min(n,k);++i)
            {
                 sum += x;
            }
            for(int i=k+1;i<=n;++i)
               sum += y;
            cout<<sum;
       }
}


Measured memory_bytes: 3608
from itertools import combinations 
INF = int(1e9)*15
def main():
    n, k = map(int, input().split()) 
    a = [int(i) for i in input().split()]
    c = [int(i) for i in range(1, n)]
    ans = INF
    for comb in combinations(c, k-1):
        s = set(comb)
        mx = a[0]
        cost = 0
        for i in range(n):
            if i in s:
                if a[i] > mx:
                    mx = a[i]
                    continue
                else:
                    mx += 1
                    cost += mx-a[i] 
                    continue
            mx = max(mx, a[i])
        ans = min(cost, ans)
    print(ans)
if __name__ == '__main__':
    main()


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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);



int main(){
  faster();
  int h,a;
  cin >> h >> a;
  cout << (h+a-1)/a;
}



























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    ll n;cin>>n;
    VLL a(n);
    rep(i,n){cin>>a[i];a[i]-=i+1;}
    ll ans=0;
    sort(ALL(a));
    ll half=a[n/2];
    rep(i,n){
        ans+=abs(a[i]-half);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
const int MAXN=100000;
int cnt[MAXN+10];
void solve(long long n, long long m, vector<long long> a, vector<long long> b){
	for(int  i=0; i<m; ++i) {
		cnt[a[i]]++;
		cnt[b[i]]++;
	}	
	for(int i=1; i<=n; ++i) {
		if (cnt[i]%2!=0) {
			puts("NO");
			return;
		}
	}
	puts("YES");
}

int main(){	
#ifdef WAAUTOMATON
	//freopen("in.txt","r",stdin);
#endif
	long long N;
	long long M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<long long> a(M-1+1);
	vector<long long> b(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&a[i]);
		scanf("%lld",&b[i]);
	}
	solve(N, M, a, b);
	return 0;
}



Measured memory_bytes: 3712
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string.h>
#define ON 1
int main() {
	int outCount=0,inningPoint=0;
	int base[3] = { 0 };
	int i,n;
	char Event[10];
	fscanf(stdin, "%d", &n),getchar();
	while (n) {
		memset(Event, '\0', sizeof(Event));
		fscanf(stdin, "%s", Event),getchar();
		if (strcmp(Event, "HOMERUN") == 0) {
			for (i = 0; i < 3; i++) inningPoint += base[i];
			inningPoint++;
			memset(base, 0, sizeof(base));
		}
		else if (strcmp(Event, "OUT") == 0) {
			if (outCount + 1 == 3) {
				n--;
				memset(base, 0, sizeof(base));
				fprintf(stdout, "%d\n", inningPoint);
				outCount = inningPoint = 0;
			}
			else outCount++;
		}
		else if (strcmp(Event, "HIT") == 0) {
			if (base[2] == ON) inningPoint++;
			base[2] = base[1];
			base[1] = base[0];
			base[0] = ON;
		}
	}
	return 0;
}

Measured memory_bytes: 604
# -*- coding: utf-8 -*-

def assignColor(G):
    n = len(G)
    C = [-1 for i in range(n)]
    for i in range(n):
        if C[i] == -1:
            C = BFS(G, i, C)
    return C

#@profile
def BFS(G, start, C):
    n = len(G)
    Q = []

    Q.append(start)
    C[start] = start

    while len(Q) != 0:
        u = Q.pop(0)
        v = [i for i in G[u] if C[i] == -1] # v := ??£??\???????????????????????¢?´¢??????????????????
        
        for i in v:
            Q.append(i)
            C[i] = C[start]
    
    return C

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

    for i in range(m):
        s, t = list(map(int, input().split()))
        G[s].append(t)
        G[t].append(s)

    C = assignColor(G)
        
    q = int(input())
    
    for i in range(q):
        s, t = list(map(int, input().split()))
        if C[s] == C[t]:
            print("yes")
        else:
            print("no")
            
if __name__ == "__main__":
    main()    

Measured memory_bytes: 32736
mod = 10**9 + 7
h, w, a, b = list(map(int, input().split()))

t_mod = [1] * (h+w-1) 
for i in range(1, h+w-1):
    t_mod[i] = i * t_mod[i-1] % mod 

t_modinv = list(map(lambda v: pow(v, mod-2, mod), t_mod))

def comb(n, r):
    return t_mod[n] * t_modinv[r] * t_modinv[n-r] % mod

ans = comb(h-a-1+b, b) * comb(a+w-1-b, a) % mod
for i in range(1, w-b):
    ans += (comb(h-a-1+b+i, b+i) - comb(h-a-1+b+i-1, b+i-1)) * comb(a+w-1-b-i, a) % mod

print(ans % mod)

Measured memory_bytes: 20924
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ll a,b,c,d,e,k,l,m,n,o=0,p,q,x,y,z,max1=0,ans;
    string s,t,u;
    cin>>a>>b>>c>>d;
    ans=a*b-a*d-b*c+c*d;
    
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9 + 7

fac = [1, 1]     # 元テーブル
f_inv = [1, 1]   # 逆元テーブル
inv = [0, 1]     # 逆元テーブル計算用テーブル
def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)


def cmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod


def prime_factorization(n):
    d = {}
    i = 2
    while i * i <= n:
        if n % i == 0:
            d[i] = 1
            n //= i
            while n % i == 0:
                n //= i
                d[i] += 1
        i += 1
    if n > 1:
        d[n] = 1
    return d


def main():
    N,M = map(int, readline().split())

    prepare(N+100, MOD)
    d = prime_factorization(M)

    ans = 1
    for v in d.values():
        ans *= cmb(N-1+v, v, MOD)
        ans %= MOD

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 57840
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

bool isprime(int x){
  if (x == 2){return true;}
  if (x < 2 | x%2 == 0){return false;}
  int i = 3;
  while (i <= sqrt(x)){
      if (x%i==0){return false;}
      i = i + 2;
  }
 return true;
}


int main(){
    int n, i, count= 0;
    int A[10000];
    scanf("%d", &n);
    rep(i,n){
        scanf("%d", &A[i]);
    }
    rep(i,n){
        if (isprime(A[i])){
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>

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

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

using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    char X,Y;
    cin>>X>>Y;
    if(X<Y)printf("<\n");
    else if(X>Y)printf(">\n");
    else printf("=\n");
    
    return 0;
}


Measured memory_bytes: 256
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{   
     IOS;
     
     ll n,m,i,j,k;
     string s;
     cin>>s;
     if(s=="ARC") cout<<"ABC";
     else cout<<"ARC";
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;cin>>n;
    vector<string>w(n);
    for(string &i:w)cin>>i;
    bool ans=true;
    for(int i=0;i<n-1;i++){
        if(w.at(i).at(w.at(i).length()-1)!=w.at(i+1).at(0)){
            ans=false;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            if(w.at(i)==w.at(j))ans=false;
        }
    }
    cout<<(ans?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
from typing import Iterable
def main(N, M, KL):
    uf = UnionFindTree(N + M)
    for i, (K, *L) in enumerate(KL):
        for l in L:
            uf.union(i, N + l - 1)
    print('YES' if uf.same_all(range(N)) else 'NO')

class UnionFindTree:
    def __init__(self, n: int) -> None:
        self.parent = [-1] * n

    def find(self, x: int) -> int:
        p = self.parent
        while p[x] >= 0: x, p[x] = p[x], p[p[x]]
        return x

    def union(self, x: int, y: int) -> bool:
        x, y, p = self.find(x), self.find(y), self.parent
        if x == y: return False
        if p[x] > p[y]: x, y = y, x
        p[x], p[y] = p[x] + p[y], x
        return True

    def same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)

    def size(self, x: int) -> int:
        return -self.parent[self.find(x)]

    def same_all(self, indices: Iterable[int]) -> bool:
        f, v = self.find, self.find(indices[0])
        return all(f(i) == v for i in indices)

if __name__ == '__main__':
    input = sys.stdin.readline
    N, M = map(int, input().split())
    KL = [list(map(int, input().split())) for _ in range(N)]
    main(N, M, KL)


Measured memory_bytes: 26664
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
 /*   double t,x;
    cin>>t>>x;
    t=t/x;
    cout<<t*1.0<<'\n';*/
  
   /* int a,b,c;
    cin>>a>>b>>c;
    cout<<(a*b)/2<<'\n';*/

   /* int d;
    cin>>d;
    if(d==22){
        cout<<"Christmas Eve Eve Eve"<<'\n';
    }else if(d==23){
        cout<<"Christmas Eve Eve"<<'\n';
    }else if(d==24){
        cout<<"Christmas Eve"<<'\n';
    }else if(d==25){
        cout<<"Christmas"<<'\n';
    }*/

   /* int x,y;
    cin>>x>>y;
    y=y/2;
    cout<<x+y<<'\n';*/

   /* int n,a,b;
    cin>>n;
    if(n==1){
        cout<<"Hello World"<<'\n';
    }else{
        cin>>a>>b;
        cout<<a+b<<'\n';
    }*/

   /* int n;
    cin>>n;
    if(n==111){
        cout<<999<<'\n';
    }else if(n==119){
        cout<<991<<'\n';
    }else if(n==199){
        cout<<911<<'\n';
    }else if(n==191){
        cout<<919<<'\n';
    }else if(n==999){
        cout<<111<<'\n';
    }else if(n==911){
        cout<<199<<'\n';
    }else if(n==919){
        cout<<191<<'\n';
    }else if(n==991){
        cout<<119<<'\n';
    }*/

  /*  int a[5];
    for(int i=0; i<3; i++){
        cin>>a[i];
    }
    sort(a,a+3,greater<int>());
    a[0]=a[0]*10;
    a[0]=a[0]+a[1]+a[2];
    cout<<a[0]<<'\n';*/

  /*  int a,b;
    cin>>a>>b;
    a=a*b;
    if(a%2==0){
        cout<<"No"<<'\n';
    }else{
        cout<<"Yes"<<'\n';
    }*/

    int a,b;
    cin>>a;
    b=a/2;
    if(a%2==0){
        cout<<b*b<<'\n';
    }else{
        cout<<b*(b+1)<<'\n';
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s ,t;
  	cin>>s>>t;
  
  	if(t.length()==s.length()+1)
    {
        int f = 0;
     	for(int i=0;i<s.length();i++)
        {
        	if(s[i]!=t[i])
            {
                f=1;
                break;
            }
        }
      
      if(f==0)
        cout<<"Yes";
      else
        cout<<"No";
    }
    else
        cout<<"No";
      
  
	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
	int i,data[3][3];
	for(i=0;i<3;i++) scanf("%d %d %d",&data[i][0],&data[i][1],&data[i][2]);
	int flag = 0;
	int a,b,c,d,e,f;
	a = 0;
	d = data[0][0];
	e = data[0][1];
	f = data[0][2];
	b = data[1][0] - d;
	c = data[2][0] - d;
	
	if(	data[1][1] != b+e ||
		data[1][2] != b+f ||
		data[2][1] != c+e ||
		data[2][2] != c+f )	flag = 1;
	
	
	if(flag==0)	printf("Yes");
	else		printf("No");
	return 0;}

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

using namespace std;

#define endl "\n"
#define F first
#define S second
#define PB push_back
#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;

const int maxn = 1e5;
const int OO = 1e18;
const int mod = 1e9 + 7;

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

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

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

    int sum = 0;
    if(k > 0)
    {
        int x = min(a,k);
        sum += x;
        k -= x;
    }
    if(k > 0)
    {
        int x = min(b,k);
        k -= x;
    }
    if(k > 0)
    {
        int x = min(c,k);
        sum -= x;
        k -= x;
    }

    cout << sum;
	return 0;
}


Measured memory_bytes: 3592
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")
    };
}

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        r: f64,
    }
    println!("{}", 2.0 * 3.14159 * r);
}


Measured memory_bytes: 2224
#include<bits/stdc++.h>
using namespace std;
int main()
{
int N,a,input=0,output=0;
cin>>N;
  for(int i=0;i<N;i++)
  {
    cin>>a;
    if(a==(input= max(input,a)))
	  {
        output++;
      }
  }
cout<<output;
return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		// 日 
		//7人 for->A*i(0<i<?)<D
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();//限界日数
		int d = sc.nextInt();//
		int x = sc.nextInt();
		int a[] = new int[n];//i人目の参加者
		int date[] = new int[d];
		int datenum = 0;
		int total = 0;
		int count = 0;
		for(int i = 0; i < n;i++){//i人目の人をそれぞれ受け取り
			a[i] = sc.nextInt();
		}
	/*	for(int i = 0; i < d;i++){
			date[i] = datenum++;
		}
	*/
		//公式にiを代入して1人の食べた数をcount
		for(int peanum = 0; peanum < n;peanum++){//hensuuと何人目
			for(int hen = 0;(hen * a[peanum] + 1) <= d;hen++){//date
							count++;
			}
		}
		System.out.println(count+x);



		
		
	
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long inf = 1LL<<60;

int main(){
    int h,w,n;
    cin >> h >> w >> n;

    int H,W;
    H = max(h,w);
    W = min(h,w);

    for(int i=1;i<=W;i++){
        if(H*i>=n){
            cout << i << endl;
            break;
        }
    }
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    int N;
    cin >> N;
    vector<ll> a(N), b(N);
    vector< pair<ll, int> > ab(N);
    rep(i, N){
        cin >> a[i] >> b[i];
        ab[i].first = a[i] + b[i];
        ab[i].second = i;
    }

    sort(ab.begin(), ab.end(), greater<pair<ll,int> >());

    ll ao = 0, t = 0;
    for(int i = 0; i < N; i++){
        if(i % 2 == 0) t += a[ab[i].second];
        else ao += b[ab[i].second];
    }

    cout << t - ao << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define V 100000

int n,m,q;
vector<int> edge[V];
int v[V],d[V],c[V];
int color[V],dp[V];

void deep(int v,int d,int c){
	if(dp[v] >= d) return;
	if(color[v] == 0) color[v] = c;
	dp[v] = d;
	for(int i = 0;i < edge[v].size();i++){
		deep(edge[v][i],d-1,c);
	}
}

int main(){
	cin >> n >> m;
	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b;
		a--;b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	cin >> q;
	for(int i = 0;i < q;i++){
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}
	for(int i = 0;i < n;i++){
		color[i] = 0;
		dp[i] = -1;
	}
	for(int i = q-1;i >= 0;i--){
		deep(v[i],d[i],c[i]);
	}
	for(int i = 0;i < n;i++) cout << color[i] << endl;
}


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

const ll maxN=1e12;

ll n;

void ReadData()
{
    //freopen("DivRem.inp","r",stdin);
    //freopen("DivRem.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
}

bool Check (ll val) {return (val!=0 && n/val==n%val);}

void Solve()
{
    ll res=0, cap=sqrt(n);
    if (cap*cap==n) --cap;
    for (int i=1; i<=cap; ++i)
        if (n%i==0 && Check(n/i-1)) res+=n/i-1;
    cout<<res;
}

int main()
{
    ReadData();
    Solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdint>
#include <array>

int64_t luca_n(int N) {
    if (N==0) return 2;
    else if (N==1) return 1;
    else return luca_n(N-1) + luca_n(N-2);
}

int main() {
    int N;
    std::cin >> N;
    
    std::array<int64_t, 86> S = {};
    
    for (int i=0; i<=N; ++i) {
        if (i==0) S[i] = 2;
        else if (i==1) S[i] = 1;
        else S[i] = S[i-2] + S[i-1];
    }
    std::cout << S[N] << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	int n,a[182] = {}, b=0,c=0;
	cin >> n;
	for (int i=0;i<n;i++) cin >> a[i],b+=a[i];
	b=round((double) b/n);
	for(int i=0;i<n;i++) c+=(a[i]-b)*(a[i]-b);
	cout << c;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9+7;
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  
  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;
  if(u==s)
    a-=1;
  else b-=1;
  ou(a<<' '<<b);
}

Measured memory_bytes: 384
import collections
n = int(input())
a = list(map(str,input().split()))
c = collections.Counter(a)
set_a = set(a)
lists = []
for i in set_a:
    if int(c[i]) >= 2:
       lists.append(int(i))
    if int(c[i]) >= 4:
        lists.append(int(i))
lists.sort()
lists.reverse()
if len(lists) > 1:
    ans = int(lists[0]) * int(lists[1])
else:
    ans = 0
print(ans)


Measured memory_bytes: 23588
n, c = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(c)]
s = [list(map(int, input().split())) for _ in range(n)]
c0 = [[0 for _ in range(c)] for _ in range(3)]
c1 = [[0 for _ in range(c)] for _ in range(3)]
for i in range(n):
    for j in range(n):
        if (i + j) % 3 == 0:
            c0[0][s[i][j] - 1] += 1
        elif (i + j) % 3 == 1:
            c0[1][s[i][j] - 1] += 1
        elif (i + j) % 3 == 2:
            c0[2][s[i][j] - 1] += 1
for i in range(3):
    for j in range(c):
        for k in range(c):
            c1[i][j] += d[k][j] * c0[i][k]
"""
c2, c3 = [], []
for i in range(3):
    c2 = []
    for j in range(3):
        x = c1[i]
        a = [min(x), x.index(min(x))]
        c2.append(a)
        c1[i][c1[i].index(min(c1[i]))] = 10 ** 9
    c3.append(c2)
ans = 10 ** 9
for i in range(3):
    for j in range(3):
        for k in range(3):
            if c3[0][i][1] != c3[1][j][1] and c3[0][i][1] != c3[2][k][1] and c3[2][j][1] != c3[2][k][1]:
                m = c3[0][i][0] + c3[1][j][0] + c3[2][k][0]
                if m < ans:
                    ans = m
print(ans)"""
m = 0
ans = 10 ** 9
for i in range(c):
    for j in range(c):
        for k in range(c):
            if i != j and j != k and k != i:
                m = c1[0][i] + c1[1][j] + c1[2][k]
                if m < ans:
                    ans = m
print(ans)

Measured memory_bytes: 5620
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

typedef  long long ll;

#define rep(i,a,n) for(ll (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(ll (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007


using namespace std;

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

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

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}


void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}

ll divisors(ll n) {
    vector<ll> res;

    for(ll i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i-1);
        if(n/i == i) continue;
        res.push_back((n/i)-1);
    }

    ll ans = 0;

    rep(i,0,res.size()){
        if(res[i] != 0)
        if(n/res[i] == n%res[i]) ans += res[i];
    } 
    return ans;
}

void solve(void){
   int a,b;
   cin >> a >> b;
    if(a%2 == 0 || b%2 == 0)ns();
    else ys();
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    ll N;
    cin >> N;
    vec<ll> A(N),B(N);
    rep(i,N)cin >> A[i] >> B[i];
    vec<ll> MAXX;
    vec<ll> MINN;
    rep(i,N){
        MAXX.push_back(max(A[i], B[i]));
        MINN.push_back(min(A[i], B[i]));
    }
    sort(all(MAXX));
    sort(all(MINN));
    
    //必ず整数
    if(N % 2 == 1){
        cout << MAXX[(N+1)/2-1] - MINN[(N+1)/2-1] + 1 << endl;
    }
    else{
        ll mid = N / 2;
        long double ue = (long double)(MAXX[mid-1] + MAXX[mid]) / 2;
        long double sita = (long double)(MINN[mid-1] + MINN[mid]) / 2;
        cerr << ue << " " << sita << endl;
        cout << (ll)(2 * ue - 2 * sita + 1) << endl;
    }
}

Measured memory_bytes: 9820
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int A, B; cin >> A >> B;

    int ans = (A-1)*(B-1);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
v_list = sorted(list(map(int, input().split())))


def cook(ary):
    if len(ary) == 1:
        return ary[0]

    new_v = (ary[0] + ary[1]) / 2
    new_ary = [new_v] + ary[2:]
    return cook(new_ary)

print(cook(v_list))


Measured memory_bytes: 38256