akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e18 + 7;
const ll infll = 1e18 + 7;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int x, y; cin >> x >> y; cout << (x + y - 1) / y;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 256
def main():
    s = input()
    t = input()

    len_s, len_t = len(s), len(t)
    num_iter = len_s - len_t + 1
    answer = len_t
    for i in range(num_iter):
        s_sub = s[i : i+len_t]
        count = 0
        for s_i, t_i in zip(s_sub, t):
            if s_i == t_i:
                count += 1
        answer = min(answer, len_t-count)
    print(answer)


if __name__ == '__main__':
    main()


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

//63^5=992436543, 64^5=1073741824

int main() {
  int64_t X;
  cin >> X;
  bool y = false;
  for(int64_t A=1;A<6209;A++){
    int64_t a5 = A*A*A*A*A;
    for(int64_t B=0;B<A;B++){
      int64_t b5 = B*B*B*B*B;
      int64_t s =a5-b5-X;
      if(s==0){
        cout << A << " " << B << endl;
        y = true;
        break;
      }
      int64_t t =a5+b5-X;
      if(t==0){
        cout << A << " " << -B << endl;
        y = true;
        break;
      }
    }
    if(y)
      break;
  }
}

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

const int mod=1e9+7;
const int max_n=2e5+10;
long long a[max_n];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    long long sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
        sum = sum % mod;
    }
    long long ans=0;
    for(int i=0;i<n;++i) {
        sum -= a[i];
        if(sum<0) sum+=mod;
        ans += a[i] * sum;
        ans = ans % mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5196
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=sc.nextInt();
        }
        Arrays.sort(A);
        for(int i=0;i<K;i++){
            ans+=A[i];
        }
        System.out.println(ans);
    }

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


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

int main() {
  vector<int>data(9);
  for(int i = 0;i < 9;i++){
    cin >> data.at(i);
  }
  int d1,d2,d3;
  d1 = data.at(0)+data.at(4)+data.at(8);
  d2 = data.at(1)+data.at(5)+data.at(6);
  d3 = data.at(2)+data.at(3)+data.at(7);
  if(d1 == d2 && d2 == d3){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
const int INF = (int)1e18 + 18;
const int maxn = (int) 1e6 + 6; 
using namespace std;
 
int n;
vector<int> a;
 
signed main() {

	cin >> n;

	for(int i = 0; i < n; i++){
		int x; cin >> x;
		a.push_back(x);
	}

	sort(a.begin(), a.end());

	cout << a[n/2] - a[n/2 - 1] << endl;


	return 0;
 
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    int a,b;
    cin>>a>>b;
    a-=1;
    b-=1;
    if(a==0) a=13;
    if(b==0) b=13;
    if(a>b) cout<<"Alice";
    if(a<b) cout<<"Bob";
    if(a==b) cout<<"Draw";
    cout<<"\n";
    }


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var hw = Input.arL;
        var res = long.MaxValue;
        for (var k = 0; k < 2; k++)
            for (var i = 1; i < hw[k]; i++)
            {
                var ar = new[] { i * hw[1 - k], (hw[k] - i + 1) / 2 * hw[1 - k], (hw[k] - i) / 2 * hw[1 - k] };
                res = Min(res, ar.Max() - ar.Min());
                ar[1] = (hw[1 - k] + 1) / 2 * (hw[k] - i);
                ar[2] = hw[1 - k] / 2 * (hw[k] - i);
                res = Min(res, ar.Max() - ar.Min());
            }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=600+5,D=1e9+7;
int lk[N],s[N]; 
s64 f[N][N],g[N][N],_jie[N];

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);
#endif
	int n,k;
	cin>>n>>k;
	while(k--)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		lk[a]=b;lk[b]=a;
	}
	n*=2;
	rep(i,1,n)s[i]=s[i-1]+(lk[i]==0);
	_jie[0]=1;
	rep(i,1,n)_jie[i]=_jie[i-1]*(2*i-1)%D;
	s64 Ans=0;
	per(l,n,1)
	{
		int mn=N,mx=0;
		rep(r,l,n)
		{
			if(lk[r])
			{
				chmin(mn,lk[r]);
				chmax(mx,lk[r]);
			}
			if(!((r-l+1)%2==0&&mn>=l&&mx<=r))continue;
			s64 ans=g[l][r]=_jie[(s[r]-s[l-1])/2];
			for(int m=l+1;m<r;m+=2)(ans-=f[l][m]*g[m+1][r])%=D;
			(Ans+=(f[l][r]=ans)*_jie[(s[l-1]+s[n]-s[r])/2])%=D;
		}
	}
	cout<<(Ans+D)%D;
}

Measured memory_bytes: 5888
#include <iostream>
#include <string>

int main()
{
  std::string s;
  std::cin >> s;
  int len = s.size();
  int begin, end;

  for ( int i = 0; i < len; i++ ) {
    if ( s[i] == 'A' ) {
      begin = i;
      break;
    }
  }

  for ( int i = len - 1; i >= 0; i-- ) {
    if ( s[i] == 'Z' ) {
      end = i;
      break;
    }
  }

  std::cout << end - begin + 1 << std::endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

template <class T>
struct Combination {
    int max_n;
    std::vector<T> f, invf;

    explicit Combination(int n)
        : max_n(n), f(n + 1), invf(n + 1) {
        f[0] = 1;
        for (int i = 1; i <= n; ++i) {
            f[i] = f[i - 1] * i;
        }

        invf[max_n] = f[max_n].inv();
        for (int i = max_n - 1; i >= 0; --i) {
            invf[i] = invf[i + 1] * (i + 1);
        }
    }

    T fact(int n) const { return f[n]; }
    T invfact(int n) const { return invf[n]; }
    T perm(int a, int b) const {
        return a < b || b < 0 ? T(0) : f[a] * invf[a - b];
    }
    T comb(int a, int b) const {
        return a < b || b < 0 ? T(0) : f[a] * invf[a - b] * invf[b];
    }
};

constexpr int MOD = 1000003;
using mint = ModInt<MOD>;

const Combination<mint> C(MOD);

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

    if (d == 0) {
        std::cout << mint(x).pow(n) << std::endl;
        return;
    }

    int y = (mint(x) / d).val;
    if (y == 0 || n >= MOD || y + n - 1 >= MOD) {
        std::cout << 0 << std::endl;
        return;
    }

    std::cout << mint(d).pow(n) * C.fact(y + n - 1) / C.fact(y - 1) << std::endl;
}

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

    int q;
    std::cin >> q;
    while (q--) solve();

    return 0;
}


Measured memory_bytes: 8704
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a+b+c) >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
}
  

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>

bool snukes[101]={false};

using namespace std;

int main()
{
    int n, k, d, sn, cnt=0;
    cin>>n>>k;
    for(int i=0; i<k; i++)
    {
        cin>>d;
        while(d--)
        {
            cin>>sn;
            if(snukes[sn])
                continue;
            else
            {
                snukes[sn]=true;
                cnt++;
            }

        }
    }
    cout<<n-cnt;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer cout<<endl<<"answer : ";
#define maxn 100005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0;string s;bool flag=false;
        cin>>n>>k; lld a[n]; for(i=0;i<n;i++) cin>>a[i];
        sort(a,a+n);
        for(i=0;i<k;i++)
            cnt+=a[i];
        cout<<cnt<<endl;
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|
 
*/

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
typedef long long ll;

using namespace std;

int main(){
	int n,x = 0,ans = 0;
	string s;
	
	cin >> n >> s;
	
	rep(i,0,s.size()){
		if(s[i] == 'I'){
			x++;
		}
		else{
			x--;
		}
		ans = max(ans,x);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << endl
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N, A, B;
  cin >> N >> A >> B;
  ll ans = 0;
  ll before = 0;
  rep(i, N) {
    ll a;
    cin >> a;
    if (i == 0) {
      before = a;
    } else {
      ll distance = a - before;
      ll cost_A = distance * A;
      ans += min(cost_A, B);
      before = a;
    }
  }
  ANS;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n1,n2) for(int i=n1;i<n2;i++)
using namespace std;
typedef long long ll;

int main() {
    int a,b;
    cin >> a >> b;
    if(a<9 && b<9){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    //cout << res << endl;
    /*vector<pair<int,int>> pair1(n);
     vector<pair<int,int>> pair2(n);
     REP(i,n){
     int a,b;
     cin >> a >> b;
     pair1[i] = make_pair(a,b);
     }
     REP(i,n){
     int c,d;
     cin >> c >> d;
     pair2[i] = make_pair(c,d);
     }
     
     sort(pair1.begin(),pair1.end());
     sort(pair2.begin(),pair2.end());
     REP(i, n){
     cout << pair1[i].first << pair1[i].second <<endl;
     }
     int maxn = -1;
     int cand = -1;
     REP(i,n){
     REP(j,n){
     if(pair1[i].first<pair2[j].first){
     if(pair1[i].second>maxn){
     cand = i;
     }
     }
     }
     }
     /*REP(i, n){
     cout << pairs[i].first << pairs[i].second <<endl;
     }
     /*int n;
     int res = 100000;
     cin >> n;
     //vector<int> x(n);
     REP2(i,1,n/2+1){
     res = min(res,psum(i)+psum(n-i));
     if(psum(i)+psum(n-i)==1){
     cout << "i:" << i <<endl;
     }
     }
     cout << res << endl;*/
    return 0;
}



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, r);
  out(3 * r * r);
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define int long long
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1e5+5;


int32_t main() {
	int n, m;
	cin >> n >> m;
	priority_queue<int, vector<int>, greater<int>> fila;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		fila.push(x);
	}
	vector<pii> query;
	for(int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		query.pb({b, a});
	}
	sort(query.begin(), query.end(), greater<pii>()); 
	
	for(auto i : query) {
		int cont = 0;
		while(cont < i.s && !fila.empty() && fila.top() < i.f) {
			cont++;
			fila.pop();
			fila.push(i.f);
		}
	}
	
	ll sum = 0;
	while(!fila.empty()) {
		sum += fila.top();
		fila.pop();
	}
	cout << sum << endl;
}


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

int d[10];

bool func(int x){
    while (x > 0){
        if (d[x%10]==1){
            return false;
        }
        x/=10;
    }
    return true;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,l;
    cin >> n >> k;
    for (int i=0; i<k; i++){
        cin >> l;
        d[l] = 1;
    }
    while (true) {
        if (func(n)){
            cout << n << endl;
            break;
        }
        else{
            n++;
        }
    }
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(8);
    double t, x; cin >> t >> x;
    cout << (double)t / x << endl;
    return 0;
}



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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod(ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit(ll b, ll i) { return b & (1 << i); }
inline ll ceiv(ll a, ll b) { return (a + b - 1) / b; }
// struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

signed main(){
    int k;
    cin >> k;
    int x = 7;
    rep(i,10000000){
        if(x % k == 0){
            cout << i+1 << endl;
            return 0;
        }
        x = (10 * x + 7) % k;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;

int main() {
    int n, m; cin >> n >> m;
    vector<int> dp(n + 2);
    while (m--) {
        int a; cin >> a;
        dp[a] = -1;
    }
    dp[0] = 1;
    for (int i = 0; i < n; i++) if (dp[i] != -1) {
        if (dp[i + 1] != -1) (dp[i + 1] += dp[i]) %= MOD;
        if (dp[i + 2] != -1) (dp[i + 2] += dp[i]) %= MOD;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
import numpy as np
import bisect
from collections import deque

X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

YZ = Y * Z

def createBitArray(X, Y, Z):
    size = X*Y*Z // 60 + 1
    return(np.zeros(size, 'int64'))

def getBit(R, a, b, c):
    pos = a * YZ + b * Z + c
    loc = pos // 60
    bit = 2 ** (pos % 60)
    return(R[loc] & bit)

def putBit(R, a, b, c):
    pos = a * YZ + b * Z + c
    loc = pos // 60
    bit = 2 ** (pos % 60)
    R[loc] = R[loc] | bit

R = createBitArray(X, Y, Z)

l = []
m = []

M = A[0] + B[0] + C[0]
position = bisect.bisect(l, M)
bisect.insort(l, M)
m.insert(position, (0, 0, 0))
putBit(R, 0, 0, 0)

for i in range(K):
    print(l[len(m)-1])

    a, b, c = m[len(m)-1]

    del l[len(m)-1]
    del m[len(m)-1]

    if a+1 < X and getBit(R, a+1, b, c) == 0:
        M = A[a+1] + B[b] + C[c]
        position = bisect.bisect(l, M)
        bisect.insort(l, M)
        m.insert(position, (a+1, b, c))
        putBit(R, a+1, b, c)

    if b+1 < Y and getBit(R, a, b+1, c) == 0:
        M = A[a] + B[b+1] + C[c]
        position = bisect.bisect(l, M)
        bisect.insort(l, M)
        m.insert(position, (a, b+1, c))
        putBit(R, a, b+1, c)

    if c+1 < Z and getBit(R, a, b, c+1) == 0:
        M = A[a] + B[b] + C[c+1]
        position = bisect.bisect(l, M)
        bisect.insort(l, M)
        m.insert(position, (a, b, c+1))
        putBit(R, a, b, c+1)


Measured memory_bytes: 139904
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
T=get_nsp
N=S.size
ans=0
N.times do|i|
  ans+=1 if S[i]!=T[i]
end
puts ans

Measured memory_bytes: 35284
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<ll> a, b, c, d, e;

int main()
{
    int x, y, z, k;
    cin>>x>>y>>z>>k;

    REP(i,x) {
        ll t;
        cin>>t;
        a.push_back(t);
    }
    REP(i,y) {
        ll t;
        cin>>t;
        b.push_back(t);
    }
    REP(i,z) {
        ll t;
        cin>>t;
        c.push_back(t);
    }

    int w = x * y;
    REP(i,x) REP(j,y) {
        d.push_back(a[i] + b[j]);
    }
    SORT(d);
    int v = z * w;
    REP(i,z) RFOR(j,w,max(w-3001,0)) {
        e.push_back(c[i] + d[j]);
    }
    SORT(e);

    //REP(i,k) cout<<e[i]<<endl;

    int size = e.size();
    for (int i = size - 1; i >= size - k ; i--) {
        cout<<e[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 43384
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll a,su[100001],ans=0;fill(su,su+100001,0);
  for(ll i=0;i<n;i++){
    cin>>a;
    ans+=a;
    su[a]++;
  }
  ll q;cin>>q;
  ll b,c;
  for(ll i=0;i<q;i++){
    cin>>b>>c;
    su[c]+=su[b];
    ans+=su[b]*(c-b);
    su[b]=0;
    cout << ans<<endl;
    
  }
}
  

Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (int)(s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
constexpr long long INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}

#define IN(a, x, b) (a<=x && x<b)

signed main(){
	int N;
	cin >> N;
	string s;
	cin >> s;
	int ni = 0,nj = 0;
	REP(i,N){
		if(IN('A',s[i],'M'+1))ni++;
		else if(IN('N',s[i],'Z'+1))ni--;
		else if(IN('a',s[i],'m'+1))nj++;
		else nj--;
	}
	
	string ans = "";
	if(ni > 0)REP(i,ni)ans += 'A';
	if(ni < 0)REP(i,abs(ni))ans += 'N';
	if(nj > 0)REP(i,nj)ans += 'a';
	if(nj < 0)REP(i,abs(nj))ans += 'n';
	cout << ans.size() << endl;
	cout << ans << endl;
}



Measured memory_bytes: 3312
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int h, a;
	cin >> h >> a;
	if (h % a == 0) cout << h / a << endl;
	else cout << h / a + 1 << endl;
}

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

int32_t main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    long long q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    q *= 8;
    h *= 4;
    s *= 2;
    d *= 1;
    long long c = min({q,h,s,d}), ans = 0;
    if( c == d ){
        ans = n / 2 * d;
        n %= 2;
        c = min({q,h,s});
        if( c == q ) ans += n * q / 2;
        else if( c == h ) ans += n * h / 2;
        else if( c == s ) ans += n * s / 2;
    }
    else if( c == q ) ans = n * q / 2;
    else if( c == h ) ans = n * h / 2;
    else if( c == s ) ans = n * s / 2;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
local function reada(n,m)m=m or 1 r={}for i=1,m do r[i]={}end for i=1,n do for j=1,m do r[j][i]=io.read"*n"end end return unpack(r)end

N=io.read"*n"
a=reada(N)

t=0
s=0
for i=1,N do
	if(a[i]~=t+1)then s=s+1
	else t=t+1 end
end

print(s~=N and s or -1)

Measured memory_bytes: 2304
#include<stdio.h>
int main()
{
	long long int k;
	scanf("%lld", &k);
	long long int i;
	long long int a[100005];
	for (i = 0; i < k; i++)
		scanf("%lld", &a[i]);
	if (a[k - 1] != 2)
	{
		printf("-1\n");
		return 0;
	}
	long long int max, min;
	max = min = 2;
	for (i = k - 1; i >= 0; i--)
	{
		if (max < a[i])
		{
			printf("-1\n");
			return 0;
		}
		min = a[i] * ((min + a[i] - 1) / a[i]);
		if (min - (min % a[i]) > max)
		{
			printf("-1\n");
			return 0;
		}
		max = a[i] * (max / a[i]) + a[i] - 1;
	}
	printf("%lld %lld", min, max);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <deque>

int main(){
  int L;
  scanf("%d", &L);
  double a = (double)L/3;
  printf("%lf\n", pow(a,3));
  return 0;
}


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

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

   int ans = (k % 2 == 0) ? pow(k/2, 2) : (k/2) * (k/2 + 1);

   cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();

        List<String> list = new ArrayList<>(N);

        for (int i = 0; i < N; i++) {
        	list.add(scanner.next());
        }

        if (list.contains("P") && list.contains("W") && list.contains("G") && list.contains("Y")) {
        	System.out.println("Four");
        } else {
        	System.out.println("Three");
        }
	}

}

Measured memory_bytes: 21972
from collections import defaultdict
from collections import deque


def bfs(si):
    q = deque()
    lights = [None for _ in range(N)]
    q.append(si)
    lights[si] = 0

    while len(q) > 0:
        prv_i = q.popleft()
        for i in g[prv_i]:
            if lights[i] is not None:
                continue
            else:
                lights[i] = prv_i
                q.append(i)
    return lights


N, M = map(int, input().split())
g = defaultdict(list)

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

lights = bfs(0)
if None in lights:
    print('No')
else:
    print('Yes')
    [print(val + 1) for val in lights[1:]]


Measured memory_bytes: 43184
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int a,b;
    cin>>a>>b;
    int k; cin>>k;
    int i=min(a,b);
    while(k){
        if(a%i==0&&b%i==0){
            k--;
        }
        if(k==0){
            cout<<i<<endl;
            return 0;
        }
        i--;
    }
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define Rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
using namespace std;

const int N = 100000 + 7;
int n , A[N];

int main() {
    cin >> n;
    Rep(i , 1 , n) scanf("%d" , A + i);
    sort(A + 1 , A + n + 1 , [](int A , int B){ return A > B; });
    Rep(i , 1 , n) if(i + 1 > A[i + 1]) {
            int Ans = 0;
            for(int j = i + 1 ; A[j] == i ; inc(j)) Ans ^= 1;
            Ans |= (A[i] - i) & 1;
            if(Ans) puts("First");
            else puts("Second");
            return 0;
        }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int main(void){
	string S;
	cin >> S;
	int l = (int) S.size();

	vector<int> v = {1, 10, 9, 12, 3, 4};
	vector<vector<int>> dp(l+1, vector<int>(13, 0));
	dp[0][0] = 1;
	for(int i = 0; i < l; i++){
		int pos = l - 1 - i;
		if(S[pos] == '?'){
			for(int n = 0; n <= 9; n++){
				for(int j = 0; j < 13; j++){
				int nj = j + n * v[i%6];
				nj %= 13;
				(dp[i+1][nj] += dp[i][j]) %= MOD;
				}
			}
		}else{
			int n = S[pos] - '0';
			for(int j = 0; j < 13; j++){
				int nj = j + n * v[i%6];
				nj %= 13;
				(dp[i+1][nj] += dp[i][j]) %= MOD;
			}
		}
	}

	cout << dp[l][5] << '\n';

	return 0;
}

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

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using pli=pair<ll,int>;

#define fi first
#define se second
#define pb push_back
#define sz(x) int((x).size())
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define testcase int _;cin>>_;while(_--)
#define all(x) ((x).begin(),(x).end())

/*D-Alter Altar*/
void Solve(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int i=0,j=n-1;
	int moves=0;
	while(i<=j){
		while(i<=j && s[i]=='R')
			i++;
		while(i<=j && s[j]=='W')
			j--;
      	if(i>j)
          break;
		moves++;
		i++,j--;
	}
	cout<<moves<<"\n";
}

int main(){
	fast
	//testcase
		Solve();
	return 0;
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string vowel = "aiueo";
  char c;
  cin >> c;
  if(vowel.find(c) != -1) cout << "vowel" << endl;
  else cout << "consonant" << endl;

  return 0;
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  ll N; in(N);
  if (N % 2) {
    print(0);
    return;
  }
  ll ans = 0;
  ll div = 10;
  while(div <= N) {
    ans += N / div;
    div *= 5;
  }
  print(ans);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int MAXN = 30;

int main(){
  int n, m;
  cin >> n >> m;
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      string s; cin >> s;
      if(s == "snuke"){
        putchar(j + 'A');
        cout << i + 1<< endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		sc.close();
		long ans = 0;
 
		int n = str.length() -1;
      
		for (int i=0; i<(Math.pow(2,n)); i++) {
			String str_first = String.valueOf(str.charAt(0));
			StringBuilder sb = new StringBuilder(str_first);
          
			for (int j=0; j<n; j++) {
				if ((1&i>>j) == 1) {
					sb.append("+");
				}
				sb.append(str.charAt(j + 1));
			}
			String[] subset = sb.toString().split("\\+");
			for (String s : subset) {
				ans += Long.parseLong(s);
			}
		}
		System.out.println(ans);
	}
}

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

int main() {
	long long n; cin >> n;
	if (n % 2 == 0) {
		long long ans = 0;
		long long m = n / 2;
		while (m > 0) {
			ans += m / 5;
			m /= 5;
		}
		cout << ans << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = l()

p.sort(reverse = True)

ms = p[0]
s = [p[0]]

for i in range(n):
    count = 0
    local = 0
    s.sort(reverse = True)
    while count < 2**i:
        if local >= 2**n:
            print("No")
            exit()
        if s[count] > p[local]:
            s.append(p[local])
            p[local] = ms
            count += 1
        local += 1
print("Yes")





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

using namespace std;

int main(){
 long long a, b, c, k;
  cin >> a >> b >> c >> k;
  if (k % 2 == 0) {
    cout << a - b << '\n';
  } else {
    cout << b - a << '\n';
  }
  return 0;
}



Measured memory_bytes: 3612
#include <iostream>
#include <string>

// data structure
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <vector>

#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[]) {
  long long int n, m, x;

  cin >> n >> m >> x;
  std::vector<std::vector<long long int>> a(n, vector<long long int>(m + 1));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m + 1; j++)
      cin >> a.at(i).at(j);
  }

  long long int sum = -1;
  int bit;
  for (bit = 0; bit < (1 << n); ++bit) {
    std::vector<int> v_sum(m+1, 0);
    for (int i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        for (int j = 0; j < m+1; ++j) {
          v_sum.at(j) += a.at(i).at(j);
        }
      }
    }

    if (sum == -1 or sum > v_sum.at(0)) {
      // 熟練度を計算
      bool flag = true;
      for (int i = 1; i < m+1; ++i) {
        if (v_sum.at(i) < x)
          flag = false;
      }
      if (flag)
        sum = v_sum.at(0);
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3572
#include<iostream>

int main(){
	int inp;
	std::cin>>inp;

	//inpの値で条件分岐
	if(inp==1){
		std::cout<<"Hello World"<<std::endl;
	} else if(inp==2){
		int A,B;
		std::cin>>A>>B;
		std::cout<<A+B<<std::endl;
	}

	return 0;
}


Measured memory_bytes: 256
import collections
n=int(input())
a=list(map(int, input().split()))
ans=0
b=[]
c=[]
for i in range(n):
    b.append(i+a[i])
    c.append(i-a[i])
b=collections.Counter(b)
c=collections.Counter(c)
for i in range((10**5)*2):
    ans+=b[i]*c[i]



print(ans)


Measured memory_bytes: 61904
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

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

	vector<int> table(N);
	for(int i=0; i<N; i++)
		cin >> table[i];

	sort(table.begin(), table.end());

	table.erase(unique(table.begin(), table.end()), table.end());

	int ret = 0;
	while(1){
		bool flag = true;
		for(int i=0; i<table.size(); i++){
			if(table[i]%2 == 0)
				table[i] /= 2;
			else{
				flag = false;
				break;
			}
		}

		if(flag == true)
			ret++;
		else
			break;
	}

	cout << ret << endl;

	return 0;
}


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

namespace AtCoder_solve
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split();
            int k = int.Parse(data[0]);
            int s = int.Parse(data[1]);
            long cnt = 0;

            for(int x = 0; x <= k; x++)
            {
                for(int y = 0; y <= k; y++)
                {
                    if (s - x - y >= 0 && s - x - y <= k)
                    {
                        cnt++;
                    }
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


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

int N;
int C[510] = {0},S[510] = {0},F[510]={0};

int main(){
	while(cin >> N){
		int ans[510] = {0};
		for(int i=1;i<=N-1;i++){
			cin >> C[i] >> S[i] >> F[i];
		}
		ans[N] = 0;
		for(int i = 1;i<=N-1;i++){
			int t = C[N-i] + S[N-i];
			ans[N-i] += C[N-i] + S[N-i];//i+1駅までかかる時間
			for(int j=1;j<=i-1;j++){//iからi+j+1までの時間は？
				ans[N-i] += C[N-i+j];//これだけは少なくともかかる
				if(t<S[N-i+j]) ans[N-i] += S[N-i+j]-t;
				else if(i!=1 && t>=S[N-i+j] && t%F[N-i+j] != 0) ans[N-i] += F[N-i+j]-t%F[N-i+j];
				t = ans[N-i];//i+j+1までにかかる時間
			}
		}
		for(int i=1;i<=N;i++){
			cout << ans[i] << endl;
		}
	}
}

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

using namespace std;

int n;
int a[110];
int s, t;
vector<int> adj[110];
long long mf, sum, f, res[110][110];
const long long INF = 1e15;

bitset<110> vis;
int par[110];

void bt(int u){
	if(u == s) return;

	f = min(f, res[par[u]][u]);
	bt(par[u]);

	res[par[u]][u] -= f;
	res[u][par[u]] += f;
}

void maxflow(){
	while(true){
		vis = 0;
		memset(par, -1, sizeof(par));

		queue<int> q;
		q.push(s); vis[s] = true;

		while(!q.empty()){
			int u = q.front(); q.pop();

			for(auto &v : adj[u]){
				if(!vis[v] && res[u][v] > 0)
					q.push(v), vis[v] = true, par[v] = u;
			}

			if(vis[t]) break;
		}

		f = INF;
		if(par[t] == -1) break;
		bt(t);

		mf += f;
	}
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin >> n;

	for(int i = 1; i <= n; i++) cin >> a[i];

	s = 0, t = n + 1;

	for(int i = 0; i <= n + 1; i++)
		for(int j = 0; j <= n + 1; j++)
			res[i][j] = -INF;

	for(int i = 1; i <= n; i++){
		if(a[i] < 0){
			adj[s].emplace_back(i);
			adj[i].emplace_back(s);
			res[s][i] = -a[i];
			res[i][s] = 0;
		} else {
			sum += a[i];
			adj[t].emplace_back(i);
			adj[i].emplace_back(t);
			res[i][t] = a[i];
			res[t][i] = 0;
		}
	}

	for(int i = 1; i <= n; i++)
		for(int j = 2 * i; j <= n; j += i)
			res[i][j] = INF, res[j][i] = 0, adj[i].emplace_back(j), adj[j].emplace_back(i);

	maxflow();

	cout << sum - mf << "\n";

	return 0;
}

Measured memory_bytes: 3756
/* vim:set foldmethod=marker: */
#include <bits/stdc++.h>
using namespace std;

//{{{
#define all(x) (x).begin(),(x).end()
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define RREP(i,a,b) for(int i=(int)(a); i>=b; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;

#define dump(x) (cerr << #x << "=" << x << endl)
template<class T> ostream& osContainer(ostream& os,T c) { os<<'[';for(decltype(c.begin()) it=c.begin();it!=c.end();it++)os<<*it<<',';os<<']';return os; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { return osContainer(os,v); }
template<class T> ostream& operator<<(ostream& os,const set<T>& s) { return osContainer(os,s); }
template<class T> ostream& operator<<(ostream& os,const multiset<T>& s) { return osContainer(os,s); }
template<class T,class S> ostream& operator<<(ostream& os,const map<T,S>& m) { return osContainer(os,m); }
template<class T,class S> ostream& operator<<(ostream& os,const multimap<T,S>& m) { return osContainer(os,m); }
template<class T1,class T2>
ostream& operator<<(ostream& os, const pair<T1,T2>& p){ os << '(' << p.first << ',' << p.second << ')'; return os; }

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

int s[1000 + 1];

void prepare()
{
    s[0] = 0;
    s[1] = 1;

    REP(i, 2, 1001) {
        s[i] = s[i-1] + i;
    }
}

void solve()
{
    int n;

    while (cin >> n, n)
    {
        int res = 0;
        REP(i, 1, 1001) {
            if (s[i] >= n) break;

            if ((n - s[i]) % (i + 1) == 0) res++;
        }

        cout << res <<  endl;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(12);
    prepare();
    solve();
}

Measured memory_bytes: 3188
from sys import stdin


def get_result(data):
    X, Y, Z = data
    return str(Z) + ' ' + str(X) + ' ' + str(Y)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


Measured memory_bytes: 2940
N = int(input())
H = list(map(int, input().split()))

max_h = -1
h = 0
for i in range(0, N-1):
    if H[i] >= H[i+1]:
        h += 1
    else:
        if h > max_h:
            max_h = h
        h = 0
if h > max_h:
    max_h = h
print(max_h)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main(void){
	string ans = "";
	rep(i, 3){
		string s; cin >> s;
		ans += s[0];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# 整数 a と、英小文字からなる文字列 s が入力されます。
# 入力は以下の形式で標準入力から与えられる。
a = gets.chomp.to_i
s = gets.chomp

# a が 3200 以上なら s と出力し、a が 3200 未満なら red と出力せよ。
if a >= 3200
  puts s
else
  puts 'red'
end

Measured memory_bytes: 1788