akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    ll Q, H ,S, D, N;
    cin >> Q >> H >> S>> D>>N;
    cout << (N/2) * min(min(8*Q,4*H),min(2*S, D)) + (N% 2) * min(min(4*Q,2*H), S);
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 10;
struct edge { int to; ll cost; };
vector<edge> G[MAX_N];
vector<ll> dijkstra(int s)
{
    vector<ll> res(MAX_N, 1LL<<50);
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, s));
    res[s] = 0;
    while(que.size())
    {
        P p = que.top(); que.pop();
        int v = p.second;
        if(res[v] < p.first) continue;
        for(int u = 0; u < G[v].size(); u++)
        {
            edge e = G[v][u];
            if(res[v] + e.cost < res[e.to])
            {
                res[e.to] = res[v] + e.cost;
                que.push(P(res[e.to], e.to));
            }
        }
    }
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    for(int i = 0; i < n - 1; i++)
    {
        int a, b; ll c; cin >> a >> b >> c;
        a--, b--;
        G[a].push_back({b, c});
        G[b].push_back({a, c});
    }
    int q, k; cin >> q >> k;
    k--;
    vector<int> v[q];
    vector<ll> dist = dijkstra(k);
    for(int i = 0; i < q; i++)
    {
        int x, y; cin >> x >> y;
        x--, y--;
        cout << dist[x] + dist[y] << endl;
    }
    return 0;
}



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


void solve(long long A, long long B){
    if(A <= 9 && B <= 9){
        cout << A * B << endl; 
    }else{
        cout << -1 << endl;
    }
}

// Generated by 1.1.6 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(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

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

typedef long long ll;

using namespace std;

void solve() {
    int n, x;
    cin >> n >> x;

    int l[n];
    rep(0, n) cin >> l[i];

    int d[n+1];
    d[0] = 0;
    rep(1, n+1) {
        d[i] = d[i-1] + l[i-1];
    }

    int cnt = 0;
    rep(0, n+1) {
        if (d[i] <= x) cnt++;
    }

    cout << cnt << endl;
}

int main() {
    solve();

    return 0;
}

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

int change(char s){
	return s - '0';
}

int main(){
	/*input*/
	char s[10] = {'\0'};	cin >> s;
	/*calculation*/
	int s_l = 0;
	int ans = 10000;
	for(int i = 0; s[i]; i++)s_l++;
	for(int i = 0; i < s_l - 2; i++){
		int tmp = change(s[i])*100 + change(s[i+1])*10 + change(s[i+2]);
		int min;
		(tmp - 753 > 0)?min=tmp-753:min=753-tmp;
		if(ans > min)ans = min;
	}
	/*output*/
	cout << ans << endl;
}


Measured memory_bytes: 256
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0,n = 0;
asas;
cncn;
//BEGIN OF CODE.
int main(void){
	int n, a;
	cin >> n >> a;
	cnt = n / 500;
	ans = n-(500 * cnt);
	Yes(ans <= a);
	please AC;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

bool is_parindrome(const string &s, char c = '?'){
    auto n = s.length();
    for (int i = 0; i < (n+1)/2; ++i) {
        if(s[i] == c || s[n-i-1] == c) continue;
        if(s[i] != s[n-i-1]) return false;
    }
    return true;
}

int main() {
    string s;
    cin >> s;
    string t;
    for (auto &&i : s) if(i != 'x') t += i;
    if(!is_parindrome(t)){
        cout << "-1\n";
        return 0;
    }
    int l = 0, r = s.length() - 1, ans = 0;
    while(l < r){
        if(s[l] == s[r]) l++, r--;
        else if(s[l] == 'x') ans++, l++;
        else if(s[r] == 'x') ans++, r--;
        else {
            ans = -1;
            break;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
import std.stdio, std.string, std.conv, std.algorithm, std.array;

int swapCount(int[] arr, int t, int n) {
  int l = 0, r = n - 1;
  int count = 0;
  while (l <= r) {
    int m = (l + r) / 2;
    count++;
    if (arr[m] > t) r = m - 1;
    else if (arr[m] == t) break;
    else l = m + 1;
  }
  return count;
}

int read_num() {return readln.chomp.to!int;}

void main() {
  for(int t; readf("%d\n", &t), t != 0;) {
    int[] arr;
    foreach(i; 0..t) arr ~= read_num;    
    swapCount(arr, read_num, t).writeln;
  }
}

Measured memory_bytes: 1076
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

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

    int n,m;
    cin>>n>>m;

    vector<long long> dp(n+1,-1);
    for(int i=1;i<=m;i++){
        int a;
        cin>>a;
        dp[a]=0;
    }

    dp[0]=1;
    if(dp[1]==-1){
        dp[1]=1;
    }

    int mod=1000000007;
    for(int i=2;i<=n;i++){
        if(dp[i]==0){
            continue;
        }

        dp[i]=dp[i-1]+dp[i-2];
        dp[i]%=mod;
    }

    cout<<dp[n]<<"\n";

    return 0;
}

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

int main(){

	int a[26]={0};
	char s;

	while(cin >> s){
		if('a'<=s && s<='z'){
			a[s-'a']++;
		}
		else if('A'<=s && s<='Z'){
			a[s-'A']++;
		}
	}


	for(int i=0; i<26; i++){
		cout << (char)(i+'a') << " : " << a[i] << endl; 
	}
}

Measured memory_bytes: 1144
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] s=new String[N];
        int[] t=new int[N];
        for(int i=0; i<N; i++){
            s[i]=sc.next();
            t[i]=sc.nextInt();
        }
        String X = sc.next();
        int res=0;

        for(int i=0; i<N; i++){
            if(X.equals(s[i])){
                for(int j=i+1; j<N; j++){
                    res = res + t[j];
                }
                System.out.println(res);
                return;
            }
        }
        
        
        
        
        }
    }

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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT_ON(bit, i) (bit & (1LL << i))

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<typename T> using VVVV = std::vector<std::vector<std::vector<std::vector<T>>>>;

template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) {  if (i != 0) {std::cout << " ";} std::cout << v[i];} std::cout << "\n"; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
template<class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
template<class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); }
template<class T> inline std::vector<T> unique(std::vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}

const int INF = 1 << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy4 = { 0, 1, 0, -1 }, dx4 = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };

using namespace std;

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

    int MOD = 1000000007;

    int N, W;
    cin >> N >> W;
    V<int> v(N);
    FOR(i, 0, N) {
        cin >> v[i];
    }
    sort(ALL(v));

    LL ans = 0;
    // iを使わない
    FOR(i, 0, N + 1) {
        int total = 0;
        FOR(j, 0, i) {
            total += v[j];
        }
        if (total >= W) {
            ans += total == W;
            continue;
        }

        int rest = W - total;
        VV<LL> dp(N + 10, V<LL>(W + 10, 0));
        dp[i + 1][0] = 1;

        FOR(j, i + 1, N) {
            int w = v[j];
            FOR(k, 0, rest + 1) {
                (dp[j + 1][k] += dp[j][k]) %= MOD;

                if (k + w <= rest) {
                    (dp[j + 1][k + w] += dp[j][k]) %= MOD;
                }
            }
        }

        FOR(k, 0, dp[0].size()) {
            if (k + v[i] > rest) {
                (ans += dp[N][k]) %= MOD;
            }
        }
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 19348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;

int main (void) {
  ios::sync_with_stdio(false);cin.tie(0);
  cout << fixed << setprecision(15);
  ll a,b,n;
  cin >> a >> b >> n;
  ll x = min(b-1, n);
  cout << a*x/b - a*(x/b) << '\n';
  return 0;
}



Measured memory_bytes: 3640
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int d = sc.nextInt();
        int count = 0;
        for(int i =l;i <=r;i++ ) {
        	if(i%d==0) {
        		count++;
        	}
        }
        System.out.println(count);
    }

}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
int gcd(int a, int b){ return (a%b ? gcd(b,a%b) : b); }

int main(){
    long long n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    long long mi = min(a,min(b,min(c,min(d,e))));
    cout << (long long)(ceil((double)n/mi))+4; 
   

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111



int main(void) {
  ll x = 0, y = 0;
  vll a, b;
  cin >> n >> m;
  FOR(i, 0, n) {
	cin >> tmp;
	a.pb(tmp);
  }
  FOR(i, 0, m) {
	cin >> tmp;
	b.pb(tmp);
  }
  sum = a[0];
  FOR(i, 1, n) {
	(x += a[i] * i - sum) %= MOD;
	(sum += a[i]) %= MOD;
  }
  sum = b[0];
  FOR(i, 1, m) {
	(y += b[i] * i - sum) %= MOD;
	(sum += b[i]) %= MOD;
  }
  cout << ((x%MOD)*(y%MOD)) % MOD << endl;

  return 0;
}

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

int main(){
    int N;cin>>N;
    set<int> s;
    for(int i = 0; i < N ;i++){
        int d;cin>>d;
        s.insert(d);
    }
    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int min = s.length();
		int max = 0;

		for(int i = 0; i < s.length(); i++) {
			if('A'==s.charAt(i)) {
				min = Math.min(min, i);
			}
			if('Z'==s.charAt(i)) {
				max = Math.max(max, i);
			}
		}
		System.out.println((max - min) + 1);

	}

}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}

    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

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

    vector<ll> ans(M);
    ans[M - 1] = (ll) N * (N - 1) / 2;

    UnionFind uf(N);

    for (int i = M - 1; i >= 1; i--) {
        ans[i - 1] = ans[i];
        if (uf.root(A[i]) != uf.root(B[i])) {
            ans[i - 1] -= (ll) uf.size(A[i]) * uf.size(B[i]);
            uf.merge(A[i], B[i]);
        }
    }

    rep(i, M) cout << ans[i] << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
using namespace std;
using namespace chrono;

//  https://ja.wikipedia.org/wiki/Xorshift
int xor64(void) {
    static unsigned long long x = 88172645463325252ULL;
    x ^= x<<13;
    x ^= x>> 7;
    x ^= x<<17;
    return int(x&0x7fffffff);
}

int main()
{
    //  入力
    int D;
    cin>>D;
    vector<int> C(26);
    for (int &c: C)
        cin>>c;
    vector<vector<int>> S(D, vector<int>(26));
    for (auto &s: S)
        for (auto &x: s)
            cin>>x;

    auto start = system_clock::now();

    //  選んだコンテスト
    vector<int> T(D, -1);

    int score = 0;
    for (int t=0; t<26; t++)
        score -= C[t]*D*(D+1)/2;

    //  d日目にコンテストtを開く
    auto add = [&](int d, int t)
    {
        int d0 = d;
        while (d0>=0 && T[d0]!=t)
            d0--;
        int d1 = d;
        while (d1<D && T[d1]!=t)
            d1++;
        score += C[t]*(d-d0)*(d1-d);
        score += S[d][t];
        T[d] = t;
    };

    //  d日目のコンテストを止める
    auto remove = [&](int d)
    {
        int t = T[d];
        T[d] = -1;
        int d0 = d;
        while (d0>=0 && T[d0]!=t)
            d0--;
        int d1 = d;
        while (d1<D && T[d1]!=t)
            d1++;
        score -= C[t]*(d-d0)*(d1-d);
        score -= S[d][t];
    };

    for (int d=0; d<D; d++)
        add(d, d%26);

    double time = 0.0;
    double limit = 1.8;

    int step;
    for (step=0; time<limit; step++)
    {
        if (step%10000==0)
            time = duration_cast<microseconds>(system_clock::now()-start).count() * 1e-6;

        if (step%2==0)
        {
            //  1日のコンテストの種類を変えてみる
            int d = xor64()%D;
            int t = xor64()%26;
            int old_score = score;
            int old_t = T[d];            
            remove(d);            
            add(d, t);

            //  悪くなったら戻す
            if (score < old_score)
            {
                remove(d);
                add(d, old_t);
            }
        }
        else
        {
            //  1週間以内のコンテストを交換してみる
            int d0 = xor64()%D;
            int d1 = d0 + xor64()%15 - 7;
            if (d1!=d0 && 0<=d1 && d1<D)
            {
                int old_score = score;
                int t0 = T[d0];
                int t1 = T[d1];
                remove(d0);
                remove(d1);
                add(d0, t1);
                add(d1, t0);

                //  悪くなったら戻す
                //  ただし、ある程度までは許容する
                //  許容範囲は時間とともに狭める（焼きなまし）
                if (score < old_score - int(100'000*(limit-time)/limit))
                {
                    remove(d0);
                    remove(d1);
                    add(d0, t0);
                    add(d1, t1);
                }
            }
        }
    }

    for (int t: T)
        cout<<t+1<<endl;

    cerr<<"score: "<<max(0, score+1000000)<<endl;
    cerr<<"step: "<<step<<endl;
}


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

int main(){
  int x,y,n,a,b,c=0;
  int dp[100][100];
  while(cin>>x>>y,x||y){
  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
      dp[i][j]=-1;
    }
  }
  x--;
  y--;
  cin>>n;

  for(int i=0;i<n;i++){
    cin>>a>>b;
    dp[a-1][b-1]=0;
  }

  for(int i=0;i<=x;i++){
    for(int j=0;j<=y;j++){
      if(i==0||j==0){
	if(j==0&&i>=1&&dp[i-1][j]==0){
	  dp[i][j]=0;
	}
	else if(i==0&&j>=1&&dp[i][j-1]==0){
	  dp[i][j]=0;
	}
	else if(dp[i][j]!=0){
	  dp[i][j]=1;
	}
      }
    }
  }
  for(int i=1;i<=x;i++){
    for(int j=1;j<=y;j++){
      if(dp[i][j]==-1){
       dp[i][j]=dp[i-1][j]+dp[i][j-1];
      }
    }
  }
  cout<<dp[x][y]<<endl;
  }
}

Measured memory_bytes: 1196
# Your code here!
input=gets.split(" ")
N=input[0].to_i
D=input[1].to_i
X=[]
for i in 0..N-1
 X[i]=gets.split(" ")
end
for i in 0..N-1
 for j in 0..D-1
  X[i][j]=X[i][j].to_i
 end
end

comb=N*(N-1)/2


#点0と点２の距離を測る実験
sig=[]
sum=[]
for i in 0..comb-1
 sum[i]=0
end

pre_sum = Array.new(N).map{Array.new(N,0)}

for h in 0..N-1
 for i in 0..N-1
  pre_sum[h][i]=0
 end
end
 L=N
 for h in 0..N-1
 for i in 0..L-1
  for j in 0..D-1#次元数ループ
   sig[j]=(X[h][j]-X[i][j])*(X[h][j]-X[i][j])
   pre_sum[h][i]=pre_sum[h][i]+sig[j]
  end
 end
 end
 pre_count=0
 for h in 0..N-1
 for i in 0..L-1
 if Math.sqrt(pre_sum[h][i])==Math.sqrt(pre_sum[h][i]).to_i && Math.sqrt(pre_sum[h][i])!=0
     pre_count=pre_count+1
 end
 end
 end
 count=pre_count/2
 puts(count)
 


Measured memory_bytes: 3836
#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <climits>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <deque>
#include <list>
#include <map>
#include <set>
using namespace std;

/*** typedef ***/
typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ULL;
typedef pair < int , int > ii;
typedef pair < LL  , LL  > ll;
typedef vector <int>  vint;
typedef vector <bool> vbool;
typedef vector <long> vlong;

/*** define ***/
#define sz(x)			((int)x.size())
#define tin(x)			scanf("%d",&x)
#define all(x)			x.begin(),x.end()
#define Set(b,a)		memset(b,a,sizeof b)
#define print1(x)		printf("Case %d:",x++)
#define tin2(x,y)		scanf("%d%d",&x,&y)
#define tin3(x,y,z)		scanf("%d%d%d",&x,&y,&z)
#define loop(i,i0,in)	for(int i=i0 ; i<in ; i++)
#define rep(i,n)		for(int i=0 ; i<(n) ; i++)
#define _rep(i,n)		for(int i=n-1 ; i>=0 ; i--)
#define _loop(i,in,i0)	for(int i=in-1 ; i>=i0 ; i--)
#define Fore(it, x)		for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)
     
int main()  
{  
#ifdef Online_Judge
	freopen("a.in","r",stdin);
#endif
	LL a,b;
	cin >> a >> b;
	if(a==b)
		cout << "a == b" << endl;
	else if(a>b)
		cout << "a > b" << endl;
	else
		cout << "a < b" << endl;
	return 0;
}

Measured memory_bytes: 1156
import java.util
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer


object Main {

  case class Edge(from: Int, to: Int)

  def read() = {
    val sc = new Scanner(System.in)
    val nVertex, nEdge = sc.nextInt()
    val edges = IndexedSeq.fill(nEdge) {
      val from = sc.nextInt() - 1
      val to = sc.nextInt() - 1
      Edge(from, to)
    }
    val start = sc.nextInt() - 1
    val goal = sc.nextInt() - 1
    (nVertex, nEdge, edges, start, goal)
  }

  def solve(nVertex: Int,
            nEdge: Int,
            edges: IndexedSeq[Edge],
            start: Int,
            goal: Int): Long = {
    val next1List = IndexedSeq.fill(nVertex)(ArrayBuffer.empty[Int])
    for (edge <- edges) {
      next1List(edge.from).append(edge.to)
    }
    val dist = IndexedSeq.fill(3)(Array.fill(nVertex)(Int.MaxValue / 2))
    val visited = IndexedSeq.fill(3)(Array.fill(nVertex)(false))
    dist(0)(start) = 0
    visited(0)(start) = true

    case class Info(v: Int, mod: Int)

    val queue: util.Queue[Info] = new util.ArrayDeque[Info]()
    queue.add(Info(start, 0))

    while (!queue.isEmpty) {
      val current = queue.remove()
      for (next <- next1List(current.v)) {
        val nextMod = (current.mod + 1) % 3
        if (!visited(nextMod)(next)) {
          dist(nextMod)(next) = dist(current.mod)(current.v) + (if (nextMod == 0) 1 else 0)
          visited(nextMod)(next) = true
          queue.add(Info(next, nextMod))
        }
      }
    }
    if (visited(0)(goal)) dist(0)(goal) else -1
  }

  def main(args: Array[String]): Unit = {
    val (nVertex, nEdge, edges, start, goal) = read()
    println(solve(nVertex, nEdge, edges, start, goal))
  }
}

Measured memory_bytes: 86452
n, k = list(map(int, input().split()))
nums = list(map(int, input().split()))
ex = [(x + 1) / 2 for x in nums]

cur = sum(ex[:k])
ans = cur
for i in range(0, n - k):
	cur = cur + ex[i + k] - ex[i]
	ans = max(ans, cur)

print(ans)

Measured memory_bytes: 25060
#include <bits//stdc++.h>
using namespace std;
int main(void){
    int a,b,c,ans,i,j;
    cin>>a>>b;
    b=b*2+1;
    if(a%b==0)
    ans=a/b;
    else
    ans=a/b+1;
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(input())

d = abs(A - B)
s = V - W

if s <= 0:
  print("NO")
  exit()

if d / s <= T:
  print("YES")
else:
  print("NO")


Measured memory_bytes: 61600
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)


main :: IO ()
main = do
    s <- getLine
    putStrLn $ if map length (group s) == [1,1,1,1] then "Good" else "Bad"


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

int n[101];

int main(){
  int s, g;
  while(cin>>s>>g){
    if(s==0&&g==0){
      int flag=true;
      if(!(n[1]%2==1&&n[2]%2==1))flag=false;
      for(int i=3; i<=100; i++){
        if(n[i]%2==1){flag=false; break;}
      }
      if(flag) cout<<"OK"<<endl;
      else cout<<"NG"<<endl;
      for(int i=0; i<101; i++)n[i]=0;
      continue;
    }
    n[s]++; n[g]++;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
int c[3][3];
signed main(){
    rep(i,3)rep(j,3)cin >> c[i][j];
    for(int a1 = -100;a1<=100;a1++){
        for(int a2 = -100;a2 <= 100;a2++){
            for(int a3 = -100;a3 <= 100;a3++){
                int a[3] = {a1,a2,a3};
                int b[3];
                rep(i,3)rep(j,3){
                    b[j] = c[i][j]-a[i];
                }
                bool ok = true;
                rep(i,3)rep(j,3){
                    if(a[i]+b[j] != c[i][j])ok = false;
                }
                if(ok){
                    cout << "Yes" << endl;
                    return 0;
                }


            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> A >> B;
  if (A<= 8 && B <=8) cout <<"Yay!" << endl;
  else cout <<":(" << endl;
  

}


Measured memory_bytes: 256
# include <bits/stdc++.h>
 
using namespace std;
 
const int  N = 1e5 + 5;
 
int n, ar[N];
 
int calc (int player = 1)
{
    int cn = 0, in, gcd;
    for (int i = 1; i <= n; i++)
    {
        if (ar[i] % 2 == 0) cn++;
        else in = i;
    }
    if (cn & 1)
        return player;
 
    else if (cn != n - 1 || ar[in] == 1)
        return (player ^ 1);
 
    ar[in]--;
    gcd = ar[1];
    for (int i = 2; i <= n; i++)
        gcd = __gcd(gcd, ar[i]);
 
    for (int i = 1; i <= n; i++)
        ar[i] /= gcd;
    calc(player ^ 1);
}
 
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++) scanf("%d", &ar[i]);
    if (calc())
        puts("First");
    else
        puts("Second");
}

Measured memory_bytes: 640
<?php

$input = trim(fgets(STDIN));
List($a, $b, $c) = explode(" ", $input);

$c = deg2rad($c);
$S = ($a * $b * sin($c)) / 2;
$L = $a + $b + sqrt($a*$a + $b*$b - 2*$a*$b*cos($c));
$h = $b * sin($c);

printf("%f" . PHP_EOL, $S);
printf("%f" . PHP_EOL, $L);
printf("%f" . PHP_EOL, $h);

Measured memory_bytes: 15668
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		java.util.Scanner scan = new java.util.Scanner(System.in);
		java.lang.StringBuilder sb = new java.lang.StringBuilder();

		java.lang.String str = scan.nextLine();
		int q = scan.nextInt();
		scan.nextLine();
		//System.out.println(str);

		for (int i = 0; i < q; i++) {
			String meirei = scan.next();

			if ( "print".equals( meirei ) ) {
				int a = scan.nextInt();
				int b = scan.nextInt();
				System.out.println( str.substring(a, b+1) );
				scan.nextLine();
			} else if ( "reverse".equals( meirei ) ) {
				int a = scan.nextInt();
				int b = scan.nextInt();
				String substr = str.substring(a, b+1);
				java.lang.StringBuilder subsb = new StringBuilder();
				subsb.append(substr).reverse();
				str = str.substring(0, a) + subsb.toString() + str.substring(b+1);
				scan.nextLine();
				//System.out.println(str);
			} else if ( "replace".equals( meirei ) ) {
				int a = scan.nextInt();
				int b = scan.nextInt();
				String p = scan.next();
				str = str.substring(0, a) + p + str.substring(b+1);
				//System.out.println(str);
			}
		}
	}

}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  map<ll, ll> cnt1, cnt2;
  cin >> N;
  rep(i, N){
    ll tmp;
    cin >> tmp;
    if(i%2==0)cnt1[tmp]++;
    if(i%2==1)cnt2[tmp]++;
  }
  
  ll ans=N;
  ll tmp=0;
  priority_queue<P> q1,q2;
  q1.push({0, 0});
  q2.push({0, 0});
  for(auto i:cnt1){
    q1.push({i.second, i.first});
  }
  for(auto i:cnt2){
    q2.push({i.second, i.first});
  }
  P a = q1.top();q1.pop();
  P b = q2.top();q2.pop();
  if(a.second==b.second){
    auto b2 = q2.top();
    ans = min(ans, N-b2.first-a.first);
    auto a2 = q1.top();
    ans = min(ans, N-b.first-a2.first); 
  }else{
    ans = N - a.first - b.first;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 8824
import kotlin.math.floor

fun main() {
    val x = readLine()!!.toDouble()
    var count = 0
    var diff = 1.0
    while (true) {
        diff = floor(diff * 101) / 100
        count += 1
        if (x / diff <= 100) {
            println(count)
            return
        }
    }
}

Measured memory_bytes: 34660
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static Reader;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
public static class P
{
    public static void Main()
    {
        int t = NextInt;
        for (int i = 0; i < t; i++)
            Console.WriteLine(FloorSum(NextInt, NextInt, NextInt, NextInt));
    }

    public static long FloorSum(long n, long m, long a, long b)
    {
        long ans = 0;
        while (true)
        {
            if (a >= m)
            {
                ans += (n - 1) * n * (a / m) / 2;
                a %= m;
            }
            if (b >= m)
            {
                ans += n * (b / m);
                b %= m;
            }

            long yMax = (a * n + b) / m;
            long xMax = yMax * m - b;
            if (yMax == 0) return ans;
            ans += (n - (xMax + a - 1) / a) * yMax;
            (n, m, a, b) = (yMax, a, m, (a - xMax % a) % a);
        }
    }
}


static class Reader
{
    const int BUF_SIZE = 1 << 12;
    static Stream Stream = Console.OpenStandardInput();
    static byte[] Buffer = new byte[BUF_SIZE];
    static int ptr = BUF_SIZE - 1;
    static void Move() { if (++ptr >= Buffer.Length) { Stream.Read(Buffer, 0, BUF_SIZE); ptr = 0; } }


    public static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0; while (Buffer[ptr] < 48) Move();
            do { res = res * 10 + (int)(Buffer[ptr] ^ 48); Move(); } while (48 <= Buffer[ptr]);
            return res;
        }
    }
}


Measured memory_bytes: 29484
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll dp[7070];

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

	int N, T;
	cin >> N >> T;
	vector<pair<ll, ll>>p(N);
	for (int i = 0; i < N; i++) {
		int A, B;
		cin >> A >> B;
		p[i] = { A,B };
	}
	sort(all(p));


	for (int i = 0; i < N; i++) {
		int A = p[i].first;
		int B = p[i].second;
		for (int j = T - 1; j >= 0;j--) {
			dp[j + A] = max(dp[j] + B,dp[j + A]);
		}
	}

	ll ans = -1;
	for (int i = 0; i < 7060; i++)ans = max(dp[i],ans);
	puts(ans);

	return 0;
}

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

int main(int argc, char const *argv[])
{
	int a, b; cin >> a >> b;
	if (a <= 8 && b <= 8) printf("Yay!\n");
	else printf(":(\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt();
		int B = s.nextInt();
		int C = s.nextInt();
		System.out.println(A + B >= C? "Yes": "No");
	}
}


Measured memory_bytes: 23764
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = [-int(input()) for _ in range(N)]

from bisect import bisect_right
lis = [1]
for a in As:
    if a>=lis[-1]:
        lis.append(a)
    else:
        lis[bisect_right(lis, a)] = a

print(len(lis))

Measured memory_bytes: 13600
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 20;
int n, m, x, y, q, d,z, w = 0, sum, ans = 0;
vector<int>a;
const int MAX = 510000;
const int MOD = 1000000007;
int main(void) {
	string s,t; cin >> s;
	rep(i, s.size()) {
		if (s[i] == '0') {
			t += '0';
		}
		else if (s[i] == '1') t += '1';
		else {
			if (!t.empty())t.erase(t.size() - 1);
		}
	}cout << t << endl;
}

Measured memory_bytes: 3628
s = list(str(input()))
t = list(str(input()))
l = []
count = 0
for i in range(len(s)-len(t) + 1):
    for j in range(len(t)):
        if s[i+j] != t[j]:
            count += 1

    l.append(count)
    count = 0
print(min(l))


Measured memory_bytes: 9056
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cstdio>
using ll = long long;
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int s=0;s<=n/7;s++){
        for(int f=0;f<=n/4;f++){
            if((s*7+f*4)==n){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    int a, b; cin >> a >> b;
    cout << (-a + b - 1) * (-a + b) / 2 - a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
const int MAXN = 120000;

int ff[MAXN];

int getf(int x) {
	int ans = 0;
	for (; x >= 0; x = (x & (x + 1)) - 1)
		ans += ff[x];
	return ans;
}

void addf(int x) {
	for (; x < MAXN; x |= x + 1)
		ff[x] += 1;
}

int solve(vector<int> vv) {
	ll inv = 0;
	memset(ff, 0, sizeof(ff));
	int n = vv.size();
	for (int i = n - 1; i >= 0; --i) {
		inv += getf(vv[i]);
		addf(vv[i]);
	}
	return (inv % 2);
}

int n;
int a[MAXN];
int tmp[MAXN][3];


int main() {
	cin >> n;
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < n; ++j)
			cin >> tmp[j][i];
	for (int i = 0; i < n; ++i) {
		int x, y, z;
		x = tmp[i][0], y = tmp[i][1], z = tmp[i][2];
		--x, --y, --z;
		int c = x / 3;
		if (i % 2 != c % 2) {
			cout << "No\n";
			return 0;
		}
		if (x == c * 3 && y == c * 3 + 1 && z == c * 3 + 2) {
			a[i] = c + 1;
		}
		else if (z == c * 3 && y == c * 3 + 1 && x == c * 3 + 2) {
			a[i] = -c - 1;
		}
		else {
			cout << "No\n";
			return 0;
		}
	}
	int c1 = 0, c0 = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] < 0) {
			if (i % 2 == 0)
				c0 ^= 1;
			else
				c1 ^= 1;
		}
		a[i] = abs(a[i]);
	}
	vector<int> vv;
	for (int i = 0; i < n; i += 2)
		vv.push_back(a[i]);
	c1 ^= solve(vv);
	vv.clear();
	for (int i = 1; i < n; i += 2)
		vv.push_back(a[i]);
	c0 ^= solve(vv);
	if (c1 == 0 && c0 == 0) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	return 0;
}




Measured memory_bytes: 2940
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;

template<class T> bool ckmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template <typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template <typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template <class X, class Y>
std::ostream & operator << (std::ostream & os, std::pair <X, Y> const& p) {
    return os << p.first << " " << p.second;
}

template <class Ch, class Tr, class Container>
std::basic_ostream <Ch, Tr> & operator << (std::basic_ostream <Ch, Tr>& os, Container const& x) {
    bool first = true;
    for(auto& y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CSplittingPile {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        vi A(n);
        in >> A;
        ll left = 0, right = accumulate(all(A), 0ll), res = LLONG_MAX;
        FOR(i, 0, n - 1) {
            int x = A[i];
            left += x;
            right -= x;
            ckmin(res, abs(right - left));
        }
        out << res << '\n';
	}

	void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
	CSplittingPile solver;
    solver.setup();
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3980
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<int> A(N);
	int sum = 0;
	for(int i=0;i<N;++i){
		cin>>A[i];
		sum += A[i];
	}
	sort(A.begin(),A.end());
	int MAX = 0;
	
	bitset<2000*2000+10> dp;
	dp[0] = true;
	for(int i=0;i<N;++i){
		dp = dp|dp<<A[i];
		/*for(int j=MAX;j>=0;--j){
			dp[j+A[i]] = dp[j+A[i]] || dp[j];
			if( dp[j+A[i]] ){
				MAX = max(MAX,j+A[i]);
			}
		}*/
	}
	for(int i=(sum+1)/2;;++i){
		if( dp[i] ){
			cout << i << endl;
			return;
		}
	}
}
#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 2176