akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
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;}
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353


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

    // solution comes here

    ll N;
    cin >> N;
    vl a(N+10);
    rep(i, N) cin>> a[i+1];//1-indexed

    vl ans(N+10);
    ll A=0;
    for(ll i=N; i>=1; i--) {
        ll cnt=0;
        for(ll j=i*(N/i); j>=1; j-=i){
            cnt += ans[j];
        }
        if(cnt%2 != a[i]) {
            ans[i]++;
            A++;
        }
    }

    cout << A << nl;
    rep(i, N+1) if(ans[i]) cout << i << nl;
}


Measured memory_bytes: 3968
//
// Created by yuu on 2019-04-21.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>

using namespace std;
int dp[3100][3100] = {};


int main(void){
    string s;
    string t;

    cin>>s;

    cin>>t;




    for (int i = 0; i < s.size(); ++i) {
        for (int j = 0; j < t.size(); ++j) {
            if(s[i] == t[j]){
                dp[i+1][j+1] = max(dp[i+1][j+1] ,dp[i][j] + 1);
            }
            dp[i+1][j+1] = max( dp[i+1][j+1], dp[i][j+1]);
            dp[i+1][j+1] = max( dp[i+1][j+1], dp[i+1][j]);
        }
    }


    string ans = "";

    int i = (int)s.size();
    int j = (int)t.size();
    while(i > 0&& j > 0){

            if(dp[i][j] == dp[i-1][j]){
                i--;
            }else if(dp[i][j] == dp[i][j-1]){
                j--;
            }else{
                ans = s[i-1] + ans;
                i--;
                j--;
            }

    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 37120
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;

int main() {

	long X, Y; cin >> X >> Y;
	long res = 0;
	res += max((long)0, 100000 * (4 - X));
	res += max((long)0, 100000 * (4 - Y));

	if (X == 1 && Y == 1) res += 400000;

	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
static const int N = 100;

int main() {
  int M[N][N];  // 0 オリジンの配列
  int n, u, k, v;

  cin >> n;

  for ( int i = 0; i < n; i++ )
    for ( int j = 0; j < n; j++ ) M[i][j] = 0;

  for ( int i = 0; i < n; i++ ) {
    cin >> u >> k;
    u--;  // 0 オリジンへ変換
    for ( int j = 0; j < k; j++ ) {
      cin >> v;
      v--;  // 0 オリジンへ変換
      M[u][v] = 1;  // u と v の間に辺を張る
    }
  }

  for ( int i = 0; i < n; i++ ) {
    for ( int j = 0; j < n; j++ ) {
      if ( j ) cout << " ";
      cout << M[i][j];
    }
    cout << endl;
  }

  return 0;
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int a[5];
    int m = 10;
    int ans = 0;
    FOR(i,0,5){
        cin >> a[i];
        if(a[i] % 10 > 0){
            m = min(m, a[i] % 10);
            ans += a[i] + 10 - a[i] % 10;
        }else{
            ans += a[i];
        }
    }
    ans -= 10 - m;
    ANS(ans);
	return 0;
}


Measured memory_bytes: 256
#if defined(LOCAL)
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#endif
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <iostream>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <limits>
#include <numeric>
#include <queue>
#include <memory>

using namespace std;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ii = pair<int,int>; using lu = unsigned long long; using l = long long;
using vs = vector<string>; using vii = vector<ii>;
using vl = vector<l>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>; using sl = unordered_set<l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; const double PI = M_PI;
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));

void solve(istream& in, ostream& out);
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  tst::test_init(argc, argv);
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  tst::maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}
const l MOD = e9 + 7; // end of template

void solve(istream& in, ostream& out) {
  l n, cost; in >> n >> cost;
  vl v(n); F(i, 0, n) in >> v[i];
  vl s(n + 1);
  F(i, 0, n) s[i + 1] = s[i] + v[i];
  l z = INF;
  F(k, 1, n + 1) {
    l m = 0;
    l x = 0;
    l t = n;
    l y = 0;
    while (t > 0) {
      l r = max(l(0), t - k);
      l mm = 5;
      if (m) {
        mm = m;
        m += 2;
      } else {
        m = 5;
      }
      y = x;
      x += mm * (s[t] - s[r]);
      if (y > x) break;
      t = r;
    }
    if (y > x) continue;
    x += k * cost;
    z = min(z, x);
  }
  z += cost * n;
  out << z << lf;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main(){
 long long N;
  cin>>N;
  long long sum=0;
  for(long long i=1;i<=N;i++){
    if(!(i%3==0)&&!(i%5==0)&&!(i%3==0&&i%5==0)){
      sum+=i;
    }
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(int N, int A, int B, int[] P)
        {
            int a = 0, b = 0, c = 0;
            foreach (int p in P)
            {
                if (p <= A) { ++a; }
                else if (p <= B) { ++b; }
                else { ++c; }
            }
            return new[] { a, b, c }.Min();
        }

        static void Main(string[] args)
        {
            int N = ReadInt();
            int[] V = ReadInts();
            int A = V[0], B = V[1];
            int[] P = ReadInts();
            Console.WriteLine(Solve(N, A, B, P));
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    int ans = 0;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        if(a >= h && b >= w) {
            ans++;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    
    string ans = "";
    int x = tx -sx;
    int y = ty -sy;
    // for(int i = 1; i <= y; i++){
    //     ans += "U";
    // }
    ans += string(y, 'U');
    // for(int i = 1; i <= x; i++){
    //     ans += "R";
    // }
    ans += string(x, 'R');
    // for(int i = 1; i <= y; i++){
    //     ans += "D";
    // }
    ans += string(y, 'D');
    // for(int i = 1; i <= x+1; i++){
    //     ans += "L";
    // }
    ans += string(x+1, 'L');
    // for(int i = 1; i <= y+1; i++){
    //     ans += "U";
    // }
    ans += string(y+1, 'U');
    // for(int i = 1; i <= x+1; i++){
    //     ans += "R";
    // }
    ans += string(x+1, 'R');
    // ans += "DR";
    ans += "DR";
    // for(int i = 1; i <= y+1; i++){
    //     ans += "D";
    // }
    ans += string(y+1, 'D');
    // for(int i = 1; i <= x+1; i++){
    //     ans += "L";
    // }
    ans += string(x+1, 'L');
    // ans += "U";
    ans += "U";

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

var LARGE = int64(1<<63 - 1)

func sum(a []int64) int64 {
	var total int64
	for _, x := range a {
		total += x
	}
	return total
}

var a [400]int64
var result [401][401]int64

func solve(x, y int) int64 {
	if result[x][y] > 0 {
		return result[x][y]
	}

	if y-x == 1 {
		return 0
	}

	if y-x == 2 {
		r := a[x] + a[x+1]
		result[x][y] = r
		return r
	}

	cost := LARGE
	for i := x + 1; i < y; i++ {
		c := solve(x, i) + solve(i, y)
		if c < cost {
			cost = c
		}
	}

	for i := x; i < y; i++ {
		cost += a[i]
	}

	result[x][y] = cost
	return cost
}

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	fmt.Println(solve(0, n))
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VL a(n);
  REP(i, 0, n) cin >> a[i];
  pair<ll, int> ma(-1e18, -1);
  vector<VI> pop(2);
  REP(i, 0, 2) {
    ll tot = 0;
    pair<ll, int> ma2(-1e18, -1);
    REP(j, 0, n) {
      if (j % 2 != i) continue;
      if (a[j] > 0) {
	pop[i].push_back(j);
	tot += a[j];
      }
      ma2 = max(ma2, make_pair(a[j], j));
    }
    if (pop[i].size() == 0) {
      tot = ma2.first;
      pop[i].push_back(ma2.second);
    }
    ma = max(ma, make_pair(tot, i));
  }
  int ind = ma.second;
  VI arr = pop[ind];
  assert (arr.size() > 0);
  VI op;
  int fst = arr[0];
  int lst = arr[arr.size() - 1];
  for (int i = n - 1; i >= lst + 1; --i) {
    op.push_back(i);
  }
  REP(i, 0, fst) {
    op.push_back(0);
  }
  REP(i, 0, arr.size() - 1) {
    int intv = arr[i + 1] - arr[i];
    assert (intv % 2 == 0);
    for (int j = intv / 2; j >= 1; --j) {
      op.push_back(j);
    }
  }
  cout << ma.first << endl;
  cout << op.size() << endl;
  REP(i, 0, op.size()) {
    cout << op[i] + 1 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
namespace qweqwe{
  namespace strlib{
    bool kaibun(std::string s){
      std::string sr = s;
      reverse(sr.begin(), sr.end());
      int n = s.size();
      for(int i=0; i<n; ++i) if(s[i]!=sr[i]) return false;
      return true;
    }
    bool kai(std::string const s){
      int l = 0, r=s.size()-1;
      while(r>l){
        if(s[l]!=s[r]) return false;
        ++l;--r;
      }
      return true;
    }
  }
}

int main(){
  using qweqwe::strlib::kai;
  string s; cin >> s;
  int n= s.size();
  if(kai(s.substr(0,n/2)) && kai(s.substr(n/2+1,n/2)) && kai(s) ) cout << "Yes";
  else cout << "No";
}

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

int main() {
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()
    var ans = 0
    var pre = 0
    while (true) {
        val idx = s.indexOf("ABC", pre)
        if (idx == -1) {
            break
        }
        ans++
        pre = idx + 3
    }
    println(ans)
}

Measured memory_bytes: 29480
/*input
apple
apple
*/

#include <bits/stdc++.h>
#include <unistd.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'
#define UQ(x) (x).resize(distance((x).begin(),unique(all((x)))))

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}

void solve(){
    ll i,j,k;
    string s,t;
    cin>>s>>t;
    ll ans=0;
    rep(i,0,s.length())ans+=(s[i]!=t[i]);
    cout<<ans<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll T=1;
   // cin>>T;
    while(T--){
        solve();
    }
    return 0;
}




Measured memory_bytes: 3716
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

double Dist(double X1, double Y1, double X2, double Y2){
  double ans = (X1 - X2) * (X1 - X2);
  ans += (Y1 - Y2) * (Y1 - Y2);
  ans = sqrt(ans);
  return ans;
}

int main(){
  double Xs, Ys, Xt, Yt;
  cin >> Xs >> Ys >> Xt >> Yt;

  int N; cin >> N;
  double X[N + 2], Y[N + 2], R[N + 2];
  X[0] = Xs; Y[0] = Ys; R[0] = 0;
  for (int i = 1; i <= N; i++){
    cin >> X[i] >> Y[i] >> R[i];
  }
  X[N + 1] = Xt; Y[N + 1] = Yt; R[N + 1] = 0;

  vector < pair<double, int> > Graph[N + 2];
  for (int i = 0; i < N + 2; i++){
    for (int j = 0; j < N + 2; j++){
      double dist = Dist(X[i], Y[i], X[j], Y[j]);
      dist -= R[i] + R[j];
      if (dist < 0) dist = 0;
      Graph[i].push_back(make_pair(dist, j));
      Graph[j].push_back(make_pair(dist, i));
    }
  }

  vector <double> ans(N + 2);
  vector <bool> visited(N + 2);

  priority_queue <pair<double, int>, vector<pair<double, int> >, greater<pair<double, int> > > que;
  que.push(make_pair(0, 0));

  while (!que.empty()){
    pair <double, int> P = que.top(); que.pop();
    double D = P.first;
    int now = P.second;

    if (visited[now] == true) continue;

    visited[now] = true;
    ans[now] = D;

    for (int i = 0; i < Graph[now].size(); i++){
      int next = Graph[now][i].second;
      double deg = Graph[now][i].first;
      if (visited[next] == true) continue;      

      que.push(make_pair(D + deg, next)); 
    }
  }
  
  cout << setprecision(16) << ans[N + 1] << endl;

  return 0;
}


Measured memory_bytes: 51116
A,B = map(int,input().split())

ans = 0

if B == 1 :
	print(0)

elif B <= A :
	print(1)

elif (B-A)%(A-1) <= 0 :
	ans = (B-A)//(A-1)+1
	print(ans)
elif (B-A)%(A-1) >= 1 :
	ans = (B-A)//(A-1)+2
	print(ans)

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

typedef long long LL;
const int N = 305;
int n, k, mod, a[N], b[N], c[N][N];

void reduce(int &x) { x += x >> 31 & mod; }
void exp() {
	for (int i = 0; i <= n; ++i) b[i] = a[i];
	for (int i = 0; i <= n; ++i)
		for (int j = 1; j <= i; ++j)
			b[i] = (b[i] + (LL) b[j - 1] * a[i - j] % mod * c[i][j]) % mod;
	for (int i = 0; i <= n; ++i) a[i] = b[i];
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> k >> mod;
	for (int i = 0; i <= n; ++i) {
		c[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			reduce(c[i][j] = c[i - 1][j] + c[i - 1][j - 1] - mod);
	}
	a[0] = 1; while (k--) exp();
	std::cout << a[n] << '\n';
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.1415926536
struct Point
{
    int x;
    int y;
};
inline double dist(Point a, Point b)
{
    return sqrt( pow(a.x - b.x , 2) + pow(a.y - b.y, 2) );
}
Point point[200005];
Point st[200005];
void getExtremePoint(int n)///at index 0
{
    int pos = 0;
    for(int i=1; i<n; i++){
        if(point[i].y < point[pos].y || (point[i].y == point[pos].y && point[i].x < point[pos].x))
            pos = i;
    }
    swap(point[0], point[pos]);
}
inline int triArea(Point p1, Point p2, Point p3)
{
    ll area = 1LL*p1.x*(p2.y - p3.y) + 1LL*p2.x*(p3.y - p1.y) + 1LL*p3.x*(p1.y - p2.y);
    if(area==0) return area;
    else return area/llabs(area);
}
inline bool comp(Point p1, Point p2)
{
    int tri = triArea(point[0],p1,p2);
    if(tri<0) return false;
    if(tri==0 && dist(point[0], p1) > dist(point[0], p2)) return false;
    return true;
}
bool comp2(Point p1, Point p2)
{
	if(p1.x==p2.x) 
		return p1.y<p2.y;
	return p1.x<p2.x;
}
int id;
void genConvexPoints(int n)
{
    getExtremePoint(n);
    sort(point+1, point+n, comp);
    id = 0;
    for(int i=0; i<3 && i<n; i++)
        st[id++] = point[i];
    for(int i = 3; i<n; i++){
        while(triArea(st[id-2], st[id-1], point[i]) <= 0 && id>=2)
            id--;
        st[id++] = point[i];
    }
}
int main()
{
    int tc,cs=1,n,d;
    tc = 1;
    while(tc--){
    	set< pair<int, int> >mp;
        scanf("%d",&n);
        int idx = 0;
        for(int i=0; i<n; i++){
            scanf("%d%d",&point[i].x,&point[i].y);
            mp.insert( make_pair(point[i].x,point[i].y));
            if(mp.size() > idx )
            	point[idx++] = point[i];
        }
        n = idx;
        genConvexPoints(n);
      	assert(id<=60);
        int ans = 0;
        for(int i=0; i<id; i++){
        	for(int j=i+1; j<id; j++){
        		ans = max(ans, abs(st[i].x-st[j].x) + abs(st[i].y - st[j].y  ));
        	}
        }
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 14780
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

using Graph = vector<vector<int>>;
using P = pair<int, int>;
const int INF = 1001001001;
const double pi = acos(-1);

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    vector<int> c(m);
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        a[i] = x;
        int SUM = 0;
        for (int j = 0; j < y; j++)
        {
            int z;
            cin >> z;
            z--;
            SUM |= (1 << z);
        }
        c[i] = SUM; // c[i] = 6 なら、1つめと2つめと3つめを開けられる。
    }

    vector<int> dp(1 << n, INF);
    dp[0] = 0;
    for (int i = 0; i < (1 << n); i++)
    {
        for (int j = 0; j < m; j++)
        {
            dp[i | c[j]] = min(dp[i | c[j]], dp[i] + a[j]);
        }
    }

    if (dp[(1 << n) - 1] == INF)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << dp[(1 << n) - 1] << endl;
    }

    return 0;
}


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

long n,m,r,ans=10000000000;
vector<long> x(8),a(100000),b(100000),c(100000);
vector<vector<long>> w(200,vector<long>(200,10000000000));

void saiki(vector<long> v,set<long> vv) {
  if(v.size()==r) {
    long aaa=0;
    for(long i=0;i<r-1;i++) {
      aaa+=w[v[i]-1][v[i+1]-1];
    }
    ans=min(aaa,ans);
  } else {
    for(long i=0;i<r;i++) {
      if(vv.find(x[i])==vv.end()) {
        vector<long> nv=v;
        nv.push_back(x[i]);
        set<long> nvv=vv;
        nvv.insert(x[i]);
        saiki(nv,nvv);
      }
    }
  }
  return;
}

int main() {
  cin >> n >> m >> r;
  for(long i=0;i<r;i++) cin >> x[i];
  for(long i=0;i<m;i++) cin >> a[i] >> b[i] >> c[i];

  for(long i=0;i<m;i++) {
    w[a[i]-1][b[i]-1]=c[i];
    w[b[i]-1][a[i]-1]=c[i];
  }
  for(long i=0;i<n;i++) w[i][i]=0;
  for(long k=0;k<n;k++) {
    for(long i=0;i<n;i++) {
      for(long j=0;j<n;j++) w[i][j]=min(w[i][j],w[i][k]+w[k][j]);
    }
  }

  saiki({},{});
  cout << ans << endl;
}

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

using namespace std;

typedef long long int lli;

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

    int N, W;
    lli v[101], w[101];
    vector<vector<lli>> dp(101, vector<lli>(100001, 0));

    cin >> N >> W;
    for (int i=0; i<N; i++) cin >> w[i+1] >> v[i+1];

    for (int i=1; i<=N; i++) {
        for (int j=1; j<=W; j++) {
            if (j-w[i] < 0) {
                dp[i][j] = dp[i-1][j];
                continue;
            }
            
            dp[i][j] = max(dp[i-1][j-w[i]] + v[i], dp[i-1][j]);
        }
    }

    lli ans = -1;
    for (int i=1; i<=W; i++) {
        ans = max(ans, dp[N][i]);
    }

    cout << dp[N][W] << endl;

    return 0;
}


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

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

typedef long long ll;

using namespace std;

int main() {
  string a, b;
  cin >> a >> b;

  string A = string(stoi(b), a.c_str()[0]);
  string B = string(stoi(a), b.c_str()[0]);

  string result = A > B ? B : A;
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        string s = sc.Next();
        int cnt = 0;
        for (int i = 0; i + 2 < s.Length; i++)
        {
            if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            {
                cnt++;
            }
        }

        Console.WriteLine(cnt);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=a;i<n;i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
int a[100000];
int main(void)
{
	int n,t=0,i;
	ll sum=0;
	scanf("%d",&n);
	FOR(i,0,n) scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),comp);
	FOR(i,0,n-1){
		sum+=a[i];
		if(sum*2<a[i+1]) t=i+1;
	}
	printf("%d\n",n-t);
	return 0;
}
    


Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001; // > 10^9
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

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

    int count = 0;
    for (int i = 0; i < n; i++) {
        int h; cin >> h;
        if (h >= k) {
            count++;
        } 
    }
    
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;
int judge(int H,int Di){
int K,sum;
if(H !=0){
    K = H%10;
    if(K == Di){
        return 1;
    }
    if(K != Di){
        H = (H - K)/10;
       sum = judge(H,Di);
    }
    return sum;
}
if(H ==0){
    return 0;
}
}



signed main() {
int N,K,flag=1,H,ans;
cin >> N >> K;
H =N;
vector<int> D(K);
REP(i,K){
cin >>D.at(i);
}
while(flag!=0){
    flag=0;
    REP(i,K){
        flag += judge(H,D[i]);
    }
    if(flag ==0) ans = H;
    else H++;
}
answer(ans);
return 0;
}


Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  ll n,m,a[100000],b[100000];
  cin>>n>>m;
  vector<ll> v[100001];
  rep(i,m){
    cin>>a[i]>>b[i];
    v[a[i]].push_back(b[i]);
  }
  rep(i,n){
    sort(ALL(v[i+1]));
  }
  rep(i,m){
    printf("%012lld\n",(ll)(a[i]*1000000)+(lower_bound(ALL(v[a[i]]),b[i])-v[a[i]].begin())+1);
  }
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

int n, m, d[100009], u[200009], v[200009];

vector<int> e[100009];

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

    cin >> n >> m;

    vector<int> ans(m, 1e9), mn(n, 1e9 + 1), num(n);
    vector<char> c(n, '?');

    rep(i, n) cin >> d[i];
    rep(i, m) {
        cin >> u[i] >> v[i];
        u[i]--;
        v[i]--;
        if(chmin(mn[u[i]], d[v[i]])) num[u[i]] = i;
        if(chmin(mn[v[i]], d[u[i]])) num[v[i]] = i;
    }
    rep(i, n) {
        if(mn[i] > d[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans[num[i]] = d[i];
        int x = (u[num[i]] == i ? v : u)[num[i]];
        e[i].push_back(x);
        e[x].push_back(i);
    }
    queue<int> que;
    rep(i, n) {
        if(c[i] == '?') {
            c[i] = 'B';
            que.push(i);
            while(!que.empty()) {
                int x = que.front();
                que.pop();
                rep(i, e[x].size()) {
                    if(c[e[x][i]] == '?') {
                        c[e[x][i]] = (c[x] == 'B' ? 'W' : 'B');
                        que.push(e[x][i]);
                    }
                }
            }
        }
        cout << c[i];
    }
    rep(i, m) cout << endl << ans[i];
}

Measured memory_bytes: 11768
#include <atcoder/dsu>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3516
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  int *cnt=(int *)malloc(sizeof(int)*(n+1));
  int *can=(int *)malloc(sizeof(int)*(n+1));
  int i;
  for(i=1;i<=n;i++){
    cnt[i]=1;
    can[i]=0;
  }
  can[1]=1;
  while(m--){
    int x,y;
    scanf("%d%d",&x,&y);
    cnt[x]--;
    cnt[y]++;
    if(can[x]==1) can[y]=1;
    if(cnt[x]==0) can[x]=0;
  }
  int ans=0;
  for(i=1;i<=n;i++) ans+=can[i];
  printf("%d\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;

bool a[1000010];
int b[1000010]={0};

int main(){
	for(ll i=0;i<1000010;i++){
		a[i]=false;
	}
	a[1]=true;
	for(ll i=1;i<1000010;i++){
		if(a[i]){
			if(2*i<1000010) a[2*i]=true;
			if(3*i<1000010) a[3*i]=true;
			if(5*i<1000010) a[5*i]=true;
		}
	}
	/*
	rep(i,100){
		if(a[i]){
			cout<<i<<" ";
		}
	}
	cout<<endl;
	*/
	for(ll i=1;i<1000010;i++){
		//if(i==0) continue;
		b[i]=b[i-1];
		if(a[i]) b[i]++;
	}
	ll m,n;
	while(cin>>m,m){
		cin>>n;
		if(a[m]) cout<<b[n]-b[m]+1<<endl;
		else cout<<b[n]-b[m]<<endl;
	}
	return 0;
}
		

Measured memory_bytes: 6048
#include<bits/stdc++.h>
#include<string>
#include<map>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define vii         vector<pair<ll,ll> >
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define rep1(i,a,b) for(ll i=a;i<= b;i++)
#define PI          3.14159
#define MAX         100000001
#define fast_io      ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
#define scan(var)    scanf("%lld",&var)
#define print(var)   printf("%lld\n", var);
#define BLOCK 317
#define double       long double
#define mod          998244353
using namespace std;
ll dp[100001];
ll arr[100001];
ll n;
ll solvedp(ll index, ll n)
{
  if(index >= n)
  {
    return INT_MAX;
  }
  if(index == n - 1)
  {
    return 0;
  }
  if(dp[index] != -1)
  {
    return dp[index];
  }
  dp[index] = min(abs(arr[index] - arr[index + 1]) + solvedp(index + 1,n),abs(arr[index] - arr[index + 2]) + solvedp(index + 2,n));
  return dp[index];
}
int main()
{
  fast_io
  cin >> n;
  memset(dp,-1,sizeof(dp));
  rep(i,0,n)
  {
    cin >> arr[i];
  }
  cout << solvedp(0,n);
  return 0;
}



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

int main() {
    int x;
    cin>>x;
    string a=to_string(x);
    int total=0;
    for(int i=0;i<a.size();i++){
        int y = a[i]-'0';
        total+=y;
    }
    
    if(x%total==0){
        cout <<"Yes"<< endl;
    }else{
        cout <<"No"<< endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 384
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = list(input())

l = len(S)

anss = []
for i in range(1<<l-1):
	ans = []
	i = list("{:b}".format(i).zfill(l-1))
	# print(i)
	S_ = S.copy()
	ans.append(S_.pop(0))
	while S_ != []:
		if i.pop(0) == '1':
			ans.append("+")
		ans.append(S_.pop(0))
	anss.append(eval("".join(ans)))
print(sum(anss))


Measured memory_bytes: 4140
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }
 
    void solve (){
        int n;
        cin>>n;
        ll ans=1;
        for(ll i=1;i<=n;i++){
            ans=mul(ans,i);
        }
        cout<<ans;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef unsigned long long LL;
bool check(int *a){
	for(int i=0;i<30;i++){
		if(a[i]>=2)
		return false;
	}
	return true;
}
int main(){
	int n;
	scanf("%d",&n);
	int a[200005];
	int bit[30];
	MEM(bit);
	LL ans=0;
	int l=0;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		int k=a[i];
		for(int j=0;k;j++){
			bit[j]+=k&1;
			k>>=1;
		}
		while(!check(bit)){
			k=a[l];
			for(int j=0;k;j++){
				bit[j]-=k&1;
				k>>=1;
			}
			l++;
		}
		ans+=i-l+1;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>

#define int long long

using namespace std;

const int INF = 1e17 + 7;

void solve() {
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x  * t;
}

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

    int t = 1;
    //cin >> t;
    while (t--) solve();

    return 0;
}

Measured memory_bytes: 3180
#include <stdio.h>
int main(void) {
	int w, h, x, y, r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);

	if ((x - r) >= 0 && (y - r) >= 0){
		if ((x + r) <= w && (y + r) <= h){
			printf("Yes\n");
		}
		else printf("No\n");
	}
	else printf("No\n");


	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int>t(N+1);
    vector<int>x(N+1);
    vector<int>y(N+1);
    for(int i = 1; i <= N; i++) {
        cin >> t[i] >> x[i] >> y[i];
        if(t[i]-t[i-1] < abs(x[i]-x[i-1])+abs(y[i]-y[i-1])) {
            cout << "No" << endl;
            return 0;
        }
        if(((t[i]-t[i-1])-abs(x[i]-x[i-1])-abs(y[i]-y[i-1]))%2 == 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1408
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 1005
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;
ll spf[MAX_INT];
ll cache[MAX_INT][MAX_INT];

ll modSum(ll A, ll B) {
	return (A + B) % MOD;
}

ll modMul(ll A, ll B) {
	return (A * B) % MOD;
}

void seivePF() {
	for(int i = 2; i <= 1000; i += 2) {
		spf[i] = 2;
	}
	for(ll i = 3; i <= 1000; i += 2) {
		if(!spf[i]) {
			spf[i] = i;
			for(ll j = i; i * j <= 1000; j += 2) {
				if(!spf[i * j]) {
					// trace2(i, j);
					spf[i * j] = i; 
				}
			}
		}
	}
}

int main() {
	go;
    cin >> N;
    seivePF();
    fei(i, 2, N, 1) {
    	ll val = i;
    	while(val > 1) {
    		mp[spf[val]]++;
    		val /= spf[val];
    	}
    }
    ll ans = 1;
    for(auto x: mp) {
    	// trace2(x.ff, x.ss);
    	ans = modMul(ans, modSum(x.ss, 1ll));
    }
    cout << ans << "\n";

   
    
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define endl '\n'
const int N = 1e5 + 10;
ll a[N],sum[N];
signed main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,m;
    cin >> n >> m;
    for(int i = 1;i <= n; ++i) cin >> a[i];
    sort(a+1,a+n+1);
    for(int i = 1;i <= n; ++i) sum[i] = sum[i - 1] + a[i];
    ll l = 0,r = 2e5,res,cnt,ans;
    while(l<=r){
        ll mid=(l+r)>>1;
        res=cnt=0;
        for(ll i=1;i<=n;i++){
            ll pos=lower_bound(a+1,a+n+1,mid-a[i])-a;
            cnt+=n-pos+1;
            res+=sum[n]-sum[pos-1]+a[i]*(n-pos+1);
        }
        if(cnt>=m){
            ans=mid;
            l=mid+1;
        }
        else r=mid-1;
    }
    cout << res - (cnt - m) * ans<< endl;
    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<char> > a(n, vector<char>(n)), b(m, vector<char>(m));
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin >> a[i][j];
        }
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<m; j++){
            cin >> b[i][j];
        }
    }
    bool ans = false;
    for(int k=0; k<=n-m; k++){
        for(int l=0; l<=n-m; l++){
            int same = true;
            for(int i=0; i<m; i++){
                for(int j=0; j<m; j++){
                    if(a[i+k][j+l] != b[i][j]){
                        same = false;
                        i = n;
                        break;
                    }
                }
            }
            if(same){
                ans = true;
                k = n;
                break;
            }
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }   
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin>>n;
  vector<string> s(n);
  int ac=0;
  int wa=0;
  int tle=0;
  int re=0;
  for(int i=0;i<n;i++){
    cin>>s[i];
    if(s[i]=="AC"){
      ++ac;
    }else if(s[i]=="WA"){
      ++wa;
    }else if(s[i]=="TLE"){
      ++tle;
    }else if(s[i]=="RE"){
      ++re;
    }
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;
  return 0;
}

Measured memory_bytes: 6368