akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 1000000007LL
#define EPS ((ld)(1e-9))
 
#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)
#define repr(i, s, e) for (int i = (s)-1, _##i = (e); i >= _##i; i--)
#define repi(i, x) for (auto &i : (x))
 
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << '(' << pai.first << ' ' << pai.second << ')';
}
 
template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    cout << '[';
    rep(i, sz(v)) cout << v[i] << ",";
    cout << "]";
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os, const set<T> v) {
    cout << "{";
    for (auto p : v) cout << p << ",";
    cout << "}";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> v) {
    cout << "{";
    for (auto p : v) cout << p << ",";
    cout << "}";
    return os;
}
 
#ifndef __SOULTCH
#define debug(...) 0
#define endl '\n'
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif
 
template<typename T> void get_max(T &a, T b) {a = max(a, b);}
template<typename T> void get_min(T &a, T b) {a = min(a, b);}

int N, M;
char a[3002], b[3002];

int dp[3001][3001];
pii prv[3001][3001];

int main(void) {
    iostream::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    cin >> (a+1) >> (b+1);
    N = strlen(a+1), M = strlen(b+1);

    repp(i, 1, N+1) repp(j, 1, M+1) {
        dp[i][j] = max({dp[i-1][j], dp[i][j-1], a[i]==b[j]?dp[i-1][j-1]+1:-1});
        if (dp[i][j] == dp[i-1][j]) prv[i][j] = {i-1, j};
        if (dp[i][j] == dp[i][j-1]) prv[i][j] = {i, j-1};
        if (a[i] == b[j] and dp[i][j] == dp[i-1][j-1]+1) prv[i][j] = {i-1, j-1};
    }

    int c = N, d = M;
    string res;
    while(dp[c][d] > 0) {
        pii t = prv[c][d];
        if (t.fi < c and t.se < d) res += a[c];
        c = t.fi, d = t.se;
    }

    reverse(all(res));
    cout << res << endl;
}

Measured memory_bytes: 105856
#include <stdio.h>
#include <math.h>
#define PI 3.141592
typedef struct{
	double x;
	double y;
}XY;
XY S(XY, XY);
XY T(XY, XY);
XY U(XY, XY);
void kock(int,XY,XY);
XY S(XY p1,XY p2) {
	XY s;
	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	return s;
}
XY T(XY p1, XY p2) {
	XY t;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	return t;
}
XY U(XY t,XY s) {
	XY u;
	double rad = 60*PI/180.0;
	u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
	u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;
	return u;
}
void kock(int n, XY p1, XY p2) {
	XY s, t, u;
	if (n == 0)	return;

	// p1, p2 から s, t, u を計算
	s = S(p1, p2);
	t = T(p1, p2);
	u = U(t, s);

	kock(n - 1, p1, s);
	printf("%lf %lf", s.x, s.y);
	printf("\n");
	kock(n - 1, s, u);
	printf("%lf %lf", u.x, u.y);
	printf("\n");
	kock(n - 1, u, t);
	printf("%lf %lf", t.x, t.y);
	printf("\n");
	kock(n - 1, t, p2);
}
int main(){
	XY p1 = {0,0}
	, p2 = {100.0};
	int n;
	scanf("%d",&n);
	printf("%lf %lf", p1.x, p1.y);
	printf("\n");
	kock(n,p1,p2);
	printf("%lf %lf", p2.x, p2.y);
	printf("\n"); 
return 0;
}


Measured memory_bytes: 2144
#include <iostream>

typedef long long ll;
const int MAX = 100010;
ll n, k;
int T[MAX];

bool enough(ll P);
ll binarySearch();

int main()
{
	using namespace std;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> T[i];
	}
	cout << binarySearch() << endl;
}

bool enough(ll P)
{
	int i = 0;
	for (int j = 0; j < k; j++)
	{
		int sum = 0;
		while (sum + T[i] <= P && i < n)
		{
			sum += T[i];
			i++;
		}
		if (i >= n)
		{
			return true;
		}
	}
	return false;
}

ll binarySearch()
{
	ll low = 0, high = 100000 * 10000;
	while (high - low > 1)
	{
		ll mid = (low + high) / 2;
		if (enough(mid))
		{
			high = mid;
		}
		else
		{
			low = mid;
		}
	}
	return high;
}


Measured memory_bytes: 3488
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

int main(){
    double N,T,A;
    cin>>N>>T>>A;
    v H(N);
    rep(i,0,N)cin>>H[i];

    ll best = 0;
    double nowdiff = abs(T- 0.006*double(H[0]) - A);
    rep(i,1,N){
        if(nowdiff > abs(T- 0.006*double(H[i]) - A)){
            nowdiff = abs(T- 0.006*double(H[i]) - A);
            best = i;
        }
    }
    best++;
    cout<<best;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;


int main(){
    ll N;
    cin >> N;
    vector<ll> h(N,0);
    vector<ll> dp(N,0);
    for(ll i=0;i<N;i++){
        cin>>h[i]
    ;}
    dp[0]=0;dp[1]=llabs(h[1]-h[0]);
    for(ll i=2;i<N;i++){
        dp[i]=min(dp[i-2]+llabs(h[i]-h[i-2]),dp[i-1]+llabs(h[i]-h[i-1]))
    ;}
    cout<<dp[N-1]<<endl;

return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
  int n,i,j;
  int max=0;
  int cnt=0;
  int tmp;
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
      j=i;
     while(j%2==0){
        cnt++;
        j=j/2;
     }
    if(max<=cnt){
      max=cnt;
      tmp=i;
    }
    cnt=0;
  }
  printf("%d\n",tmp);
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        sc.close();
        double l = m*6;
        double s = h*30+m*0.5;
        double cos;
        if (Math.abs(l-s) > 180) {
            cos = 360 - Math.abs(l-s);
        } else {
            cos = Math.abs(l-s);
        }
        double c2 = Math.pow(a, 2) + Math.pow(b, 2) - 2*a*b*Math.cos(Math.toRadians(cos));
        double c = Math.sqrt(c2);

        System.out.println(c);
        
    }
}

Measured memory_bytes: 35964
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

namespace n91 {

bool solve() {
  usize n;
  std::cin >> n;
  std::map<u32, usize> map;
  for (const auto i : rep(0_z, n)) {
    u32 a;
    std::cin >> a;
    ++map[a];
  }
  if (map.size() > 3_z) {
    return false;
  }
  if (n % 3_z != 0_z) {
    return map.size() == 1_z && map.cbegin()->first == static_cast<u32>(0);
  }
  if (map.size() == 1_z) {
    return map.cbegin()->first == static_cast<u32>(0);
  }
  u32 x = map.cbegin()->first;
  u32 y = std::next(map.cbegin())->first;
  for (const auto i : rep(0_z, n)) {
    u32 z = x ^ y;
    if (map[z] == 0_z) {
      return false;
    }
    --map[z];
    x = y;
    y = z;
  }
  return true;
}

void main_() { std::cout << (solve() ? "Yes" : "No") << std::endl; }

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


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

int main(){
  int N,a,s,sum = 0;
  cin >> N;
  s = N;
  while(s != 0){
  	a = s % 10;
    sum += a;
    s /= 10;
  }
  if(N % sum ==0)
  	cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string A;
  cin>>A;
  if(A.at(0)==A.at(1)){if(A.at(2)==A.at(3) && A.at(1)!=A.at(2)){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
  else if(A.at(0)==A.at(2)){if(A.at(1)==A.at(3) && A.at(1)!=A.at(2)){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
  else if(A.at(0)==A.at(3)){if(A.at(2)==A.at(1) && A.at(1)!=A.at(3)){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
  else{cout<<"No"<<endl;}
}


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

using namespace std;

int main(){
  int n;
  int tmp;
  bool flag = true;
  vector<int> h;
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> tmp;
    h.push_back(tmp);
  }
  for(int i=n-1; i>0; i--){
    if(h.at(i)<h.at(i-1)){
      h.at(i-1)--;
    }
    if(h.at(i)<h.at(i-1)){
      flag = false;
      break;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }  
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
using namespace std;

int main(){
	
	string s1,s2; cin >> s1 >> s2;
	int cont=0;
	
	for (int i=0 ; i<s1.size() ; i++)
		if (s1[i] != s2[i]) cont++;
	
	cout << cont << "\n";
	
	return 0;
}

Measured memory_bytes: 3904
n = int(input())
l = list(map(int, input().split()))
u = list(set(l))
if len(u)==1 and u[0]==0:
  print("Yes")
elif n%3==0:
  if len(u)==2:
    x = l.count(u[0])
    y = l.count(u[1])
    if (x==2*n/3 and y==n/3 and u[1]==0) or (y==2*n/3 and x==n/3 and u[0]==0):
      print("Yes")
    else:
      print("No")
  elif len(u)==3:
    x = l.count(u[0])
    y = l.count(u[1])
    z = l.count(u[2])
    if x==n/3 and y==n/3 and z==n/3 and ((u[0]^u[1])^u[2])==0:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")



Measured memory_bytes: 20540
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int N;
vector<int> dist;
vector<vector<int> > to;

void dfs(int v,int p=-1,int d=0){
  dist[v]=d;
  rep(i,to[v].size()){
    int nv=to[v][i];
    if(nv==p) continue;
    dfs(nv,v,d+1);
  }
}

vector<int> calcdist(int s){
  dist=vector<int>(N);
  dfs(s);
  return dist;
}

int main(){
  int u,v;
  cin >> N >> u >> v;
  u--; v--;
  to.resize(N);
  rep(i,N-1){
    int a,b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vector<int> distT=calcdist(u);
  vector<int> distA=calcdist(v);
  int mx=0;
  rep(i,N){
    if(distT[i]<distA[i]){
      chmax(mx,distA[i]);
    }
  }
  int ans=mx-1;
  cout << ans << endl;
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vb = vector<bool>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define xx first
#define yy second

#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)

#define rv(type,name,count) vector<type> name(count); FOR(_i,0,count) cin >> name[_i];
#define grid(type,name,c1,c2) vector<vector<type>> name(c1, vector<type>(c2)); FOR(_i,0,c1)FOR(_j,0,c2)cin >> name[_i][_j];

int main() {
	string s;
	cin >> s;
	vvl v(2, vl(sz(s)));
	v[0][0] = 1;
  v[1][0] = -1000000;
	v[1][1] = 1;
	FOR(i,0,sz(s)) {
		if (i >= 1) {
			v[0][i] = v[1][i-1] + 1;
			if (s[i] != s[i-1]) v[0][i] = max(v[0][i], 1+v[0][i-1]);
		}
		if (i >= 2) {
			v[1][i] = v[0][i-2]+1;
			if (s[i] != s[i-2] || s[i-1] != s[i-3]) {
				v[1][i] = max(v[1][i], v[1][i-2]+1);
			}
		}
	}
	cout << max(v[0][sz(s)-1], v[1][sz(s)-1]) << endl;
}

Measured memory_bytes: 5252
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
    int N, M; cin >> N >> M;

    priority_queue<long long> que;
    for (int i = 0; i < N; ++i) {
        long long A;
        cin >> A;
        que.push(A);
    }
    for (int i = 0; i < M; ++i) {
        long long t = que.top();
        que.pop();
        que.push(t/2);
    }
    long long res = 0;
    while (!que.empty()){
        res += que.top();
         que.pop();
        }
    cout << res << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
  
int main(){
    const std::string wrong_word("Hoshino");
    const std::string right_word("Hoshina");
	
    int num;
    std::cin >> num;
    std::cin.ignore(); // ignore next newline character
      
    for(int i = 0; i < num; ++i){
        std::string str;
        std::getline(std::cin, str);
		
        std::string::size_type pos = str.find(wrong_word);
        while(pos != std::string::npos){
            str.replace(pos, wrong_word.length(), right_word);
            pos = str.find(wrong_word);
        }
		
        std::cout << str << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1220
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

typedef struct data_t {
	int num;
	int x, y, z;
	bool operator<(const data_t& right) const {
		return num == right.num ? x < right.x : num < right.num;
	}
} D;

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	int x[N], y[N], z[N];
	rep(i, N) cin >> x[i] >> y[i] >> z[i];
	int ans = 0;
	cout << endl;
	rep(j, 8) {
		int ans1 = 0, ans2 = 0, ans3 = 0;
		int A = 1, B = 1, C = 1;
		if (j % 2 == 0) A = -1;
		if (j % 4 == j % 2) B = -1;
		if (j % 8 == j % 4) C = -1;
		// cout << A << B << C << endl;
		int tmp = 0;
		vector<D> sum;
		rep(i, N) {
			sum.push_back({ A * x[i] + B * y[i] + C * z[i], x[i], y[i], z[i] });
		}
		sort(sum.begin(), sum.end());
		rep(i, M) {
			ans1 += sum[i].x;
			ans2 += sum[i].y;
			ans3 += sum[i].z;
			// cout << sum[i].x << " " << sum[i].y << " " << sum[i].z << endl;
		}
		// cout << ans1 << " " << ans2 << " " << ans3 << endl << endl;
		ans = max(ans, abs(ans1) + abs(ans2) + abs(ans3));
	}

	cout << ans << endl;

    return 0;
}


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

using namespace std;

int fib(int n)
{
	int fibarray[45];
	for (int i = 0; i < n; i++)
	{
		fibarray[i] = 0;
	}
	fibarray[0] = 1;
	fibarray[1] = 1;

	for (int i = 2; i <= n; i++)
	{
		fibarray[i] = fibarray[i - 1] + fibarray[i - 2];
	}

	return fibarray[n];
}

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

	cout << fib(n) << endl;

	return 0;
}

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

using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<string,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

int  powermod(int  x, int  y, int p )
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}

int modinv(int x)
{
    return powermod(x, mod - 2, mod);
}

int ncr(int n,int r)
{
    int num=1;
    for(int i=n;i>n-r;i--)
        num*=i,num%=mod;

    int den=1;
    for(int i=2;i<=r;i++)
        den*=i,den%=mod;

    num*=modinv(den),num%=mod;
    return num;
}

int32_t main() 
{ 
    fast;
    int n,a,b;cin>>n>>a>>b;
    int ans=powermod(2,n,mod);
    ans=(ans-1+mod)%mod;
    ans-=ncr(n,a),ans+=mod,ans%=mod;
    ans-=ncr(n,b),ans+=mod,ans%=mod;
    cout<<ans;
} 

Measured memory_bytes: 256
#include <iostream>

int main()
{
  int d[50];
  int n;
  int all=0;

  std::cin >> n;

  for (int x=0; x < n; ++x){
    std::cin >> d[x];
  }

  for (int i=0; i < n; ++i){
    for (int j=1; i+j < n; ++j){
      all += d[i] * d[i+j];
    }
  }
    std::cout << all << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int cnt=0;
  for(int i=0;i<n;i++){
    cnt+=a[i]/2;
    a[i]%=2;
    if(i<n-1&&a[i]==1&&a[i+1]>0){
      a[i]-=1;
      a[i+1]-=1;
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long int sum=0;
  for(int i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0){
      sum+=i;
    }
  }
  cout<<sum<<"\n";
  return 0;
}


Measured memory_bytes: 3624
n, m = map(int, input().split())
a = list()
for i in range(n):
	a.append(list(map(int, input().split())))
b = list()
for i in range(m):
	b.append(int(input()))
for i in range(n):
	ans = 0
	for j in range(m):
		ans += a[i][j] * b[j]
	print(ans)



Measured memory_bytes: 6004
input()
A=list(map(int,input().split()))

def even(num, l):
    if num % 2 == 0:
        l.append(num)
        
B = []
for num in A:
    even(num, B)
    
C = []
for nn in B:
  if nn % 3 != 0 and nn % 5 != 0:
    C.append(nn)
    
if len(C) == 0:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 9096
c = [list(map(int, input().split())) for _ in range(3)]
if all([c[i][j] - c[i][j + 1] == c[i + 1][j] - c[i + 1][j + 1]
        for i in range(2) for j in range(2)]):
    print('Yes')
else:
    print('No')

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

int main(){
    int N,count;
    cin>>N;
    vector<int>t(N);
    vector<int>x(N);
    vector<int>y(N);
    for(int i=0;i<N;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    if(t[0]<x[0]+y[0]||(t[0]-x[0]-y[0])%2!=0){
        cout<<"No"<<endl;
    }
    else{
        for(int i=0;i<N-1;i++){
            int T=t[i+1]-t[i];
            int X=x[i+1]-x[i];
            int Y=y[i+1]-y[i];
            if((T-X-Y)%2!=0||T<X+Y){
                cout<<"No"<<endl;
                break;
             }
            else{
                count++;    
            }
        }
        if(count==N-1){
            cout<<"Yes"<<endl;
        }
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF INT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n;
    cin>>n;
    int ans=INF;
    REP(i,n){
        int a,b;
        cin>>a>>b;
        ans=min(ans,a+b);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
	static void Main()
	{
		var abc = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		var count = 0;
		if (abc[0] == abc[1])
			++count;
		if (abc[0] == abc[2])
			++count;
		if (abc[1] == abc[2])
			++count;

		Console.WriteLine(count == 1 ? "Yes" : "No");
	}
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int

const int mod = 998244353;
int before[(int)2e5] = {0};
int after[(int)2e5] = {0};
int read(int idx, int * tree){
    int sum = 0;
    while (idx > 0){
        sum += tree[idx];
        idx -= (idx & -idx);
    }
    return sum;
}


int mxx;
void update(int idx, int val, int * tree){
    while (idx <= mxx ){
        tree[idx] += val;
        idx += (idx & -idx);
    }
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    
    vi p2((int)2e5 + 10);
    p2[0] = 1;
    FOR1(i, 2e5)p2[i] = p2[i-1] * 2, p2[i] %= mod ;
    int n;cin >> n;
    vpii points(n);
    vi ys;
    map<int,int> yMap;
    FOR(i, n){
        cin >> points[i].first >> points[i].second;
        yMap[points[i].second] = 0;
        ys.pb(points[i].second);
    }
    int cnt= 1;
    mxx = yMap.size() + 1;
    for(auto& val: yMap){
        val.second = cnt++;
        update(val.second, 1, after);
    }
    sort(ys.begin(), ys.end());
    sort(points.begin(), points.end());
    int tot = p2[n] - 1;
    int ans = 0;
    assert(cnt == mxx);
    FOR(i, n){
        update(yMap[points[i].second], -1, after);
        int left = p2[i] - 1;
        int right = p2[ n - i -1] - 1;
        int down = p2[(lower_bound(ys.begin(), ys.end(), points[i].second) - ys.begin())] - 1;
        int up = p2[(n - 1-  (lower_bound(ys.begin(), ys.end(), points[i].second) - ys.begin()))] - 1;
        int beforeUp = i - read(yMap[points[i].second], before);  
        int beforeDown = i - beforeUp;

        int afterUp = (n - i -1) - read(yMap[points[i].second], after);
        int afterDown = (n-i - 1) - afterUp; 
        
        assert(beforeUp >= 0);
        assert(beforeDown >= 0);
        assert(afterUp >= 0);
        assert(afterDown >= 0);

        int sub = left + right + down + up - p2[beforeUp] - p2[beforeDown] - p2[afterUp] - p2[afterDown] + 4;
        sub %= mod;
        ans += tot - sub;
        ans %= mod;
        update(yMap[points[i].second], 1, before);
    }
    while(ans < 0)ans += mod;
    ans %= mod;
    cout <<ans;

}




Measured memory_bytes: 23920
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

struct edge
{
  int to, cap, rev;
};

const int MAX_N = 100;
// const int MAX_M = 1000;
const int MAX_L = 1000;
const int MAX_V = MAX_L + MAX_L + 2;
const int INF = 1 << 28;

vector<edge> G[MAX_V];
bool used[MAX_V];

void init_G()
{
  for (int v = 0; v < MAX_V; v++)
    G[v].clear();
}

void add_edge(int from, int to, int cap)
{
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[from].size() - 1});
}

int dfs(int v, int t, int f)
{
  if (v == t)
    return f;

  used[v] = true;

  for (int i = 0; i < (int)G[v].size(); i++)
  {
    edge &e = G[v][i];

    if (!used[e.to] && e.cap > 0)
    {
      int d = dfs(e.to, t, min(f, e.cap));

      if (d > 0)
      {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }

  return 0;
}

int max_flow(const int s, const int t)
{
  int flow = 0;

  for (;;)
  {
    memset(used, false, sizeof used);
    int f = dfs(s, t, INF);

    if (f == 0)
      return flow;
    else
      flow += f;
  }
}

int N; // number of houses
int M; // number of roads
int L; // number of requests

int as[MAX_L], ts[MAX_L]; // delivery addresses and times.
int dist[MAX_N][MAX_N];   // dist[u][v] is minimum distances from u to v.

// init_dist() initialize dist[][].
void init_dist()
{
  for (int i = 0; i < MAX_N; i++)
    for (int j = 0; j < MAX_N; j++)
      dist[i][j] = i == j ? 0 :INF;
}

// wrshall_floyd() calc minimum distances between all each towns.
void warshall_floyd()
{
  for (int k = 0; k < N; k++)
    for (int u = 0; u < N; u++)
      for (int v = 0; v < N; v++)
        dist[u][v] = min(dist[u][v], dist[u][k] + dist[k][v]);
}

// solve() solves question.
void solve()
{
  warshall_floyd();

  init_G();

  const int s = L + L, t = s + 1;
  // connect s and towns.
  for (int u = 0; u < L; u++)
    add_edge(s, u, 1);

  // connect towns and t.
  for (int u = 0; u < L; u++)
    add_edge(u + L, t, 1);

  // connect from u(=as[i]) to v(=as[j]) if dist[u][v] <= ts[j] - ts[i]
  for (int i = 0; i < L; i++)
    for (int j = 0; j < L; j++)
      if (i != j && dist[as[i]][as[j]] <= ts[j] - ts[i])
        add_edge(i, j + L, 1);

  printf("%d\n", L - max_flow(s, t));
}

// main() handles input.
int main()
{
  while (true)
  {
    init_dist();

    scanf("%d%d%d", &N, &M, &L);
    if (N == 0 && M == 0 & L == 0)
      break;

    // load roads.
    for (int m = 0; m < M; m++)
    {
      int u, v, d;
      scanf("%d%d%d", &u, &v, &d);
      dist[u][v] = d;
      dist[v][u] = d;
    }

    // load presents.
    for (int l = 0; l < L; l++)
    {
      scanf("%d%d", as + l, ts + l);
    }

    solve();
  }
  return 0;
}



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

namespace B.Bitter_Alchemy
{
    class Program
    {
        static void Main(string[] args)
        {
            var NX = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NX[0];
            var X = NX[1];

            var mi = new List<int>();

            for (int i = 0; i < N; i++)
            {
                mi.Add(int.Parse(Console.ReadLine()));
            }

            var cnt = mi.Count();

            for (int i = mi.Sum() + mi.Min(); i <= X; i += mi.Min())
            {
                cnt++;
            }

            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 15444
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#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 <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#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; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, K;
    cin >> N >> K;
    set<int> X;
    rep(i, K) {
        int d;
        cin >> d;

        rep(j, d) {
            int a;
            cin >> a;
            X.insert(a);
        }
    }
    ll ans = N - X.size();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	string s, t;
	vector<char> a;
	vector<char> b;

	cin >> s >> t;
	
	for (int i = 0; i < s.size(); i++) {
		a.push_back(s[i]);
	}

	for (int i = 0; i < t.size(); i++) {
		b.push_back(t[i]);
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end(), greater<char>());

	
	if (a < b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	// chrono::steady_clock sc;
 //  	auto start = sc.now();
 //  	ifstream cin;
 //  	cin.open("INPUT.txt");

	int N;
	cin>>N;
	cout<<fixed<<showpoint;
	cout<<setprecision(10);
	long double P[N];
	for (int i = 0; i < N; ++i)
	{
		cin>>P[i];
	}
	vector<long double> A;
	for (int i = 0; i < 2*N+1; ++i)
	{
		A.push_back(0);
	}
	A[N+1]=P[0];
	A[N-1]=1-P[0];
	for (int i = 2; i < N; i+=2)
	{
		long double hh=P[i]*P[i-1];
		long double ht=P[i]*(1-P[i-1]);
		long double th=(1-P[i])*P[i-1];
		long double tt=(1-P[i])*(1-P[i-1]);
		vector<long double> B(2*N+1,0);
		for (int j = 0; j < 2*N+1; ++j)
		{
			if(A[j]!=0)
			{
				B[j-2]+=A[j]*tt;
				B[j]+=A[j]*(ht+th);
				B[j+2]+=A[j]*hh;
			}
		}
		A=B;
	}
	long double ans=0;
	for (int i = N+1; i < 2*N+1; ++i)
	{
		ans+=A[i];
	}
	cout<<ans<<endl;
	
	// cin.close();
	// auto end = sc.now();
 //   	auto time_span = static_cast<chrono::duration<double>>(end - start);
 //   	cout<<"Operation took: "<<time_span.count()<<" seconds";

	return 0;
}

Measured memory_bytes: 640
use std::io;
use std::cmp;


fn main() {
    let (n, k) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    let hn = read::<isize>();
    let mut dp = vec![::std::isize::MAX; n];
    dp[0] = 0;

    for i in 1..n {
        let mut score = ::std::isize::MAX;
        for j in 1..cmp::min(k + 1, i + 1) {
            score = cmp::min(
                score,
                (hn[i - j] - hn[i]).abs() + dp[i - j]
            );
        }
        dp[i] = score;
    }

    println!("{}", dp[n - 1]);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 6396
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
unsigned long int gcd(unsigned long int a, unsigned long int b)
{
    unsigned long int i, j;

    while (1)
    {
        i = a / b;
        j = a % b;
/*
        printf("%ld = %ld x %ld + %ld\n", a, b, i, j);
*/
        if (j == 0) break;
        a = b;
        b = j;
    }
    return b;
}

unsigned long int lcm(unsigned long int a, unsigned long int b)
{
    return a/gcd(a, b)*b;
}

int main(){
    char line[128];
    char sp[] = " ";
    char *tok;
    unsigned long int a, b;

    while(gets(line) != NULL)
    {
        tok = (char*)strtok(line, sp);
        a = atol(tok);
        tok = (char*)strtok(NULL, sp);
        b = atol(tok);

        printf("%lu %lu\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

Measured memory_bytes: 528
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (100000)

using namespace std;

int main() {
  // read inputs
  int N, hs[MAX_N];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &hs[i]);
  }

  // solve dp
  int dps[MAX_N];
  dps[N - 1] = 0;
  dps[N - 2] = abs(hs[N - 1] - hs[N - 2]);
  for (int i = N - 3; i >= 0; i--) {
    dps[i] = min(dps[i + 1] + abs(hs[i + 1] - hs[i]),
                 dps[i + 2] + abs(hs[i + 2] - hs[i]));
  }
  printf("%d\n", dps[0]);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll N, M, tot;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin >> N >> M;
	for(int i = 1, x;i<=M;i++){cin >> x; tot+=x;}
	tot = max(N-tot, (1LL)*-1);
	cout << tot << '\n';
	return 0;
}

Measured memory_bytes: 3620
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	ll n,x,s;
	cin>>n;
	x = (-1+sqrt(1+8*n))/2;
	s = (x*(x+1))/2;
	if(n>s) cout<<x+1<<nw;
	else cout<<x<<nw;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	ll m;
	while(cin>>n>>m,n||m){
		vector<pii> v(n);
		ll ans = 0;
		rep(i,n){
			cin>>v[i].se>>v[i].fi;
			ans += v[i].se*v[i].fi;
		}
		sort(ALL(v));
		reverse(ALL(v));
		rep(i,n){
			if(v[i].se<m){
				ans -= v[i].se*v[i].fi;
				m -= v[i].se;
			}
			else{
				ans -= v[i].fi*m;
				break;
			}
		}
		cout<<ans<<endl;
	}
}


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

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

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

ll f(ll i,ll j,ll x,ll y) {
  if((i<=x&&j<=x)||(i>=y&&j>=y)) return j-i;
  if(i<=x&&j>=y) return x-i+1+j-y;
  if(x<i&&i<=y&&x<j&&j<y) return min(j-i,i-x+1+y-j);
  if(i<=x&&x<j&&j<y) return min(j-i,x-i+1+y-j);
  else return min(j-i,i-x+1+j-y);
}

void solve() {
  ll n,x,y;
  cin>>n>>x>>y;
  /*
  vvi d(n,vi());
  rep(i,n-1) d[i].eb(i+1);
  d[x-1].eb(y-1);
  */
  x--; y--;
  vi ans(n,0);
  rep(i,n-1){
    REP(j,i+1,n){
      //out(f(i,j,x,y));
      ans[f(i,j,x,y)]++;
    }
  }
  REP(i,1,n) out(ans[i]);
  //outv(ans);
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	int m, n;
	cin >> m >> n;
	while (n--) {
		int x;
		cin >> x;
		m -= x;
	}
	cout << max(-1, m) << endl;
}


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

#define int long long
#define inf 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)

int dp[1145141];
int dpr[1145141];

signed main() {
  int n;
  cin >> n;
  dp[0] = 1;
  dpr[0] = 1;
  rep1(i, n) {
    dp[i] = dp[i - 1];
    if(i >= 3) {
      dp[i] += dpr[i - 3];
    }
    dp[i] %= inf;
    dpr[i] = (dp[i] + dpr[i - 1]) % inf;
  }
  int ans = 0;
  rep(i, n - 1) {
    ans = (ans + dp[i] * (n - max((int)2, n - i - 1) + 1) + dp[i] * (n - 1) % inf * (n - 1)) % inf;
  }
  ans = (ans + dp[n - 1] * n) % inf;
  cout << ans << endl;
}


Measured memory_bytes: 17024
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long
#define pb push_back
#define INF 100000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;

char c;
char s;




signed main(){


    scanf("%c %c", &c, &s);

    if(c == 'H'){
        if(s == 'H'){
            printf("H\n");
        }else if(s == 'D'){
            printf("D\n");
        }
    }else if(c == 'D'){
        if(s == 'H'){
            printf("D\n");
        }else if(s == 'D'){
            printf("H\n");
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

class Point {
  public:
    double x, y;
};

void koch(int n, Point a, Point b) {
    if (n == 0)
        return;

    // coord to vector
    Point s, t, u;
    double theta = M_PI * 60.0 / 180.0;
    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(theta) - (t.y - s.y) * sin(theta) + s.x;
    u.y = (t.x - s.x) * sin(theta) + (t.y - s.y) * cos(theta) + s.y;

    // recursive
    koch(n - 1, a, s);
    cout << precise(8) << s.x << " " << s.y << endl;
    koch(n - 1, s, u);
    cout << precise(8) << u.x << " " << u.y << endl;
    koch(n - 1, u, t);
    cout << precise(8) << t.x << " " << t.y << endl;
    koch(n - 1, t, b);
}

int main() {
    fastIO;

    Point a, b;
    int n;

    cin >> n;
    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    cout << precise(8) << a.x << " " << a.y << endl;
    koch(n, a, b);
    cout << precise(8) << b.x << " " << b.y << endl;
}



Measured memory_bytes: 3276
"use strict"

let arg_str = require('fs').readFileSync('/dev/stdin', 'UTF-8')
arg_str = arg_str.split('\n')
const N = +arg_str[0]
const S_array = arg_str[1].split('')

let sum = 1
let current = S_array[0]
for(let i=1;i<N;i++){
  if(current != S_array[i]){
    current = S_array[i]
    sum++
  }
}

console.log(sum)

Measured memory_bytes: 21960
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=400005;
int ne[N],fi[N],zz[N],tot,n,m,flag[N],Flag,x,y;
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x){
	for (int i=fi[x];i;i=ne[i]){
		if (flag[zz[i]]){
			if (flag[zz[i]]==flag[x])Flag=1;
			continue;
		}
		flag[zz[i]]=3-flag[x];
		dfs(zz[i]);
	}
}
signed main(){
	scanf("%lld%lld",&n,&m);
	while (m--){
		scanf("%lld%lld",&x,&y);
		jb(x,y);jb(y,x);
	}
	int cnt=0,cnt1=0,cnt2=0;
	for (int i=1;i<=n;i++)
		if (!flag[i]){
			if (!fi[i]){
				cnt++;
				continue;
			}
			flag[i]=1;Flag=0;dfs(i);
			if (Flag)cnt1++;
			else cnt2++;
		}
	int ans=0,now=2*n-1;
	while (cnt--)ans+=now,now-=2;
	ans+=cnt1*cnt2*2+cnt2*cnt2*2+cnt1*cnt1;
	printf("%lld\n",ans);
}

Measured memory_bytes: 13312
S = input()

def flip(S):

    flipedS = ""
    for i in range(len(S)-1, -1, -1):
        flipedS += S[i]

    return flipedS  

def main(S):

    N = len(S)
    flipedS = flip(S)
    
    frontS = S[:((N-1)//2)]
    rearS  = S[((N+3)//2)-1:]
    fliped_frontS = flip(frontS)
    fliped_rearS  = flip(rearS)
    

    if S == flipedS and frontS == fliped_frontS and rearS == fliped_rearS:
        return "Yes"
    else:
        return "No"

if __name__ == "__main__":

    answer = main(S)
    print(answer)
    

Measured memory_bytes: 3064
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

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

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll x; cin >> x;
  fin((x >= 30?"Yes":"No"));
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(4); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 3596