akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define SIZE(a) (int)((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}

class BIT
{
  private:
    vector<int> bit;
    int len;
  public:
    BIT(int n) {
      len = n+1;
      bit = vector<int>(len);
    }
    void add(int i, int x) {
      i += 1;
      while (i <= len) {
        bit[i] += x;
        i += i & -i;
      }
    }
    int sum(int i) {
      i += 1;
      int s = 0;
      while (i > 0) {
        s += bit[i];
        i -= i & -i;
      }
      return s;
    }
};

int inversion_num(const vector<int>& p)
{
  int n = SIZE(p);
  BIT bit(n);
  int s = 0;
  rep(i, 0, n) {
    bit.add(p[i], 1);
    s += (i+1 - bit.sum(p[i]));
  }

  return s;
}



signed main()
{
  string S; cin >> S;

  vector<int> num(26, 0);
  rep(i, 0, SIZE(S)) {
    num[S[i] - 'a']++;
  }

  int odd_num = 0;
  rep(i, 0, 26) {
    if (num[i] % 2 == 1) {
      odd_num++;
    }
  }
  if (odd_num >= 2) {
    cout << -1 << endl;
    return 0;
  }

  vector<int> cnt(26, 0);
  vector< pair<int,char> > A, B, C;
  rep(i, 0, SIZE(S)) {
    int n = num[S[i] - 'a'];
    int count = ++cnt[S[i] - 'a'];
    if (n % 2 == 1 && (n+1)/2 == count) {
      B.push_back(make_pair(i, S[i]));
    } else if (n/2 >= count) {
      A.push_back(make_pair(i, S[i]));
    } else {
      C.push_back(make_pair(i, S[i]));
    }
  }


  vector< vector<int> > A_idx(26, vector<int>());
  EACH(i, A) {
    A_idx[i->second - 'a'].push_back(i - A.begin());
  }


  vector<int> C1(SIZE(C));
  EACH(i, C) {
    char c = i->second;
    C1[SIZE(C) - 1 - A_idx[c - 'a'].back()] = i->first;
    A_idx[c - 'a'].pop_back();
  }


  vector<int> p;
  EACH(i, A) {
    p.push_back(i->first);
  }
  EACH(i, B) {
    p.push_back(i->first);
  }
  EACH(i, C1) {
    p.push_back(*i);
  }


  cout << inversion_num(p) << endl;

  return 0;
}


Measured memory_bytes: 11108
#include <stdio.h>

int main(void) {
  unsigned int a, b, tmp;
  unsigned int gcd, lcm;

  while (scanf("%d %d", &a, &b) != EOF) {
    if (a < b) { tmp = a; a = b; b = tmp; }
    gcd = a; lcm = b;
    while (b != 0) {
      tmp = b;
      b = gcd % b;
      gcd = tmp;
    }
    lcm = a / gcd * lcm;

    printf("%d %d\n", gcd, lcm);
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
const int N=1e5+10;
int n,m,p;
int head[N];
bool vis[N];
vector<int> G[2];
struct Edge {
  int to,last;
  Edge () {}
  Edge (int a,int b) :to(a),last(b) {}
}edge[N<<1];
void ADD(int a,int b) {
  edge[++p]=Edge(b,head[a]); head[a]=p;
  edge[++p]=Edge(a,head[b]); head[b]=p;
}
void DFS(int u,int id) {
  vis[u]=true;
  if(u!=1||id) G[id].push_back(u);
  for(int& i=head[u];i;i=edge[i].last) {
    int v=edge[i].to;
    if(!vis[v]) {
      DFS(v,id);
      break;
    }
  }
}
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,m);
  for(int i=1;i<=m;++i) {
    int u,v; read(u,v);
    ADD(u,v);
  }
  DFS(1,0); DFS(1,1);
  printf("%d\n",G[0].size()+G[1].size());
  reverse(G[0].begin(),G[0].end());
  for(auto v: G[0]) printf("%d ",v);
  for(auto v: G[1]) printf("%d ",v);
  return 0;
}


Measured memory_bytes: 6076
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
  int N;cin >> N;
  int a,b;cin >> a >> b;
  string s;cin >> s;
  int sum=0;
  int fr=0;
  for(int i=0;i<N;i++){
    if(s[i]=='c'){
      cout << "No" << endl;
      continue;
    }
    if(s[i]=='a'){
      if(sum<a+b){
        cout << "Yes" << endl;
        sum++;
      }
      else{
        cout << "No" << endl;
      }
    }
    else{
      if(sum<a+b&&fr<b){
        cout << "Yes" << endl;
        sum++;fr++;
      }
      else{
        cout << "No" << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 896
// ACM-ICPCアジア地区予選2014 D. Space Golf

#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;

double getMinYvel(const vector<int>& p, const vector<int>& h, double jumpX){
	double L = 0, R = 1e12;
	for(int _=0;_<200;_++){
		double v = 0.5*(L+R);
		bool ok = true;
		for(int i=0;i<p.size();i++){
			int block = p[i]/jumpX;
			double t = 2.0*(p[i]-block*jumpX)/jumpX*v;
			if(h[i] > t*(v-0.5*t)){
				ok = false;
				break;
			}
		}
		if(ok) R = v;
		else   L = v;
	}
	return 0.5*(L+R);
}

int main(){
	int d, n, b;
	while(cin >> d >> n >> b){
		vector<int> p(n), h(n);
		for(int i=0;i<n;i++) cin >> p[i] >> h[i];
		double res = 1e12;
		for(int div=1;div<=b+1;div++){
			double jumpX = (double)d/div;
			double L = getMinYvel(p, h, jumpX), R = 1e12;
			for(int _=0;_<200;_++){
				double vy1 = (2*L+R)/3, vy2 = (L+2*R)/3;
				double vx1 = 0.5*jumpX/vy1, vx2 = 0.5*jumpX/vy2;
				if(vx1*vx1+vy1*vy1 < vx2*vx2+vy2*vy2) R = vy2;
				else L = vy1;
			}
			double velY = 0.5*(L+R);
			double velX = 0.5*jumpX/velY;
			res = min(res, sqrt(velX*velX+velY*velY));
		}
		printf("%.6lf\n", res);
	}
}

Measured memory_bytes: 1224
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define PER(i,a,b) for(int i=(a);i>=(b);i--)
#define RVC(i,S) for(int i=0;i<(S).size();i++)
#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
     
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
/*============ Header Template ============*/

const int maxn=(int)(1e5)+5;
char s[maxn];
int f[maxn],g[maxn];
int n;

inline int chk(int a,int b) {
    f[1]=a;f[2]=b;
    REP(i,3,n) if(g[i-1]^f[i-1]) f[i]=f[i-2]^1; else f[i]=f[i-2];
    if(g[n]^f[n]) {
        if(f[n-1]==f[1]) return 0;
    } else {
        if(f[n-1]!=f[1]) return 0;
    }
    if(g[1]^f[1]) {
        if(f[n]==f[2]) return 0;
    } else {
        if(f[n]!=f[2]) return 0;
    } return 1;
}

inline void print() {
    REP(i,1,n) if(!f[i]) putchar('S'); else putchar('W');putchar('\n');
    exit(0);
}

int main() {
    read(n);
    scanf("%s",s+1);
    REP(i,1,n) g[i]=(s[i]=='x');
    if(chk(0,0)) print();
    else if(chk(1,1)) print();
    else if(chk(1,0)) print();
    else if(chk(0,1)) print();
    printf("-1\n");
    return 0;
}

Measured memory_bytes: 1280
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
	int n, i;
	int a=1;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		int A;
		scanf("%d", &A);
		if(A==a) a++;
	}
	printf("%d\n", a==1?-1:n-a+1);
}


Measured memory_bytes: 128
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n;
string s[222222];
map<string,int> ta;

int main(){
  cin>>n;
  rep(i,n)cin>>s[i];
  rep(i,n)ta[s[i]]++;
  int ma=-1;

  rep(i,n){
    ma=max(ma,ta[s[i]]);
  }
  sort(s,s+n);
  rep(i,n){
    if(ma==ta[s[i]]){
      cout<<s[i]<<endl;
      i+=(ta[s[i]]-1);
    }
  }

  return 0;
}


Measured memory_bytes: 26880
N, K = map(int, input().split())
S = [int(_) for _ in input()]

Nums = []
# 今見ている数字
now = 1
# 何個続いているか
cnt = 0
ans = 0

for i in range(N):
    if S[i] == now:
        cnt += 1
    else:
        # 続いた数を挿入
        Nums.append(cnt)
        # 0と1を入れ替え
        now = 1 - now
        # 新しくカウント
        cnt = 1

if cnt != 0:
    Nums.append(cnt)

if len(Nums) % 2 == 0:
    Nums.append(0)

Add = 2 * K + 1
# 累積和生成
listSum = [0 for _ in range(len(Nums) + 1)]
for i in range(len(Nums)):
    listSum[i + 1] = listSum[i] + Nums[i]

# 1から始まるので、偶数番目(0のみ)見る
for i in range(0,len(Nums),2):
    left = i
    right = min(i + Add, len(Nums))
    tmp = listSum[right] - listSum[left]

    ans = max(tmp, ans)

print(ans)

Measured memory_bytes: 8684
n, k = list(map(int, input().split(' ')))
lens = {0: 1}
for i in range(1, 51):
  lens[i] = lens[i-1] * 2 + 3
memo = {}
def sumP(level, index):
  key = (level, index)
  if key in memo:
    return memo[key]
  if level == 0:
    if index == 1:
      memo[key] = 1
    else:
      memo[key] = 0
  elif index < lens[level] // 2 + 1:  # レベル一つ下の奴の一部分のみ
    memo[key] = sumP(level-1, index-1)
  elif index == lens[level] // 2 + 1:  # ど真ん中のPを入れて一つ下全部(index-1は左端のB)
    memo[key] = 1 + sumP(level-1, lens[level-1])
  else: # レベル一つ下の奴の丸々1つ + P + レベル一つ下の奴の一部分もしくは全部, minは最後のBを捨てるため
    memo[key] = sumP(level-1, lens[level-1]) + 1 + sumP(level-1, min(lens[level-1], index-lens[level-1]-2))
  return memo[key]
 
print(sumP(n, k))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
#define PAI 3.14159265358979
// ver1.6
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  int n;
  string s;
  cin >> n >> s;
  vector<int> e(n),w(n);
  
  
  rep(i,1,n){
    e[i] = e[i-1];
    if(s[i-1]=='W') e[i]++;
  }
  
  repreq(i,n-2,0){
    //cout << '$' << endl;
    w[i] = w[i+1];
    if(s[i+1]=='E') w[i]++;
  }
  
  
  int ans = INF;
  rep(i,0,n){
    //cout << e[i] << ' ' << w[i] << endl;
    ans = min(ans,e[i]+w[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5380
N=int(input())
A=list(map(int,input().split()))
t=0
cnt=1
for i in range(1,N):
    if(A[i]>A[i-1]):
        if(t==0):
            t=1
        elif(t==-1):
            cnt+=1
            t=0
    if(A[i]<A[i-1]):
        if(t==0):
            t=-1
        elif(t==1):
            cnt+=1
            t=0
print(cnt)

Measured memory_bytes: 15020
import static java.lang.Integer.MIN_VALUE;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		while (input.ready()) {
			int setCount = Integer.valueOf(input.readLine());
			if (setCount == 0)
				break;
			ArrayList<Integer> dataSet = new ArrayList<>();
			for (int i = 0; i < setCount; i++) {
				dataSet.add(Integer.valueOf(input.readLine()));
			}
			int ans = MIN_VALUE;
			for (int i = 0; i < setCount; i++) {
				int tmp = 0;
				for (int j = i; j < setCount; j++) {
					tmp += dataSet.get(j);
					if (tmp > ans)
						ans = tmp;
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 29272
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[4];
        for (int i = 0 ; i < n ; i++) {
            String s = sc.next();
            if (s.equals("AC")) {
                a[0]++;
            }
            if (s.equals("WA")) {
                a[1]++;
            }
            if (s.equals("TLE")) {
                a[2]++;
            }
            if (s.equals("RE")) {
                a[3]++;
            }
        }
        System.out.println("AC x " + a[0]);
        System.out.println("WA x " + a[1]);
        System.out.println("TLE x " + a[2]);
        System.out.println("RE x " + a[3]);
    }

}

Measured memory_bytes: 58448
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

void go()
{
    ll int n,w;
    cin>>n>>w;
    vector<ll int> wt(n),v(n);
    for(int i=0;i<n;i++)
        cin>>wt[i]>>v[i];
    vector<vector<ll int> > dp(n+1,vector<ll int>(w+1,0));
//    for(int i=0;i<n;i++)
//        dp[i+1][0]=v[i];
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(j>=wt[i-1])
                dp[i][j]=max(dp[i][j],dp[i-1][j-wt[i-1]]+v[i-1]);
        }
    }
    cout<<dp[n][w];
}
int main()
{
    FIO;
//    int t;
//    cin>>t;
//    while(t--)
        go();
    return 0;
}



Measured memory_bytes: 83120
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
using namespace std;
using ll = long long;
int main(){
  int n, ureshisa;
  cin>> n;
  ureshisa=0;
  while (n >= 500){
    n -=500;
    ureshisa +=1000;
  }
  while(n>=5){
    n -=5;
    ureshisa +=5;
  }
  cout << ureshisa << endl;
}

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

#define rep(var, start, end)  for(int var = start; var <= end; ++var)
#define drep(var, start, end) for(int var = start; var >= end; --var)

using namespace std;

int main() {

    int K, A, B;

    cin >> K >> A >> B;

    int am = A % K;

    if (am == 0) {
        cout << "OK" << endl;
    } else if ((A - am + K) <= B) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF (1<<29)
 
int N,M;
 
int bfs(int s,int g){
    queue<int> Q;
    Q.push(s);
    int d[1<<N];
    fill(d,d+(1<<N),INF);
    d[s] = 0;
 
    while(!Q.empty()){
	int S = Q.front(); Q.pop();
	if(S == g) return d[S];
	for(int i = 0 ; i < N-1 ; i++){
	    int nS = S;
	    if(((S >> i) & 1) ^ ((S >> (i+1)) & 1)){
		nS ^= 1<<i; nS ^= 1<<(i+1);
		if(d[S] + 1 < d[nS]){
		    d[nS] = d[S] + 1;
		    Q.push(nS);
		}
	    }
	}
    }
    return INF;
}
 
int main(){
    int in,s,g1,g2,sum;
    s = g1 = g2 = sum = 0;
    cin >> N >> M;
    for(int i = 0 ; i < N ; i++){
	cin >> in;
	s += (in ? (1<<i) : 0);
    }
    for(int i = 0 ; i < M ; i++){
	cin >> in;
	for(int j = 0 ; j < in ; j++){
	    g1 += (i % 2 ? 1<<(sum+j) : 0);
	}
	for(int j = 0 ; j < in ; j++){
	    g2 += (i % 2 ? 0 : 1<<(sum+j)); 
	}
	sum += in;
    }
    cout << min(bfs(s,g1),bfs(s,g2)) << endl;
    return 0;
}

Measured memory_bytes: 3248
#include<stdio.h>
int main(void)

{
	int a,b;
	
	scanf("%d",&a);
	scanf("%d",&b);

	if(a>b)
	{
		printf("a > b\n");
	}
	if(a<b)
	{
		printf("a < b\n");
	}
	if(a==b)
	{
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
N = int(input())
monster = [int(i) for i in input().split()]
brave_power = [int(i) for i in input().split()]
toubatsu_count = 0

for i in range(N):
    if brave_power[i]>monster[i]:
        toubatsu_count+=monster[i]
        nokori_brave = brave_power[i] - monster[i]
        
        if nokori_brave > monster[i+1]:
            toubatsu_count+=monster[i+1]
            monster[i+1]=0
        else:
            toubatsu_count+=nokori_brave
            monster[i+1]-=nokori_brave
    else:
        toubatsu_count+=brave_power[i]

print(toubatsu_count)

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> a(M);
  vector<int> b(M);
  
   for(int i = 0; i < M ; i++) {
     cin >> a.at(i) >> b.at(i);
  }
  
  int cnt = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      if(a.at(j) == i+1) cnt++;
      if(b.at(j) == i+1) cnt++;
    }
    cout << cnt <<endl;
    cnt = 0;
  }
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
typedef long long ll;
typedef pair<int,int> pii;

struct cuadruple{
    int ai;
    int bi;
    int ci;
    int di;
};

vector<cuadruple> cuadruples;
vector<int> permutaciones;
int n,m,q;
int maximaPuntuacion=0;

void busqueda(int inicio){
    if(permutaciones.size()==n){
        int acumulado=0;
        for(int i=0;i<cuadruples.size();i++){
            bool condicion=(permutaciones[cuadruples[i].bi-1]-permutaciones[cuadruples[i].ai-1])==cuadruples[i].ci;
            if(condicion){
                acumulado+=cuadruples[i].di;
            }
        }
        if(acumulado>maximaPuntuacion) maximaPuntuacion=acumulado;
    }
    else{
        for(int i=inicio;i<=m;i++){
            permutaciones.push_back(i);
            busqueda(i);
            permutaciones.pop_back();
        }
    }
}

int main() {
    #ifndef LOCAL
        fastIO;
    #endif
    int a,b,c,d;
    cin >> n >> m >> q;
    for(int i=0;i<q;i++){
        cin >> a >> b >> c >> d;
        cuadruples.push_back(cuadruple{a,b,c,d});
    }
    busqueda(1);
    cout << maximaPuntuacion << endl;
    return 0;
}


Measured memory_bytes: 3632
n, m = map(int,input().split())
A = list(map(int,input().split()))

lim = 1/(4*m)

ans = 0
for a in A:
  a /= sum(A)
  if a>=lim:
    ans += 1
    
if ans >= m:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int MAX = 100005;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main(){
  int n; cin >> n;
  int c = 1<<n;
  vector<int> s(c);
  rep(i,c) cin >> s[i];
  sort(s.begin(),s.end());
  vector<int> t;
  t.push_back(s.back());
  s.back() = -1;
  rep(i,n){
    vector<int> pa = t;
    sort(pa.begin(),pa.end());
    int a = c-1;
    while(pa.size() > 0 && a >= 0){
      if(s[a] == -1){
        a--;
        continue;
      }
      if(s[a] < pa.back()){
        t.push_back(s[a]);
        pa.pop_back();
        s[a] = -1;
      }
      a--;
    } 
    if(pa.size() > 0){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 2932
import java.util.Scanner;

public class Main {

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

        long N = Long.parseLong(sc.next());
        long K = Long.parseLong(sc.next());

        if (K == 0) {
            System.out.println(N * N);
            return;
        }

        long count = 0;
        for (long i = K + 1; i <= N; i++) {
            long p = N / i;
            long r = N % i;
            count += (i - K) * p + Math.max(r - K + 1, 0);
        }

        System.out.println(count);
    }
}

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

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), k = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) a[i] = in.nextInt();
            Arrays.sort(a);
            int res = 0, cur = n - 1;
            while (k-- > 0) res += a[cur--];
            out.println(res);
        }

    }

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

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define nmax 200005

using namespace std;

int fi[nmax][26];
int dp[nmax];

int main(){
    string s;
    cin >> s;
    int n=s.size();
    vector <int> h(26,n);
    for(int i=n-1;i>=0;i--){
        h[s[i]-'a']=i;
        for(int j=0;j<26;j++){
            fi[i][j]=h[j];
        }
    }
    dp[n]=0,dp[n+1]=-1;
    h.assign(26,n);
    for(int i=n-1;i>=0;i--){
        h[s[i]-'a']=i;
        int mx=-1;
        for(int j=0;j<26;j++){
            mx=max(mx,h[j]);
        }
        dp[i]=1+dp[mx+1];
    }
    int cnt=dp[0],la=-1;
    //cout << cnt+1 << endl;
    for(int i=0;i<=cnt;i++){
        int req=cnt-i;
        for(int j=0;j<26;j++){
            if(dp[fi[la+1][j]+1]<req){
                cout << (char)(j+'a');
                la=fi[la+1][j];
                break;
            }
        }
    }
    cout << endl;
    return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    int ans = (n - 2) / (k - 1) + 1;
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a;
    cin >> a;
    if (a >= 1 && a <= 999) cout << "ABC";
    else cout << "ABD";
}

Measured memory_bytes: 3628
n = int(input())
a = list(map(int, input().split()))
add_dic = {}
sub_dic = {}

for i in range(n):
    add_tmp = i + a[i]
    sub_tmp = i - a[i]
    if not add_tmp in add_dic.keys():
        add_dic[add_tmp] = 1
    else:
        add_dic[add_tmp] += 1
    if not sub_tmp in sub_dic.keys():
        sub_dic[sub_tmp] = 1
    else:
        sub_dic[sub_tmp] += 1

ans = 0
for k, v in add_dic.items():
    if k in sub_dic.keys():
        ans += v * sub_dic[k]
print(ans)

Measured memory_bytes: 56584
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0 ; i < int(N);i++)
using namespace std ;
typedef long long ll;
typedef pair <int , int >pi;
typedef vector <int> vi ;
typedef vector <string> si;



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

    int a ,c , e;
    cin >> a >>	c >> e ;
    a = (a+c-1)/c;
    cout << (a*e) << endl;
    
    
    

	return 0 ;
}


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

#define rep(i,a,b) for(long long i = (a); i < (b); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define pb push_back
using ll = long long;

string s,t;
int helper(int i,int j){
	
	int ans=0;
	int index=0;
	for(int k=i;k<=j;k++){
		if(s[k]!=t[index]){
			ans++;
		}
		index++;
	}
	return ans;
}

void solve()
{

	cin>>s>>t;
	int n=t.size();
	int ans=1e5;
	for(int i=0;i+n-1<s.size();i++){
		ans=min(ans,helper(i,i+n-1));
		
	}
	cout<<ans;
}



int  main(){


ll t;
t=1;
//cin>>t;
while(t--){
		solve();
		cout<<endl;

}

}

Measured memory_bytes: 3600
main :: IO ()
main = do
  n  <- read <$> getLine :: IO Int
  hs <- map read . words <$> getLine :: IO [Int]
  let f (maxH, count) h = if maxH <= h then (h, count + 1)
                          else (maxH, count)
      (maxH, count) = foldl f (0, 0) hs
  print count

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

const long long int INF = 1LL << 60;
const int INI = 0;
int n, v[200];
long long int weight, w[200], dp[200][101010];

int main(){
  //入力
  cin >> n >> weight;
  rep(i, n) cin >> w[i] >> v[i];
  //dp配列の初期化
  rep(i, n + 1){
    rep(j, 100001){
      dp[i][j] = INF;
    }
  }
  dp[0][0] = 0;
  
  //dp本体
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= 100000; j++){
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
    }
  }
  
  //デバッグ（dp配列の出力
  /*
  rep(i, n + 1){
    rep(j, 100){
      cerr << setw(3) << dp[i][j] <<" ";
    }
    cerr << endl;
  }*/
  
  //出力
  
  int res;
  for(int i = 100000; i > 0; i--){
    if(dp[n][i] <= weight){
      res = i;
      break;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define open(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)
namespace io {
	const size_t maxn = 1 << 18;
	char in[maxn], out[maxn], *p = in, *q = in, *t = out;
	char getc() {if(p == q) q = (p = in) + fread(in, 1, maxn, stdin); return (p == q? EOF: *(p++));}
	void putc(char c) {if(t == out + maxn) fwrite(out, 1, maxn, stdout), t = out; *(t++) = c;}
	const struct over {~over(){fwrite(out, 1, t - out, stdout);}} ends;
	int read() { int x = 0, op = 1; char ch = 0;
		while(ch = getc(), not isdigit(ch)) if(ch == '-') op = -op;
		do x = x * 10 + (ch ^ '0'); while(ch = getc(), isdigit(ch));
		return x * op;
	} void write(int x) { char str[20], *v = str;
		if(x < 0) x = -x, putc('-');
		do *(v++) = (x % 10) ^ '0'; while(x /= 10);
		while(v != str) putc(*(--v));
	}
} using io::getc; using io::putc; using io::read; using io::write;

const int mods = 1e9 + 7;
int frac[105] = {1, 1}, ifac[105] = {1, 1};
int sol(signed n, int l, int r) {
	if(n == 1) return r - l + 1;
	if(l == r) return 1;
	int x = 1; while(x <= r) x <<= 1;
	while(not (x & (l ^ r))) l &= ~x, r &= ~x, x >>= 1;
	if(r == x) return ((r - l) << 1) + 1 - (not l);
	else {
		int y = 1; while(y <= r - x) y <<= 1;
		if(x + y >= l + x) return (x << 1) - l;
		return ((x - l) << 1) + y;
	}
}

signed main() {
//	open("c");
	
	for(int i = 2; i <= 100; i++) {
		frac[i] = frac[i - 1] * i % mods;
		ifac[i] = ifac[mods % i] * (mods - mods / i) % mods;
	}
	for(int i = 2; i <= 100; i++) {
		ifac[i] = ifac[i] * ifac[i - 1] % mods;
	}
	
	int TIM = 1;
	while(TIM--) {
		int n = 2, l = read(), r = read();
		write(sol(n, l, r)), putc('\n');
	}
	
	return 0;
}

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

int main()
{
    ll k;
    cin >> k;
    ll a[50];
    for(int i = 0; i < 50; i++){
        a[i] = 49 + k / 50 - k % 50;
    }
    for(int i = 0; i < k % 50; i++){
        a[i] += 51;
    }
    cout << 50 << endl;
    for(int i = 0; i < 50; i++){
        cout << a[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
import sys


def aa():
    n, t = map(int, input().split())
    count = 0
    for x in range(n+1):
        if(10000 * x > t):
            break
        for y in range(n+1):
            if(10000 * x + 5000 * y> t):
                break
            z = n - (x + y)
            if(10000 * x + 5000 * y + 1000 * z == t and z >= 0):
                print(x,y,z)
                return 0
    print(-1,-1,-1)
    return 0
aa()




Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<i64> a;
int main() {
  cin >> n;
  read_n(a, n);
  a.push_back(0);
  if (a[0] != 0) { cout << -1 << '\n'; return 0; }
  i64 ans = 0;
  for (i64 i = n - 1; i >= 0; --i) {
    i64 d = a[i + 1] - a[i];
    if (d <= 0) ans += a[i];
    if (d > 1) { cout << -1 << '\n'; return 0; }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4736
import java.util.Scanner;                      


class Main {



	public static void main(String[] args) {   

		Scanner scanner = new Scanner(System.in);


			String s= scanner.nextLine();//文字列sの入力
			String p= scanner.nextLine();//文字列pの入力
			
		
			char[] chars; 
			chars=new char[s.length()];//文字列sを格納する配列chars
			String[] Strings;
			Strings=new String[s.length()];
			String compare="";//文字列pと比較する変数
			boolean anther =false; 
			
			for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			}

			int loop=0;//ループを制御する変数
			for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			}
				if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				}


		scanner.close();


	}
}



Measured memory_bytes: 28028
#include<bits/stdc++.h>
using namespace std;
#define inf 0x7fffffff
#define X first
#define Y second
#define N 120010
typedef long long ll;
char s[1005][1005];
int main()  {
	int n,m,a,b;
	scanf("%d%d%d%d",&n,&m,&a,&b);
	for(int i=1;i<=n;i++){for(int j=1;j<=m;j++)s[i][j]='.';s[i][m+1]='\0';}
	if(n%2){
	for(int i=1;i<m&&a;i+=2){
	s[n][i]='<';
	s[n][i+1]='>';
	a-=1;
	}
	}
	if(m%2){
	for(int i=1;i<n&&b;i+=2){
	s[i][m]='^';
	s[i+1][m]='v';
	b-=1;
	}
	}
	for(int i=1;i<n;i+=2){
		for(int j=1;j<m;j+=2){
			if(a>=2){
				a-=2;
			s[i][j]=s[i+1][j]='<';
			s[i][j+1]=s[i+1][j+1]='>';
			}
			else if(b>=2){
				b-=2;
			s[i][j]=s[i][j+1]='^';
			s[i+1][j]=s[i+1][j+1]='v';
			}
			else if(a&&b&&i==n-2&&j==m-2){
				a--;
				b--;
				s[i][j]='<';
				s[i][j+1]='>';
				s[i][j+2]='^';
				s[i+1][j]='^';
				s[i+1][j+2]='v';
				s[i+2][j]='v';
				s[i+2][j+1]='<';
				s[i+2][j+2]='>';
			}
			else if(a){
				a--;
				s[i][j]='<';
				s[i][j+1]='>';
			}
			else if(b){
				b--;
				s[i][j]='^';
				s[i+1][j]='v';
			}
		}
	}
	if(a||b)printf("NO\n");
	else {
	printf("YES\n");
	for(int i=1;i<=n;i++)printf("%s\n",s[i]+1);
	}

     return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> V(N);
  vector<int> C(N);
  
  for(int &i: V)
    cin >> i;
  for(int &i: C)
    cin >> i;
  
  int sum = 0;
  
  for(int i = 0; i < N; i++){
    if(V.at(i) > C.at(i))
      sum += V.at(i) - C.at(i);
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<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;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){    
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}
 
int main() {
    string s;
    cin >> s;
    vector<char> o = {'R','U','D'};
    vector<char> e = {'L','U','D'};
    string ans = "Yes";
    REP(i, s.size()){
        if(i%2 == 1){
            if(s[i] != e[0] && s[i] != e[1] && s[i] != e[2]){
                ans = "No";
                break;
            }
        }else{
            if(s[i] != o[0] && s[i] != o[1] && s[i] != o[2]){
                ans = "No";
                break;
            }
        }
    }
    cout << ans << endl;
}



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

int main(){
  long long int a,b,r,x,tmp;
  cin>>a>>b;
    x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  cout<<x/b<<endl;
}

Measured memory_bytes: 256
function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s[this._y++].split(" ");
    return f?s:s.map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};
var o=new gets(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a(), a = o.l();
  var u = 0, v = a[0], ans = n;
  for(var i = 1; i < n; i++){
    while(v + a[i] !== (v ^ a[i])){
      v ^= a[u++];
    }
    ans += i - u;
    v += a[i];
  }
  return ans;
}

Measured memory_bytes: 22256
N,M=list(map(int, input().split()))
a=[]
c=[]
for n in range (0,N):
  a.append(list(map(int, input().split())))
for m in range(0,M):
  c.append(list(map(int, input().split())))

ans=[]
for n in range (0,N):
  place=1
  dist=abs(a[n][0]-c[0][0])+abs(a[n][1]-c[0][1])
  for m in range(1,M):
    if abs(a[n][0]-c[m][0])+abs(a[n][1]-c[m][1])<dist:
      dist=abs(a[n][0]-c[m][0])+abs(a[n][1]-c[m][1])
      place=m+1
  ans.append(place)

for n in range (0,N):
  print(ans[n])

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if ((c > a && c < b) || (c < a && c > b) ) {
		    System.out.println("Yes");
		}else if((c < a || c < b) || (c < b || c > a)  ) {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 22736
import std.stdio, std.string;

void main() {
  for(int h, w; readf("%d %d\n", &h, &w), h + w != 0;) {
    char[][] field = new char[][](h, w);
    bool[][] used = new bool[][](h, w);
    int x = 0, y = 0;
    foreach(uint i; 0..h)
      foreach (uint j, t; readln.chomp)
        field[i][j] = t;

    while(true) {
      if (used[x][y]) {
        writeln("LOOP");
        break;
      }
      used[x][y] = true;
      switch(field[x][y]) {
      case '^':
        x -= 1;
        break;
      case '>':
        y += 1;
        break;
      case 'v':
        x += 1;
        break;
      case '<':
        y -= 1;
        break;
      case '.':
        writeln(y, " ", x);
        goto end;
      default:
        break;
      }
    }
  end:;
  }
}

Measured memory_bytes: 1088
#Union Find
import sys
input = sys.stdin.readline
 
n,m = map(int,input().split())

par = [i for i in range(n)] #親
rank = [0]*n #木の深さ

#木の根を求める
def find(x,par):
    if par[x] == x:
        return x
    else:
        par[x] = par[par[x]]
        return find(par[x],par)

#xとyの属する集合の併合
def unite(x,y,par,rank):
    x = find(x,par)
    y = find(y,par)
    
    if x != y:
        #xとyの属している集合が異なる時
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x]==rank[y]:
                rank[x] += 1

#xとyが同じ集合に属するかの判定
def same(x,y,par):
    return find(x,par) == find(y,par)

for i in range(m):
    X,Y,Z = map(int,input().split())
    unite(X-1,Y-1,par,rank)
 
tank = set([])
for i in range(n):
    p = find(i,par)
    tank.add(p)
print(len(tank))

Measured memory_bytes: 16784
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
typedef long long ll;

ll DP[101][(int)1e5 + 1];
vector<pair<int, int>> objects;

ll Knapsack(int i, int w) {
	if (DP[i][w] != -1) { return DP[i][w]; }
	if (i >= objects.size()) { return DP[i][w] = 0; }

	ll c1 = Knapsack(i + 1, w), c2 = 0;
	if (objects[i].first <= w) {
		c2 = Knapsack(i + 1, w - objects[i].first) + objects[i].second;
	}

	DP[i][w] = max(c1, c2);
	return DP[i][w];
}

int main() {
	for (int i = 0; i < 101; i++)
		for (int j = 0; j < (int)1e5 + 1; j++)
			DP[i][j] = -1;
	
	int N, W; cin >> N >> W;
	objects.resize(N);
	for (auto &x : objects) { cin >> x.first >> x.second; }

	cout << Knapsack(0, W) << endl;
}

Measured memory_bytes: 79104
#include <stdio.h>

int main(){
	int i,x,m;
	char s[11];
	x = 0;
	m = 0;
	scanf("%s", s);
	for (i = 0; s[i] != '\0'; i++) {
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') x++;
		else{
			if (x > m) m = x;
			x = 0;
		}
	}
	if (x > m) m = x;
	printf("%d", m);
}

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

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

    int N;
    cin >> N;

    if (N < 2) {
        cout << 1 << endl;
        exit(0);
    }
    vector<ll> fib(N + 1);
    fib.at(0) = 1;
    fib.at(1) = 1;
    for (int i = 2; i <= N; ++i) {
        fib.at(i) = fib.at(i - 1) + fib.at(i - 2);
    }

    cout << fib.at(N) << endl;

    return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  vl a(n);
  vl minus_vec,zero_vec,plus_vec;
  REP(i,n) {
    cin >> a[i];
    if(a[i]<0) minus_vec.push_back(a[i]);
    if(a[i]==0) zero_vec.push_back(a[i]);
    if(a[i]>0) plus_vec.push_back(a[i]);
  }
  sort(plus_vec.begin(),plus_vec.end());
  sort(minus_vec.begin(),minus_vec.end(),[](ll a,ll b){return a>b;});
  if(minus_vec.size()==0){
    REP(i,plus_vec.size()) zero_vec.push_back(plus_vec[i]);
    ll m = abs(zero_vec[0])*(-2);
    REP(i,zero_vec.size()) m += abs(zero_vec[i]);
    cout << m << endl;
    if(zero_vec.size()==2){
      cout << zero_vec[1] << " " << zero_vec[0] << endl;
    }else{
      cout << zero_vec[0] << " " << zero_vec[1] << endl;
      ll tmp = zero_vec[0] - zero_vec[1];
      FOR(i,2,zero_vec.size()-1){
        cout << tmp << " " << zero_vec[i] << endl;
        tmp -= zero_vec[i];
      }
      cout << zero_vec[zero_vec.size()-1] << " " << tmp << endl;
    }
  }else if (plus_vec.size()==0){
    REP(i,minus_vec.size()) zero_vec.push_back(minus_vec[i]);
    ll m = abs(zero_vec[0])*(-2);
    REP(i,zero_vec.size()) m += abs(zero_vec[i]);
    cout << m << endl;
    if(zero_vec.size()==2){
      cout << zero_vec[0] << " " << zero_vec[1] << endl;
    }else{
      cout << zero_vec[0] << " " << zero_vec[1] << endl;
      ll tmp = zero_vec[0] - zero_vec[1];
      FOR(i,2,zero_vec.size()){
        cout << tmp << " " << zero_vec[i] << endl;
        tmp -= zero_vec[i];
      }
    }
  }else{
    ll m = 0;
    REP(i,a.size()) m += abs(a[i]);
    cout << m << endl;
    ll tmp = plus_vec[0];
    FOR(i,1,minus_vec.size()){
      cout << tmp << " " << minus_vec[i] << endl;
      tmp -= minus_vec[i];
    }
    ll tp = minus_vec[0];
    FOR(i,1,plus_vec.size()){
      cout << tp << " " << plus_vec[i] << endl;
      tp -= plus_vec[i];
    }
    cout << tmp << " " << tp << endl;
    tmp = tmp - tp;
    REP(i,zero_vec.size()){
      cout << tmp << " " << zero_vec[i] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4212
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
  const numbers = line.split(' ');
  const a = numbers[0];
  const b = numbers[1];
  const equality = a - b;
  let sign = '';

  if (equality > 0 ) {
    sign = '>'
  } else if (equality < 0) {
    sign = '<'
  } else {
    sign = '=='
  }
  
  let output = `a ${sign} b`;
  console.log(output);
} 


Measured memory_bytes: 15096
#B

s = input()
flag = 0

for i in range(len(s)):
    if i%2 == 0:#奇数文字目
        if s[i] == "L":
            flag = 1
    else:
        if s[i] == "R":
            flag =1
if flag == 0:
    print("Yes")
else:
    print("No")

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

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    int total = 0;

    while (n)
    {
        total += n % 10;
        n = n / 10;
    }

    if (total == 1)
    {
        cout << 10 << endl;
    }
    else
    {
        cout << total << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

int main() {
	int n; std::cin >> n;
	std::string str; std::cin >> str;
	for (auto& c : str) {
		c = (c - 'A' + n) % 26 + 'A';
	}
	std::cout << str << '\n';
}

Measured memory_bytes: 888
X,N=map(int, input().split())
NL=list(map(int, input().split()))
BL=[i for i in range(-1,102)]

for i in NL:
    BL.remove(i)

ANS=1000
out=1000
for i in BL:
    temp=abs(X-i)
    if ANS>temp:
        ANS=temp
        out=i
print(out)

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

using namespace std;

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1;
  int dy = y2 - y1;
  printf("%d %d %d %d\n", dx - dy + x1, dx + dy + y1, -dy + x1, dx + y1);
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef unsigned long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int total = (h2-h1)*60+m2-m1;
    if(total<=k)
        cout<<0<<endl;
    else
        cout<<total-k<<endl;
    return 0;
}

Measured memory_bytes: 3652
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sat Feb  8 14:33:18 2020
//
package main

import "fmt"

const MOD = 1e9 + 7

var K, X int

func main() {
	fmt.Scan(&K, &X)
	if X <= 500*K {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

struct M{int e,a;};

int main(void){
	
	int x,y,z;
	double dp[51][5001];
	map<int,M>m;
	
	while(cin >> x >> y >> z,x|y|z){
		vector<int>v(x);
		m.clear();
		
		for(int i=0;i<x;i++)cin >> v[i];
		for(int i=0;i<z;i++){
			int n,e,a;
			M in;
			cin >> n >> in.e >> in.a;
			m[n]=in;
		}
		
		fill(dp[0],dp[51],0);
		dp[0][0]=1;
		
		for(int i=0;i<y;i++){
			for(int j=0;j<5001;j++){
				for(int k=0;k<x;k++){
					int nx=i+v[k];
					if(m[nx].e==1)dp[min(y,nx+m[nx].a)][j]+=dp[i][j]/x;
					else if(m[nx].e==2)dp[nx][j+m[nx].a]+=dp[i][j]/x;
					else if(m[nx].e==3)dp[nx][max(0,j-m[nx].a)]+=dp[i][j]/x;
					else dp[min(y,nx)][j]+=dp[i][j]/x;
				}
			}
		}
		double ans=0;
		for(int j=0;j<5001;j++)ans+=dp[y][j]*j;
		
		cout << (int)ans << endl;
	}
	
return 0;
}

Measured memory_bytes: 3188
/*
ID: jerrywcy
TASK: AtCoder ABC 100 Problem A
LINK: https://abc102.contest.atcoder.jp/tasks/abc102_a
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

int a,b;
 
int main(){
	cin>>a>>b;
	if (a>8 || b>8)cout<<":("<<endl;
	else cout<<"Yay!"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,n=0,i;
    double b;
    scanf("%d",&a);
    for(i=1;i<=a;i++)
    {
        if(i%2!=0)
        {
            n++;
        }
    }
    b=(double)n/a;
    printf("%lf",b);

}


Measured memory_bytes: 128