akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    LL(N);
    VEC(ll,a,N);
    vector<pair<ll,ll>> v1;
    for(ll i = 0LL; i < N; ++i){
        v1.push_back(make_pair(a[i],i+1));
    }
    sort(v1.begin(),v1.end());

    for(int i = 0; i < N; ++i){
        cout << v1[i].second << " ";
    }



}

Measured memory_bytes: 3312
n,m=map(int,input().split())
class UnionFind():
  def __init__(self,n):
    self.n=n
    self.root=[-1]*(n+1)
    self.rnk=[0]*(n+1)
    
  def Find_Root(self,x):
    if self.root[x]<0:
      return x
    else:
      self.root[x]=self.Find_Root(self.root[x])
      return self.root[x]
  
  def Unite(self,x,y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x==y:
      return
    elif self.rnk[x] > self.rnk[y]:
      self.root[x]+=self.root[y]
      self.root[y]=x
    else:
      self.root[y]+=self.root[x]
      self.root[x]=y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y]+=1
        
  def isSameGroup(self,x,y):
    return self.Find_Root(x) == self.Find_Root(y)
  
  def Count(self,x):
    return -self.root[self.Find_Root(x)]


uf=UnionFind(n)
for iii in range(m):
  x,y,z=map(int,input().split())
  uf.Unite(x,y)

cnt=0
for iii in uf.root:
  if iii<0:
    cnt+=1
print(cnt-1)


    
  

Measured memory_bytes: 7748
import sys
input = sys.stdin.readline
 
N, X = [int(x) for x in input().split()]
# P,B
L = [1]

#P
P = [1]

for i in range(N):
    L.append(3 + L[-1] * 2)
    P.append(1 + P[-1] * 2)

ans = 0
# idx = N
while True:
    if L[N] == X:
        ans += P[N]
        print(ans)
        break
    elif L[N] - 1 == X:
        ans += P[N]
        print(ans)
        break
    elif 2 + L[N - 1] <= X:
        ans += 1 + P[N - 1]
        X -= 2 + L[N - 1]
        if X == 0:
            print(ans)
            break
    elif 1 + L[N - 1] == X:
        ans += P[N - 1]
        print(ans)
        break
    elif X == 1:
        print(ans)
        break
    else:
        X -= 1
    N -= 1 








Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
using namespace std;
const int mod=1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,x,n) for (int i= x;i<n;i++)
#define all(v) v.begin(), v.end()
#define nepe(v) next_permutation(all(v))
#define F first 
#define S second
#define PB push_back 
#define MP make_pair
using ll = long long;
using vi = vector<int>; 
using vvi = vector<vi>;
using vp =vector<pair<int,int>>;

typedef pair<int,int> P;
string s;
int k;
ll INF = 10000000000000000;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    if(n%2==0){
        rep(i,n/2) cout << a[n-2*i-1]<<" ";
        rep(i,n/2) cout << a[2*i]<<" ";
    }
    else{
        rep(i,n/2) cout <<a[n-1-2*i]<<" ";
        cout <<a[0]<<" ";
        rep(i,n/2) cout <<a[1+2*i]<<" ";
    }
}

Measured memory_bytes: 3712
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
// #include <iostream>
// #include <iomanip>
using namespace std;
/*------------------junk----------------------*/
typedef long long int lli;
typedef unsigned long long int ulli;
const int MOD = 1e9 + 7;
#define ff first
#define ss second
#define gc getchar_unlocked
#define fri(i, j , n) for (auto (i) = (j); (i) < (n); ++(i))
#define frie(i, j , n) for (auto (i) = (j); (i) <= (n); ++(i))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define f2a(x , n , v)  fill(&(x)[0][0], &(x)[0][0] + (0 + n) *(0 + n) , (v))
#define fa(x , n , v) fill( (x), (x)+(n), (v)) 
#define pb emplace_back
#define mp make_pair
#define getchar_unlocked getchar
# define TMP template<typename
#ifdef LOCAL 
template < class c > struct rge { c b, e; };
template < class c > rge<c> range(c i, c j) { return rge<c>{i, j}; }
template < class c > auto dud(c* x) -> decltype(cerr << *x, 0);
template < class c > char dud(...);
struct debug {
    
    ~debug() { cerr << endl; }
    template < class c > typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) { cerr << boolalpha << i; return * this; }
    template < class c > typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) { return * this << range(begin(i), end(i)); }
    template < class c, class b > debug & operator <<(pair < b, c > d) {
        return * this << "(" << d.first << ", " << d.second << ")";
    }
    template < class c > debug & operator <<(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
            *this << ", " + 2 * (it == d.b) << *it;
        return * this << "]";
    }};
#define oo(...) __f(#__VA_ARGS__, __VA_ARGS__)
TMP Arg1>
void __f(const char *name, Arg1 &&arg1)
{cout << name << ": " << arg1 << "\n";}
TMP Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{const char *comma = strchr(names + 1, ',');cout.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);
}
void in(int &x){
    cin  >> x;
}
#else
inline void in(int &x)
    {
    register int c = getchar_unlocked();
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = getchar_unlocked());
    if(c=='-') {neg=1;c=getchar_unlocked();}
    for(;c>47 && c<58;c = getchar_unlocked()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
    }
inline void uin(ulli &n){
    register ulli c=gc();
    n=0;
    while(c<'0'||c>'9')
    c=gc();
    while(c<='9'&&c>='0'){
    n=n*10+c-'0';
    c=gc();}
}
#endif
/*----------check constraints again-------------*/

int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
    int n;
    cin >> n;
    if(n&1){
       
    cout << fixed <<  setprecision(10) << (1.0 *  (n/2 + 1) / n);
    }else{
        cout << "0.5000000000";
    }
   
}


Measured memory_bytes: 256
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>

using namespace std;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main(){
    string sa,sb,sc;
    cin >> sa >> sb >> sc;
    int ia = 0,ib = 0,ic =0;

    char c = sa[0];
    ia++;

    while(1){
        switch (c)
        {
        case 'a':
            if(ia==sa.length()){
                cout << "A" << endl;
                return 0;
            }
            c = sa[ia];
            ia++;
            break;
        case 'b':
            if(ib==sb.length()){
                cout << "B" << endl;
                return 0;
            }
            c = sb[ib];
            ib++;
            break;
        case 'c':
            if(ic==sc.length()){
                cout << "C" << endl;
                return 0;
            }
            c = sc[ic];
            ic++;
            break;
        default:
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		double x1=0,x2=0,y1=0,y2=0;
		double[] tmp = new double[4];
		Scanner sc = new Scanner(System.in);
		for(int i = 0; i < 4; ++i){
			tmp[i] = sc.nextDouble();
		}
		x1 = tmp[0]; y1 = tmp[1]; x2 = tmp[2]; y2 = tmp[3];
		double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		System.out.printf("%f\n", d);
		sc.close();
	}

}

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

ll mod_pow(ll x, ll n, ll p)
{
    ll res = 1;
    while(n)
    {
        if(n & 1) res =res * x % p;
        x = x * x % p;
        n >>= 1;
    }
    return res;
}

ll comb(ll n, ll m, ll p)
{
    if(m > n) return 0;
    ll ret = 1;
    m = min(n - m, m);
    for(int i = 1; i <= m; i ++)
    {
        ll a = (n + i - m) % p;
        ll b = i % p;
        ret = ret * (a * mod_pow(b, p - 2, p) % p) % p;
    }
    return ret;
}

/*ll Lucas(ll n, ll m, ll p)
{
    if(m == 0) return 1;
    return comb(n % p, m % p, p) * Lucas(n / p, m / p, p) % p;
}*/

int main()
{
    ll n, a,b, p=1e9+7,ans;
    cin>>n>>a>>b;
    ans=(mod_pow(2,n,p)-1+p)%p;
    ans=(ans-comb(n,a,p)+p)%p;
    ans=(ans-comb(n,b,p)+p)%p;
    //printf("%lld",(mod_pow(2,n,p)-1-comb(n,a,p)-comb(n,b,p)+p)%p);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define ll long long
using namespace std;
string s;
int t=0;
int main()
{
	cin >>s;
	for (int i=0;i<s.size()-1;)
	{
		//cout <<s<<" "<<t<<" "<<i<<"\n";
		int x=i,y=i+1;
		bool fl=0;
		while (x>=0 && y<s.size())
		{
			fl=1;
			if (s[x]==s[y]) break;
			t+=2;
			x--,y++;
		}
		x++,y--;
		if (fl)
		{
			string ss=s.substr(0,x)+s.substr(y+1);
		    s=ss;
		}
		else break;
		i=x;
	}
	cout <<t;
	return 0;
}

Measured memory_bytes: 720
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll h,w;cin>>h>>w;
  vector<string>S(h);
  rep(i,h)cin>>S[i];
  vvl yoko(h,vl(w,-INF));
  vvl tate(h,vl(w,-INF));
  for(int i=0;i<h;i++){
    ll start=0;
    ll count=0;
    for(int j=0;j<w;j++){
      if(S[i][j]=='.'){
        count++;
        if(j==w-1){
          for(ll k=start;k<=j;k++)yoko[i][k]=count;
        }
      }
      else if(S[i][j]=='#'){
        if(start<=j-1){
          for(int k=start;k<=j-1;k++){
            yoko[i][k]=count;
          }
        }
        if(j!=w-1){
          start=j+1;
          count=0;
        }
      }
    }
  }
  for(int j=0;j<w;j++){
    ll start=0;
    ll count=0;
    for(int i=0;i<h;i++){
      if(S[i][j]=='.'){
        count++;
        if(i==h-1){
          for(ll k=start;k<=i;k++)tate[k][j]=count;
        }
      }
      else if(S[i][j]=='#'){
        if(start<=i-1){
          for(int k=start;k<=i-1;k++){
            tate[k][j]=count;
          }
        }
        if(i!=w-1){
          start=i+1;
          count=0;
        }
      }
    }
  }
  ll MAX=0;
  rep(i,h){
    rep(j,w) MAX=max(MAX,tate[i][j]+yoko[i][j]-1);
  }
  cout<<MAX<<endl;
}
      
    
          
    
    
          

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int md = 1e9 + 7;

void add(int &a, int b) {
    a += b;
    if (a >= md) a -= md;
}

void sub(int &a, int b) {
    a -= b;
    if (a < 0) a += md;
}

int mul(int a, int b) {
    return ((ll)a * b) % md;
}

int power(int a, ll b) {
    int res = 1;
    while (b > 0) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}

int inv(int a) {
    return power(a, md - 2);
}

const int N = 8007;

int f[N];

const int MX = 2007;

int dp[2 * MX][2 * MX];

int C(int n, int k) {
    return mul(f[n], mul(inv(f[n - k]), inv(f[k])));
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    f[0] = 1;
    for (int i = 1; i < N; ++i) f[i] = mul(f[i - 1], i);
    int n;
    cin >> n;
    vector <int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        ++dp[MX - a[i]][MX - b[i]];
    }
    for (int i = 1; i < 2 * MX; ++i) {
        for (int j = 1; j < 2 * MX; ++j) {
            add(dp[i][j], dp[i - 1][j]);
            add(dp[i][j], dp[i][j - 1]);
        }
    }  
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        add(ans, dp[a[i] + MX][b[i] + MX]);
    }
    for (int i = 0; i < n; ++i) sub(ans, C(a[i] + a[i] + b[i] + b[i], a[i] + a[i]));
    ans = mul(ans, inv(2));
    cout << ans << '\n';
}

Measured memory_bytes: 64896
#include <bits/stdc++.h>
using namespace std;
#define modulo p
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000


int main(){
	int N = 100000;
	bitset<100001> B;
	B.set();
	B.reset(0);B.reset(1);
	
	for(int i=2;i<=N;i++){
		if(i*i>N)break;
		if(B[i]){
			for(int j=2*i;j<=N;j+=i){
				B.reset(j);
			}
		}
	}
	vector<int> sum(N+1,0);
	for(int i=3;i<=N;i++){
		sum[i] = sum[i-1];
		if(B[i]&&B[(i+1)/2]){
			sum[i]++;
		}
	}
	
	int Q;
	cin>>Q;
	for(int i=0;i<Q;i++){
		int l,r;
		cin>>l>>r;
		cout<<sum[r]-sum[l-1]<<endl;
	}
	
	
	
	
	return 0;
}


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

const int INF = 1001001001;
const int mod = 1000000007;

ll pow(ll base, ll order) {
	ll ans = 1;
	rep(i,order - 1) ans *= base;
	return ans;
}

int gcd(int a, int b) {
	if (a < b) {
		int c = a;
		a = b;
		b = c;
	}
	if (b == 0) return a;
	return gcd (b, a % b);
}

ll sum(ll x) { // sum of subsequent numbers from 0 to x
	return x*(x + 1)/2;
}

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	while (1) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		a -= d;
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int n;
    cin >> n;
    vector<int> a(1000010,0),num;
    int t,count = 0;
    REP(i,n){
        cin >> t;
        a[t]++;
        num.push_back(t);
    }
    for(int x:num){
        if(a[x]==0)continue;
        int b = x;
        if(a[x]==1)x += b;
        while(x<=1000010){
            a[x]=0;
            x += b;
        }
    }
    for(int i=1;i<1000005;i++){
        if(a[i]>0){
            count++;
        }
    }
    COUT(count);
    return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string str; cin >> str;
    int first = 10*int(str[0] - '0') + int(str[1] - '0');
    int second = 10*int(str[2] - '0') + int(str[3] - '0');
    if((first > 12 || first <= 0) && (second > 12 || second <= 0)){
        cout << "NA" << endl;
    }else if(first > 12 || first <= 0){
        cout << "YYMM" << endl;
    }else if(second > 12 || second <= 0){
        cout << "MMYY" << endl;
    }else{
        cout << "AMBIGUOUS" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

		for (int i=1; i <= vl; i++) {
			System.out.println(state[i]);
		}
	}

	public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	}
}

Measured memory_bytes: 25992
'use strict';
(function(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  const N=input.shift();
  const a=input;
  const dp=new Array(N).fill(0).map((x,i)=>new Array(N-i).fill(Infinity));
  //dp[i][j]は添字jからj+iまでのslimeを合成する最小コスト。
  dp[0]=new Array(N).fill(0);
  
  const size=new Array(N).fill(0).map((x,i)=>new Array(N-i).fill(0));
  //size[i][j]は添字jからj+iまでのスライムを合成して得られるスライムのサイズ。
  size[0]=a;
  for(let i=1;i<N;i++)
    for(let j=0;j<N-i;j++)
      size[i][j]=size[i-1][j]+size[0][j+i];
  
  for(let i=1;i<N;i++){
    for(let j=0;j<N-i;j++){
      for(let k=0;k<i;k++){
        //添字jからj+kまでとj+k+1からj+iまでとをそれぞれくっつけて最後に合わせる。
        //kを0からi-1までふったときの最小を出す。
        dp[i][j]=Math.min(dp[i][j],dp[k][j]+dp[i-k-1][j+k+1]+size[k][j]+size[i-k-1][j+k+1]);
      }
    }
  }
  //console.log(size);
  //console.log(dp);
  console.log(dp[N-1][0]);
})(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 16128
#include <stdio.h>
int main() {
    int n, a, max = 0, min = 1e9;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a);
        if (max < a)
            max = a;
        if (min > a)
            min = a;
    }
    printf("%d", max - min);
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,x;
int c[15],a[15][15],b[15],d[15],len,sum=100000000,cost;
void dfs(int step){
	int i,j,k;
	if(step==len+1){
		for(k=1;k<=m;k++)d[k]=0;
		for(j=1;j<=len;j++)
			for(k=1;k<=m;k++)
				d[k]+=a[b[j]][k];
		for(k=1;k<=m;k++)
			if(d[k]<x)return;
		cost=0;
		for(j=1;j<=len;j++)cost+=c[b[j]];
		sum=min(sum,cost);
		return ;
	}
	for(i=b[step-1]+1;i<=n;i++)
		b[step]=i,dfs(step+1);
}
int main(){
	int i,j;
	scanf("%d%d%d",&n,&m,&x);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&c[i]);
		for(j=1;j<=m;j++)
			scanf("%d",&a[i][j]);
	}
	for(len=1;len<=n;len++)
		b[0]=0,dfs(1);
	if(sum==100000000)printf("-1\n");
	else printf("%d\n",sum);
	return 0;
}

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

using namespace std;

int main(){
    int H,W,D,Q;
    cin >> H >> W >> D;
    vector<vector<int>> A(H*W+1,vector<int>(2));
    int ans[H*W+1];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            int a;
            cin >> a;
            A[a][0] = i;
            A[a][1] = j;
        }
    }

    for(int i=1;i<=D;i++){
        int now = i;
        ans[now] = 0;
        now += D;
        while(now<=H*W){
            ans[now] = ans[now-D] + abs(A[now-D][0]-A[now][0]) + abs(A[now-D][1]-A[now][1]);
            now += D;
        }
    }

    cin >> Q;

    for(int i=0;i<Q;i++){
        int L,R;
        cin >> L >> R;
        cout << ans[R]-ans[L] << endl;
    }
}

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

using namespace std;

int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int N;
  cin >> N;
  vector<int> X(N + 1);
  cin >> X[0];
  for (int i = 1; i <= N; i++) {
    cin >> X[i];
  }
  sort(X.begin(), X.end());
  vector<int> Y(N);
  for (int i = 0; i < N; i++) {
    Y[i] = X[i + 1] - X[i];
  }
  int g = Y[0];
  for (int i = 1; i < N; i++) {
    g = gcd(g, Y[i]);
  }
  cout << g << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int X = sc.nextInt();
		int[] m = nextIntArray(sc, N);
		sc.close();

		Arrays.sort(m);

		for (int i = 0; i < N; i++) {
			X -= m[i];
		}
		int ans = N + X / m[0];

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359
using ull = unsigned long long;
using ll = long long;
using namespace std;

int main()
{
  string s;
  cin >> s;
  cout << ((s[1] == 'B') ? "ARC" : "ABC") << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <unordered_map>
#define lli long long int
#define fl(i, a, b) for(int i = a; i < b; ++i)
#define fl2(i, a, b) for(int i = a; i <= b; ++i)
#define rfl(i, a, b) for(int i = a; i > b; --i)
#define rfl2(i, a, b) for(int i = a; i >= b; ++i)
#define all(v) ((v).begin(), (v).end())
#define all2(v) ((a) + 0, (a) + n);
#define sz(s) (s).size()
#define OO (lli)1e18
#define MIN INT_MIN
#define f first
#define s second		
#define mp make_pair
#define pb puch_back
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
using namespace std;

lli power(lli x, lli y) {
	lli i, power = 1;
	if (y == 0)
		return 1;
	for (i = 1; i <= y; i++)
		power = power * x;
	return power;
}

int32_t main() {

	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	//freopen("overcode.in","r",stdin);
	//freopen("output.txt", "w", stdout);

	clock_t z = clock();

	int n;
	double sum = 0;
	cin >> n;
	fl(i, 0, n) {
		double d;
		cin >> d;
		sum += (1 / d);
	}
	cout << fixed << setprecision(9) << 1.0 / sum << '\n';
	debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 256
let N = Int(readLine()!)!

var a = [[Bool]]()
for _ in stride(from: 0, to: N, by: 1) {
    let row = readLine()!.split(separator: " ").map { Int($0)! == 1 }
    a.append(row)
}

let divider = 1_000_000_007

var dp = Array(repeating: Optional<Int>.none, count: 1 << N)
dp[0] = 1

/// - bit: 孤立している女性一覧
/// - i: 男性iさん
func dfs(_ bit: Int, _ i: Int) -> Int {
    guard dp[bit] == nil else {
        return dp[bit]!
    }

    var numberOfPatterns = 0
    /// 女性jさんについて
    for j in stride(from: 0, to: N, by: 1) {
        /// 孤立しており、かつ男性iさんと相性がいいならば
        if bit & (1 << j) > 0, a[i][j] {
            /// 排他的論理和でjさんのbitを0にする
            /// jさんのbitを0にして次の男性を調べに行く
            numberOfPatterns = (numberOfPatterns + dfs(bit ^ (1 << j), i + 1))
        }
    }
    let newValue = numberOfPatterns % divider
    dp[bit] = newValue
    return newValue
}

/// 女性が誰もペアを作っていない状態からスタート
print(dfs((1 << N) - 1, 0))


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

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

void Main()
{
    int x = in();
    int h = x / 100;
    int o = x % 100;

    vint dp(1000, INF);
    dp[0] = 0;

    for (int i = 1; i <= 5; ++i)
    {
        rep(j, 105)
        {
            chmin(dp[j + i], dp[j] + 1);
        }
    }

    if (dp[o] <= h)
        puts("1");
    else
        puts("0");
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using i64 = long long;
using P = pair<i64, i64>;


void solve(long long N){
    if(N % 2 == 1){
        cout << 0 << endl;
        return;
    }
    i64 b = 5;
    i64 ans = 0;
    while(b < N){
        ans += (N / b) / 2;
        b *= 5;
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18;

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

signed main(){
	int n;cin>>n;
	cout<<(n+999)/1000*1000-n<<endl;
	return 0;
}



Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

#define N 90
#define MAX(D,S) \
  { \
    int __temp = (S); \
    (D) = ( (D) > __temp ? (D) : __temp ); \
  }

static
int d[ N ][ N ];
static
int m, n;

int dfs (
  int x,
  int y
  )
{
  int res = 0;

#if 0
  if ( x < 0 || x >= m
    || y < 0 || y >= n )  return ( 0 );
  if ( !d[ x ][ y ] )     return ( 0 );
#endif

  d[ x ][ y ] = 0;
  if ( x > 0 && d[ x - 1 ][ y ] )       MAX( res, dfs ( x - 1, y ) );
  if ( x < m - 1 && d[ x + 1 ][ y ] )   MAX( res, dfs ( x + 1, y ) );
  if ( y > 0 && d[ x ][ y - 1 ] )       MAX( res, dfs ( x, y - 1 ) );
  if ( y < n - 1 && d[ x ][ y + 1 ] )   MAX( res, dfs ( x, y + 1 ) );
  d[ x ][ y ] = 1;

  return ( res + 1 );
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int x, y;

  for ( ; ; )
  {
    int res = 0;

    scanf ( "%d%d", &m, &n );
    if ( !( m | n ) ) break ;

    for ( y = 0; y < n; ++y )
    for ( x = 0; x < m; ++x )
    {
      scanf ( "%d", &d[ x ][ y ] );
    }

    for ( y = 0; y < n; ++y )
    for ( x = 0; x < m; ++x )
    {
      if ( d[ x ][ y ] )
      MAX( res, dfs ( x, y ) );
    }

    printf ( "%d\n", res );
  }

  return ( 0 );
}

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

p = 10 ** 9 + 7

def fact(n, p=10**9 + 7):
    f = 1
    for i in range(1, n+1):
        f *= i
        f %= p
    return f

def get_inv(n, p=10**9 + 7):
    inv = [0, 1]
    for i in range(2, n+1):
        inv.append(-(p//i * inv[p%i]) % p)
    return inv

f = fact(n)
inv = get_inv(n)

csum = [0]

for i in range(1, n+1):
    csum.append((csum[-1] + inv[i]) % p)

ans = 0
for i, a in enumerate(A):
    ans += (csum[i+1] + csum[n-i] - csum[1]) * a
    ans %= p

print(ans * f % p)

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,m,n;
        cin>>n;
        map<string,ll> ma;
        for(i=0;i<n;i++)
        {
            string ss;
            cin>>ss;
            ma[ss]=1;
        }
        ll ans=0;
        for(auto i:ma) ans+=i.S;
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 19284
using System.Linq;
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var k = int.Parse(Console.ReadLine().Trim());
            if (k == 0) break;
            string[] line = Console.ReadLine().Trim().Split(' ');
            var c = Array.ConvertAll(line, int.Parse);
            Console.WriteLine(c.Sum() / (k - 1));
        }
    }
}

Measured memory_bytes: 10376
fun main(args: Array<String>){
    val (N, X) = readLine()!!.split(" ").map { it.toLong() }
    val num = LongArray(N.toInt() + 1)
    val pNum = LongArray(N.toInt() + 1)
    num[0] = 1
    pNum[0] = 1
    for(i in 1..N.toInt()){
        num[i] = 2*num[i-1] + 3
        pNum[i] = 2*pNum[i-1] + 1
    }

    fun count(l: Int, x: Long): Long{
        if(num[l] == x){
            return pNum[l]
        }else if(num[l] > x && x > (num[l] + 1) / 2){
            return pNum[l - 1] + 1 + count(l - 1, x - (num[l] + 1) / 2)
        }else if((num[l] + 1) / 2 == x){
            return 1 + pNum[l - 1]
        }else if((num[l] + 1) / 2 > x && x > 1){
            return count(l - 1, x - 1)
        }else{
            return 0
        }
    }
    println(count(N.toInt(), X))
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

map<ll, ll> mp;

void prime_fact(int n)
{
    for (int i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            n /= i;
            mp[i]++;
        }
    }
    if (n != 1)
        mp[n]++;
}

int num(int n)
{
    int cnt = 0;
    for (auto x : mp)
    {
        if (x.second >= n)
            cnt++;
    }
    return cnt;
}

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

    for (int i = 1; i <= n; i++)
        prime_fact(i);

    OP(num(74) + num(24) * (num(2) - 1) + num(14) * (num(4) - 1) + (num(2) - 2) * (num(4) - 1) * num(4) / 2);

    return 0;
}

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

int main()
{
    string num;
    while (1)
    {
        int i, ans = 0;
        cin >> num;
        if (num == "0")
            break;

        for (i = 0; i < num.size(); i++)
            ans += (int)(num[i] - '0');
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 3268
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
    char ch[5]= {'A','T','G','C'};
    char a;
    cin >>a;
    if(a==ch[0])
        cout << ch[1];
    if(a==ch[1])
        cout << ch[0];
    if(a==ch[2])
        cout << ch[3];
    if(a==ch[3])
        cout << ch[2];
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9)
#define MAXX (int)1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (ll)(1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
//printf("myco\n");//for debug
/*--------------------------------------------*/

int main(){
    int n,W;cin>>n>>W;
    V w(n),v(n);
    rep(i,n){
        cin>>w[i]>>v[i];
    }
    vector<vector<ll>> dp(n+1,vector<ll>(W+1));
    rep(i,n){
        for(int j=0;j<=W;j++){//商品iを入れれるのはw[i]以上W以下のカバン
            int remain=j-w[i];
            //printf("remain=%d\n",remain);
            //大きさjのカバンが持ちうる最大の価値
            if(j<w[i]){dp[i+1][j]=dp[i][j];continue;}//入らん大きさはとりあえず引き継ぐだけ
            //j>=w[i]のとき更新の手続き
            dp[i+1][j]=max(dp[i][remain]+v[i],dp[i][j]);
            //printf("dp[%d][%d]=%lld\n",i+1,j,dp[i+1][j]);
        }
    }
    cout<<dp[n][W]<<endl;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;
bool comp(lpair l1, lpair l2){
    if(l1.first == l2.first){
        return l1.second > l2.second;
    }
    return l1.first > l2.first;
}

bool comp2(lpair l1, lpair l2){
    if(l1.second == l2.second){
        return l1.first > l2.first;
    }
    return l1.second > l2.second;
}
struct compare{
    bool operator() (lpair l1, lpair l2){
         return l1.second > l2.second;
    }
};

struct compare2{
    bool operator() (lpair l1, lpair l2){
         return l1.second < l2.second;
    }
};
ll t[100010], d[100010];
priority_queue<lpair, vector<lpair>, compare> pq_top;
priority_queue<lpair, vector<lpair>, compare2> pq_other;
ll val[100010] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    rep(i,0,N){
        cin >> t[i] >> d[i];
    }
    vector<lpair> lp;
    rep(i,0,N){
        lp.push_back(make_pair(t[i], d[i]));
    }
    sort(lp.begin(), lp.end(), comp2);
    map<ll, ll> mp1, mp2;
    ll ans = 0;
    rep(i,0,K){
        ans += lp[i].second;
        mp1[lp[i].first]++;
        mp2[lp[i].first]++;
        // pq_top.push(lp[i]);
    }
    rrep(i,K-1,0){
        if(mp2[lp[i].first] >= 2){
            mp2[lp[i].first]--;
            pq_top.push(lp[i]);
        }
    }

    rep(i,K,N){
        pq_other.push(lp[i]);
    }
    ll kinds = mp1.size();
    ans += kinds * kinds;
    val[kinds] = ans;
    while(!pq_other.empty()){
        lpair l1 = pq_other.top();
        pq_other.pop();
        if(mp1[l1.first] != 0) continue;
        if(pq_top.empty()) break;
        lpair l2 = pq_top.top();
        pq_top.pop();
        mp1[l2.first]--;
        mp1[l1.first]++;
        ans = ans + l1.second - l2.second + 2 * kinds + 1;
        kinds++;
        val[kinds] = ans;
    }
    ll v = -INF;
    rep(i,1,N+2){
        v = max(v,val[i]);
    }
    print(v);
}


Measured memory_bytes: 12656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lunch
{
    class Program
    {
        static void Main()
        {
            int pasta = int.MaxValue;
            for (int i = 0; i < 3; i++)
            {
                pasta = Math.Min(pasta, int.Parse(Console.ReadLine()));
            }
            int juice = int.MaxValue;
            for (int i = 0; i < 2; i++)
            {
                juice = Math.Min(juice, int.Parse(Console.ReadLine()));
            }
            Console.WriteLine(pasta + juice - 50);
        }
    }
}

Measured memory_bytes: 5604
#include<stdio.h>
int main(void)
{
    int n,k;
    int h[100000];
    long long int cnt=0;

    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
        if(h[i]>=k)cnt++;
    }
    printf("%lld",cnt);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define mod 1000000007
string s;
int main(){
	cin>>s;
	if(s.size()>=4 && s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
		puts("Yes");
	else
		puts("No");

}

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

#define ll long long

void exgcd(int a, int b, int& x, int& y) {
	if (!b) {
		x = 1, y = 0;
	} else {
		exgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
}

int inv(int a, int n) {
	int x, y;
	exgcd(a, n, x, y);
	return (x < 0) ? (x + n) : (x);
}

const int Mod = 998244353;

template <const int Mod = :: Mod>
class Z {
	public:
		int v;

		Z() : v(0) {	}
		Z(int x) : v(x){	}
		Z(ll x) : v(x % Mod) {	}

		friend Z operator + (const Z& a, const Z& b) {
			int x;
			return Z(((x = a.v + b.v) >= Mod) ? (x - Mod) : (x));
		}
		friend Z operator - (const Z& a, const Z& b) {
			int x;
			return Z(((x = a.v - b.v) < 0) ? (x + Mod) : (x));
		}
		friend Z operator * (const Z& a, const Z& b) {
			return Z(a.v * 1ll * b.v);
		}
		friend Z operator ~(const Z& a) {
			return inv(a.v, Mod);
		}
		friend Z operator - (const Z& a) {
			return Z(0) - a;
		}
		Z& operator += (Z b) {
			return *this = *this + b;
		}
		Z& operator -= (Z b) {
			return *this = *this - b;
		}
		Z& operator *= (Z b) {
			return *this = *this * b;
		}
		friend boolean operator == (const Z& a, const Z& b) {
			return a.v == b.v;
		} 
};

Z<> qpow(Z<> a, int p) {
	Z<> rt = Z<>(1), pa = a;
	for ( ; p; p >>= 1, pa = pa * pa) {
		if (p & 1) {
			rt = rt * pa;
		}
	}
	return rt;
}

typedef Z<> Zi;

const int N = 1e7 + 7;

int n;
Zi fac[N], _fac[N], pw2[N];

Zi comb(int n, int m) {
	return (n < m) ? (0) : (fac[n] * _fac[m] * _fac[n - m]);
}

int main() {
	scanf("%d", &n);
	fac[0] = 1;
	for (int i = 1; i <= n; i++)
		fac[i] = fac[i - 1] * i;
	_fac[n] = ~fac[n];
	for (int i = n; i; i--)
		_fac[i - 1] = _fac[i] * i;
	pw2[0] = 1;
	for (int i = 1; i <= n + 1; i++)
		pw2[i] = pw2[i - 1] + pw2[i - 1];
	Zi ans = qpow(3, n);
	for (int i = (n >> 1) + 1; i <= n; i++)
		ans -= comb(n, i) * pw2[n - i + 1];
	printf("%d\n", ans.v);
	return 0;
}



Measured memory_bytes: 117376
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        k: usize,
    } 
    let a = n / k; 

    if k % 2 != 0 {
        println!("{}", a.pow(3_u32));
    } else {
        let mut time: usize= 0;
        for i in 1..n+1 {
            if i % k == k / 2 { time+=1; }
        }
        println!("{}", a.pow(3_u32) + time.pow(3_u32) )
    }
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARangeProduct solver = new ARangeProduct();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARangeProduct {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong(), b = in.nextLong();

            long answer = solve(a, b);

            if (answer > 0)
                out.println("Positive");
            else if (answer < 0)
                out.println("Negative");
            else
                out.println("Zero");
        }

        private long solve(long a, long b) {
            if (a <= 0 && b >= 0) {
                return 0;
            }

            if (a > 0)
                return +1;

            long count = b - a + 1;
            if (count % 2 == 0)
                return +1;
            return -1;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 24788
import re

S = str(input())

ans = "AC"

uppercount = len(re.findall('[A-Z]', S))
if not uppercount == 2:
    ans = "WA"

if not S[0] == "A":
    ans = "WA"

cfind = S[2:-1].find("C")
if cfind < 0:
    ans = "WA"

if not S[1:cfind+2].islower and S[cfind+3:].islower():
    ans = "WA"

print(ans)


Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
	public static void main(String[] args) {
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";
		int input=0;
		double ans=0;
		try {
			while(true) {
				str=bfr.readLine();
				input=Integer.parseInt(str);
				if(input<0) {
					System.exit(0);
				}
				ans=(double)input;
				ans=kotae(ans/2,input);
				System.out.println(ans);
			}
		}catch(IOException e) {
		}
	}

	public static double kotae(double a,int b) {		//a 漸化式のこう　b3乗したあたい
		double newans=0;
		double bb=(double) b;

		newans=a-(a*a*a-bb)/(3*a*a);

		if(Math.abs(newans*newans*newans-bb)<0.00001*bb) {
			return newans;
		}
		else {
			newans=kotae(newans,b);
		}

		return newans;
	}
}


Measured memory_bytes: 24368
N = int(input())
A = list(map(int, input().split()))
count = 0
shift = True
while True:
    for i in range(0,N):
        if A[i]%2==1:
            shift = False
    if shift==True:
        for i in range(0,N):
            A[i] = A[i]/2
        count = count+1
    else:
        break
print("{}".format(count))


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

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

    int n;
    cin >> n;
    vector<int> a(n);

    ll sum=0;
    rep(i, n) {
        cin >> a[i];
        sum += (ll)a[i];
    }

    ll x=0;
    ll ans=1LL<<50;

    rep(i, n-1) {
        x += a[i];
        sum -= a[i];
        ans = min(ans, abs(x-sum));
    }

    cout << ans << endl;

}


Measured memory_bytes: 1024