akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>
#define F first
#define S second
#define PI 3.141592653589793238
#define pb push_back

using namespace std;

//doesn't work for arrays
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const lli N=100000;
vector<lli> g[N];
lli low[N],in[N]={0},timer=1;
set<pair<lli,lli>> ans;
bool bridge=0;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        lli k,n=7,ct=1;
        cin>>k;
        bool flag=0;
        for(i=0;i<k;i++)
        {
            if(n%k==0)
            {
                flag=1;
                break;
            }
            else
            {
                ct++;
                n=10*n+7;
                n=n%k;
            }
        }
        if(flag)
        {
            cout<<ct<<"\n";
        }
        else
        {
            cout<<"-1\n";
        }

    }
    return 0;
}


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

int main() {
  int count[5][4][11] = {};
  int n, b, f, r, v;
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b >> f >> r >> v;
   count[b][f][r] += v;
  }
  
  for(int i = 1; i <= 4; i++) {
    if (i > 1) cout << "####################" << endl;
    for(int j = 1; j <= 3; j++) {
      for(int k = 1; k <= 10; k++) {
      	cout << " " << count[i][j][k];
      }
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    for (int i=1; i<=n; i++) {
        int p; cin >> p;
        if (p != i) cnt++;
    }
    cout << (cnt <= 2 ? "YES" : "NO") << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    int odd = 0;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if(a % 2) odd++;
    }
    if(odd % 2) cout << "NO" << endl;
    else cout << "YES" << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end(), greater<ll>());

    bool ok = true;
    for(int i = 0; i < n-1; i+=2) {
        if (a[i] == a[i+1] && a[i] == n-i-1) continue;
        else {
            ok = false;
            break;
        }
    }
    if (n % 2 == 1) if (a[n-1] != 0) ok = false;
    if (!ok) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    if (ok) rep(i, 0, n/2) {
        ans *= 2;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

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

    string S, T;
    cin >> S >> T;

    vector<int> sums(S.size() + 1);
    REP(i, S.size()) {
        sums[i + 1] = sums[i];
        sums[i + 1] += S[i] == 'A' ? 1 : 2;
    }
    vector<int> sumt(T.size() + 1);
    REP(i, T.size()) {
        sumt[i + 1] = sumt[i];
        sumt[i + 1] += T[i] == 'A' ? 1 : 2;
    }

    int q;
    cin >> q;
    while (q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if ((sums[b] - sums[a - 1]) % 3 == (sumt[d] - sumt[c - 1]) % 3) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string t;
  cin>>t;
  for(char c:t){
    if(c=='?') cout<<'D';
    else cout<<c;
  }
  cout<<endl;
}

Measured memory_bytes: 3704
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s = list(input())
    ans = 0
    for i in range(len(s)):
        count = 0
        for j in range(i, len(s)):
            if s[j] in ['A', 'C', 'G', 'T']:
                count += 1
            else:
                break
        ans = max(ans, count)
    print(ans)
            
if __name__ == '__main__':
    main()

Measured memory_bytes: 8952
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += w[i];
        }

        int ans = sum;
        for (int i = 1; i <= n; i++) {
            int under = 0;
            for (int j = 0; j < i; j++) {
                under += w[j];
            }
            // System.out.printf("%s -> %s : %s = %s\n", i, under, sum - under,
            // Math.abs(sum - under - under));
            ans = Math.min(Math.abs(sum - under - under), ans);
        }

        System.out.println(ans);
    }

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A, B, K;
  cin >> A >> B >> K;
  for(int i = 0; i < B - A + 1; i++) {
    if(i + A <= A + K - 1 || i + A >= B - K + 1) cout << i + A << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

class Program {
    static void Main (string[] args) {
        string[] s = Console.ReadLine ().Split(' ');
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);
        string ans = string.Empty;

        a = a - 1;

        
        int end = a + b;

        for(int start = b - a;start <= end;start ++){
            ans = ans + start + " ";

        }

        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


string s;

int main(){
	cin >> s;
	
	int n=0,S=0,e=0,w=0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'N') n = 1;
		if(s[i] == 'S') S = 1;
		if(s[i] == 'E') e = 1;
		if(s[i] == 'W') w = 1;
	}
	
	if(n + S == 1 || e + w == 1) cout << "No" << endl;
	else cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int n,k;
vector<int> x;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  cin >> n >> k;
  x.resize(n);
  rep(i,n) cin >> x[i];
  
  ll res = 1LL << 60;
  
  rep(i,n-k+1){
    ll l = x[i];
    ll r = x[i+k-1];
    
    chmin(res, abs(l) + abs(r-l));
    chmin(res, abs(r) + abs(l-r));  
  }
  
  cout << res;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

ll INF = 1LL << 50;

int main()
{
    int v, e;
    cin >> v >> e;
    vvll dp(v, vll(v, INF));
    rep(i, e)
    {
        int f, t, c;
        cin >> f >> t >> c;
        dp[f][t] = c;
    }
    rep(i, v) dp[i][i] = 0;

    rep(k, v) rep(i, v) rep(j, v)
    {
        if (dp[i][k] == INF || dp[k][j] == INF)
        {
            continue;
        }
        chmin(dp[i][j], dp[i][k] + dp[k][j]);
    }

    rep(i, v)
    {
        if (dp[i][i] < 0)
        {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    rep(i, v)
    {
        rep(j, v)
        {
            if (dp[i][j] == INF)
            {
                cout << "INF";
            }
            else
            {
                cout << dp[i][j];
            }
            if (j == v - 1)
                continue;
            cout << " ";
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3240
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#include <iomanip>
#include <map>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


struct UnionFind{
  int static const n_max = 1000 * 1000 ;
  int par[n_max];
  int rank[n_max];

  void init(int n){
    for(int i=0;i<n;i++){
      par[i] = i;
      rank[i] = 0;
    }
  }

  int find(int x){
    if(par[x] == x){
      return x;
    }else{
      return par[x] = find(par[x]);
    }
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return ;

    if(rank[x] < rank[y]){
      par[x] = y;
    }else{
      par[y] = x;
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
};

int static const N_MAX = 1000 * 100 + 100;
int N,M;
int P[N_MAX];

int main(){

  cin>>N>>M;
  rep(i,N){
    cin>>P[i]; P[i]--;
  }

  UnionFind uf;uf.init(N);
  int x,y;
  rep(i,M){
    cin>>x>>y;x--;y--;
    uf.unite(x,y);
  }

  int ans = 0;
  rep(i,N){
    if( uf.same(P[i], i) ) ans++;
  }
  
  cout<< ans << endl;

}




Measured memory_bytes: 5120
n,m = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
t = sum(A)
for i in range(n):
    if A[i] < t/(4*m):
        None
    else:
        ans += 1
if ans >= m:
    print('Yes')
else:
    print('No')


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

typedef long long ll;

using namespace std;


int main()
{
    ll n,a,b,x=1,y=1;
    cin >> n;

    while(n--)
    {
        cin >> a >> b;
        ll y2 = (((x-1) / a) + 1) * b;
        if(y2 >= y)
        {
            y = y2;
            x = (((x-1) / a) + 1) * a;
            continue;
        }

        x = (((y-1) / b) + 1) * a;
        y = (((y-1) / b) + 1) * b;
    }

    cout << x+y << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
   int N;
   int amari;
   int sum =0;

  scanf("%d",&N);

  int M = N;

  while(M > 0){
    amari = M % 10;
    sum = sum + amari;
    M = M/10;
  }

  if(N % sum == 0){
      printf("Yes\n");
  }else {
      printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
import sys

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

input = sys.stdin.readline

N, M = map(int, input().split())
relations = []
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    relations.append((a, b))

uf = UnionFind(N)
for a, b in relations:
    uf.union(a, b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))
print(ans)

Measured memory_bytes: 88584
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;

const int NMAX = 100110;
typedef long long i64;

i64 rucsac[NMAX];
int W;

void add(int w, int c)
{
    for (int i = W; i >= w; i--)
        rucsac[i] = max(rucsac[i], rucsac[i - w] + c);
}

int main()
{
    int n;
    scanf("%d%d", &n, &W);

    for (int i = 1; i <= n; i++) {
        int w, c;
        scanf("%d%d", &w, &c);
        add(w, c);
    }

    printf("%lld\n", rucsac[W]); /// mereu optim ;)

    return 0;
}


Measured memory_bytes: 896
<?php
fscanf(STDIN, "%d%d%d", $n, $m, $k);
$flag = false;
for($i = 0; $i <= $n; $i++){
    for($j = 0; $j <= $m; $j++){
        if($i * $j + ($n-$i)*($m-$j) == $k)$flag = true;
    }    
}
echo $flag ? "Yes" : "No","\n";

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int k;
    cin >> k;
    vi x = { a, b, c, d, e };
    bool res = true;
    rep(i, sz(x)) {
        rep(j, i) {
            if (x[i] - x[j] > k) res = false;
        }
    }
    string ans;
    if (!res) ans = ":(";
    else ans = "Yay!";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <stdint.h>
#include <emmintrin.h>

using namespace std;
static int32_t a[100000] __attribute__((aligned(16)));

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){ scanf("%d", a + i); }
	int q;
	scanf("%d", &q);
	while(q--){
		int l, r, e;
		scanf("%d%d%d", &l, &r, &e);
		--l;
		const int lo = min(a[l], a[r - 1]) - e;
		const int hi = max(a[l], a[r - 1]) + e;
		int i = l;
		const __m128i vec_lo = _mm_set1_epi32(lo);
		const __m128i vec_hi = _mm_set1_epi32(hi);
		__m128i vec_sum = _mm_setzero_si128();
		for(i = l; i + 3 < r; i += 4){
			const __m128i x = _mm_loadu_si128((const __m128i *)(a + i));
			const __m128i c0 = _mm_cmpgt_epi32(vec_lo, x);
			const __m128i c1 = _mm_cmpgt_epi32(x, vec_hi);
			const __m128i c = _mm_or_si128(c0, c1);
			vec_sum = _mm_add_epi32(vec_sum, c);
		}
		vec_sum = _mm_add_epi32(vec_sum, _mm_srli_si128(vec_sum, 4));
		vec_sum = _mm_add_epi32(vec_sum, _mm_srli_si128(vec_sum, 8));
		int answer = -_mm_cvtsi128_si32(vec_sum);
		for(; i < r; ++i){
			if(a[i] < lo || hi < a[i]){ ++answer; }
		}
		printf("%d\n", answer);
	}
	return 0;
}

Measured memory_bytes: 1416
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;

ll dp[200001],ans[200000];

int main(){
	int i,j,n;	cin>>n;
	int c[n];
	for(i=0;i<n;i++){
		cin>>c[i];
	}
	vector<int> pos[200001];
	ans[0]=1;	dp[c[0]]=1;	pos[c[0]].pb(0);
	for(i=1;i<n;i++){
		if(i>0 && c[i]!=c[i-1]){
			ans[i]=ans[i-1]+dp[c[i]];	ans[i]%=mod;
			int m=pos[c[i]].size();
			if(m>0)	dp[c[i]]+=ans[i]-ans[pos[c[i]][m-1]];
			else	dp[c[i]]+=ans[i];
			dp[c[i]]%=mod;
		}
		else	ans[i]=ans[i-1];
		pos[c[i]].pb(i);
	}
	ans[n-1]+=mod;	ans[n-1]%=mod;
	cout<<ans[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 15104
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<ll,ll>> pc;
//int ABS(int a){return max(a,-a);}
int a[31];
int main(){
    int n,m,k;
    cin>>n>>m;
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>k;
        for(int j=0;j<k;j++){
            int p;
            cin>>p;
            a[p]++;
            if(a[p]==n) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = eval(input())
n1 = str(n)

if(n%10==0):
	print(10)
else:
	mini = 0
	sum1 = 0
	sum2 = 0
	for i in range(1,n):
		a = i
		b = n-i
		a1 = str(a)
		b1 = str(b)
		for j in a1:
			sum1+=(int)(j)
		for k in b1:
			sum2+=(int)(k)

		if(i==1):
			mini = sum1+sum2
		else:
			if((sum1+sum2)<mini):
				mini = sum1+sum2
	print(mini)

Measured memory_bytes: 3188
/*
* @Author: Kabid
* @Date:   2020-04-19 17:59:10
*/

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define in(x)  scanf("%d", &x);
#define ins(x)  scanf("%s", &x);
#define out(x) printf("%d", x);
#define lin puts("");
#define _ putchar(' ');

int main(){
	int n,m,a,s=0,i;
	in(n) in (m)
	for(i=0;i<m;i++){
		in(a);
		s+=a;
	}
	//out(s) _
	if((n-s)<0)s=-1;

	else s=n-s;
	out(s);

	

	
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define chal ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
    int q=1;
    //cin>>t;
    while(q--)
    {
        ll n;
        cin>>n;
        ll a[n],i,ans=0,p;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        for(i=1;i<n;i++)
        {
            p=max(0LL,a[i-1]-a[i]);
            a[i]=max(a[i],a[i-1]);
            ans+=p;
        }
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 5196
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
	int N, M, X, Y;
	std::cin >> N >> M >> X >> Y;
	std::vector<int> x(N+1), y(M+1);
	x[0] = X;
	y[0] = Y;
	for(int i=0; i<N; i++) std::cin >> x[i+1];
	for(int i=0; i<M; i++) std::cin >> y[i+1];
	std::sort(x.begin(), x.end());
	std::sort(y.begin(), y.end());
	if(x[N] < y[0]) std::cout << "No War\n";
	else std::cout << "War\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10000
#define NIL -1

typedef struct{
  int parent,left,right;
}tree;

tree T[MAX];
int n,D[MAX],H[MAX];

int getSibling(int);
int setDepth(int,int);
int high(int);
void print(int);

int main()
{
  int v,l,r,i,root=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      T[i].parent=T[i].left=T[i].right=NIL;
    }
  for(i=0;i<n;i++)
    {
      scanf("%d%d%d",&v,&l,&r);
      T[v].left=l;
      T[v].right=r;
      T[l].parent=v;
      T[r].parent=v;
    }
  for(i=0;i<n;i++)
     {
       if(T[i].parent == NIL)
	 r = i;
     }
  setDepth(r,0);
  high(r);
  for(i=0;i<n;i++)
    {
      print(i);
    }
}
void print(int u)
{
  int deg=0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  if(T[u].left != NIL)
    deg++;
  if(T[u].right != NIL)
    deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  if(T[u].parent == NIL)
    printf("root\n");
  else if(T[u].left == NIL && T[u].right == NIL)
    printf("leaf\n");
  else
    printf("internal node\n");
}

int setDepth(int u,int d)
{
  if(u == NIL)
    return 0;
  D[u]=d;
  if(T[u].right != NIL)
    setDepth(T[u].right,d+1);
  if(T[u].left != NIL)
    setDepth(T[u].left,d+1);
}

int high(int u)
{
 int h1 = 0,h2 = 0;
 if(T[u].left != NIL)
 h1 = high(T[u].left) + 1;
 if(T[u].right != NIL)
 h2 = high(T[u].right) + 1;
 if(h1 > h2)
 return H[u]=h1;
 else
 return H[u]=h2;
}

int getSibling(int u)
{
  int k;
  if(T[u].parent==NIL)
    return -1;
  k=T[u].parent;
  if(T[k].left == u)
    return T[k].right;
  else
    return T[k].left;
}



Measured memory_bytes: 2048
#include<iostream>

using namespace std;


class DICE {
	void Roll_E() {
		int tmpTop = Top;

		Top = Left;
		Left = Bottom;
		Bottom = Right;
		Right = tmpTop;
	}

	void Roll_N() {
		int tmpTop = Top;

		Top = Rear;
		Rear = Bottom;
		Bottom = Front;
		Front = tmpTop;
	}

	void Roll_S() {
		int tmpTop = Top;

		Top = Front;
		Front = Bottom;
		Bottom = Rear;
		Rear = tmpTop;
	}

	void Roll_W() {
		int tmpTop = Top;

		Top = Right;
		Right = Bottom;
		Bottom = Left;
		Left = tmpTop;
	}

public:
	int Top;
	int Bottom;
	int Left;
	int Right;
	int Front;
	int Rear;


	void Roll(const char Direction) {
		switch (Direction) {
		case'E':
			Roll_E();
			break;
		case'N':
			Roll_N();
			break;
		case'S':
			Roll_S();
			break;
		case'W':
			Roll_W();
			break;
		}
	}
};

int main() {
	DICE Dice;
	char Input[101];

	cin >> Dice.Top >> Dice.Rear >> Dice.Right >> Dice.Left >> Dice.Front >> Dice.Bottom;
	cin >> Input;

	for (int i = 0; Input[i] != '\0'; i++) {
		Dice.Roll(Input[i]);
	}

	cout << Dice.Top << endl;

	return 0;
}

Measured memory_bytes: 1164
using System;
class ProgramA
    {
        static void Main(string[] args)
        {
            //日付を入力する
            int n  = int.Parse(Console.ReadLine());
            string[] s = new string[n];
            int[] t = new int[n];

            for(int i = 0;i < n;i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                s[i] = input[0];
                t[i] = int.Parse(input[1]);
            }

            string X = Console.ReadLine();

            int count = 0;
            int frag = 0;

            for(int i = 0;i < n;i++)
            {
                
                 
                
                if(frag == 1)
                    count += t[i];
              
                if(s[i] == X)
                    frag = 1;
            }

            Console.WriteLine(count);

            
                
        }
    }

Measured memory_bytes: 13140
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
#include<bitset>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<ll> l(n+1);
  l[0]=2;
  l[1]=1;
  for(int i=2; i<=n; i++)
  	l[i] = l[i-1]+l[i-2];
  cout << l[n] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int x,b,p;
    cin>>x;
    bool a[x+1]={};
    a[1]=true;
    for(b=2;b<x;b++)for(p=2;pow(b,p)<=x;p++)a[(int)pow(b,p)]=true;
    for(;x>0;x--)if(a[x]){cout<<x<<endl;return 0;}
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    string s;
    cin >> s;
    rep(i, int(s.size())) {
        s[i] = 'x';
    }
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int x, a;
	cin >> x >> a;
	if (0, a <= x) {
		cout << "10" << endl;
	}
	else {
		cout << "0" << endl;
	}
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main(){
	int k, n, min = 1000000007;
	int a[200010];
	cin >> k >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n - 1; i++) {
		int ans = a[i] + k - a[i + 1];
		if (ans < min) {
			min = ans;
		}
	}
	if (a[n - 1] - a[0] < min) {
		min = a[n - 1] - a[0];
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn abc(a: i32, b: i32) -> i32 {
    return (a-1)*(b-1)
    }

fn main() {
    /*
    assert_eq!(abc(), "Yes");
    assert_eq!(abc(101), "No");
    assert_eq!(abc(999999999), "Yes");
    */
    input!{
        a: i32,
        b: i32,
    }
    let result = a - b + 1;

    println!("{}", result);
}




Measured memory_bytes: 4352
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;

void Main()
{
	int N;
  	cin >> N;
  	vector<int> a(N);
  	rep(i,N) cin >> a[i];
  	
  	sort(a.begin(), a.end());
  	
  	const int NUM = 8;
  	vector<int> rate = {400, 800, 1200, 1600, 2000, 2400, 2800, 3200};
  	vector<int> ans = {0, 0, 0, 0, 0, 0, 0, 0};
  	int countmax = 0;
  	int countmin = 0;
  	int i = 0;
  	int j = 0;
  	while(i<N && j<NUM){
		if(a[i] < rate[j]){
          	if(ans[j] == 0){
              countmax++;
              countmin++;
            }
			ans[j] = 1;
          	i++;
        }
      	else{
          j++;
        }
    }
  	//cout << "i = " << i << ", j = " << j << "." << endl;	
  	//rep(i,NUM) cout << ans[i] << ", " ;	
  	if(i == 0){countmin++;}
  	countmax += (N-i);
  	cout << countmin << " " << countmax << endl;
	return;
}

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


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

int main() {
  int N;
  int K;
  
  
  cin >> N >> K;
  
  int sum;
  int X;
  for (int i=0; i < N; i++) {
   
    cin >> X;
    
    if (K - X > X) {
        sum += 2 * X;
    } 
    else {
        sum += 2 * (K - X);
    }
  }
  
  cout << sum << endl;

}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;


const long long INF = 1LL << 60;


int main() {
    int k, a[200010] = {};
    INT n,sum=0,ans;

    cin >> n>>k;
    
    for (INT i = k; i <= n + 1; i++) {
        sum+=(n + (INT)1 - i)* i+1;
    }

    ans = (sum) % (1000000007);

    cout << ans << endl;

    return 0;
}

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

typedef struct t_bingo{
	int		j;
	int		k;
	struct t_bingo *next;
}		t_bingo;

t_bingo		*create_entry(int j, int k)
{
	t_bingo		*p;

	p = (t_bingo *)malloc(sizeof(t_bingo));
	if (!p)
		return (0);
	else
	{
		p->j = j;
		p->k = k;
		p->next = NULL;
	}
	return (p);
}

int		is_diagnol(int *nbrs)
{
	int		i;
	int		flag;
	int		same1, same2, diff1, diff2;

	i = 0;
	flag = 0;
	while (nbrs[i])
	{
		if (nbrs[i] == 2 && nbrs[i + 1] == 2)
			flag = 1;
		if (nbrs[i] == 1 && nbrs[i + 1] == 1)
			same1 = 1;
		if (nbrs[i] == 3 && nbrs[i + 1] == 3)
			same2 = 1;
		if (nbrs[i] == 1 && nbrs[i + 1] == 3)
			diff1 = 1;
		if (nbrs[i] == 3 && nbrs[i + 1] == 1)
			diff2 = 1;
		i += 2;
	}
	if (flag == 1 && ((same1 == 1 && same2 == 1) || (diff1 == 1 && diff2 == 1)))
		return (1);
	return (0);
}

int		is_bingo(t_bingo *p, int count)
{
	int		*nbrs;
	int		i;
	int		a, b, c;

	i = 0;
	a = 0;
	b = 0;
	c = 0;
	nbrs = (int *)malloc(sizeof(int) * (count * 2 + 1));
	while (p)
	{
		nbrs[i] = p->j;
		nbrs[i + 1] = p->k;
		i += 2;
		p = p->next;
	}
	nbrs[i] = 0;
	i = 0;
	while (i < (count * 2))
	{
		if (nbrs[i] == 1)
			a++;
		else if (nbrs[i] == 2)
			b++;
		else if (nbrs[i] == 3)
			c++;
		i += 2;
	}
	if (a >= 3 || b >= 3 || c >= 3)
		return (1);
	a = 0;
	b = 0;
	c = 0;
	i = 1;
	while (i < (count * 2))
	{
		if (nbrs[i] == 1)
			a++;
		else if (nbrs[i] == 2)
			b++;
		else if (nbrs[i] == 3)
			c++;
		i += 2;
	}
	if (a >= 3 || b >= 3 || c >= 3 || is_diagnol(nbrs))
		return (1);
	return (0);
}

int		main()
{
	t_bingo		*p;
	t_bingo		*new;
	int		bingo[3][3];
	int		N, n, count, r;
	int		i = 0;

	count = 0;
	while (i < 3)
	{
		r = scanf("%d %d %d\n", &bingo[i][0], &bingo[i][1], &bingo[i][2]);
		if (!r)
			return (0);
		i++;
	}
	r = scanf("%d\n", &N);
	if (!r)
		return (0);
	for (i = 0; i < N; i++)
	{
		r = scanf("%d\n", &n);
		if (!r)
			return (0);
		for (int j = 0; j < 3; j++)
		{
			for(int k = 0; k < 3; k++)
			{
				if (n == bingo[j][k])
				{
					new = create_entry(j + 1, k + 1);
					if (count)
						new->next = p;
					p = new;
					count++;
				}
			}
		}
	}
	if (count >= 3 && is_bingo(p, count))
		printf("Yes\n");
	else
		printf("No\n");
	return (0);
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define F first
#define S second
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll a = 0, b = 0, c = 0;
  cin >> a >> b >> c;
  if (a == b and c != a or a == c and b != a or b == c and a != b)
    cout << "Yes";
  else cout << "No";
}



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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int, int> pii;
const int mod = (int)1e9 + 7;


int main()
{

	cin.tie(0); ios_base::sync_with_stdio(false);
	const int DF =25000;
	int n;
	cin >> n;
	VI p(n);
	rep(i,n) cin >>p[i];
	
	VI va(n), vb(n);
	rep(i,n){
		va[i] = DF * (i+1);
		vb[i] = DF * (n-i);
	}
	rep(i,n) va[p[i]-1] += i;
	
	rep(i,n) printf("%s%d",(i? " ":""), va[i]); puts("");
	rep(i,n) printf("%s%d",(i? " ":""), vb[i]); puts("");
	
	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define f(p,n) for(ll i=p;i<n;i++)
ll exp(ll a,ll b,ll m);
bool vis[1000001]={0};
ll ans=1;

void solve(ll a)
{
	if(vis[a]==1) return;

	vis[a]=1;
	ans++;
	if(a%2==0) 
	{
		solve(a/2);
	}
	else
	{
		solve(3*a+1);
	}
}
int main()
{
 ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll s;
	cin>>s;
	solve(s);
	cout<<ans<<endl;
	
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if ( x - r >= 0 && x + r <= W ){
        if ( y - r >= 0 && y + r <= H)
            printf("Yes\n");
        else
            printf("No\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s,t; cin>>s>>t;
	int ret=0;
	for (int i=0; i<3; i++)
		ret+=(s[i]==t[i]);
	cout<<ret<<"\n";
	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

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)];
    }
};

struct edge{int u,v,cost;};

bool comp(const edge& e1,const edge& e2){
    return e1.cost<e2.cost;
}

edge es[100010];
int v,e;

int kruskal(){
    sort(es,es+e,comp);
    //cout<<es[0].cost<<endl;
    //cout<<es[e-1].cost<<endl;
    UnionFind uf(v+1);
    int res=0;
    for (int i=0;i<e;i++){
        auto e=es[i];
        if (!uf.issame(e.u,e.v)){
           uf. merge(e.u,e.v);
            res+=e.cost;
        }
    }
    return res;
}

int main() {
    cin>>v>>e;
    rep(i,e){
        int a,b,c;
        cin>>a>>b>>c;
        edge e1={a,b,c};
        es[i]=e1;
    }
    int ans=kruskal();
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 4312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	int k; cin >> k;
	int ans;
	ans = k/2 * ((k+1)/2);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int N,X,T;
  int ans;
  
  scanf("%d %d %d",&N,&X,&T);
  
  ans = 0;
  while (N >= X) {
	ans = ans + T;
    N = N - X;
  }
  
  if (N != 0) {
    ans = ans + T;
  }
  
  printf("%d",ans);
  
  return 0;
}

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


namespace ACprac
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] itmp = Console.ReadLine().Split(' ');
            int N = int.Parse(itmp[0]);
            int X = int.Parse(itmp[1]);
            int[] m = new int[N];

            int make = N;
            int konaZan = X;

            for(int i = 0; i < N; i++)
            {
                m[i] = int.Parse(Console.ReadLine());
                konaZan = konaZan - m[i];
            }
            Console.WriteLine(make + (konaZan / m.Min()));
        }
    }
}

Measured memory_bytes: 13268
#include "bits/stdc++.h"
#define ll long long int
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<ll, ll> pairs;
typedef pair<ll, pairs> tpl;
vector<ll> v[100001];
bool vis[100001];
ll dp[100001];
void dfs(ll node)
{
	vis[node] = 1;
	for (auto i : v[node])
	{
		if (!vis[i])
			dfs(i);
		dp[node] = max(dp[node], 1 + dp[i]);
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;
	while (m--)
	{
		ll x, y;
		cin >> x >> y;
		v[x].push_back(y);
	}
	for (ll i = 1; i <= n; i++)
		if (!vis[i])
			dfs(i);
	ll ans = 0;
	for (ll i = 1; i <= n; i++)
		ans = max(ans, dp[i]);
	cout << ans;
}


Measured memory_bytes: 12696
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
  long long int N; cin >> N;

  int ans = 10000;
  for (long long int i = 1; i <= sqrt(N); i++) {
    long long int A = i;
    long long int B = N / A;
    if (A * B != N) continue;

    int digitA = 0, digitB = 0;
    while (A != 0) {
      A /= 10;
      digitA++;
    }
    while (B != 0) {
      B /= 10;
      digitB++;
    }

    if (max(digitA, digitB) < ans) ans = max(digitA, digitB);
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

typedef long long int ll;

const ll inf = 1e15;

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

  ll ns, nt, q;
  cin >> ns >> nt >> q;
  set < ll > s, t;
  for(int i = 0; i < ns; i++){
    ll a; cin >> a;
    s.insert(a);
  }
  for(int i = 0; i < nt; i++){
    ll a; cin >> a;
    t.insert(a);
  }

  s.insert(inf);
  s.insert(-inf);
  t.insert(inf);
  t.insert(-inf);

  while(q--){
    ll x; cin >> x;
    auto it = s.lower_bound(x);
    ll sr = *it - x, sl = x - *(--it);
    it = t.lower_bound(x);
    ll tr = *it - x, tl = x - *(--it);

    ll ans = max(sl, tl);
    ans = min(ans, 2 * sl + tr);
    ans = min(ans, sl + 2 * tr);
    ans = min(ans, max(sr, tr));
    ans = min(ans, sr + 2 * tl);
    ans = min(ans, 2 * sr + tl);

    cout << ans << '\n';
  }
}


Measured memory_bytes: 10752
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    string S; cin >> S;     
    if(S.length() % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }
    REP(i, S.length()-1)
    {
        if(S[i] == 'h' && S[i+1] == 'i') i++;
        else 
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var r, d, x int
	fmt.Scan(&r, &d, &x)

	s := r * x - d
	fmt.Println(s)
	for i := 0; i < 9; i++ {
		s = r * s - d
		fmt.Println(s)
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <complex>

using namespace std;
main () {
	int n;
	cin>>n;
	int w[n];
	
	for(int i=0; i<n; i++) {
		cin>>w[i];
	}
	
	int diff=200000; 
	
	for(int i=0; i<n-1; i++) {
		int sum1=0, sum2=0;
		for(int k=0; k<=i; k++) {
			sum1+=w[k];
		}
		for(int l=i+1; l<n; l++) {
			sum2+=w[l];
		}
		int temp=abs(sum2-sum1);
		diff=min(diff, temp);
	}
		
	cout<<diff;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;//typo用
using itn = int;//typo用
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl//1次元配列の出力
#define rrdebug(i, j, x) rep(i, alength(x))rep(j, alength(x[i]))cout << #x << "[" << i << "][" << j << "]:" << x[i][j] << endl//二次元配列の出力
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) {a = b; return true;} return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) {a = b; return true;} return false; }
intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); }
intl lcm(intl a,intl b){ return a / gcd(a, b) * b; }
intl kai(intl k){//k!を求める関数,
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl digit10(intl a){//aを10進数で表したときの桁数を求める関数
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}


signed main(){
    cout << fixed << setprecision(10);
    intl h,w;
    cin >> h >> w;
    bool s[h + 2][w + 2];
    m0(s);
    rep(i, h){
        rep(j, w){
            char c;
            cin >> c;
            s[i + 1][j + 1] = (c == '.');
        }
    }/*
    rep(i,h + 2){
        rep(j, w + 2)cout << s[i][j];
        cout << endl;
    }*/
    intl mturn = 0;
    vector<pii > move = {{0,1},{1,0},{-1,0},{0,-1}};
    repi(i, 1, h + 1){
        repi(j, 1, w + 1){
            if(!s[i][j])continue;
            queue<pii > q;
            q.push(mp(i,j));
            intl turn = -1;
            bool board[h + 2][w + 2];
            memcpy(board,s,sizeof(board));
            board[i][j] = false;
            while(!q.empty()){
                turn++;
                intl len = q.size();
                rep(k,len){
                    pii p = q.front();
                    q.pop();
                    for(auto  l : move){
                        intl fir = l.first + p.first;
                        intl sec = l.second + p.second;
                        if(!board[fir][sec])continue;
                        board[fir][sec] = false;
                        q.push(mp(fir,sec));
                        //cout << fir << ":" << sec << endl;
                    }
                }
            }
            mturn = max(mturn,turn);
        }
    }
    cout << mturn << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
ans = "Yes"
if len(s)%2 == 0:
    for i in range(len(s)):
        if i%2 == 0:
            if s[i] != "h":
                ans = "No"
                break
        else:
            if s[i] != "i":
                ans = "No"
                break
else:
    ans = "No"
print(ans)

Measured memory_bytes: 2940