akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef long long ll;  //ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<ll, ll> > PS;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { rep(i, f.size())input(f[i]); input(r...); }

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

template<typename T>
T gcd(T a, T b){
	return b != 0 ? gcd(b, a % b) : a;
}    

template<typename T>
T lcm(T a, T b){
    return a/gcd(a,b)*b;
}    
// g++ -std=c++11 prac.cpp 

int main(){
    ll x=0,y=0,z=0,n,m=0,k,h,w,sum=0,Max=-1e9-1,count=0,Min=1e9+1;
    string s,t,u;
    bool ok=true;
    cin >> x >> y;

   
    cout << lcm(x,y) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll i,j,k,l;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll h,w;
    cin>>h>>w;
    ll c[10][10];
    for(i=0; i<10; i++)
        for(j=0; j<10; j++)
            cin>>c[i][j];
    ll a[h*w];
    for(i=0; i<h*w; i++)
        cin>>a[i];
    ll dp[10][10];
    for(i=0; i<10; i++)
        for(j=0; j<10; j++)
            dp[i][j]=c[i][j];
    for(i=0; i<10; i++)
    {
        for(k=0; k<10; k++)
        {
            if(i!=k)
            {
                for(j=0; j<10; j++)
                {
                    ll tmp=dp[i][j]+dp[j][k];
                    if(tmp<dp[i][k])
                        dp[i][k]=tmp;
                }
            }
        }
    }
    for(i=0; i<10; i++)
    {
        for(k=0; k<10; k++)
        {
            if(i!=k)
            {
                for(j=0; j<10; j++)
                {
                    ll tmp=dp[i][j]+dp[j][k];
                    if(tmp<dp[i][k])
                        dp[i][k]=tmp;
                }
            }
        }
    }
    for(i=0; i<10; i++)
    {
        for(k=0; k<10; k++)
        {
            if(i!=k)
            {
                for(j=0; j<10; j++)
                {
                    ll tmp=dp[i][j]+dp[j][k];
                    if(tmp<dp[i][k])
                        dp[i][k]=tmp;
                }
            }
        }
    }

    ll tot=0;
    for(i=0; i<h*w; i++)
    {
        if(a[i]!=-1)
        {
            tot+=dp[a[i]][1];
        }
    }
    cout<<tot<<endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll multbig(ll a,ll b,ll mod){
    if(a==0 or b==0) return 0;
    if(a==1 or b==1) return (a*b)%mod;
    ll cur=multbig(a,b/2,mod);
    cur=(2*cur)%mod;
    if(b%2) cur=(cur+a)%mod;
    return cur;
}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
void solve(){
	int n; cin>>n; int nn = n;
	int s = 0;
	while(n){
		s += n%10;
		n/=10;
	}
	if(nn%s) cout<<"No"<<endl; 
	else cout<<"Yes"<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    ll H[N];
    for (int i=0;i<N;i++){
        cin >> H[i];
    }

    int ans=0;
    int count=0;
    for (int i=0;i<N-1; i++){
        
        if (H[i] >= H[i+1]){
            count++;
        }
        else{
            
            ans = max(ans,count);
            count=0;
        }


    }
    ans = max(ans,count);

    cout << ans;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<ios>
#include<cmath>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<assert.h>
#include<bitset>
#include<tuple>
#include<climits>
#include<deque>
#include<utility>
#include<unordered_map>
#include<unordered_set>
#include<iterator>
#include<sstream>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define l     long
#define ll    long long
#define nitro ios_base::sync_with_stdio(false);cin.tie(0);
#define vi    vector<int>
#define pub   push_back
#define puf   push_front
#define pob   pop_back
#define pof   pop_front
#define PI    3.1415926535897932384626433
#define endl  '\n'
#define gap   ' '
int main()
{
    nitro
    ll int x;cin>>x;
    ll int i=100,c=0;
    while(i<x)
    {
          i+=(.01*i);c++;
    }  cout<<c;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
	string S;
	cin >> S;
	if(S.size() == 2) cout << S;
	else{
		for(int index = 0; index < S.size(); index++)
			cout << S[S.size() - 1 - index];
	}
	cout << endl;
	return 0;
}


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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

#define chmax(x, y) x = max(x, y)

int main() {
  u32 n, k;
  cin >> n >> k;
  vector<i32> p(n), c(n);

  rep(i, n) { cin >> p[i]; }
  rep(i, n) { p[i]--; }

  rep(i, n) { cin >> c[i]; }

  i64 ans = -1e18;
  rep(i, n) {
    u32 s = i;
    vector<i32> l;
    i64 tot = 0;
    while (1) {
      s = p[s];
      l.push_back(c[s]);
      tot += c[s];
      if (i == s){
        // cout << "tot:" << tot << " l:" << l.size()<<endl;
        break;
      }
    }

    i64 part = 0;
    i64 point = 0;

    rep(j, l.size()) {
      part += l[j];
      if (j+1>k) break;
      if (tot > 0) {
        point = part + (k-j-1) / l.size() * tot;
        chmax(ans, point);
      }
      chmax(ans, part);
    }
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 3696
a,b = map(int,input().split(" "))
ar = []
mn = 10000
for i in range(a):
  ar.append(i+b)
mx = sum(ar)
ans = 0
for r in ar:
    if mn > abs(mx - (mx - r)):
        mn = abs(mx - (mx - r))
        ans = mx - r
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i < 10) {
            ans++;
        } else if (i > 99 and i < 1000) {
            ans++;
        } else if (i > 9999 and i < 100000) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(void) {
  int N, K; cin >> N >> K;
  long long min = 0, max = N;
  long long minSum = 0, maxSum = 0;
  for (int i = 0; i < K; i++) {
    minSum += min;
    maxSum += max;
    min++;
    max--;
  }

  long long ans = 0;
  for (int i = K; i <= N+1; ++i) {
    ans += maxSum - minSum + 1;
    ans %= 1000000007;
    minSum += min;
    maxSum += max;
    min++;
    max--;
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3636
n, a, b = map(int, input().split())

def digitSum(num):
    numToString = str(num)
    array = list(map(int, numToString))
    return sum(array)

ans = 0

for i in range(n+1):
    if digitSum(i) >= a and digitSum(i) <= b:
        ans += i
    
print(ans)


Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#define begin Begin
#define next Next
using namespace std;
typedef long long ll;
const int maxn=1e5+10,maxm=2e5+10;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	ll f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
int begin[maxn],next[maxm],to[maxm],e;
int col[maxn];
void add(int x,int y){
	to[++e]=y;
	next[e]=begin[x];
	begin[x]=e;
}
bool flag;
bool vis[maxn];
void dfs(int x){
	if(flag) return;
	for(int i=begin[x];i;i=next[i]){
		if(!vis[to[i]]){
			col[to[i]]=col[x]^1;
			vis[to[i]]=1;
			dfs(to[i]);
		}
		else if(col[to[i]]==col[x]){
			flag=1;
			return;
		}
	}
}
int main(){
	int n=read(),m=read();
	for(int i=1;i<=m;i++){
		int x=read(),y=read();
		add(x,y);
		add(y,x);
	}
	vis[1]=1;
	dfs(1);
	if(flag){
		printf("%lld\n",1ll*n*(n-1)/2-m);
	}
	else{
		int x=0,y=0;
		for(int i=1;i<=n;i++)
			x+=(col[i]==0),y+=(col[i]==1);
		printf("%lld\n",1ll*x*y-m);
	}

	return 0;
}


Measured memory_bytes: 2944
// ------------------------------------
// Date:2018/ 3/25
// Problem:_ _ _ c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

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

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

  CIN(N);
  vector< int > a(N + 1);

  ll sum = 0ll;
  
  FOR(i, 1, N + 1) {
    cin >> a[i];
  }

  a[0] = 0;
  REP(i, N) {
    sum += abs(a[i + 1] - a[i]);
  }
  sum += abs(a[N]);
  // debug(sum);
  
  FOR(i, 1, N + 1) {
    int s = (i - 1) % (N + 1);
    int t = (i) % (N + 1);
    int u = (i + 1) % (N + 1);
    ll ans = sum - abs(a[t] - a[s]) - abs(a[u] - a[t]) + abs(a[u] - a[s]);
    /*
    debug(s);
    debug(t);
    debug(u);
    debug(abs(a[t] - a[s]));
    debug(abs(a[u] - a[t]));
    debug(abs(a[s] - a[u]))
    */
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
#define repb(i, n) for (int i = (n - 1); i >= 0; i--)
#define repb2(i, a, n) for (int i = (n - 1); i >= (a); i--)
#define all(x) x.begin(), x.end()
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
inline void fastio() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
    fastio();

    // 1つのコマで訪れる場合、区間の一端に最初に配置し、もう一端に
    // 向かって移動し続けるのが最適。
    // よって、複数のコマの場合も同様んじ両端からもう一端に向かって
    // 移動し続けて、移動が最小になる地点をみつける。

    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    rep(i, M) { cin >> X[i]; }
    if (N >= M) {
        co(0);
        return 0;
    }
    sort(all(X));
    vector<int> L(M - 1);
    rep(i, M - 1) { L[i] = X[i + 1] - X[i]; }
    sort(all(L));
    co(accumulate(L.begin(), L.end() - N + 1, 0));
}

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

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif


long long gcd(long long a, long long b) {
    return b ? gcd(b, a % b) : a;
}

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

long long mul(long long a, long long b, const long long mod) {
    return b ? (mul(a * 2, b / 2, mod) + (b & 1 ? a : 0)) % mod : 0;
}

long long bpow(long long a, long long b, const long long mod) {
    return (b ? bpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) : 1) % mod;
}

long long inv(long long a, const long long mod) {
    return bpow(a, mod - 2, mod);
}

// to overflow
/*long long bpow(long long a,long long b,const long long mod){
	return (b?mul(bpow(mul(a,a,mod),b/2,mod),(b&1?a:1),mod):1)%mod;
}*/
class mInt {
public:
    static const long long mod = 1000000007;
    long long v;

    mInt() : v(0) {}

    mInt(long long v) : v((v % mod + mod) % mod) {}
};

mInt &operator+=(mInt &a, mInt b) { return a = a.v + b.v; }

mInt &operator-=(mInt &a, mInt b) { return a = a.v - b.v; }

mInt &operator*=(mInt &a, mInt b) { return a = a.v * b.v; }

mInt &operator/=(mInt &a, mInt b) { return a = a.v * inv(b.v, mInt::mod); }

mInt operator+(mInt a, mInt b) { return a += b; }

mInt operator-(mInt a, mInt b) { return a -= b; }

mInt operator*(mInt a, mInt b) { return a *= b; }

mInt operator/(mInt a, mInt b) { return a /= b; }

ostream &operator<<(ostream &os, const mInt &x) { return os << x.v; }

template<int N, long long mod>
struct nCr {
    vector<long long> f, finv;

    long long ncr(long long n, long long r) {
        if (r > n || r < 0) return 0;
        assert(n <= N);
        return f[n] * finv[r] % mod * finv[n - r] % mod;
    }

    nCr() {
        f.resize(N + 1);
        finv.resize(N + 1);
        f[0] = 1;
        for (int i = 1; i <= N; i++) f[i] = i * f[i - 1] % mod;
        finv[N] = inv(f[N], mod);
        for (int i = N - 1; i >= 0; i--) finv[i] = finv[i + 1] * (i + 1) % mod;
    }
};


nCr<200010, mInt::mod> ncr;


vector<int> f(ll M) {
    vector<int> c;
    for (int i = 2; i * i <= M; i++) {
        if (M % i == 0) {
            int cnt = 0;
            while (M % i == 0) M /= i, cnt++;
            c.push_back(cnt);
        }
    }
    if (M != 1) {
        c.push_back(1);
    }
    return c;
}


mInt nHr(int ball, int box) {
    return ncr.ncr(ball + box - 1, box - 1);
}

void solve(ll N, ll M) {
    mInt ans = 1;
    for (auto c : f(M)) {
        ans *= nHr(c, N);
    }
    cout << ans << endl;

}


void main_(istream &cin) {
    ll M;
    ll N;
    cin >> N;
    cin >> M;
    solve(N, M);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 3328
n, m = map(int, input().split())
l = 0
r = 1000000
for i in range(m):
    li, ri = map(int, input().split())
    if li > l:
        l = li
    if ri < r:
        r = ri
    if l > r:
        print(0)
        break
else:
    if r >= n:
        print(n-l+1)
    else:
        print(r-l+1)
        


Measured memory_bytes: 3060
import java.util.*;
import java.io.PrintWriter;
public class Main{
	static ArrayList<Integer>[] edge;
	static int[] dp;
	static boolean[] visited;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		edge=new ArrayList[n];
		dp=new int[n];
		visited=new boolean[n];
		for(int i=0; i<n; i++){
			edge[i]=new ArrayList<>();
		}
		for(int i=0; i<m; i++){
			int x=sc.nextInt()-1;
			int y=sc.nextInt()-1;
			edge[x].add(y);
		}
		int ans=0;
		for(int i=0; i<n; i++){
			if(!visited[i]){
				dfs(i);
				ans=Math.max(ans,dp[i]);
			}
		}
		System.out.println(ans);
	}
	static void dfs(int now){
		visited[now]=true;
		for(int i:edge[now]){
			if(!visited[i]){
				dfs(i);
			}
			dp[now]=Math.max(dp[now],dp[i]+1);
		}
	}
}


Measured memory_bytes: 109116
r, g, b = list(map(int, input().split()))

if 1 <= r <= 9 and 1 <= g <= 9 and 1 <= b <= 9:
    res = "YES" if (r * 100 + 10 * g + b) % 4 == 0 else "NO"
    print(res)
else:
    print("error")

Measured memory_bytes: 2940
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<int>v(N);
	vector<int>w(N);
	for (auto& i : v)cin >> i;
	for (auto& i : w)cin >> i;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans += max(0, v[i] - w[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
n = int(input())
cs, ss, fs = [], [], []
for _ in range(n - 1):
    c, s, f = map(int, input().split())
    cs.append(c)
    ss.append(s)
    fs.append(f)
cs.append(0)
ss.append(0)
fs.append(1)

res = []
for i in range(n - 1):
    t = 0
    for j in range(i, n - 1):
        s = ss[j]
        f = fs[j]
        if t < s:
            t = s
        elif t % f > 0:
            t += f - t % f
        t += cs[j]
    res.append(t)
res.append(0)
for x in res:
    print(x)

Measured memory_bytes: 3188
#!/usr/bin/env python3

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	l = list(map(int, sys.stdin.readline().split()))
	cnt = 0
	for i in range(n):
		for j in range(i, n):
			for k in range(j, n):
				if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
					a = sorted([l[i], l[j], l[k]])
					log.print(a)
					if (a[0] + a[1] <= a[2]):
						continue
					cnt += 1
	print(cnt)
	


main()

Measured memory_bytes: 69764
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#define all(x) (x).begin(),(x).end()

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> h;
    int x;
    for (int i = 0; i < n; i++){
        cin >> x;
        h.push_back(x);
    }
    
    sort(all(h));
    int ans = INT_MAX;
    for (int i = 0; i + k <= n; i++){
        int min1 = h[i];
        int max1 = h[i+k-1];
        ans = min(ans, max1-min1);
    }
    cout << ans << endl;;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
    int count[26]={0};
    char x;

    while(scanf("%c",&x)!=EOF) {
    
        x=toupper(x);
        count[x-'A']++;
    }

    for(int i=0;i<26;i++){
        printf("%c : %d\n",i+'a',count[i]);
    }  
}

Measured memory_bytes: 972
#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long n, x, m;
    cin >> n >> x >> m;
    vector<vector<long long>> to(50, vector<long long>(m));
    vector<vector<long long>> s(50, vector<long long>(m));
    for (long long i = 0; i < m; i++) {
        to[0][i] = i * i % m;
        s[0][i] = i;
    }
    for (int i = 1; i < 50; i++) {
        for (int j = 0; j < m; j++) {
            to[i][j] = to[i - 1][to[i - 1][j]];
            s[i][j] = s[i - 1][j] + s[i - 1][to[i - 1][j]];
        }
    }
    long long ans = 0;
    long long pos = x;
    for (int i = 49; i >= 0; i--) {
        if (n & (1LL << i)) {
            ans += s[i][pos];
            pos = to[i][pos];
        }
    }
    cout << ans << '\n';
    return 0;
}

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

int main()
{
  int n;
  cin>>n;
  int a[n+1];
  for(int i=1;i<=n;i++)
    cin>>a[i];
  
  a[0]=INT_MAX;
  int dp[n+1];
  dp[0]=0;
  dp[1]=0;
  
  for(int i=2;i<=n;i++)
  {
    dp[i]=min( dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]) );
  }
  
  cout<<dp[n]<<endl;
  
  return 0;
}
  

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

int a[305][305];
bool uzeo[305];

int br[305];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	int sol = 1e9;
	for (int i=0 ; i<n ; i++) {
		for (int j=0 ; j<m ; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (int i=0 ; i<m ; i++) {
		memset(br, 0, sizeof br);
		for (int j=0 ; j<n ; j++) {
			int k = 0;
			for ( ; uzeo[a[j][k]] ; k++) ;
			br[a[j][k]]++;
		}
		int maxx = 0;
		int koji;
		for (int j=1 ; j<=m ; j++) {
			if (br[j] > maxx) {
				maxx = br[j];
				koji = j;
			}
		}
		sol = min(sol, maxx);
		uzeo[koji] = 1;
	}
	printf("%d\n", sol);
	return 0;
}

Measured memory_bytes: 640
import sys
from numpy import argmin
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
input = sys.stdin.buffer.readline

V, E = map(int, input().split())

v_from = []
v_to = []
cost = []

for _ in range(E):
    u, v, d = map(int, input().split())
    v_from.append(u)
    v_to.append(v)
    cost.append(d)

graph = csr_matrix((cost, (v_from, v_to)), [V+1, V+1])
dist, predecessors = floyd_warshall(graph, directed=False, return_predecessors=True)
dist[dist == 0] = float('inf')

dist_min = list(map(argmin, dist))

# print(dist_min)


# print(dist, predecessors)

T_max = int(input())
order = [[int(input().split()[1]) for _ in range(int(input()))] for _ in range(T_max)]

time = 0
delivering = False
distination = 1
v_next = 1

while time < T_max:
    # 配達中なら配達作業
    if delivering:
        # 途中経由地へ進む
        print(v_next)
        # 途中経由地までの残りの距離を減らす
        remaining_next -= 1
        # 到着したら次の途中経由地へ
        if remaining_next == 0:
            next_temp = predecessors[distination, v_next] # predecessors[v_next, distination]
            if next_temp != -9999:
                remaining_next = dist[v_next, next_temp]
                v_next = next_temp
        # 最終目的地までの距離を減らす
        remaining_last -= 1
        # 到着してる(はず)
        if remaining_last == 0:
            # 店に戻り終わった(目的地が店だった)
            if distination == 1:
                delivering = False
            # 店に戻る
            else:
                remaining_last = dist[distination, 1]
                v_next = predecessors[1, distination] # predecessors[distination, 1]
                remaining_next = dist[distination, v_next]
                distination = 1
        time += 1
    # 配達する目的地を決める(一番近いところ)
    else:
        idx = -1
        remaining_last = 0
        dist_temp_min = 10**18
        for i, o in enumerate(order):
            if not o:
                continue
            dst = o[0]
            # 店から配達場所までの時間(注文時間が今より後なら待たなければいけない)
            dist_temp = dist[1, dst] + max(0, i - time)
            if dist_temp < dist_temp_min:
                dist_temp_min = dist_temp
                idx = i
        # オーダーが無ければ終わり
        if idx == -1:
            while time < T_max:
                print(-1)
                time += 1
            break
        # オーダーが現在時刻より遅ければ待つ
        if time < idx:
            while time < idx:
                print(-1)
                time += 1
        # 目的地等を設定
        distination = order[idx].pop()
        remaining_last = dist[1, distination]
        v_next = predecessors[distination, 1] # predecessors[1, distination]
        # print(distination, v_next)
        remaining_next = dist[1, v_next]
        delivering = True

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

int main(){

int N;
cin >> N;

long long mi =1000000000;

vector<long long> A(N);
      for(int i = 0; i < N; i++){ 
             
             cin >> A.at(i);
             
             mi = min(mi, A.at(i));
      }
long long ans = mi;
      for(int i = 0; i < N; i++){ 
            if (A.at(i) % ans != 0){
                  ans = A.at(i) % ans;
                  i = -1;
                  continue;
            }

      }

cout << ans << endl; 

}
          


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

int main()
{
   
   int a,b,c;
   cin>>a>>b>>c;
   if(a==b+c||b==a+c||c==a+b){
       cout<<"Yes"<<endl;
   }
   else{
       cout<<"No"<<endl;
   }
   
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i=0; i<N; i++) {
        cin >> H[i];
    }
    
    int ans=0;
    int max=0;
    for (int i=0; i<N; i++) {
        if (H[i]>=max) {
            ans++;
            max=H[i];
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
 
int main() {
  int a,b,c;
  int curr;
  int ans;
  cin >> a >> b >> c;
  curr=a-b;
  ans=c-curr;
  if(ans<0){
    ans=0;
  }

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

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

main = abc163b

abc163b = do
    [n, _] <- getIntList
    as <- getIntList
    print $ let ans = n - sum as
             in if ans < 0 then -1 else ans

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine

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

int main() {
	int i, j, cnt = 0, k;
	string s; cin >> s;
	cin >> k;
	
	string a[25000];
	for (i = 0; i < s.size(); i++) {
		for (j = 1; j <= min(k, (int)s.size() - i); j++) {
			a[cnt++] = s.substr(i, j);
		}
	}
	sort(a, a + cnt);
	if (k == 1) {
		cout << a[0] << endl;
		return 0;
	}
	for (i = 1;; i++) {
		if (a[i - 1] != a[i])k--;
		if (k == 1) {
			cout << a[i] << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1664
#include<cstdio>
#include<cstring>
char str[305];
int dp[305][305][305],K;
int max(int a,int b){return a>b?a:b;}
int main(){
	scanf("%s%d",str,&K); int lens=strlen(str);
	for(int i=0;i<lens;i++)
		for(int k=0;k<=K;k++)
			dp[i][i][k]=1;
	for(int l=1;l<lens;++l)
		for(int i=0;i+l<lens;++i){
			int j=i+l;
			for(int k=0;k<=K;++k){
				dp[i][j][k]=max(dp[i+1][j][k],dp[i][j-1][k]);
				if(k>0) dp[i][j][k]=max(dp[i+1][j-1][k-1]+2,dp[i][j][k]);
				if(str[i]==str[j]) dp[i][j][k]=max(dp[i+1][j-1][k]+2,dp[i][j][k]);
	        }
	    }
	printf("%d\n",dp[0][lens-1][K]);
}

Measured memory_bytes: 110720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
  string s;
  cin >> s;
  
  int n = s.size();
  int ans = 0,cou = 0;
  rep(i,n){
    int j = i;
    while(s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T'){
      cou++;
      j++;
    }//while
    if(cou > ans){
      ans = cou;
    }
    cou = 0;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3624
z=set([1])
for i in range(100):
	if 6**i <= 100000:
		z.add(6**i)
	if 9**i <= 100000:
		z.add(9**i)

N=int(input())
A=[0]*(N+1)

for n in range(1, N+1):
	ans = []
	for m in z:
		if n-m >= 0:
			ans.append(1 + A[n-m])
	A[n] = min(ans)

print(A[N])


Measured memory_bytes: 3828
fun main(arg: Array<String>) {
    val N = next()
    val A = listOfInt()
    val S = java.util.HashSet<Int>()
    A.forEach { a -> S.add(a) }
    var ans = S.size - if (S.size % 2 == 0) 1 else 0
    println(ans)
}

fun next() = readLine()!!
fun nextInt(offset: Int = 0) = Integer.parseInt(next()) + offset
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }


Measured memory_bytes: 58176
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int n, k, i, x;
	cin >> n >> k;
	int ans = 0;
	fo(i, 0, n){
		cin >> x;
		ans += (x >= k);
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
typedef long long LL;
typedef long double LD;

using namespace std;

int main()
{
	LD a,b,h,m,w1,w2,t1,t2,t3,l3;
	cin >> a >> b >> h >> m;
	w1 = (LD)2*M_PI/720.0;
	w2 = (LD)2*M_PI/60.0;
	t1 = (LD)w1*(h*60+m);
	t2 = (LD)w2*m;
	t3 = (LD)abs(t1-t2);
	l3 = (LD)sqrt(a*a+b*b-(2*a*b*cos(t3)));
	cout.precision(20);
	cout << l3 << endl;
	
	return 0;
} 

Measured memory_bytes: 4160
N = input()

S = set(N)
C = []

for s in S:
    C.append(N.count(s))

S2 = set(C)
C2 = []

for s in S2:
    C2.append(C.count(s))

x = len(N)*(len(N)-1)
for s,c in zip(S2,C2):
    x -= (s * (s-1)) * c

print( 1 + x//2 ) 


Measured memory_bytes: 3500
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			//System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start();
			//Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			int x = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int ans = 0;
			if (x >= 500) {
				ans = (x / 500) * 1000;
				x %= 500;
			}
			if (x >= 5) {
				ans += (x / 5) * 5;
			}
			Console.WriteLine(ans);



			//Console.Out.Flush();
			//System.Diagnostics.Debug.WriteLine(sw.Elapsed);
		}
	}
}

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

int main() {
    int n,cnt=0;
    ll d,x,y;
    cin >> n >> d;
    for (int i=0;i<n;i++) {
        cin >> x >> y;
        if (x*x+y*y<=d*d) {cnt++;}
    }
    cout << cnt << endl;


}


Measured memory_bytes: 3584
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;
using static System.Console;

namespace CsTest
{
    class Program
    {
        static void Main()
        {
            var input1 = AtCoder.ReadInt32Array();
            var a = input1[0];
            var b = input1[1];
            var c = input1[2];
            WriteLine((b - a == c - b) ? "YES" : "NO");
        }
    }

    public class AtCoder
    {
        public static string[] ReadStringArray() => ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
        public static int[] ReadInt32Array() => ReadStringArray().Select(s => int.Parse(s)).ToArray();
        public static long[] ReadInt64Array() => ReadStringArray().Select(s => long.Parse(s)).ToArray();
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	// your code goes here
	int n;
	cin>>n;
	
	double a[n];
	
	for(int i=0;i<n;i++)
		cin>>a[i];
		
	sort(a,a+n);
	
	double ans=0;
	ans = (a[1] + a[0])/2;
	for(int i=2;i<n;i++){
		ans = (ans + a[i])/2;
	}
	cout<<fixed<<setprecision(8)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N; cin >> N;
  for(int i = (int)(N / 1.1); i <= N; i++) {
    int j = (int)(i * 1.08);
    if(j == N) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define  rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef vector<int> vi;
typedef long int li;
typedef unsigned long long ull;


int main(int argc,char* argv[])
{
    int W,H,N,cnt=0;
    cin>>W>>H>>N;
    bool a[W*H]={0};

    
    rep(i,N){
        int x,y,z;
        cin>>x>>y>>z;
        if(z==1){
            rep(i,W*H) if(i%W<x) a[i]=1;
        }
        if(z==2){
            rep(i,W*H) if(i%W>=x) a[i]=1;
        }
        if(z==3){
            rep(i,W*H) if(i/W<y) a[i]=1;
        }
        if(z==4){
            rep(i,W*H) if(i/W>=y) a[i]=1;
        }
    }
    for(bool z:a) if(z==0)cnt++;
    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int cmp(int *x, int *y)
{
	return (*x - *y);
}

int main(int argc, char const *argv[])
{
	int scores[1024];
	int n;

	while (scanf("%d", &n), n){
		int i;
		int sum = 0;

		for (i = 0; i < n; i++){
			scanf("%d", scores + i);
		}
		qsort(scores, n, 4, cmp);

		for (i = 1; i < n - 1; i++){
			sum += scores[i];
		}
		printf("%d\n", sum / (n - 2));
	}
	return 0;
}

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


void solve(std::string S){
    long long ans=0;
    for(auto c: S)
        ans = (c == '+' ? ans+1 : ans-1);
    cout << ans << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  string ans;
  if (a == 1 && b != 1) {
    ans = "Alice";
  }
  else if (a != 1 && b == 1) {
    ans = "Bob";
  }
  else if (a > b) {
    ans = "Alice";
  }
  else if (a < b) {
    ans = "Bob";
  }
  else {
    ans = "Draw";
  }
  cout << ans << endl;
}


Measured memory_bytes: 3604
#include<cstdio>
#include<cmath>



int main(){
    int n;
    double x,y,C2 = 0,C3 = 0 ,D1 = 0,D2,D3,Dm = 0,X[100]={},Y[100]={},Z[100]={};
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        scanf("%lf",&x);
        X[i] = x;
    }
    for (int i = 0; i < n; i++){
        scanf("%lf",&y);
        Y[i] = y;
    }
    for (int i = 0; i < n; i++){
        D1 += fabs(X[i] - Y[i]);
        C2 += (X[i] - Y[i])*(X[i] - Y[i]);
        C3 += fabs((X[i] - Y[i])*(X[i] - Y[i])*(X[i] - Y[i]));
        Z[i] = fabs(X[i] - Y[i]);
    }

    for (int i = 0; i < n; i++){
        if (Dm < Z[i]){
            Dm = Z[i];
        }
    }


    D2 = sqrt(C2);
    D3 = pow(C3, 1.0/3.0);

    printf("%lf\n",D1);
    printf("%lf\n",D2);
    printf("%lf\n",D3);
    printf("%lf\n",Dm);
    
    
    return 0;

}


Measured memory_bytes: 2952
#include<bits/stdc++.h>
using namespace std;
int ans,a,b;
int c[20][20];

void dfs(int y,int x){
  if(y<0 || x>a) return;
  if(y==0 && x==a-1) ans++;
  else{
    if(c[y-1][x]!=1) dfs(y-1, x);
    if(c[y][x+1]!=1) dfs(y, x+1);
  }
}
int main(){
  while(cin>>a>>b, a){
    ans=0;
    for(int i=0;i<20;++i){
      for(int j=0;j<20;++j){
        c[i][j]=0;
      }
    }
    
    int x; cin>>x;
    for(int i=0;i<x;++i){
      int s,t; cin>>s>>t;
      c[b-t][s-1]=1;
    }
    dfs(b-1, 0);
    cout<<ans<<endl;
    
    
  }
  return 0;
}

Measured memory_bytes: 3076
n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))

dt = 10000000
ans = 0
for i in range(len(h)):
    tmp = float(t) - 0.006 * h[i]
    if dt > abs( a - tmp ):
        dt = abs( a - tmp )
        ans = i + 1

print(ans)


Measured memory_bytes: 9200
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B, P, Q, R;
	
	cin>>A>>B>>P>>Q>>R;
	
	cout<<(long double)(P * B - Q * (B - A))/  (Q + R) + B<<endl;
	
	return 0;
}


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

int gcd(int x,int y){
  if(y==0) return x;
  return gcd(y,x%y);
}

int main(){
  int x,y;
  cin>>x>>y;
  if(x<y) swap(x,y);
  cout<<gcd(x,y)<<endl;
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
 
int main(){
    long int x;
    long int a, b;
    int end = 0;
 
    scanf("%ld", &x);
 
    for(long int i = -1000; i <= 1000; i++){
        for(long int j = -1000; j <= 1000; j++){
            if(i*i*i*i*i - j*j*j*j*j == x){
                a = i; b = j;
                end = 1;
                break;
            }
        }
        if(end == 1) break;
    }
    printf("%ld %ld", a, b);
}

Measured memory_bytes: 1728
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 2056
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int n, K;
int x[50], y[50];
int xx[50], yy[50];

signed main() {
	int i, j, k, l, m;
	
	cin >> n >> K;
	for (i = 0; i < n; i++) cin >> x[i] >> y[i];
	for (i = 0; i < n; i++) xx[i] = x[i];
	for (i = 0; i < n; i++) yy[i] = y[i];
	sort(xx, xx + n);
	sort(yy, yy + n);
	
	int ans = 5e+18;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			for (k = 0; k < n; k++) {
				for (l = k + 1; l < n; l++) {
					int cnt = 0;
					for (m = 0; m < n; m++) {
						if (xx[i] <= x[m] && x[m] <= xx[j] &&
						    yy[k] <= y[m] && y[m] <= yy[l])
						    	cnt++;
					}
					if (cnt >= K) {
						ans = min(ans, (xx[j] - xx[i]) * (yy[l] - yy[k]));
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std;  
 
int main() {  
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(30);  
  	int N;
  	int R;
  	cin>>N>>R;
  	if(N>=10){
      cout<<R;
    }
  	else{
      cout<<(R+100*(10-N));
    }
    return 0;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e5 + 5;

ll n;
int x, p;
int a[maxn], vis[maxn];
ll b[maxn];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	scanf("%lld%d%d", &n, &x, &p);
	a[1] = x, vis[x] = 1;
	int l, r, cnt = 1;
	while(1){
		a[cnt+1] = 1ll * a[cnt] * a[cnt] % p;
		++cnt;
		if(vis[a[cnt]]){
			l = vis[a[cnt]], r = cnt - vis[a[cnt]];
			break;
		}
		vis[a[cnt]] = cnt;
	}
	for(int i = 1; i <= cnt; ++i) b[i] = b[i-1] + 1ll * a[i];
	
	cout << (b[cnt-1] - b[l-1]) * ((n - l + 1) / r) + b[(n-l+1)%r+l-1];
}

Measured memory_bytes: 4704
/* Dynamic Programming implementation of LCS problem */
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;

/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( string X, string Y, int m, int n )
{
   int L[m+1][n+1];

   /* Following steps build L[m+1][n+1] in bottom up fashion. Note
      that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
   for (int i=0; i<=m; i++)
   {
     for (int j=0; j<=n; j++)
     {
       if (i == 0 || j == 0)
         L[i][j] = 0;
       else if (X[i-1] == Y[j-1])
         L[i][j] = L[i-1][j-1] + 1;
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]);
     }
   }

   // Following code is used to print LCS
   int index = L[m][n];

   // Create a character array to store the lcs string
   char lcs[index+1];
   lcs[index] = '\0'; // Set the terminating character

   // Start from the right-most-bottom-most corner and
   // one by one store characters in lcs[]
   int i = m, j = n;
   while (i > 0 && j > 0)
   {
      // If current character in X[] and Y are same, then
      // current character is part of LCS
      if (X[i-1] == Y[j-1])
      {
          lcs[index-1] = X[i-1]; // Put current character in result
          i--; j--; index--;     // reduce values of i, j and index
      }

      // If not same, then find the larger of two and
      // go in the direction of larger value
      else if (L[i-1][j] > L[i][j-1])
         i--;
      else
         j--;
   }

   // Print the lcs
   cout << lcs;
}

/* Driver program to test above function */
int main()
{
  string x;cin>>x;
  string y;
  cin>>y;
  int m = x.length();
  int n = y.length();
  lcs(x, y, m, n);
  return 0;
}


Measured memory_bytes: 35456
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc.Split(bufio.ScanWords)

	xs, ys := nextString(), nextString()
	x, _ := strconv.ParseInt(xs, 16, 32)
	y, _ := strconv.ParseInt(ys, 16, 32)
	if x < y {
		fmt.Println("<")
	} else if x > y {
		fmt.Println(">")
	} else {
		fmt.Println("=")
	}
}

var sc = bufio.NewScanner(os.Stdin)

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	if i, err := strconv.Atoi(sc.Text()); err != nil {
		panic(err)
	} else {
		return i
	}
}

func atoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(err)
	} else {
		return i
	}
}

func split(s, seq string) []string {
	return strings.Split(s, seq)
}


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

int main() {
	int x,h,m,s;
	cin >> x;

	s = x % 60;
	x = (x - s) / 60;
	m = x % 60;
	h = (x - m) / 60;

	cout << h << ":" << m << ":" << s << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 100000 + 10;
ll n, a[N];
ll ans[N];
map <ll, ll> f, id;
map <ll, ll>::iterator it, jt;

int main() {
	cin >> n;
	ll mx = 0, idx = -1;
	f[0] = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		++f[-a[i]];
		mx = max(mx, a[i]);
	}
	for (int i = n - 1; i >= 0; --i)
		id[a[i]] = i;

	idx = id[mx];
	ll pre = 0;
	for (it = f.begin(); ; ++it) {
		jt = it, ++jt;
		if (jt == f.end()) break;
		ans[idx = min(idx, id[-it->first])] += (it->second + pre) * (-it->first - -jt->first);
		pre += it->second;
	}
	for (int i = 0; i < n; ++i)
		cout << ans[i] << "\n";
	return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) cin >> A.at(i);
  sort(A.begin(), A.end(), greater<int>());
  int index = 0;
  double diff = 1000000007;
  for (int i = 1; i < n; i++) {
    if (abs(A.at(i) - A.at(0) / 2.0) < diff) {
      diff = abs(A.at(i) - A.at(0) / 2.0);
      index = i;
    }
  }
  cout << A.at(0) << " " << A.at(index) << endl;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,x;
Vi a;
Vi sum;//sum[i]:=ai+ai+1
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>x;
    a.resize(n);
    sum.resize(n-1);
    rep(i,n){
        cin>>a[i];
        if(i!=0){
            sum[i-1] = a[i]+a[i-1];
        }
    }
    ll ans = 0;
    rep(i,n){
        if(i!=n-1){
            ll tp = a[i]+a[i+1] - x;
            chmax(tp,0LL);
            a[i+1] -= tp;
            if(a[i+1]<0){
                a[i] += a[i+1];
                a[i+1] = 0;
            }
            ans += tp;
        }
    }
    print(ans);
    return 0;
}

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

int main()
{
    int n, x1=0, x2=0, x3=0, x4=0;
    cin >> n;
    string s;
    for(int i=0; i<n; i++)
    {
        cin >> s;
        if(s == "AC")
            x1++;
        else if(s == "WA")
            x2++;
        else if(s == "TLE")
            x3++;
        else
            x4++;
    }
    cout << "AC x " << x1 <<endl;
    cout << "WA x " << x2 <<endl;
    cout << "TLE x " << x3 <<endl;
    cout << "RE x " << x4 <<endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=1000000000000000000;
int main(){
	int n;cin>>n;
	if(n==1){
		cout<<"Hello World"<<endl;
	}else{
		int a,b;cin>>a>>b;
		cout<<a+b<<endl;
	}
}

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

void solve() 
{
    ll x,k,d;cin>>x>>k>>d;
    if(x<0)x=-x;
    ll m=x%d;
    if(abs(m-d)<m)m-=d;
    if((x-m)/d>=k)cout<<abs(x)-k*d<<endl;
    else if(((x-m)/d)%2==k%2)cout<<abs(m)<<endl;
    else cout<<min(abs(m+d),abs(m-d))<<endl;
}

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


Measured memory_bytes: 3644