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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void init_sieve(vector<bool> &is_prime,int n){
	for(int i=0; i<n; ++i) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2; i*i<=n; ++i){
		if(is_prime[i]){
			for(int j=2*i; j<n; j+=i) is_prime[j]=false;
		}
	}
}

vector<bool> is_prime(1e6,true);

void solve(int n){
    int ans=0;
    rep(i,0,n+1) if(is_prime[i]) ++ans;
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    init_sieve(is_prime,1e6);
    int n;
    while(cin >> n) solve(n);
    return 0;
}

Measured memory_bytes: 3340
/* */

#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
#else
	#define errp(...)
#endif
#define dbg(x) errp("%s = %s\n", #x, to_string(x).data())
string to_string (string s) { return "\"" + s + "\""; }
template<typename T> string to_string (vector<T>);
template<typename U, typename V> string to_string (pair<U, V> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template<typename T> string to_string (vector<T> v) {
	string res = "["; for (int i = 0; i < (int)v.size() - 1; i++) res += to_string(v[i]) + ", ";
	if (!v.empty()) res += to_string(v.back());	res += "]"; return res; }

int main () { 
#ifdef XVENOM
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
#endif

	int n;
	scanf("%d", &n);
	printf("%d\n", n * n * n);

}

Measured memory_bytes: 256
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))
H = H[::-1]

for i in range(len(H) - 1):
    if H[i + 1] - H[i] == 1:
        H[i + 1] -= 1
    elif H[i + 1] - H[i] > 1:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 23060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        System.out.println(Math.max(Math.min(b, d) - Math.max(a, c), 0));
    }
}


Measured memory_bytes: 22740
s, t = input(), input()
s_lst, t_lst = [], []

for i in s:
    s_lst.append(i)

for j in t:
    t_lst.append(j)

s_lst.sort()
t_lst.sort(reverse=True)

s, t = "".join(s_lst), "".join(t_lst)
if s < t:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
n, a = map(int, input().split())
x = [ int(i) for i in input().split() ]

dp = [ [[0] * 3000 for _ in range(55)] for __ in range(55) ]
dp[0][0][0] = 1

for j in range(n+1):
    for k in range(n+1):
        for s in range(2555):
            if j > 0 and x[j-1] > s:
                dp[j][k][s] = dp[j-1][k][s]
            elif j > 0 and k >= 1 and s >= x[j-1]:
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]

ans = 0

for k in range(1, n+1):
    ans += dp[n][k][k*a]

print(ans)


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

int main() {
  int N, M;
  cin >> N >> M;
  int NMMAX = 50;
  int A[NMMAX], B[NMMAX];
  
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
  }
  
  int road[NMMAX];
  for (int i = 0; i < N; i++) {
    road[i] = 0;
  }
  
  for (int i = 0; i < M; i++) {
    road[A[i] - 1] += 1;
    road[B[i] - 1] += 1;
  }
  
  for (int i = 0; i < N; i++) {
    cout << road[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
    int N,D;
    scanf("%d %d",&N,&D);
    double X[20][20];
    int i,j,k;
    for(i=1;i<=N;i++){
        for(j=1;j<=D;j++){
            scanf("%lf",&X[i][j]);
        }
    }
    double d;
    int c;
    c=0;
    for(i=1;i<=N;i++){
        for(j=i+1;j<=N;j++){
            d=0;
            for(k=1;k<=D;k++){
                d=d+(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            d=sqrt(d);
            if(d==floor(d)){
                c=c+1;
            }
        }
    }
    printf("%d",c);
}

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

int main() {
  int N;
  cin >> N;
  long push=0;
  int a[N];
  int b[N];
  for(int i=0;i<N;i++)cin >> a[i] >> b[i];
  for(int i=N-1;i>-1;i--){
    if((a[i]+push)%b[i]!=0){
      int x;
      x=b[i]-(a[i]+push)%b[i];
      push+=x;
    }
  }
  cout << push;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <unordered_map>
// #include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int n;
char s[maxn];
ll cnt[maxn];
const ll mod = 2019;
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    ll ans = 0ll;
    ll base = 1ll;
    ll num = 0ll;
    cnt[0]++;
    for (int i = n; i >= 1; --i)
    {
        num = num + (s[i] - '0') * base % mod;
        num %= mod;
        base = base * 10 % mod;
        ans += cnt[num];
        cnt[num]++;
    }
    printf("%lld\n", ans );
    return 0;
}




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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v)
{
    for (auto& e : v) {
        is >> e;
    }
    return is;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

template <typename Base>
class SparseTable
{
public:
    using T = typename Base::T;
    using SemiLattice = Base;
    SparseTable(const vector<T>& val) : size(val.size()), lg2(size + 1, 0)
    {
        for (int i = 2; i <= size; i++) {
            lg2[i] = lg2[i / 2] + 1;
        }
        table.resize(size, vector<T>(lg2[size] + 1));
        for (int i = 0; i < size; i++) {
            table[i][0] = val[i];
        }
        for (int j = 0; j < lg2[size]; j++) {
            const int w = 1 << j;
            for (int i = 0; i <= size - (w << 1); i++) {
                T tl = table[i][j], tr = table[i + w][j];
                table[i][j + 1] = op(tl, tr);
            }
        }
    }

    T accumulate(const int l, const int r) const
    {
        assert(0 <= l and l < r and r <= size);
        const int j = lg2[r - l];
        return op(table[l][j], table[r - (1 << j)][j]);
    }


private:
    const int size;
    vector<int> lg2;
    vector<vector<T>> table;
    const SemiLattice op{};
};
struct Max {
    using T = ll;
    T operator()(const T& a, const T& b) const
    {
        return max(a, b);
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> x(N + 1, 0);
    vector<ll> s(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        cin >> x[i] >> s[i];
    }
    vector<ll> t = s;
    for (int i = 1; i <= N; i++) {
        t[i] += t[i - 1];
    }
    for (int i = 0; i <= N; i++) {
        t[i] -= x[i];
    }

    SparseTable<Max> st{t};

    ll maximum = -INF<ll>;
    for (int i = 0; i < N; i++) {
        maximum = max(maximum, st.accumulate(i + 1, N + 1) - t[i] - (x[i] - x[i + 1]));
    }
    cout << maximum << endl;


    return 0;
}


Measured memory_bytes: 43776
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <sstream>
using namespace std;
#define N(X) ((X)-'0')

string update(string &s) {
	int count = 0;
	while(1 < s.size()) {
		stringstream ss;
		ss << N(s[0]) + N(s[1]);
		s.erase(0, 2);
		s.insert(0, ss.str());
		count++;
	}
	cout << ((count % 2) ? "Fabre" : "Audrey") << " wins." << endl;
	return s;
}

int main() {
	int n; cin >> n;
	string str;
	while(n--) {
		cin >> str;
		update(str);
	}
}

Measured memory_bytes: 1244
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dp = [0] * (n*n)
    for i in range(n):
        dp[i+i*n] = a[i]
    for i in range(n - 2, -1, -1):
        for j in range(i + 1, n):
            dp[i+j*n] = max(a[i] - dp[i + 1+j*n], a[j] - dp[i+(j - 1)*n])
    print(dp[(n - 1)*n])

main()


Measured memory_bytes: 111088
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<utility>
#define mod 1000000007
#define pb push_back
using namespace std;
int main(){
	long long ans,n,k;
	cin>>n>>k;
	long long num = n/k;
	ans = num*num*num;
	if(k%2==0){
		long long num2 = (n+k/2)/k;
		ans+=num2*num2*num2;
	}
	cout<<ans<<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;
using P = pair<int, int>;
typedef long long ll;

int main() {
  int x;
  cin >> x;
  cout << (x < 1200 ? "ABC" : "ARC") << endl;
}

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


int main(void){
  int N;
  cin >> N;
  
  vector<long long> a(N); 
  int even = 0;
  int odd  = 0;
  for(long long i=0; i<N; i++){
      cin >> a[i];
      if(a[i]%2 == 0) even++; 
      else odd++;
  }//for

  if(odd%2 == 0) cout << "YES" << "\n";
  else  cout << "NO" << "\n";

}//main


Measured memory_bytes: 4044
import heapq
N = int(input())
A = list(map(int,input().split()))

h = []

for i in range(len(A)):
    heapq.heappush(h,(A[i],i+1))

ans = []
for i in range(len(A)):
    ans.append(heapq.heappop(h)[1])

print(" ".join(map(str,ans)))





Measured memory_bytes: 78052
import math
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    c=int(math.sqrt(a*b))
    if a*b==c*c and a!=b:  print(2*c-3)
    elif c*(c+1)<a*b: print(2*c-1)
    else:  print(2*c-2)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n, k; cin >> n >> k;
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	vector<int> c;
	int ans = 0;
	for (int l = 0; l <= n; l++) {
		for (int r = 0; r + l <= min(n, k); r++) {
			c.clear();
			for (int j = 0; j < l; j++) c.push_back(v[j]);
			for (int j = 0; j < r; j++) c.push_back(v[n - j - 1]);
			sort(c.begin(), c.end());
			int res = k - l - r;
			int s = 0;
			for (int i : c) {
				if (res > 0 && i < 0) {
					res--;
				}
				else {
					s += i;
				}
			}
			ans = max(ans, s);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);

  for(int i = 0;i < N;i++){
    cin >> A[i];
    A[i]--;
  }
  for(int i = 0;i < N;i++)cin >> B[i];
  for(int i = 0;i < N-1;i++)cin >> C[i];

  int ans = B[A[0]];
  for(int i = 1;i < N;i++){
    ans += B[A[i]];
    if(A[i-1] + 1 == A[i])ans += C[A[i-1]];
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
template<class T> inline bool chmin(T& a, T b){
  if (a > b){
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b){
  if (a < b){
    a = b;
    return true;
  }
  return false;
}

int main(){
  cout << fixed << setprecision(15);
  int ans = 0;
  //string ans = "Yes";

  int n, a; cin >> n >> a;
  vector<int> l(n); rep(i, n) cin >> l[i];

  rep(i, n) l[i] = abs(l[i] - a);
  ans = l[0];
  rep(i, n - 1)  ans = gcd(ans, l[i + 1]);
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    ll a,b,c; cin>>a>>b>>c;
    if(b<=c&&a>b)return puts("-1")*0;
    ll dif=b-c;
    a-=b;
    if(a<=0)return puts("1")*0;
    cout<<(a/dif+(a%dif?1:0))*2+1<<endl;
}



Measured memory_bytes: 256
n=int(input())
a=[int(i)for i in input().split()]

count=0
p=1
while p<n:
    if a[p-1] == a[p]:
        try:
         if a[p-1] == a[p] == a[p+1]:
             a[p]=a[p-1]+a[p]+a[p+1]
             p+=1
             count+=1
         else:
             a[p]=a[p-1]+a[p]+a[p+1]
             p+=1
             count+=1
        except:
            if a[p-1]==a[p]:
                p+=1
                count+=1
    p+=1
print(count)


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

using namespace std;

int main() {
	int n;
	cin >> n;
	int a = n/100;
	if (n-a*100 > a*10+a) {
		int b = a+1;
		cout << b*100+b*10+b << endl;
	} else {
		cout << a*100+a*10+a << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
 
const int MAXR = 21;
const int MAXC = 21;
const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};
 
struct State {
  int i, j, d, m;
  State();
  State(int i, int j, int d, int m)
    : i(i), j(j), d(d), m(m) {}
};
 
int R, C;
char G[MAXR][MAXC];
bool vis[MAXR][MAXC][4][16];
 
bool canFinish() {
  State s(0,0,0,0);
  queue<State> que;
  que.push(s);
  fill(vis[0][0][0], vis[MAXR][0][0], false);
  vis[s.i][s.j][s.d][s.m] = true;
 
  while(!que.empty()) {
    s = que.front();
    que.pop();
 
    if(isdigit(G[s.i][s.j])) {
      s.m = G[s.i][s.j] - '0';
    } else {
      switch(G[s.i][s.j]) {
      case '<':
        s.d = 2;
        break;
      case '>':
        s.d = 0;
        break;
      case '^':
        s.d = 3;
        break;
      case 'v':
        s.d = 1;
        break;
      case '_':
        if(s.m == 0) s.d = 0;
        else s.d = 2;
        break;
      case '|':
        if(s.m == 0) s.d = 1;
        else s.d = 3;
        break;
      case '?':
        s.d = -1;
        break;
      case '.':
        //
        break;
      case '@':
        return true;
      case '+':
        s.m = (s.m+1)%16;
        break;
      case '-':
        s.m = (s.m-1+16)%16;
        break;
      }
    }
 
    vector<State> next;
    if(s.d == -1) {
      for(s.d = 0; s.d < 4; ++s.d) {
        next.push_back(s);
      }
    } else {
      next.push_back(s);
    }
 
    for(int k = 0; k < next.size(); ++k) {
      State &t = next[k];
      t.i = (t.i + di[t.d] + R) % R;
      t.j = (t.j + dj[t.d] + C) % C;
      if(vis[t.i][t.j][t.d][t.m]) continue;
      vis[t.i][t.j][t.d][t.m] = true;
      que.push(t);
    }
  }
  return false;
}
 
int main() {
  while(cin >> R >> C) {
    for(int i = 0; i < R; ++i) {
      for(int j = 0; j < C; ++j) {
        cin >> G[i][j];
      }
    }
    if(canFinish()) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NK = Sarray();
            var N = NK[0];
            var K = NK[1];
            var Ai = Sarray();
            var rui = new long[N + 1];
            for (var i = 1; i <= N; ++i)
                rui[i] = rui[i - 1] + Ai[i - 1];
            var max = rui[N];
            var mask = 1L;
            while (max != 1)
            {
                max >>= 1;
                mask <<= 1;
            }
            var seq = new List<long>((int)(N * (N + 1) / 2));
            for(var s=0;s<N;++s)
            {
                for (var e = s + 1; e <= N; ++e)
                    seq.Add(rui[e] - rui[s]);
            }
            var ans = 0L;
            while (mask != 0) 
            {
                var t = seq.Where(s => (s & mask) != 0).ToList();
                if (K <= t.Count())
                {
                    ans += mask;
                    seq = t;
                }
                mask >>= 1;
            }
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 27744
import java.util.Scanner;

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

    long a = sc.nextInt();
    long b = sc.nextInt();
    long c = sc.nextInt();
    long d = sc.nextInt();

    long ac = a * c;
    long ad = a * d;
    long bc = b * c;
    long bd = b * d;

    System.out.println(Math.max(Math.max(ac, ad), Math.max(bc, bd)));
  }
}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}

////////////////////////////////////////////////////////////////////




int main() {
ll n;
cin>>n;
ll a[n+1];
for(int i=1;i<=n;i++){
	cin>>a[i];
}

ll min=-1000500000;
ll cnt=0;
ll wa=0;
for(int i=1;i<=n;i++){
if(a[i]<0)cnt++;
if(abs(a[i])<abs(min)){
	min=abs(a[i]);
}
wa+=abs(a[i]);
}


if(cnt%2==1){
cout<<wa-2*min<<endl;
return 0;
}
else{
	cout<<wa<<endl;
	return 0;
}




}




Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  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;
  }

  // for prime mod
  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;
  }
};

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main(){
  Sieve sieve(1e6);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
  }
  map<int, int> lcmfactor;
  rep(i, n){
    auto f = sieve.factor(a[i]);
    for(auto p: f){
      lcmfactor[p.first]=max(lcmfactor[p.first], p.second);
    }
  }
  mint lcm=1;
  for(auto p: lcmfactor){
    rep(i, p.second){
      lcm*=p.first;
    }
  }

  mint ans=0;
  rep(i, n){
    mint b=lcm/a[i];
    ans+=b;
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 4984
#include<stdio.h>
int main()
{
int x,y,cou,w;
cou=0;w=0;

while(scanf("%d %d", &x, &y) != EOF){
cou=0;
w=x+y;
while(1)
{
if(w/10==0){cou++;break;}
else {w=w/10; cou++;}
}
printf("%d\n",cou);
}
return 0;
}

Measured memory_bytes: 1028
import java.util.*;
import java.io.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = 5;
        int[] antenna = new int[N];
        for(int n=0; n<N; n++) antenna[n] = sc.nextInt();
        int K = sc.nextInt();
        for(int i=0; i<N; i++) for(int j=i+1; j<N; j++){
            if(Math.abs(antenna[i]-antenna[j]) > K){
                System.out.println(":(");
                System.exit(0);
            }
        }
        System.out.println("Yay!");


    }
}


Measured memory_bytes: 21844
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"

	"strconv"
)

func solve(in io.Reader, out io.Writer) error {
	sc := bufio.NewScanner(in)
	sc.Split(bufio.ScanWords)

	n, k := nextInt(sc), nextInt(sc)

	cnt := 0
	for b := k + 1; b <= n; b++ {
		q := n / b
		r := n % b
		cnt += q * (b - k)
		if r > 0 && r >= k {
			cnt += r - k
			if k > 0 {
				cnt += 1
			}
		}
	}

	fmt.Fprintf(out, "%d\n", cnt)
	return nil
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	err := solve(os.Stdin, os.Stdout)
	if err != nil {
		log.Fatal(err)
	}
}


Measured memory_bytes: 640
//Bismillahir Rahmanir Rahim. Ya Allah....
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7;
const int mx = 1e5+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m,k,x,c=0;
    cin>>n>>m>>k;
    ll pre[n];
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(i==0)
            pre[i]=x;
        else
            pre[i]= pre[i-1]+x;
        if(pre[i]<=k)
            c++;

    }
    int ans =c;
    //cout<<ans<<endl;
    c=0;
    for(int i=0;i<m;i++)
        {
            cin>>x;
            sum+=x;
            if(sum<=k)
                {
                    c= i+upper_bound(pre,pre+n,k-sum)-pre+1;
                    ans = max(ans,c);
                }
        }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 5164
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

class Robot
{
public:
	ll x;
	ll l;

	bool operator<(const Robot& rhs) const
	{
		return x < rhs.x;
	}

	ll calcLeft() const
	{
		return x - l;
	}

	ll calcRight() const
	{
		return x + l;
	}

	bool isAwayFrom(const Robot& rhs) const
	{
		if (x < rhs.x)
		{
			return calcRight() <= rhs.calcLeft();
		}
		else
		{
			return rhs.calcRight() <= calcLeft();
		}
	}
};

int main()
{
	int N;
	cin >> N;
	vector<ll> X(N);
	vector<ll> L(N);
	vector<Robot> r(N);

	rep(i, N)
	{
		cin >> X[i];
		cin >> L[i];
		r[i].x = X[i];
		r[i].l = L[i];
	}

	std::sort(all(r));

	int ans = N;

	int last_robot = 0;

	for(int i = 1; i < N; i ++)
	{
		// check intersection between last_robot and i
		// cout << "compare" << last_robot << ":" << i << endl;
		if (r[last_robot].isAwayFrom(r[i]))
		{
			last_robot = i;
		}
		else
		{
			// erae longer one
			if (r[last_robot].calcRight() < r[i].calcRight())
			{
				// cout << "erase:" << last_robot << endl;
			}
			else
			{
				last_robot = i;
				// cout << "erase:" << i << endl;
			}

			ans--;
		}
	}

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


Measured memory_bytes: 3328
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _  in range(N)]

cnt = 0
for i in range(N):
    inner = 0
    for j in range(M):
        inner += A[i][j]*B[j]
    if (inner>-C):
        cnt += 1
print(cnt)

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i < (n)i++)
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define int long long
#define abs(a) llabs(a)
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

priority_queue<long long,vector<long long>,greater<long long>> x;
signed main()
{

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

   int n;
   string s,v;

   cin>>n;
   cin>>s>>v;

   rep(i,n){
      cout<<s[i]<<v[i];
   }
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  }

  // for prime mod
  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;
  }
};
// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main()
{
  int n, k; cin >> n >> k;
  combination C(2*n);
  auto H = [&](int n, int r) {
    return C(n+r-1, r);
  };

  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(ALL(a));

  a.insert(a.begin(), 0);
  rep(i, n) a[i+1] += a[i];

  if(k == 1) {
    cout << 0 << endl;
    return 0;
  }

  mint ans = 0;
  for(int d = k; d <= n; ++d) {
    int diff = n-d+1;
    ans += C(d-2, k-2) * (a[n]-a[n-diff] - a[diff]);
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
using namespace std;
int main() {
	int d, c;
	scanf("%d%d", &d, &c);
	printf("%d\n", (c*d));
}


Measured memory_bytes: 1028
import java.util.Scanner;

public class Main {
	public static void main(String ... args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int count = 0;
		while (a * count <= t) {
			count++;
		}
		System.out.println((count - 1) * b);
	}
}


Measured memory_bytes: 23124
#include <iostream>

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

	int ans = 1;
	while( ans <= n ) {
		ans = ans * 2;
		if( ans > n ) {
			ans = ans / 2;
			break;
		}
	}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define Fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20)
#define endl '\n'
#define pb push_back
#define N 1000009
#define ff first
#define ss second
#define all(x) x.begin(),x.end() 
int main()
{
	Fast;
	string s;
	cin>>s;
	if(s=="BBB" || s=="AAA")
	cout<<"No"<<endl;
	else
	cout<<"Yes"<<endl;
}

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

int main(){
	string A, B, C;
	
	cin >> A >> B >> C;
	
	if(A[A.size() - 1] == B[0]){
		if(B[B.size() - 1] == C[0]){
			cout << "YES" << endl;	
			return 0;
		}	
	} 
	
	cout <<  "NO" << endl;
	
	return 0;
}

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

    void solve(set<string> &s, vector<int> &x)
    {
        char id = 'a';
        int pp = 15;
        vector<char> ans(30, 0);
        for (int i = 0; i < x.size(); i++)
        {
            if (x[i] == -1)
            {
                x[i] = pp++;
                ans[x[i]] = id++;
                continue;
            }
            if (ans[x[i]]) continue;
            ans[x[i]] = id++;
        }
        string t = "";
        for (int i = 0; i < x.size(); i++) 
        {
            t += ans[x[i]];
            if (x[i] > 14) x[i] = -1;
        }
        s.insert(t);
    }

    void dfs(set<string> &s, vector<int> &x, int n)
    {
        int cnt = 0;
        for (int i = 0; i < x.size(); i++)
        {
            cnt += x[i];
            if (x[i] == 0)
            {
                if (i == 0)
                {
                    for (int j = 1; j < n; j++)
                    {
                        if (j * x.size() > n) break;
                        x[i] = j;
                        dfs(s, x, n);
                    }
                    x[i] = 0;
                    return ;
                }
                for (int j = x[i - 1]; j < n; j++)
                {
                    if (cnt + j * (x.size() - i) > n) break;
                    x[i] = j;
                    dfs(s, x, n);
                }
                x[i] = 0;
                return ;
            }
        }
        if (cnt != n) return ;
        vector<int> y;
        for (int i = 0; i < x.size(); i++)
        {
            if (x[i] == 1)
            {
                y.push_back(-1);
                continue;
            }
            for (int j = 0; j < x[i]; j++) y.push_back(i);
        }
        sort(y.begin(), y.end());
        do {
            solve(s, y);
        } while (next_permutation(y.begin(), y.end()));
    }

    int main()
    {
        int n;
        cin >> n;
        set<string> s;
        string t = "";
        for (int i = 0; i < n; i++) t += "a";
        s.insert(t);
        t = "";
        for (int i = 0; i < n; i++) t += ('a' + i);
        s.insert(t);
        for (int i = 2; i <= n - 1; i++)
        {
            vector<int> x(i, 0);
            dfs(s, x, n);
        }
        auto ptr = s.begin();
        while (ptr != s.end()) cout << *(ptr++) << endl;
    }


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

int main() {
  int a,b,h,m;cin>>a>>b>>h>>m;
  double pai=acos(-1);
  double hh=(double)(h*60+m)/720*2*pai;
  double mm=(double)m/60*2*pai;
  double xh=a*cos(hh),yh=a*sin(hh);
  double xm=b*cos(mm),ym=b*sin(mm);
  double dx=(xh-xm),dy=(yh-ym);
  double ans=sqrt(dx*dx+dy*dy);
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 4004
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

const int INF = 1e9;

int main(){
  int N;
  cin >> N;
  vector<char> D(N);
  vector<int> L(N);
  vector<pair<int,int>> V;
  for(int i = 0; i < N; ++i){
    cin >> D[i] >> L[i];
    if(D[i] == 'y') V.emplace_back(L[i],i);
  }
  sort(V.begin(), V.end());
  int ans = 0;
  for(auto p : V){
    if(L[p.second] >= INF) continue;
    ++ans;
    int idx = p.second, h = L[idx];
    for(int i = idx-1; i >= 0; --i){
      if(L[i] >= h and D[i] == 'n') break;
      if(L[i] >= h) L[i] = INF;
    }
    for(int i = idx+1; i < N; ++i){
      if(L[i] >= h and D[i] == 'n') break;
      if(L[i] >= h) L[i] = INF;
    }
  }
  cout << ans << endl;
}



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

int main() {
    int A,B,AB,X,Y;
    cin >> A >> B >> AB >> X >> Y;
    int a = A*X+B*Y;
    int b = X*AB*2 + max(Y-X,0)*B;
    int c = Y*AB*2 + max(X-Y,0)*A;
    cout << min({a,b,c}) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    int mi = 0;
    vec c(9, 0);
    rep(i, n) {
        if (a[i] >= 3200) {
            c[8]++;
        }
        else {
            c[a[i]/400]++;
        }
    }

    rep(i, 8) if (c[i] > 0) mi++;
    if (mi == 0) mi = 1;
    
    int mx = 0;
    rep(i, 8) if (c[i] > 0) mx++;
    mx += c[8];
    printf("%d %d\n", mi, mx);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

class BIT {
    // Binary Indexed Tree : 数列要素1つへの加算、数列のある地点までの累積和を高速に計算
    public:
    std::vector<int> data;
    BIT() {}
    BIT(const int size) {
        // 想定されるサイズの2倍の値を入れた方がいいかもしれない。
        data.resize(size, 0);
    }
    int sum(int i) const {
        int s = 0;
        while (i > 0) {
            s += data[i];
            i = i & (i-1); // iの最後のビットを引く。
        }
        return s;
    }

    void add(int i, int x) {
        while (i < data.size()) {
            data[i] += x;
            i += i - (i & (i-1)); // iの最後のビットを加算する。
        }
    }
};

class BIT2 {
    // Binary Indexed Tree 2つ : 数列区間への加算、数列のある地点までの累積和を高速に計算。
    public:
    BIT bit[2];
    BIT2() {}
    BIT2(const int size) {
        bit[0] = BIT(size);
        bit[1] = BIT(size);
    }
    int sum(int i) const {
        return bit[1].sum(i) * i + bit[0].sum(i);
    }
    void add(int l, int r, int x) {
        // [l,r]にxを加算。閉区間であり、rを含む点に注意。l=rの時、一つの値のみを操作できることになる。
        bit[0].add(l, -x * (l - 1));
        bit[1].add(l, x);
        bit[0].add(r + 1, x * r);
        bit[1].add(r + 1, -x);
    }
};

const int MAX_N = 300050;
const int MAX_M = 100050;

int N, M;

int L[MAX_N], R[MAX_N];

std::vector<int> seg[MAX_M];
int seg_ac[MAX_M] = {};
BIT2 bit = BIT2(MAX_M * 2);

int ret[MAX_M] = {};

int main(int argc, char **argv) {
    std::cin >> N >> M;

    for (int i = 1; i <= N; i++) {
        std::cin >> L[i] >> R[i];
    }

    for (int i = 1; i <= N; i++) {
        seg[R[i] - L[i]].push_back(L[i]);
    }

    seg_ac[M + 1] = 0;
    for (int m = M; 0 <= m; m--) {
        seg_ac[m] = seg_ac[m+1] + seg[m].size();
    }

    for (int d = 1; d <= M; d++) {
        ret[d] = seg_ac[d-1];
        for (int i = d; i <= M; i += d) {
            ret[d] += bit.sum(i) - bit.sum(i-1);
        }

        for (int s : seg[d - 1]) {
            bit.add(s, s + d - 1, 1);
        }
    }

    for (int d = 1; d <= M; d++) {
        std::cout << ret[d] << std::endl;
    }
    
    return 0;
}

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

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
#define all(v) (v).begin(),(v).end()
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000001];
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for(int p=2;p<1000001;p++)
        if(prime[p])
            primes.pb(p);
}
ll fact[100010];
ll finv[100010];
void factorial(int n){
    fact[0]=1;
    finv[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=fact[i-1]*i,fact[i]%=MOD,finv[i]=fermat_inv(fact[i]);
}
ll ncr(ll n,ll r)
{
    if(n<r)
        return 0;
    else{
        ll x=finv[r]*finv[n-r]%MOD;
        return fact[n]*x%MOD;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int te=1;
    //cin>>te;
    //SieveOfEratosthenes(1000000);
    //factorial(100005);
    while(te--){
        int n;
        cin>>n;
        ii d[n];
        for(int i=0;i<n;i++)
            cin>>d[i].ff>>d[i].ss;
        bool b=false;
        for(int i=2;i<n;i++){
            if(d[i].ff==d[i].ss&&d[i-1].ff==d[i-1].ss&&d[i-2].ff==d[i-2].ss)
                b=true;
        }
        if(b)
            cout<<"Yes";
        else
            cout<<"No";
    }
}

Measured memory_bytes: 3656
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")
           
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
           
using namespace std;
using namespace __gnu_pbds;
           
//#define int long long
  
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
           
using matrix = vector<vector<ll>>;
template<typename T>
using kawaii_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
           
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
  
void FAST_IO() {
    //ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.setf(ios::fixed);
    //cout.precision(20);
    #ifndef _offline
    //freopen("mincost.in", "r", stdin);
    //freopen("mincost.out", "w", stdout);
    #endif
}

signed main() {
    FAST_IO();
    ll n, m;
    cin >> n >> m;
    cout << (n * (n - 1)) / 2 + (m * (m - 1)) / 2 << '\n';
}   

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

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int H, W, sx, sy, gx, gy;
	cin >> H >> W;
	sx = 0; sy = 0; gx = H - 1; gy = W - 1;

	vector<string> field(H);
	for (int i = 0; i < H; ++i) cin >> field[i];

	vector<vector<int> > dist(H, vector<int>(W, -1));
	dist[sx][sy] = 0;

	queue<pair<int, int> > que;
	que.push(make_pair(sx, sy));

	while (!que.empty()) {
		pair<int, int> current_pos = que.front();
		int x = current_pos.first;
		int y = current_pos.second;
		que.pop();

		for (int direction = 0; direction < 4; ++direction) {
			int next_x = x + dx[direction];
			int next_y = y + dy[direction];
			if (next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) continue;
			if (field[next_x][next_y] == '#') continue;

			if (dist[next_x][next_y] == -1) {
				que.push(make_pair(next_x, next_y));
				dist[next_x][next_y] = dist[x][y] + 1;
			}
		}
	}

	int cnt_white = 0;
	for (int h = 0; h < H; ++h) {
		for (int w = 0; w < W; ++w) {
			if (field[h][w] == '.') ++cnt_white;
		}
	}
	if (dist[gx][gy] == -1) cout << -1 << endl;
	else cout << cnt_white - (dist[gx][gy] + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int ls = s.length();
        int lt = t.length();
        String out = new String();

        String subt = t.substring(0, ls);
        if(1 <= ls && ls <= 10 && ls + 1 == lt && s.equals(subt)){
            out = "Yes";
        } else{
            out = "No";
        }

        System.out.println(out);
        sc.close();
    }
}

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

int main(){
  char s[10];
  bool ans = 1;
  for(int i = 0;i < 6;i++){
    cin >> s[i];
    if((i == 3)||(i == 5)){
      if(s[i] != s[i - 1]){
	ans = 0;
      }
    }
  }
  if(ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}
		   


Measured memory_bytes: 256