akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 200005
using namespace std;
typedef long long ll;
int n;
struct data{
	int a,id,b;
}d[maxn];
bool cmp(const data &x,const data &y){
	return x.a < y.a;
}
bool cmp2(const data &x,const data &y){
	return x.id < y.id;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&d[i].a);
		d[i].id = i;
	}
	sort(d+1,d+n+1,cmp);
	int m = n>>1;
	for(int i=1;i<=m;i++) d[i].b = d[m+1].a;
	for(int i=m+1;i<=n;i++){
		d[i].b = d[m].a;
	}
	sort(d+1,d+n+1,cmp2);
	for(int i=1;i<=n;i++){
		printf("%d\n",d[i].b);
	}
	return 0;
}


Measured memory_bytes: 4480
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (ll i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
struct edge {int to,cost;};
#define VMAX 51
//typedef std::pair<int,int> P;

    ll X,Y;
    ll ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>X>>Y;
    ll temp=X;

    while(temp<=Y){
        ans++;
        temp*=2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int a, b = 1000000001, c = 0, e;
	cin >> a;
	for (int h = 1; h <= a; h++) {
		cin >> e;
		b = min(b, e);
		c = max(c, e);
	}
	cout << c - b << "\n";
	cin >> e;
}

Measured memory_bytes: 256
#include<cstdio>
#define N 500000
#define LL long long
using namespace std;

LL mod=1e9+7;
LL fac[N+5],facinv[N+5];
LL ksm(LL x,LL y)
{
	LL res=1;
	while(y)
	{
		if(y&1) res=res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
LL A(int x,int y)
{
	return fac[x]*facinv[x-y]%mod;
}
LL C(int x,int y)
{
	return fac[x]*facinv[y]%mod*facinv[x-y]%mod;
}
int n,m;
int main()
{
	int i;
	fac[0]=1;
	for(i=1;i<=N;i++)
		fac[i]=fac[i-1]*i%mod;
	facinv[N]=ksm(fac[N],mod-2);
	for(i=N-1;i>=0;i--)
		facinv[i]=facinv[i+1]*(i+1)%mod;
	scanf("%d%d",&n,&m);
	LL ans=A(m,n);
	for(i=1;i<=n;i++)
	{
		if(i&1) ans=(ans-C(n,i)*A(m-i,n-i)%mod+mod)%mod;
		else ans=(ans+C(n,i)*A(m-i,n-i))%mod;
	}
	printf("%lld\n",ans*A(m,n)%mod);
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  double a,b;
  a=N+1;
  b=2*N;
  if(N%2==0){
    cout << 0.5;
  }
  if(N==1){
    cout << 1.0;
  }
  if(N!=1 && N%2==1){
    cout << a/b;
  }
}


Measured memory_bytes: 256
N , K = map(int, input().split())
p = list(map(int, input().split()))
Etop = 0
E = 0
q = []
Ruiseki = 0
S = []
Top = 0
for i in p:
    q.append((i+1) / 2)

for E in q:
    Ruiseki += E
    S.append(Ruiseki)

if N == K:
    print(S[N-1])
    quit()
else:
    for j in range(N-K):
        Sig = S[K+j] - S[j]
        if Sig > Top:
            Top = Sig

print(Top)

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

int main(void) {
	int n, max_player,a,b,max=-1;
	cin >> n;
	while (n) {
		cin >> a >> b;
		if (b > max) {
			max_player = a;
			max = b;
		}
		else if (b == max) {
			if (max_player > a)max_player = a;
		}
		n--;
	}
	cout << max_player << " " << max << endl;

}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int a[14], p;

int main(){
  char str[514];
  while(fgets(str, sizeof(str), stdin) && str[0] != '0'){
    memset(a, 0, sizeof(a));
    char *tp;
    tp = strtok(str, " ");
    while(tp != NULL){
      a[atoi(tp)]++;
      tp = strtok(NULL, " ");
    }

    //    rep(i, p) printf("%d ", a[i]); puts("");
    int res = 0;
    a[10] += a[11]; a[10] += a[12]; a[10] += a[13];
    REP(i, 2, 11) res += a[i]*i;
    //    printf("%d\n", res);
    //    printf("%d\n", a[1]);

    int one = 11*a[1];
    while(res+one > 21 && one != a[1]){
      one -= 10;
    }
    //    printf("%d\n", res+one);
    res += one;
    if(res > 21) res = 0;

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

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

using namespace std;

using int64 = long long;

struct Combination {
  int mod;
  vector< int64_t > mfact, rfact;

  Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod) {
    mfact[0] = 1;
    for(int i = 1; i < mfact.size(); i++) {
      mfact[i] = mfact[i - 1] * i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for(int i = sz - 1; i >= 0; i--) {
      rfact[i] = rfact[i + 1] * (i + 1) % mod;
    }
  }

  int64_t fact(int k) const {
    return (mfact[k]);
  }

  int64_t pow(int64_t x, int64_t n) const {
    int64_t ret = 1;
    while(n > 0) {
      if(n & 1) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int64_t inv(int64_t x) const {
    return (pow(x, mod - 2));
  }

  int64_t P(int n, int r) const {
    if(r < 0 || n < r) return (0);
    return (mfact[n] * rfact[n - r] % mod);
  }

  int64_t C(int p, int q) const {
    if(q < 0 || p < q) return (0);
    return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
  }

  int64_t H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return (r == 0 ? 1 : C(n + r - 1, r));
  }
};

const int mod = 1e9 + 7;


int main() {
  int N, M, K;
  cin >> N >> M >> K;
  
  Combination beet(1010101, mod);
  int64 pow3[1010101];
  pow3[0] = 1;
  for(int i = 1; i < 1010101; i++) pow3[i] = pow3[i - 1] * 3 % mod;

  pair< int, int > ask[2][1010101];

  auto get = [&](int x, int y, bool t) {
    if(x == 0) {
      int64 ret = 0;
      for(int j = 0; j <= y; j++) {
        ret += beet.C(x, j);
        ret %= mod;
      }
      ask[t][x] = {y, ret};
      return ret;
    } else {
      int64 ret = ask[t][x - 1].second * 2 % mod;
      ret += mod - beet.C(x - 1, ask[t][x - 1].first);
      ret %= mod;
      while(y < ask[t][x - 1].first) {
        ret += mod - beet.C(x, ask[t][x - 1].first);
        ret %= mod;
        --ask[t][x - 1].first;
      }
      while(ask[t][x - 1].first < y) {
        ++ask[t][x - 1].first;
        ret += beet.C(x, ask[t][x - 1].first);
        ret %= mod;
      }
      ask[t][x] = {y, ret};
      return ret;
    }
  };

  int64 ret = 0;
  for(int i = N; i <= N + M + K; i++) {
    int64 add = 0;
    add += get(i - N, min(M, i - N), true);
    add += mod - get(i - N, max(0, i - N - K) - 1, false);
    add %= mod;

    add *= beet.C(i - 1, N - 1);
    add %= mod;

    add *= pow3[N + M + K - i];
    add %= mod;


    ret += add;
    ret %= mod;
  }

  cout << ret << endl;
}

Measured memory_bytes: 39680
#include<bits/stdc++.h>
using namespace std;
int a[100001],b[100001];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a,a+n);
	int ans=1;
	for(int i=1;i<=n;i++)
	{
		b[a[i]]++;
	}
	for(int i=1;i<=100000;i++)
		ans=max(b[i-1]+b[i]+b[i+1],ans);
	cout<<ans;
} 

Measured memory_bytes: 1024
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numX = scanner.nextInt();

			if (numX - numA <= numB && numA <= numX) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numM = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numM = scanner.nextInt();
			numX = scanner.nextInt();

			Set<Integer> wk = new HashSet<Integer>();

			for (int i = 0; i < numM; i++) {
				wk.add(scanner.nextInt());
			}
			int res1 = 0;
			for (int i = numX; i <= numN; i++) {
				if (wk.contains(i)) {
					res1++;
				}

			}
			int res2 = 0;
			for (int i = 0; i <= numX; i++) {
				if (wk.contains(i)) {
					res2++;
				}

			}

			System.out.println(Math.min(res1, res2));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23636
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;

void solve() {
	int n, x; cin >> n >> x;
	int d = 0;
	int ans = 1;
	rep(i, n) {
		int l; cin >> l; d += l;
		if (d <= x)ans++;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(9);
	//init();
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <cstring>
#include <iomanip>
using namespace std;
 
//#define int long long
#define double long double
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << '\n';
#define fi first
#define se second
#define pb push_back
//typedef long long ll;
typedef pair<int, int> pii;
 
void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}

signed main() {
	fast();
	int x;
	cin >> x;
	cout << 1 - x;
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const int N=3050;
int fap(int a,int b,int c){
    int s=1;
    for (; b; b>>=1,a=1ll*a*a%c)
	if (b&1) s=1ll*s*a%c;
    return s;
}
int s[N][N],c[N][N],mo,n;
int main(){
    cin>>n>>mo;
    for (int i=0; i<=n+1; ++i){
	c[i][0]=1,s[i][i]=1;
	for (int j=1; j<=i; ++j){
	    c[i][j]=(c[i-1][j-1]+c[i-1][j])%mo;
	    s[i][j]=(1ll*s[i-1][j]*j+s[i-1][j-1])%mo;
	}
    }
    int ans=0,sum;
    for (int i=0; i<=n; ++i){
	sum=0;
	for (int j=1; j<=i+1; ++j)
	    (sum+=1ll*s[i+1][j]*fap(2,1ll*(j-1)*(n-i)%(mo-1),mo)%mo)%=mo;
	sum=1ll*c[n][i]*sum%mo*fap(2,fap(2,n-i,mo-1),mo)%mo;
	if (i&1) sum=mo-sum;
	(ans+=sum)%=mo;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 71040
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
   int A, B, C, X;
   cin >> A >> B >> C >> X;
   int ans = 0;
   for (int i = 0; i <= A; i++) {
      for (int j = 0; j <= B; j++) {
         for (int k = 0; k <= C; k++) {
            if (500 * i + 100 * j + 50 * k == X) ans++;
         }
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
program honest_or_unkind_2
  implicit none
  integer :: n, a, x, y, m = 0, t(15,15) = -1, u, i, j, k
  read(*,*) n
  do i = 1, n
    read(*,*) a
    do j = 1, a
      read(*,*) x, y
      t(i,x) = y
    end do
  end do
  u = lshift(1,n)-1
  do k = 0, u
    do i = 1, n
      do j = 1, n
        if (t(i,j) < 0) cycle
        if (btest(k,i-1)) then
          if (btest(k,j-1) .eqv. t(i,j) == 0) goto 100
        end if
      end do
    end do
    m = max(m,popcnt(k))
100 end do
  write(*,'(i0)') m
end program honest_or_unkind_2

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

#define int long long
#define REP0(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
int n;
int a[2002];
int dp[2002][2002];

signed main(){
  cin>>n;
  REP0(i,n)cin>>a[i];
  REP1(j,n){
    REP0(i,n){
      if(j==1){
        dp[i][1]=a[i];
      }else if(j==2){
        dp[i][2]=max(a[i],a[(i+1)%n]);
      }else{
        dp[i][j]=max(
          a[i]+(a[(i+1)%n]>a[(i+j-1)%n]?dp[(i+2)%n][j-2]:dp[(i+1)%n][j-2]),
          a[(i+j-1)%n]+(a[i]>a[(i+j-2)%n]?dp[(i+1)%n][j-2]:dp[i][j-2])
        );
      }
    }
  }
  int m=0;
  REP0(i,n)m=max(m,dp[i][n]);
  cout<<m<<endl;
  return 0;
}

Measured memory_bytes: 34388
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int N;
	int fourBaisuu = 0;
	int guusuuSum = 0;
	string ans = "No";
	cin >> N;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
		if (a[i] % 4 == 0)
			fourBaisuu++;
		else if (a[i] %2==0)
			guusuuSum++;
	}
	int temp = N / 2;
	if (fourBaisuu >= temp) {
		ans = "Yes";
	}
	else if (guusuuSum > 1 && fourBaisuu*2 + guusuuSum >= N) {
		ans = "Yes";
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
require 'prime'

X = gets.to_i

max = 1

for i in 2..X do
  ary = Prime.prime_division(i)

  if ary.all? {|i| i[1] == ary[0][1] && i[1] >= 2} then
    tmp = 1
    ary.map { |e|
      tmp *= e[0]**e[1]
    }
    max = [max, tmp].max
  end
  
end

p max

Measured memory_bytes: 2300
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        var n = sc.nextInt();
        var h = new int[n];
        var gap = new long[n];

        bool flag = false;
        bool ans = true;
        long tmp = 0;
        for (int i = 0; i < n; i++)
        {
            h[i] = sc.nextInt();
            if (i > 0) gap[i] = h[i] - h[i - 1];
            if (gap[i] <= -1)
            {
                flag = true;
            }
            if (flag) tmp += gap[i];
            if (tmp < -1)
            {
                ans = false;
                break;
            }
            else if (tmp >= 0)
            {
                flag = false;
                tmp = 0;
            }
        }

        if (ans) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 27744
import numpy as np
N, W = map(int, input().split())
dp = np.ones(10**5+1, dtype=np.int64) * np.inf
dp[0] = 0
for _ in range(N):
    w,v = map(int, input().split())
    np.minimum(dp[v:], dp[:-v] + w , dp[v:])
print(max(np.where(dp <= W)[0]))

Measured memory_bytes: 14000
M, D = map(int, input().split())

c = 0
for i in range(1, M + 1):
    for j in range(1, D + 1):
        D01 = j % 10
        D10 = j // 10
        if D01 >= 2 and D10 >= 2:
            if D01 * D10 == i:
                c += 1

print(c)


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main() {
    int n, a;
    cin >> n >> a;
    if ((n % 500) <= a) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    //    ifstream in("input.txt");
    //    cin.rdbuf(in.rdbuf());
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> p(n);
    int sum = 0;
    int max_val = 0;
    rep(i, n)
    {
        cin >> p[i];
        sum += p[i];
        max_val = max(max_val, p[i]);
    }
    
    sum -= max_val / 2;
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

template <typename T>
struct swag {
    struct node {
        T val, sum;
        node(const T &val, const T &sum) : val(val), sum(sum) {}
    };
    using F = function<T(T, T)>;
    F op;
    stack<node> front_stack, back_stack;
    swag(const F &op) : op(op) {}
    bool empty() const { return front_stack.empty() && back_stack.empty();}
    size_t size() const { return front_stack.size() + back_stack.size();}
    T fold() const {
        assert(!empty());
        if (front_stack.empty()) {
            return back_stack.top().sum;
        } else if (back_stack.empty()) {
            return front_stack.top().sum;
        } else {
            return op(front_stack.top().sum, back_stack.top().sum);
        }
    }
    void push(const T &x) {
        if (back_stack.empty()) {
            back_stack.emplace(x, x);
        } else {
            T s{op(back_stack.top().sum, x)};
            back_stack.emplace(x, s);
        }
    }
    void pop() {
        assert(!empty());
        if (front_stack.empty()) {
            front_stack.emplace(back_stack.top().val, back_stack.top().val);
            back_stack.pop();
            while (!back_stack.empty()) {
                T s{op(back_stack.top().val, front_stack.top().sum)};
                front_stack.emplace(back_stack.top().val, s);
                back_stack.pop();
            }
        }
        front_stack.pop();
    }
};

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

    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    auto f = [](int a, int b) { return a + b;};
    swag<int> sw(f);
    int ans = n+1;
    int r = 0;
    for (int l = 0; l < n; ++l) {
        while (r < n && (sw.empty() || sw.fold() < s)) sw.push(a[r++]);
        if (sw.fold() < s) break;
        chmin(ans, (int)sw.size());
        sw.pop();
    }
    cout << (ans == n+1 ? 0 : ans) << endl;
}



Measured memory_bytes: 4200
#include <iostream>

using namespace std;

int main()
{
    int a[5];
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    for (int i = 4; i > 0; i--) {
        for (int j = 0; j < i; j++) {
            if (a[j] < a[j+1]) {
                swap(a[j], a[j+1]);
            }
        }
    }
    
    for (int i = 0; i < 5; i++) {
        if (i > 0) cout << " ";
        cout << a[i];
    }
    cout << endl;
    return 0;
}

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

int main(){
  long long x,y;
  cin >> x >> y;
  
  int cnt=0;
  while (x<=y){
    x*=2;
    cnt++;
    if (x>y){
      break;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var S string
	fmt.Scan(&S)
	count0 := count(S, "0")
	count1 := count(S, "1")
	fmt.Println(min(count0, count1) * 2)
}

func count(s, t string) int {
	var ret int
	for i := 1; i <= len(s); i++ {
		if s[i-1:i] == t {
			ret++
		}
	}
	return ret
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 2492
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int W = stdIn.nextInt();
		int H = stdIn.nextInt();
		int x = stdIn.nextInt();
		int y = stdIn.nextInt();
		int r = stdIn.nextInt();
		stdIn.close();
		boolean isOk = false;

		//縦チェック
		if ((((y-r) >= 0)  && ((y+r) <= H)) && (((x-r) >= 0)  && ((x+r) <= W)))  isOk =true;

		if (isOk) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26360
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>
#include <random>

#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14


using namespace std;


pair<int, long long> getFarthestNode(int from, vector<bool> &visited, const vector<vector<pair<int, int>>> &tree) {
    visited[from] = true;

    int farthest_node = from;
    long long farthest_distance = 0;

    for(pair<int, int> p1 : tree[from]) {
        int middle = p1.first;
        long long middle_w = p1.second;
        if (visited[middle]) { continue; }

        pair<int, long long> p2 = getFarthestNode(middle, visited, tree);
        int to = p2.first;
        long long to_w = p2.second;

        // form -> middle -> toの距離
        long long distance = middle_w + to_w;
        
        if (distance > farthest_distance) {
            farthest_node = to;
            farthest_distance = distance;
        }
    }

    return make_pair(farthest_node, farthest_distance);
}


/**
 * 木の直径を求める
 * @param num_of_node ノードの数
 * @param tree tree[node1] = [(node2, weight2), (node3, weight3), ...]
 * @return 
 */
long long tree_diameter(unsigned int num_of_node, const vector<vector<pair<int, int>>> &tree) {
    vector<bool> visited(num_of_node, false);
    pair<int, long long> p1 = getFarthestNode(0, visited, tree);

    visited = vector<bool>(num_of_node, false);
    pair<int, long long> p2 = getFarthestNode(p1.first, visited, tree);

    return p2.second;
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);


    int n;
    cin >> n;

    vector<vector<pair<int, int>>> tree(n);

    FOR(i, 0, n - 1) {
        int s, t, w;
        cin >> s >> t >> w;
        tree[s].emplace_back(make_pair(t, w));
        tree[t].emplace_back(make_pair(s, w));
    }

    cout << tree_diameter(n, tree) << endl;

    return 0;
}


Measured memory_bytes: 15864
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<int>V(10);
    for(int i=1;i<10;i++)cin>>V[i];
    if(V[1]-V[4]==V[2]-V[5]&&V[2]-V[5]==V[3]-V[6]&&V[1]-V[7]==V[2]-V[8]&&V[2]-V[8]==V[3]-V[9])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int A,B;
    cin >>  A >> B;
    Yes((A*B)%2==1);
    return 0;
}   

Measured memory_bytes: 256
// https://atcoder.jp/contests/tenka1-2017-beginner/tasks/tenka1_2017_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> v(n);
    REP(i, n) cin >> v[i].first >> v[i].second;
    sort(ALLR(v));
    cout << v[0].first + v[0].second << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
using Graph = vector<vector<ll> >;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

//input
string n;
ll l;

ll dp[1000100][2];

int main(){
    cin >> n;
    l = n.size();
    rep(i,1000100){
        rep(j,2){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    dp[0][1]=1;
    for(int i=1;i<=l;i++){
        int now = n[i-1]-'0';
        chmin(dp[i][1],dp[i-1][0]+10-now);
        chmin(dp[i][1],dp[i-1][1]+9-now);

        chmin(dp[i][0],dp[i-1][1]+now+1);
        chmin(dp[i][0],dp[i-1][0]+now);
    }
    ll ans = INF;
    chmin(ans,dp[l][0]);
    chmin(ans,dp[l][1]+1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20004
#include <iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;

bool judge(string s, int count){
	if(isalpha(s[s.size() - 1])){
		if(s.size() >= 3 && s.size() <= 6){
			if(count != 0) cout << " ";
			cout << s ;
			return true;
		}
		return false;
	}else{
		if(s.size() >= 4 && s.size() <= 7){
			if(count != 0) cout << " ";
			for(int i = 0; i < s.size() - 1; i++){
				cout << s[i];
			}
			return true;
		}
		return false;
	}
}

int main(){
	string s;
	vector<string> vs;
	while(cin >> s){
		vs.push_back(s);
	}
	int count = 0;
	for(vector<string>::size_type i = 0;
		i < vs.size(); i++)
	{
		if(judge(vs[i],count)){
			count++;
		}
		if(i == vs.size() - 1 ) cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
#endif

int main(){
    int n; cin >> n;
    vector<map<char, int>> vm(n);
    for(int i=0;i<n;i++){
        string s; cin >> s;
        for(char c : s){
            vm[i][c]++;
        }
    }
    for(char c='a';c<='z';c++){
        int num = M;
        for(int i=0;i<n;i++){
            num = min(num, vm[i][c]);
        }
        for(int i=0;i<num;i++){
            cout << c;
        }
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

int N, M;
ll ans;

string s, t;

int main()
{
    cin >> s >> t;
    cout << t << s << endl;
}

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

int main() {
    ll K;
    cin >> K;
    ll num = 7%K;
   
    for(int i = 1; i <= K; i++){

        if(num%K == 0){
            cout << i << endl;
            return 0;            
        }
       
        num = (num*10 + 7)%K;
    } 

    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int jishu[100001],qian[100001];
int zs(int a){//输入一个数a，运行完毕后在数组里有小于a的质数，返回小于a的质数的个数 
	int sum=0;
	int i,j;
	for(i=2;i<=sqrt(a);i++){
		if(jishu[i]==0) continue;
		for(j=i*2;j<=a;j+=i){
			jishu[j]=0;
		} 
	}
	return sum;
}
int main(){
	for(int i=1;i<=100000;i++) jishu[i]=1;
	zs(100000);
	jishu[1]=0;
	int n;
	cin>>n;
	qian[1]=0;
	for(int i=2;i<=100000;i++){
		if(jishu[i]&&jishu[(i+1)/2])
			qian[i]=qian[i-1]+1;
		else
			qian[i]=qian[i-1];
	}
	for(int i=1;i<=n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		printf("%d\n",qian[b]-qian[a-1]);
	}
	return 0;
}

Measured memory_bytes: 4568
#include<bits/stdc++.h>
using namespace std;
long long int a,b,n,ans,temp;
int main()
{
    cin>>n>>a>>b;
    if(a>b) cout<<"0"<<endl;
    else if(a!=b && (n==1)) cout<<"0"<<endl;
    else    cout<<(b-a)*(n-2)+1<<endl;
return 0;
}


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

int main() {
    ll N; cin >> N;
    ll upper = floor(N / 100);
    ll lower = N % 100;
    bool upper_flg = false; 
    bool lower_flg = false;
    if(0 < upper && upper < 13) upper_flg = true;
    if(0 < lower && lower < 13) lower_flg = true;

    if(upper_flg && lower_flg) cout << "AMBIGUOUS" << endl;
    else if(!upper_flg && !lower_flg) cout << "NA" << endl;
    else if(upper_flg) cout << "MMYY" << endl;
    else if(lower_flg) cout << "YYMM" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;

int main(){
    int a,b;
    char p;
    cin >> a >> p >> b;
    int ans = p=='+' ? a+b:a-b;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
l = []
for i in range(m):
    _, *s = [int(x)-1 for x in input().split()]
    l.append(s)
p = [int(x) for x in input().split()]

ans = 0
for i in range(2**n):
    d = 0
    q = i
    r = [0] * m
    while q > 0:
        s = q & 1
        if s == 1:
            for j in range(m):
                if d in l[j]:
                    r[j] += 1
        d += 1
        q >>= 1
    c = 0
    for j in range(m):
        if p[j] == (r[j] % 2):
            c += 1
    if c == m:
        ans += 1
print(ans)


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

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

  string s; cin >> s;
  string t = "keyence";

  string kk;
  for(int i = 0; i < 7; i++){
    kk += s[i];
  }
  if(kk == t){
    cout << "YES" << endl;
    return 0;
  }

  string l;
  for(int i = s.size()-7; i < s.size(); i++){
    l += s[i];
  }
  if(l == t){
    cout << "YES" << endl;
    return 0;
  }

  string ans;
  int sc = 0,tc = 0;
  while(s[sc] == t[tc]){
    ans += s[sc];
    sc++,tc++;
  }

  string ans2;
  int k = 7 - sc;
  sc = s.size()-1,tc = t.size()-1;
  while(s[sc] == t[tc]){
    ans2 += s[sc];
    sc--,tc--,k--;
    if(k <= 0) break;
  }

  reverse(ans2.begin(),ans2.end());
  //cout << (ans + ans2) << endl;
  if(t == (ans + ans2)){
    cout << "YES" << endl;
    return 0;
  }


  cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a, b, ans = 1, j = 2, i;
	scanf("%d %d" , &a, &b);
	
	for(i = 0; i < a;i++){
		if(ans < b){
			ans = 1;
			ans = ans * j;
			j *= 2;
		}else{
			ans += b;
		}
	}

	printf("%d", ans);
	
	
	return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
#define pb push_back
#define fi first
#define se second
using ii = pair <int , int>;
int n,truth[N];
vector <ii> v[N];

void work() {
   int sol = 0;
   for (int mask = 0 ; mask < (1 << n) ; mask++) {
      memset (truth , -1 , sizeof truth);
      bool pos = true;
      for (int i = 0 ; i < n ; i++) {
         if (mask & (1 << i)) {
            truth[i] = 1;
         } else {
            truth[i] = 0;
         }
      }
      for (int i = 0 ; i < n ; i++) {
         if (mask & (1 << i)) {
            for (auto x : v[i]) {
               if (truth[x.fi] != x.se) pos = false;
            }
         }
      }
      if (pos) {
         // for (int i = n - 1 ; i >= 0 ; i--) {
         //    printf(mask & (1 << i) ? "1" : "0");
         // } puts("");
         // printf(" >> %d\n" , mask);
         sol = max(sol , __builtin_popcount(mask));
      }
   }
   printf("%d\n" , sol);
   return;
}

int main() {
   scanf("%d" , &n);
   for (int i = 0 ; i < n ; i++) {
      int p; scanf("%d" , &p);
      while (p--) {
         int u,x; scanf("%d%d" , &u , &x);
         v[i].pb({u - 1 , x});
      }
   }
   work();
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int x;
	int i;
	int n[101]={0};
	scanf("%d",&x);
	for(i=0;i<x;i++){
		scanf("%d",&n[i]);
	}
	for(i<0;i--;){
		printf("%d",n[i]);
		if(i!=0)printf(" ");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include<stdio.h>

int main(void){
        long int n,y,i,j,k;

        scanf("%ld%ld",&n,&y);
        y=y/1000;
        k=y-n;

    for(i=0;i<=k;i++){
        for(j=0;j<=k;j++){
                if((k==i*9+j*4)){
                        if(n-i-j<0){continue;}
                    printf("%ld %ld %ld",i,j,(n-i-j));
                    return 0;

            }
        }
    }

        printf("-1 -1 -1");

        return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }
using ll = long long;
const ll MOD=1e9+7;
const long long INF = 1LL<<60;

int main() {
    string s;
    cin >> s;

    if(int(s.size())==2){
        cout << s << endl;
    }else{
        for(int i = 0;i<int(s.size());i++){
            cout << s.at(int(s.size())-1-i);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
INF = 1145141919810893

H,N = map(int,input().split())
A=[]
B=[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

#dp[i]=体力がちょうどiのモンスターを倒すのに必要な魔力の最小値
#もしそのような魔力が存在しない場合、INF
#INFは10^9くらいあれば足りると思う(適当)
dp = [INF]*20000
dp[0]=0
#体力が0のモンスターを倒すのに必要な魔力は0
#iは小さい順に決定することができる
#なぜなら、i<jのとき決定したdp[j]の値はdp[i]に影響しないから
for i in range(H):
    #dp[H]から配る遷移は、必ずdp[H]より大きい値を配ることになるので、不要
    #よってH-1までやればOK
    #dp[i]の値はこの時点で確定する
    if dp[i]==INF:
        continue
    for j in range(N):
        #いわゆる配るDP
        dp[i+A[j]]=min(dp[i+A[j]],dp[i]+B[j])

#これで答えはdp[H]であるかというと、そうとは限らない
#なぜなら、dp[H+1]に行くコストがdp[H]に行くコストより安いかもしれないから
#今回は「与えるダメージがH以上」で条件を達成することができる
#なので、H以上のdpについて精査して、最もコストが低いものが答えである
Ans=INF
for d in dp[H:]:
    Ans=min(Ans,d)
print(Ans)




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

int main()
{
  int nAmin, nAmax, nBmin, nBmax;
  cin >> nAmin >> nAmax >> nBmin >> nBmax;

  int nSameTime = min(nAmax, nBmax) - max(nAmin, nBmin);
  if (nSameTime < 0)  nSameTime = 0;

  cout << nSameTime << endl;

  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();
        int X = cin.nextInt();

        int sum = 0;

        int i = 1;
        for (; i <= N; ++i)
        {
            int L = cin.nextInt();

            sum += L;

            if (X < sum)
            {
                break;
            }
        }

        WriteLine(i);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int g,t=-192839,n,a[109000];
	while(1)
	{
	cin>>n;
	if(n==0)
		break;
	for(int i=0;i<n;i++)
		cin>>a[i];
	t=-192839;
	for(int i=0;i<n;i++)
	{
		g=0;
		for(int j=i;j<n;j++)
		{
			g+=a[j];
			t=max(g,t);
		}
	}
	cout<<t<<endl;	
	}
	return 0;
}

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

int main() {
	int n; cin >> n;
    vector<double> vet(n);
    for(int i = 0; i < n; i++) cin >> vet[i];
    sort(vet.begin(), vet.end());
    for(int i = 0; i < n - 1; i++){
        vet[i + 1] = (vet[i] + vet[i + 1]) / 2.0;
    }
    cout << vet[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    int n;
    int i;
    int ans;

    cin >> n >> i;
    ans = n-i+1;
    cout << ans << endl;

    return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           Console.WriteLine(ABC057_C());
        }
        
        static int ABC057_C()
        {
            var N = double.Parse(Console.ReadLine());
            var min = int.MaxValue;
            for (var a = 1; a <= int.Parse(((int)Math.Sqrt(N)).ToString()); a++)
            {
                var b = N / a;
                var keta = Math.Max(a.ToString().Length, b.ToString().Length);
                min = Math.Min(min, keta);
            }
            return min;
        }
    }
}

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

/*
delete 演算子はNULLを渡したとき何も行われないことが保証されている
unme　　属している集合の要素数
setnum 集合数
*/
class union_find
{
	int  _setnum;
	vector<int> par, nume;
public:
	union_find(){
	}
	
	union_find(int x){
		par.resize(x);
		nume.resize(x);
		init();
	}
	
	~union_find(){
		//
		
	}
	
	void clear(){
		_setnum = 0;
		par.clear();
		nume.clear();
	}
	
	void init(){
		_setnum = par.size();
		for(int i = 0; i < par.size(); i++){
			par[i] = i;
			nume[i] = 1;
		}
	}
	
	void resize(int x){
		
		par.resize(x);
		nume.resize(x);
		init();
	}

	int find(int x){
		return par[x] == x ? x : par[x] = find(par[x]);
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
	
		if(x == y)return;
		
		_setnum--;
		
		if(nume[x] > nume[y]) std::swap(x,y);
		
		par[x] = y;
		nume[y] += nume[x];
	}
	
	bool same(int x, int y){
		return find(x) == find(y);
	}
	
	int numel(int x){
		return nume[find(x)];
	}
	
	int size(){
		return par.size();
	}
	
	int setnum(){
		return _setnum;
	}
};

int main(){
	
	int n, q, com, x, y;
	
	cin>>n>>q;
	
	union_find uf(n);
	
	for(int i = 0; i < q; i++){
		cin>>com>>x>>y;
		
		if(com == 0){
			uf.unite(x,y);
		} else if(com == 1){
			cout<<uf.same(x,y)<<endl;
		}
	}
	return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int R, G;
  cin >> R >> G;
  cout << G * 2 - R << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( (ll)( 1e9 + 7 ) )


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

	vector<int> v( N );
	rep( i, N ) { cin >> v[i]; }

	int counter = 0;
	int max = 0;

	rep( i, N )
	{
		if ( chmax( max, v[i] ) )
		{
			++counter;
		}
	}

	cout << counter << endl;

	return ( 0 );
}


Measured memory_bytes: 888