akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;
#define MAXN 10001
int n, A[MAXN], Rank[MAXN];

void init()
{
	for (int i = 0; i < n; i++) {
		A[i] = i;
		Rank[i] = 0;
	}
}

int findSet(int x)
{
	if (x != A[x]) {
		x = findSet(A[x]);
	}
	return x;
}

void link(int x, int y)
{
	if (Rank[x] > Rank[y]) {
		A[y] = x;
	}else {
		A[x] = y;
		if (Rank[x] == Rank[y]) {
			Rank[y]++;
		}
	}
}

void Union(int x, int y)
{
	link(findSet(x), findSet(y));
}


bool same(int x, int y)
{
	return findSet(x) == findSet(y);
}

int main(int argc, char *argv[]) {
	int m;
	cin >> n >> m;
	init();
	for (int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (a == 0) {
			Union(b, c);
		}else if (a == 1) {
			if (same(b, c)) {
				printf("1\n");
			}else {
				printf("0\n");
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3152
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};


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

  double t, x;
  cin >> t >> x;
  printf("%.6lf\n", t/x);

}


Measured memory_bytes: 888
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << '\n';
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

long long COM(long long n, long long k) {
    long long mul = 1;
    long long div = 1;
    for (long long i = 0; i < k; i++) {
        mul = (mul * (n - i));
        div = (div * (i + 1));
    }
    return mul / div;
}


//--------------------------- Solve ---------------------------//

void solve() {
    int N, K; cin >> N >> K;

    if (K > COM(N-1, 2)) {
        cout << -1 << '\n';
        return;
    }

    vector<pair<int, int>> ans;

    for (int i = 2; i <= N; i++) {
        ans.push_back(make_pair(1, i));
    }

    int cnt = COM(N-1, 2);

    bool flag = false;
    for (int i = 2; i <= N-1; i++) {
        for (int j = i+1; j <= N; j++) {
            if (cnt == K) {
                flag = true;
                break;
            }
            ans.push_back(make_pair(i, j));
            cnt--;
        }
        if (flag) break;
    }

    cout << ans.size() << '\n';
    for (auto e : ans) {
        print(e.first, e.second);
    }
}

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

    solve();

    return 0;
}

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

#define fto(i, x, y) for(auto i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(auto i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(auto i = (x); i <= (y); i += a)
#define ftoit(it, var) for (auto it = var.begin(); it != var.end(); ++it)

#define ii pair<int, int>
#define mp make_pair
#define ff first
#define ss second

#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>

#define eb emplace_back
#define ef emplace_front
#define lb lower_bound
#define ub upper_bound

#define oo 1000000007
#define OO 1000000000000000007LL

using namespace std;

#define Pro "tmp"
#define maxN 1000007

int main() {

    int n, k;
    scanf("%d%d", &n, &k);

    double sum = 0.0;
    fto(i, 1, n) {
        int j = i;
        double res = 1.0;
        while (j < k) {
            j *= 2;
            res /= 2.0;
        }
        sum += res;
    }

    sum /= (double)n;
    cout << setprecision(20) << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;
ll D2 = 998244353LL;
using namespace std;

ll n, m, k;

int main(){
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> dfs;
    for(int i=0; i<n; ++i){
        cin >> a[i];
        dfs[i - a[i]] += 1;
    }
    ll ctr = 0;

    for(int i=0; i<n; ++i){
        ctr += dfs[a[i] + i];
    }
    cout << ctr << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    bool can = true;
    for(int i = 0; i < s.size(); i++){
        if(i%2 == 0 && s[i] == 'L') can = false;
        else if (i%2 == 1 && s[i] == 'R') can = false;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
ll k;
ll a[200010],f[200010];

void solve(){
    cin >> n >> k;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> f[i];
    }
    sort(a,a+n);
    sort(f,f+n);
    ll l=-1,r=INF;
    while(r-l>1){
        ll mid=(l+r)/2;
        ll num=0;
        rep(i,n){
            num+=a[i]-min(a[i],mid/f[n-1-i]);
        }
        if(num<=k){
            r=mid;
        }
        else{
            l=mid;
        }
    }
    cout << r << endl;
}

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

Measured memory_bytes: 3328
#include<iostream>

using namespace std;

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

int INF = 10e8;
const int max_n = 10e5;
int x[max_n+1];
int y[max_n+1];
int w[max_n+1];

int wseg[2*max_n+1];
int hseg[2*max_n+1];

int pow2(int n_){
    int n=1;
    while(n<n_) n*=2;
    return n;
}

void init(int n_, int seg[]){
    int n = pow2(n_);
    REP(i, 2*n-1) seg[i] = 1;
    REP(i, (2*n-1)-(n-n_)) seg[i] = 0;
}

void query(int a, int b, int k, int l, int r, int seg[]){
    if(r<=a || b<=l) return;
    if(a<=l && r<=b){
        seg[k] = 1; return;
    } else {
        query(a, b, k*2+1, l, (l+r)/2, seg);
        query(a, b, k*2+2, (l+r)/2, r, seg);
    }
}

int update(int n_, int seg[]){
    int n=pow2(n_);
    REP(i, n){
        int k = i+n-1;
        while(k>0){
            k = (k-1)/2;
            seg[k] = max(seg[k], min(seg[k*2+1], seg[k*2+2]));
        }
    }
    return seg[0];
}

int main(){
    int n, W, H;
    cin >> n >> W >> H;

    REP(i, n){
        cin >> x[i] >> y[i] >> w[i];
    }

    init(2*W+1, wseg);
    init(2*H+1, hseg);

    REP(i, n){
        query(max(0, 2*(x[i]-w[i])), min(2*W+1, 2*(x[i]+w[i])+1), 0, 0, pow2(2*W+1), wseg);
        query(max(0, 2*(y[i]-w[i])), min(2*W+1, 2*(y[i]+w[i])+1), 0, 0, pow2(2*H+1), hseg);
    }

    /*
    REP(i, 2*pow2(2*W+1)-1) cout << wseg[i];
    cout << endl;
    REP(i, 2*pow2(2*H+1)-1) cout << hseg[i];
    cout << endl;
    */
    if(update(2*W+1, wseg) || update(2*H+1, hseg)){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 8404
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll q;
  cin>>q;
  PQR b;
  PQ s;
  ll cu=0;
  ll mi=0;
  rep(i,q){
    ll a;
    cin>>a;
    if(a==1){
      ll n,m;
      cin>>n>>m;
      cu+=m;
      s.pu(n);
      b.pu(n);
      if(s.top()>b.top()){
        ll st=s.top();
        s.pop();
        ll bt=b.top();
        b.pop();
        b.pu(st);
        s.pu(bt);
        mi+=abs(st-bt);
      }
    }
    else{
      cout<<s.top()<<" "<<mi+cu<<endl;
    }
  }
}

Measured memory_bytes: 6516
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<double> v(N);
	for (int i = 0; i < N; i++){
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	v[1] = (v[1]+v[0])/2;
	for (int i = 1; i < N-1; i++){
		v[i + 1] = (v[i]+v[i+1])/2;
	}
	cout << v[N - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
Imports System.Collections.Generic
Imports System.Console
Imports System.Math  
Module Program
 	Sub Main()
        Dim input As String() = Console.ReadLine().Split(" ")
	    Dim A As Integer = input(0)
	    Dim B As Integer = input(1)
        Console.WriteLine(Math.Max(A+B,Math.Max(A-B,A*B)))
    End Sub
End Module


Measured memory_bytes: 11220
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll KK, HH, WW;

  ll div = 1e9 + 7;
  // std::cout << div << '\n';

  std::cin >> HH >> WW >> KK;

  ll trans[WW][WW];

  for (size_t i = 0; i < WW; i++) {
    for (size_t j = 0; j < WW; j++) {
      trans[i][j] = 0;
    }
  }

  for (size_t i = 0; i < WW; i++) {
    for (size_t i2 = i; i2 < WW; i2++) {
      if (i > 0 && i2 - i <2) {
        continue;
      }
      for (size_t i3 = i2; i3 < WW; i3++) {
        if (i2 > 0 && i3 -i2 < 2) {
          continue;
        }
        // #valid check
        // std::cout << "i::"<<i<<"  i2::"<<i2<<"  i3::"<<i3 << '\n';
        for (size_t i4 = i3; i4 < WW; i4++) {
          if (i3 > 0 && i4 -i3 < 2) {
            continue;
          }
          int sss[WW];
          for (size_t j = 0; j < WW; j++) {
            sss[j] = j;
          }

          if (i != 0) {
            int temp = sss[i-1];
            sss[i-1] = sss[i];
            sss[i] = temp;
          }
          if (i2 != 0) {
            int temp = sss[i2-1];
            sss[i2-1] = sss[i2];
            sss[i2] = temp;
          }
          if (i3 != 0) {
            int temp = sss[i3-1];
            sss[i3-1] = sss[i3];
            sss[i3] = temp;
          }
          if (i4 != 0) {
            int temp = sss[i4-1];
            sss[i4-1] = sss[i4];
            sss[i4] = temp;
          }

          for (size_t j = 0; j < WW; j++) {
            trans[j][sss[j]] += 1;
          }
        }



      }
    }
  }
  // 
  // std::cout << "trans mat ============" << '\n';
  // 
  // for (size_t i = 0; i < WW; i++) {
  //   for (size_t j = 0; j < WW; j++) {
  //     std::cout << trans[i][j] << ' ';
  //   }
  //   std::cout  << '\n';
  // }
  // std::cout << "trans mat ============ end" << '\n';


  ll ans_dence[WW];
  // for (size_t i = 0; i < WW; i++) {
  //   ans_dence[i] = 1;
  // }
  ans_dence[0] = 1;
  for (size_t i = 1; i < WW; i++) {
    ans_dence[i] = 0;
  }

  for (size_t i = 0; i < HH; i++) {
    ll ans_dence_next[WW];
    for (size_t hh = 0; hh < WW; hh++) {
      ans_dence_next[hh] = 0;
    }
    for (size_t j = 0; j < WW; j++) {
      ll ans_dence_j = 0;
      for (size_t j2 = 0; j2 < WW; j2++) {
        ans_dence_j = (trans[j][j2] * ans_dence[j2] + ans_dence_j) % div;
      }
      ans_dence_next[j] = ans_dence_j;
    }
    for (size_t gg = 0; gg < WW; gg++) {
      ans_dence[gg] = ans_dence_next[gg];
    }
  }

  // for (size_t i = 0; i < WW; i++) {
  //   std::cout << ans_dence[i] << '\n';
  // }
  // 
  // std::cout << "answer+++++++++" << '\n';

  std::cout << ans_dence[KK-1] << '\n';


  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),d = sc.nextInt();
        int[][] x = new int[n][d];
        int count = 0;
        for(int i = 0;i<n;i++){
            for(int j = 0;j<d;j++){
                x[i][j] = sc.nextInt();
            }
        }
        for(int i = 0;i<n;i++){
            int j = i+1;
            while(j<n){
                int tmp = 0;
                for(int k = 0;k<d;k++){
                    tmp += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
                }
                int l =1;
                while(l*l<=tmp){
                    if(l*l==tmp){
                        count ++;
                    }
                    l ++;
                }
                j++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {

	static int n, a, b, h[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		a = sc.nextInt();
		b = sc.nextInt();
		h = new int[n];
		for(int i=0;i<n;i++)h[i] = sc.nextInt();
		sc.close();
		
		int l = 0;
		int r = (int)1e9+100;
		while(l+1<r) {
			int c = (l+r)/2;
			if(check(c))r = c;
			else l = c;
		}
		
		System.out.println(r);
		
	}
	
	static boolean check(int x) {
		long num = 0;
		for(int i=0;i<n;i++) {
			long t = h[i];
			t -= ((long)b)*x;
			if(t > 0) {
				num += ((long)t +(a-b-1) )/(a-b);
			}
			if(num>x) {
				return false;
			}
		}
		return true;
	}
}



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

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i, n) cin >> vec.at(i);
  sort(vec.begin(), vec.end());
  bool a = true;
  rep(i, n-1) {
    if(vec.at(i) == vec.at(i+1)) {
      a = false;
      break;
    }
  }
  if(a) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    if(m == 1){
        cout << 1 << endl;
        return 0;
    }
    vector<P> a(m);
    rep(i, m)cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end());
    int l = a[0].first;
    int r = a[0].second;
    int ans = 0;
    for(int i = 1; i < m; i++){
        if(a[i].first >= r){
            ans++;
            l = a[i].first;
            r = a[i].second;
        }
        r = min(r, a[i].second);
        if(i == m - 1)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
<?php
  list($a, $b, $c) = explode(" ", trim(fgets(STDIN)));

  $n = $a;
  $amari = [];
  while(1){
    if($n % $b == $c){
      echo "YES";
      exit;
    }else{
      $n += $a;
    }
    if(isset($amari[$n%$b])) break;
    $amari[$n%$b] = true;
  }
  echo "NO";
  exit;

Measured memory_bytes: 16300
#[macro_use]
mod utils {
    macro_rules! input {
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};

        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
}

fn main() {
    input! {
        h:usize, w:usize,
        grid : [chars; h],
    }

    let check = |c: char| {
        if c == '#' {
            1
        } else {
            0
        }
    };

    let mut dp = vec![vec![-1; w]; h];
    dp[0][0] = check(grid[0][0]);

    for i in 1..w {
        if grid[0][i] == '#' {
            dp[0][i] = dp[0][i - 1] + (1 - check(grid[0][i - 1]));
        } else {
            dp[0][i] = dp[0][i - 1];
        }
    }
    for i in 1..h {
        if grid[i][0] == '#' {
            dp[i][0] = dp[i - 1][0] + (1 - check(grid[i - 1][0]));
        } else {
            dp[i][0] = dp[i - 1][0];
        }
        for j in 1..w {
            if grid[i][j] == '#' {
                dp[i][j] = std::cmp::min(
                    dp[i][j - 1] + (1 - check(grid[i][j - 1])),
                    dp[i - 1][j] + (1 - check(grid[i - 1][j])),
                );
            } else {
                dp[i][j] = std::cmp::min(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

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


Measured memory_bytes: 4352
import sys
input=sys.stdin.readline
from bisect import bisect_right

def main():
    n,d,a=map(int,input().split())
    XH=[list(map(int,input().split())) for _ in range(n)]
    XH.sort()
    X=[i[0] for i in XH]
    Damage=[0]*(n+1)
    ans=0
    for i,(x,h) in enumerate(XH):
        Damage[i]+=Damage[i-1]
        h-=Damage[i]
        if h<=0:
            continue
        cnt=(h+a-1)//a
        ans+=cnt
        Damage[i]+=a*cnt
        br=bisect_right(X,x+2*d)
        Damage[br]-=a*cnt
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 88412
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S, T;
  cin >> S >> T;
  ll ans = 0;
  REP(i, 3) {
    if (S[i] == T[i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
vector<ll> a;

void solve(){
    cin >> n;
    a.resize(n,0);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    if (n%3!=0) puts(a[n-1]==0 ? "Yes" : "No") ;
    else puts(a[0]==a[n/3-1] && a[n/3]==a[2*n/3-1] && a[(2*n)/3]==a[n-1] && (a[0]^a[n/3]^a[(2*n)/3])==0 ? "Yes" : "No") ;
}

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

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

using namespace std;
int main(int argc, char *argv[]) {
    	int i,check[26]={0},size;
		string s;
		cin >> s;
		
		size = s.size();
		//使用されている英単語をチェック
		for(i = 0; i < size; i++)
				check[s[i] - 'a'] = 1;
		
		if(size < 26){
			//使用されていない最小の単語を探索
			for(i = 0;check[i] != 0;i++){}
			s.push_back(i+'a');
			cout << s << "\n";
			return 0;
		}
		else{
			for(i = 25; i >= 0; i--){
				for(int j = s[i] - 'a'+1; j < 26; j++){
					if(check[j] == 0){
						s.erase((s.begin()+i),s.end());
						s.push_back(j + 'a');
						cout << s << "\n";
						return 0;
					}
				}
				check[s[i] - 'a'] = 0;
			}
			printf("-1\n");
		}
}

Measured memory_bytes: 256
using System;  
 class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();

            if (S.Length != T.Length)
            {
                Console.WriteLine("No");
                return;
            }
            
            for (int i = 0; i < S.Length; i++)
            {
                if (S == T)
                {
                    Console.WriteLine("Yes");
                    return;
                }

                char c = S[0];
                S = S.Substring(1) + c.ToString();

            }

            Console.WriteLine("No");

        }
    }

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int x, y, z;
  cin >> x >> y >> z;

  int ans = x / (y + z);
  if (x - ans * (y + z) < z) ans--;

  // 解答
  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

int main() {
	int x; cin >> x;
	int ans = -1;
	REP(b, 1, x+1) {
	    REP(p, 2, 11) {
	        int tmp = pow(b, p);
	        if(tmp > x) break;
	        ans = max(ans, tmp);
	    }
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int q;
    cin >> q;

    priority_queue<int> lt;
    priority_queue<int, vector<int>, greater<int>> gt;
    int ls = 0;
    int gs = 0;
    int sum = 0;
    rep(i, q){
        int x;
        cin >> x;

        if(x == 2){
            int ans = lt.top() * SZ(lt) - ls - lt.top() * SZ(gt) + gs;
            cout << lt.top() << " " << ans + sum << endl;

            continue;
        }
        int a, b;
        cin >> a >> b;
        sum += b;

        if(lt.empty() || lt.top() >= a){
            lt.push(a);
            ls += a;
        }else{
            gt.push(a);
            gs += a;
        }
        while(SZ(lt) - SZ(gt) > 1){
            gt.push(lt.top());
            gs += lt.top();
            ls -= lt.top();
            lt.pop();
        }
        while(SZ(lt) - SZ(gt) < 0){
            lt.push(gt.top());
            ls += gt.top();
            gs -= gt.top();
            gt.pop();
        }
    }

    return 0;
}


Measured memory_bytes: 3828
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    A = [0] * N
    for i in range(N):
        A[i] = [int(s) - 1 for s in reversed(readline().split())]

    S = set()

    def check(i):
        if not A[i]:
            return
        j = A[i][-1]
        if i == A[j][-1]:
            if i > j:
                i, j = j, i
            S.add((i, j))

    for i in range(N):
        check(i)

    day = 0
    matches = 0
    while S:
        day += 1
        S, S_prev = set(), S
        for i, j in S_prev:
            A[i].pop()
            A[j].pop()
            matches += 1
        for i, j in S_prev:
            check(i)
            check(j)

    if matches == N * (N - 1) // 2:
        ans = day
    else:
        ans = -1

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 87088
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    x, t = LI()
    print(max(0, x-t))
    return

#B
def B():
    s = S()
    print("".join(s[::2]))
    return

#C
def C():
    II()
    a = LI()
    lis = [0] * (10**5+2)
    for ai in a:
        lis[ai - 1] += 1
        lis[ai] += 1
        lis[ai + 1] += 1
    print(max(lis))
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 52832
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }




signed main() {

	int N;
	cin >> N;
	vector<int> B(N);
	vector<int> A(N);
	rep(i, N - 1) cin >> B[i];

	int ans = 0;
	rep(i, N) {
		if (i == 0) {
			A[i] = B[0];
		}
		else if (i == N - 1) {
			A[i] = B[i-1];
		}else{
			A[i] = min(B[i - 1], B[i]);
		}
		ans += A[i];
	}

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


Measured memory_bytes: 256
h, w = map(int, input().split())
c = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(h)]
def warshall_floyd(n, d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d
dic = {}
for i in range(h):
    for j in range(w):
        if a[i][j] not in dic:
            dic[a[i][j]] = 1
        else:
            dic[a[i][j]] += 1
          
c = warshall_floyd(10, d=c)          

ans = 0
for i in dic.keys():
    if i != -1 and i != 1:
        ans += c[i][1] * dic[i]
print(ans)

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

#define mod 1000000007
#define pb push_back
#define fr first
#define sc second
#define linf  (1ll << 60)
#define inf (((1 << 30) - 1) << 1)
#define leps 1e-18
#define mkp make_pair
#define pnode Node*
#define mpi unordered_map<int, int>
const double eps = 0.000000001;
std::random_device rd;
std::mt19937 mt(rd());
using namespace std;

const int maxn = 100001;

struct FenwickTree {
    vector<int> bit;  // binary indexed tree
    int n;

    FenwickTree(int n) {
        this->n = n;
        bit.assign(n, 0);
    }

    FenwickTree(vector<int> a) : FenwickTree(a.size()) {
        for (size_t i = 0; i < a.size(); i++)
            add(i, a[i]);
    }

    int sum(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }

    int sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }

    void add(int idx, int delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
};

int main() {

    string s;
    int t;
    cin >> s >> t;

    if (s.length() == 1) {
        cout << (t / 2) << endl;
        return 0;
    }

    vector<int> u;
    char c = s[0];

    int cnt = 1;
    for (int i = 1; i < s.length(); i++) {
        if (s[i] == c) cnt++;
        else {
            u.pb(cnt);
            cnt = 1;
            c = s[i];
        }
    }
    u.pb(cnt);

    if (u.size() == 1) {
        long long ans = 1ll * s.length() * t;

        ans >>= 1;

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

    if (s[0] == s.back()) {
        long long ans = 0;
        ans += (u[0] / 2);

        for (int i = 1; i < u.size() - 1; i++) {
            ans += 1ll * t * (u[i] / 2);
        }
        ans += 1ll * ((u[0] + u.back()) / 2) * (t - 1);
        ans += (u.back() / 2);
        cout << ans << endl;
    } else {
        long long ans = 0;
        for (auto x : u) {
            ans += 1ll * (x >> 1) * t;
        }
        cout << ans << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<31)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s, t;
bool ans;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> s >> t;
    eper(i, s.size()-t.size(), 0) {
        bool flag = true;
        rep(j, i, i+t.size()) {
            if (s[j] == t[j-i] || s[j] == '?') continue;
            flag = false;
            break;
        }
        if (flag) {
            s.erase(i, t.size());
            s.insert(i, t);
            ans = true;
            break;
        }
    }
    if (!ans) 
        cout << "UNRESTORABLE" << endl;
    else {
        rep(i, 0, s.size()) s[i] = s[i] == '?' ? 'a' : s[i];
        cout << s << endl;
    }
}


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


int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  priority_queue<int> q;
  q.push(a);
  q.push(b);
  q.push(c);
  for(int i=1;i<=k;++i){
    int x=q.top();
    q.pop();
    x=x*2;
    q.push(x);
  }
  int ans=0;
  while(!q.empty()){
    ans+=q.top();
    q.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <sstream>
using namespace std;

typedef long long ll;

ll operation(ll x, ll K) {
    while (x > K) {
        if (x % K == 0) x = x / K;
        else x = x % K;
    }
    return x;
} 

bool isGood(ll x, ll K) {
    while (x % K == 0) {
        x /= K;
    }

    return (x % K == 1);
}

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

    vector<ll> toTest;

    for (ll i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            toTest.push_back(i);
            if (i != N / i) toTest.push_back(N / i);
        }
    }

    ll n = N - 1;

    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            toTest.push_back(i);
            if (i != n / i) toTest.push_back(n / i);
        }
    }

    // toTest.push_back(N);
    // toTest.push_back(n);

    if( N == 2) {
        cout << 1;
        return 0;
    }

    ll ans = 2;
    for (auto it: toTest) {
        if (isGood(N, it)) ans++;
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {
		FastScanner scanner = new FastScanner();
		int n=scanner.nextInt();
		int k=scanner.nextInt();
		String s=scanner.next();
		List<Integer>list =new ArrayList<>();
		list.add(0);
		int cnt=1;
		char pre=s.charAt(0);
		if(pre=='0'){
			list.add(0);
		}
		s=s.charAt(n-1)=='0'?s+"1":s+"0";
		for(int i=1;i<=n;i++){
			char now =s.charAt(i);
			if(pre==now){
				cnt++;
			}else{
				list.add(list.get(list.size()-1)+cnt);
				cnt=1;
			}
			pre=now;
		}
		int max=-1;
		for(int l=1;l<list.size();l+=2){
			int r=l+2*k;
			int tmp;
			if(r>=list.size()){
				tmp=list.get(list.size()-1)-list.get(l-1);
			}else{
				tmp=list.get(r)-list.get(l-1);
			}
			max=Math.max(max, tmp);
		}
		System.out.println(max);
	}
	
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


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

#define YES "YES"
#define NO "NO"

using namespace std;

int main(){
    vector<int> e(4, 0);
    int a, b;
    for(int i=0; i<3; ++i){
        cin>>a>>b;
        e[a-1]++;
        e[b-1]++;
    }

    for(int i=0; i<4; ++i){
        if(e[i]>2){
            cout<<NO<<endl;
            return 0;
        }
    }
    cout<<YES<<endl;
    return 0;
}

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

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

int cnt[100005];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	cnt[0] = 3;
	mint ans = 1;
	rep(i,n){
		int a;
		cin >> a;
		if(cnt[a] == 0){
			cout << 0 << endl;
			return 0;
		}
		ans *= cnt[a];
		--cnt[a];
		++cnt[a+1];
	}
	cout << ans.x << endl;
	return 0;
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
constexpr auto INF = 2147483647;
static const double EPS = pow(10,-10);
typedef long long ll;
static int COUNTER_CLOCKWISE = 1;
static int CLOCKWISE = -1;
static int ONLINE_BACK = 2;
static int ONLINE_FRONT = -2;
static int ON_SEGMENT = 0;




class Vector2{
  public:
  double x, y;
  Vector2(){}
  Vector2(double x, double y): x(x), y(y) {}

  Vector2 operator + (Vector2 v) {
    return Vector2(x + v.x , y + v.y);
  }
  Vector2 operator - (Vector2 v) {
    return Vector2(x - v.x , y - v.y);
  }

  Vector2 operator * (double d){
    return Vector2(d*x, d*y);
  }

  double norm(){
    return pow(x,2) + pow(y,2);
  }

};

double dot(Vector2 a, Vector2 b){
  return a.x * b.x + a.y * b.y; 
}

double cross(Vector2 a, Vector2 b){
  return a.x * b.y - a.y*b.x;
}

Vector2 projection(Vector2 a, Vector2 b, Vector2 p){
  Vector2 base = b - a;
  Vector2 hypo = p - a;
  double norm_base = pow(base.x,2) + pow(base.y,2);

  Vector2 x;
  x = a + base*(dot(hypo,base) / norm_base);
  return x;
}

Vector2 refrection(Vector2 a, Vector2 b, Vector2 p){
  Vector2 v, p_projection;
  p_projection = projection(a,b,p); 
  v = p_projection + (p_projection - p);
  return v;
}

int ccw(Vector2 a, Vector2 b, Vector2 p){
  Vector2 hypo = p - a;
  Vector2 base = b - a;
  if(cross(base,hypo) > EPS) return COUNTER_CLOCKWISE;
  if(cross(base,hypo) < -EPS) return CLOCKWISE;
  if(dot(base,hypo) < -EPS) return ONLINE_BACK;
  if(hypo.norm() > base.norm()) return ONLINE_FRONT;
  return ON_SEGMENT;
}




int main(){
  Vector2 a,b,p;
  int queri;
  cin >> a.x >> a.y >> b.x >> b.y;
  cin >> queri;
  rep(i,queri){
    cin >> p.x >> p.y;
    int ans = ccw(a,b,p);
    if(ans == COUNTER_CLOCKWISE) cout << "COUNTER_CLOCKWISE";
    else if(ans == CLOCKWISE) cout << "CLOCKWISE";
    else if(ans == ONLINE_BACK) cout << "ONLINE_BACK";
    else if(ans == ONLINE_FRONT) cout << "ONLINE_FRONT";
    else if(ans == ON_SEGMENT) cout << "ON_SEGMENT";
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char> > table(h+1, vector<char>(w+1, ' '));

  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      cin >> table.at(i).at(j);
    }
  }

  for(int i=1; i<=h; i++){
    bool isBlank=true;
    for(int j=1; j<=w; j++){
      if(table.at(i).at(j) == '#') isBlank=false;
    }

    if(isBlank){
         for(int j=1; j<=w; j++){
          table.at(i).at(j) = ' ';
        }
    }
  }

  for(int j=1; j<=w; j++){
    bool isBlank=true;
    for(int i=1; i<=h; i++){
      if(table.at(i).at(j) == '#') isBlank=false;
    }

    if(isBlank){
         for(int i=1; i<=h; i++){
          table.at(i).at(j) = ' ';
        }
    }
  }

  for(int i=1; i<=h; i++){
    bool isBlank=true;
    for(int j=1; j<=w; j++){
      if(table.at(i).at(j) != ' ') {
        cout << table.at(i).at(j); 
        isBlank = false;
      }
    }
    if(!isBlank) cout << endl;
  }

}

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

#define int long long

#define MOD 1000000007
#define PB(a) push_back(a);
#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, a, b) for (int i = a; i < b; i++)
using  ll = long long;

signed main()
{
	string s;
	cin >> s;
	int l = s.length();
	int res = 0;
	rep(i, l) res += s[i];
	cout << res - '0' * l << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; for(auto v : V) os << v << " "; return os << "]"; }
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; for(auto s:S) os<<s<<" ";return os<<"}"; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) { os << "{ "; for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") "; return os<<"}"; }
#ifdef LMAO
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | "; __f(comma+1, args...); }
#else
    #define trace(...) 42
#endif
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
#define all(x) x.begin(), x.end()
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000010;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;    
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)   
/*****************start************/

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed<<setprecision(25);cerr<<fixed<<setprecision(10);
    int n;
    cin>>n;
    vector<ll> a(n);
    ll rem =1e18;
    ll ans=1;
    bool flag=false;
    for(auto &x:a)
    {
        cin>>x;
        if(!x)
        {
            cout<<0<<endl;
            return 0;
        }
        if(ans <= rem/x)
            ans*=x;
        else
        {
            flag=true;
        }
    }
    if(flag)
        ans=-1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
ll MAX=9223372036854775807;

int main(){
    fast_io;
    int n;
    cin>>n;
    int t,a;
    cin>>t>>a;
    a=1000*a;
    int h[n];
    int closest = MOD;
    int id=-1;
    for (int i = 0; i < n; ++i)
    {
    	cin>>h[i];
    	int curr = 1000*t-6*h[i];
    	if(abs(curr-a)<closest){
    		closest=abs(curr-a);
    		id=i+1;
    	}
    }
    show(id);
    return 0;
}

Measured memory_bytes: 256