akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void){
	
	int a,b,added,taxadded;
	int x,y,res;
	int ta,tb,t2a,t2b;
	
	while(1){
		res = 0;
		
		scanf(" %d %d %d",&x,&y,&added);
		
		if(x == 0 && y == 0 && added == 0){
			break;
		}
		
		for(a=1;a<added - 1;a++){
			for(b=1;b<added - 1;b++){
				ta = (int)((a * (100 + x)) / 100);
				tb = (int)((b * (100 + x)) / 100);
				t2a = (int)((a * (100 + y)) / 100);
				t2b = (int)((b * (100 + y)) / 100);
				if(((ta + tb) == added) && ((t2a + t2b) > res)){
					res = t2a + t2b;
				}
			}
		}
		
		printf("%d\n",res);
	}
	
	return(0);
}

Measured memory_bytes: 600
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	int n,out=0;string s;
	cin>>s;n=s.size();
	rep(i,n){
		if(s[i]=='p') out--;
		out+=i%2;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
	int a,b,c,d,p;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	cin>>p;
	if(p<=c){
		if(a*p<b){
			cout<<a*p<<endl;
		}else{
			cout<<b<<endl;
		}
	}else{
		if(a*p<b+(p-c)*d){
			cout<<a*p<<endl;
		}else{
			cout<<b+(p-c)*d<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
public class prigraming
    shared function Main as Integer
        dim line as string
        while True
            line=Console.ReadLine()
            if line is nothing
                exit while
            end if
            dim counter as integer = 0
            for each c as char in line
                counter = counter + if(c = "o"c, 1, 0)
            next
            Console.WriteLine (700 + 100 * counter)
        end while
        return 0
    End function
End class



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

using namespace std;
using namespace std::chrono;

#define rep(i,a,b) for(int i = a;i<(b);++i)
#define trav(a,v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

const ll big = 1000000007ll;
const ll big2 = 1000000009ll;
ll n,m,k,q,w,h,T;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,d;

    string s;
    cin >> s;
    ll ans = 0;
    bool yes = 1;
    n = s.length();
    ll l = 0;
    ll r = n-1;

    while(l < r){

       // cout << s[l] << " " << s[r] << "\n";

        if(s[l] == s[r]){
            l++;
            r--;
        }
        else{
            if(s[l] == 'x'){
                l++;
                ans++;
            }
            else{
                if(s[r] == 'x'){
                    r--;
                    ans++;
                }
                else{
                    yes = 0;
                    break;
                }
            }
        }
    }

    if(!yes){ans = -1;}
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
struct Robot {
  ll X, L, r, l;
  Robot(ll X, ll L) : X(X), L(L) {
    l = X - L, r = X + L;
  }

  bool operator<(const Robot& another) const {
    return r < another.r;
  };
};


signed main() {
  ll N;
  cin >> N;

  vector<Robot> Robots;
  rep(i, N) {
    ll X, L;
    cin >> X >> L;
    Robots.pb(Robot(X, L));
  }


  sort(all(Robots));
  ll temp = -LINF;
  int ans = 0;
  rep(i, N) {
    if (Robots[i].l >= temp) {
      ans++;
      temp = Robots[i].r;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 6256
def waru(k,l):
  if k%l==0:
    return k//l
  else:
    return (k//l)+1
A=0
B=0
N=int(input())
for i in range(N):
  a,b=map(int,input().split())
  if a>=A and b>=B:
    A,B=a,b
  elif a>=A and b<B:
    A,B=a*waru(B,b),b*waru(B,b)
  elif a<A and b>=B:
    A,B=a*waru(A,a),b*waru(A,a)
  else:
    c=max(waru(A,a),waru(B,b))
    A,B=a*c,b*c
print(A+B)

Measured memory_bytes: 73388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
   int h,n;cin>>h>>n;
   int a[n];int sum=0;
   for(int i=0;i<n;i++)cin>>a[i];
   for(int i=0;i<n;i++){
       sum+=a[i];
   }
   if(sum>=h)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  int a[33];
  a[1]=1;
  a[2]=1;
  a[3]=1;
  a[4]=2;
  a[5]=1;
  a[6]=2;
  a[7]=1;
  a[8]=5;
  a[9]=2;
  a[10]=2;
  a[11]=1;
  a[12]=5;
  a[13]=1;
  a[14]=2;
  a[15]=1;
  a[16]=14;
  a[17]=1;
  a[18]=5;
  a[19]=1;
  a[20]=5;
  a[21]=2;
  a[22]=2;
  a[23]=1;
  a[24]=15;
  a[25]=2;
  a[26]=2;
  a[27]=5;
  a[28]=4;
  a[29]=1;
  a[30]=4;
  a[31]=1;
  a[32]=51;
  int k;
  scanf("%d",&k);
  printf("%d",a[k]);
  
  return 0;
  
}

Measured memory_bytes: 128
S = input()
T = input()


def matchCount(str1, str2):
    count = 0
    if str1 == str2:
        return len(str1)
    for i in range(len(str1)):
        if str1[i] == str2[i]:
            count = count + 1
    return count


# 1文字ずつ探してなん文字合致するかカウントする
lenT = len(T)
maxCount = 0
for i in range(len(S) - lenT + 1):
    token = S[i:i + lenT]
    count = matchCount(token, T)
    if count > maxCount:
        maxCount = count

print(lenT - maxCount)


Measured memory_bytes: 9112
#include<cstdio>

const int MAXN=100;

bool vis[MAXN+5];

int ans;

int n,k;

signed main(){
	scanf("%d %d",&n,&k);
	ans=n;
	for(int i=1,d,a;i<=k;++i){
		scanf("%d",&d);
		for(int j=1;j<=d;++j){
			scanf("%d",&a);
			if(!vis[a])--ans;
			vis[a]=true;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int c[10][10];

int main()
{
	cin.tie(nullptr), ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < 10; i++)
		for (int j = 0; j < 10; j++)
			cin >> c[i][j];
	for (int i = 0; i < 10; i++)
		for (int j = 0; j < 10; j++)
			for (int k = 0; k < 10; k++)
				c[j][k] = min(c[j][k], c[j][i] + c[i][k]);
	int r = 0, a;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a;
			if (a > -1)
				r += c[a][1];
		}
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]" << endl; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/


ll dp[200010][3];
int main() {
    string S;
    cin >> S;
    int N = S.size();
    rep(i,N+1)rep(j,3)dp[i][j] = 0;
    rep(i,N){
        if(i == 0){
            rep1(k,3)chmax(dp[i+k][k], dp[i][0]+1);
            continue;
        }
        rep1(j,3)rep1(k,3){
            if(i - j < 0)continue;
            if(i + k > N)continue;
            string pre = S.substr(i-j, j);
            string nxt = S.substr(i, k);
            if(pre == nxt)continue;
            chmax(dp[i+k][k], dp[i][j]+1);
        }
    }
    cout << max(dp[N][1], dp[N][2]) << endl;
}


Measured memory_bytes: 8472
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
 if(s.size()!=6)
   cout<<"No"<<endl;
  else
  {
    if(s[2]==s[3]&&s[4]==s[5])
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  long x, y;
  readf("%s %s\n", &x, &y);

  auto a = x;
  long res;
  while (a <= y) {
    res++;
    a *= 2;
  }

  res.writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
 
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
signed main(){
    int n,m;
    cin>>n>>m;
    cout<<n-m-1<<endl;
}

Measured memory_bytes: 3088
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

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

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

bool search(const vector<set<int> > &g, int now, int dist){
  if(dist == now) return true;
  FOR(it,g[now]) if(search(g, *it, dist)) return true;
  return false;
}


int main(){
  while(true){
    int n,m;
    string buff;

    getline(cin, buff);
    sscanf(buff.c_str(), "%d%d", &n, &m);
    if(n + m == 0) break;

    vector<set<int> > g(n);
    vector<int> p(n);
    map<string,int> name;

    stack<int> st;

    REP(i,n){
      getline(cin, buff);
      for(int j=0; ;j++){
        if(buff[j] != ' '){

          int next = name.size();
          buff = buff.substr(j);
          name[buff] = next;

          while(j != st.size())
            st.pop();

          if(st.size()){
            g[st.top()].insert(next);
            p[next] = st.top();
          }

          st.push(next);
          break;
        }
      }
    }

    REP(i,m){
      string n1, b, a, r, o, n2;
      getline(cin, buff);
      stringstream ss(buff);
      ss>>n1>>b>>a>>r>>o>>n2;

      int aa = name[n1];
      int bb = name[n2.substr(0, n2.size()-1)];

      //cout << aa << " " <<r << " " << bb << " ";

      bool ans = false;
      switch(r[0]){
      case 'c':
        if(g[bb].count(aa)) ans = true;
        break;
      case 'p':
        if(g[aa].count(bb)) ans = true;
        break;
      case 's':
        if(aa != 0 && g[p[aa]].count(bb)) ans = true;
        break;
      case 'd':
        ans = search(g, bb, aa);
        break;
      case 'a':
        ans = search(g, aa, bb);
        break;
      }
      cout << (ans ? "True" : "False") << endl;
    }

    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
	string S;
	cin >> S;
	set<char> st;
	for(auto& c : S) st.insert(c);
	if(st.size() == 1) cout << "No" << endl;
	else cout << "Yes" << endl;
}


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

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

        vector<int> v(N+1, 0);

        for(int i = 0; i < N; ++i)
        {
                if(S[i] == '#') v[i+1] = v[i] + 1;
                else v[i+1] = v[i];
        }

        long long ans = 2e6;
        for(int i = 0; i < N+1; ++i)
        {
                long long tmp = v[i] + ((N - i) - (v[N] - v[i]));
                ans = min(ans, tmp);
        }

        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 1412
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
const int M=2e5+10;
priority_queue<pair<int,int> > q;
int L[M], R[M],a[M],b[M];
int main(){
	int n;
	n=read();
	F(i,1,n) L[i]=i-1,R[i]=i+1,a[i]=read();
	L[1]=n; R[n]=1;
	int ok=0;
	F(i,1,n){
		b[i]=read();
		if (b[i]==a[i]) ok++;
		else q.push({b[i],i});
	}
	LL step=0;
	while (ok<n && q.size()){
		int x=q.top().second; q.pop();
//		cout<<x<<" ";
		int g=b[x]/(b[L[x]]+b[R[x]]);
		int r=b[x]%(b[L[x]]+b[R[x]]);
		if (a[x]>r && (a[x]-r)%((b[L[x]]+b[R[x]]))==0 && a[L[x]]==b[L[x]] && a[R[x]]==b[R[x]]){
			g-=(a[x]-r)/((b[L[x]]+b[R[x]]));
			r=a[x];
		}
		if (!g || r<a[x]) {
			puts("-1");
			return 0;
		}
		step+=g;
		b[x]=r;
//		cout<<b[x]<<"\n";
		if (b[x]==a[x]) ok++;
		else q.push({r,x});
	}
	cout<<(ok==n ? step: -1)<<"\n";
	return 0;
}



Measured memory_bytes: 5364
#include <iostream>
using namespace std;
int arr[200005];
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	scanf("%d",&arr[i]);
	long long ans=0;
	for (int i=n-1;i>=0;i--)
	{
		if (i-arr[i]<0 || (i && arr[i]>arr[i-1]+1))
		{
			printf("-1");
			return 0;
		}
		if (arr[i]+1!=arr[i+1])
		ans+=arr[i];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};
 
static const double EPS = 1e-12;

void dfs(vector<int>& log){
}

int main(){
  string str;
  while(cin >> str){
    string shrinked = "";
    for(int i=0;i<str.size();){
      if(i+3 <= str.size()
	 && str.substr(i,3) == "egg"){
	shrinked += "0";
	i+=3;
	continue;
      }
      else if(i+7 <= str.size() 
	      && str.substr(i,7) == "chicken"){
	shrinked += "1";
	i+=7;
	continue;
      }
      i++;
    }

    vector<string> log;
    int prev = 0;
    for(int i=0;i+1<shrinked.length();i++){
      if(shrinked[i] == shrinked[i+1]){
	log.push_back(shrinked.substr(prev,i-prev + 1));
	prev = i+1;
      }
    }
    if(prev < shrinked.length()){
      log.push_back(shrinked.substr(prev,shrinked.size()-prev));
    }

    int max_length = 0;
    string res = "egg";
    for(int i=0;i<log.size();i++){
      if(max_length < log[i].length()){
	max_length = log[i].length();
	if(log[i][log[i].length()-1] == '1'){
	  res = "chicken";
	}
	if(log[i][log[i].length()-1] == '0'){
	  res = "egg";
	}
      }
    }

    cout << res << endl;
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> diameter(n);
  for(int i = 0; i < n; ++i) {
    cin >> diameter.at(i);
  }

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

  int count = 1;
  for(int i = 0; i < n-1; ++i)
    if (diameter.at(i) < diameter.at(i+1) )
      count++;

  cout << count << endl;
}


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

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

const ll MAX_N = 2e5 + 10;
ll n, m;
int dp[MAX_N];
int par[MAX_N];
string s;
set <pii> Set;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n >> m >> s;
    dp[n] = 0;
    for (int i = 0; i < n; i++)
        dp[i] = 1e9 + 7;

    Set.insert({1e9 + 6, n + 1});
    Set.insert({0, n});
    for (int i = n - 1; ~i; i--) {
        if (i + m + 1 <= n)
            Set.erase({dp[i + m + 1], i + m + 1});

        if (s[i] == '1')
            continue;
        
        dp[i] = Set.begin()->first + 1;
        Set.insert({dp[i], i});
        par[i] = Set.begin()->second;
    }

    if (dp[0] >= 1e9 + 7) {
        cout << "-1\n";
        return 0;
    }

    int d = 0;
    for (int i = 0; i < dp[0]; i++) {
        cout << par[d] - d << " ";
        d = par[d];
    }
}

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

int n, a[21], ans;

void dfs(int sum, int k){
	if( k == n ){
		ans = min( ans , abs(sum) );
	}else{
		dfs(sum + a[k], k+1 );
		dfs(sum - a[k], k+1 );
	}
}

int main(){
	while( cin >> n , n ){
		for(int i=0 ; i < n ; i++ ){
			cin >> a[i];
		}
		ans = 1e+9;
		dfs(0,0);
		cout << ans << endl;
	}
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  string s; cin >> s;
  vector<int> d(4);
  for (int i = 0; i < (int)s.size(); ++i) {
    d[i] = s[i] - '0';
  }
  // int pat = 0;
  // for (int i = 0; i < 8; ++i) {
  //   int sum = d[0];
  //   for (int j = 0; j < 3; ++j) {
  //     if (i & (1 << j)) { sum += d[j + 1]; }
  //     else { sum -= d[j + 1]; }
  //   }
  //   if (sum == 7) {
  //     pat = i;
  //     break;
  //   }
  // }
  // printf("%d", d[0]);
  // for (int i = 1; i < 4; ++i) {
  //   char c = (pat & (1 << (3 - i))) ? '+' : '-';
  //   printf("%c%d", c, d[i]);
  // }
  // printf("=7\n");

  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 2; ++k) {
        int sum = d[0];
        if (i == 0) { sum += d[1]; }
        else { sum -= d[1]; }
        if (j == 0) { sum += d[2]; }
        else { sum -= d[2]; }
        if (k == 0) { sum += d[3]; }
        else { sum -= d[3]; }
        if (sum == 7) {
          char op1 = (i == 0) ? '+' : '-';
          char op2 = (j == 0) ? '+' : '-';
          char op3 = (k == 0) ? '+' : '-';
          printf("%d%c%d%c%d%c%d=7\n", d[0], op1, d[1], op2, d[2], op3, d[3]);
          return 0;
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void solve() {
		int n=s.nextInt();
		int k=s.nextInt();
//		memo=new boolean[k+1];
//		visited = new boolean[k+1];
		int[] arr = new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=s.nextInt();
		}
//		boolean ans = winOrLoss(k, arr, false);
		boolean[] helper = new boolean[k+1];
		helper[0]=true;
		for(int i=1;i<=k;i++) {
			boolean ans = false;
			for(int j=0;j<n;j++) {
				if(i-arr[j]>0) {
					ans |= !helper[i-arr[j]];
				}else if(i-arr[j]==0){
					ans |=true ;
				}
			}
			helper[i]=ans;
		}
		if(!helper[k]) {
			out.println("Second");
		}else {
			out.println("First");
		}
	}

//	public static boolean[] memo;
//	public static boolean[] visited;
//	public static boolean winOrLoss(int k,int[] arr, boolean chance) {
//		if(k<0) {
//			return true;
//		}
//		if(k==0) {
//			return false;
//		}
//		if(visited[k]) {
//			return memo[k];
//		}
//		boolean ans = false;
//		int n=arr.length;
//		for(int i=0;i<n;i++) {
//			ans |= !winOrLoss(k-arr[i], arr, !chance);
//		}
//		visited[k]=true;
//		memo[k]=ans;
//		return ans;
//	}
	
	public static void main(String[] args) {
		out = new PrintWriter(new BufferedOutputStream(System.out));
		s = new FastReader();
		solve();
		out.close();
	}

	public static FastReader s;
	public static PrintWriter out;

	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	
}


Measured memory_bytes: 23892
#include<stdio.h>
main()
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	
	if ( a < b && b < c )
	printf("Yes\n", a, b, c);
	else 
	printf("No\n", a, b, c);
	return 0;
}



Measured memory_bytes: 2044
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let s = buf.trim().chars().collect::<Vec<char>>();

    let mut rel_r_cnt: isize = 0;
    for c in s.iter() {
        rel_r_cnt += if *c == 'R' {
            1
        }
        else {
            -1
        }
    }

    println!("{}", if rel_r_cnt>0 {"Yes"} else {"No"});
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define int ll


string s;
string t = "keyence";

bool f(int a,int b){
  string u;
  rep(i,a){
    u.PB(s[i]);
  }
  FOR(i,b,s.size()){
    u.PB(s[i]);
  }

  return u==t;
}

signed main(){
  cin>>s;

  rep(i,s.size()){
    FOR(j,i,s.size()){
      if(f(i,j)){
        cout<<"YES"<<endl;
        return 0;
      }
    }
  }

  cout<<"NO"<<endl;
}

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

/* */

int main(){
    // 入力スタンダード
    long long x;
    cin >> x;

    int year = 0;
    long long val = 100;

    while(val<x){
        val *= 1.01;
        year++;
    }

    /*
    while(true){
        val += val/100;
        if(val>=x) {
            break;
        } else {
            year++;
        }
    }
    */

    cout << year << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const long long maxn=2*1e5+10;
const long long inf=99999999999;
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<ll> uid(l, r); return uid(rng); }

ll power(ll x, ll y){  
	ll p=mode, res=1;
    x = x % p;
    while (y > 0) {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}



void solve(){
	
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	if (k<=(a+b)){
		cout<<min(k,a)<<endl;
	}
	else{
		ll ans=a;
		k-=(a+b);
		ans-=k;
		cout<<ans<<endl;
	}
	
	
	return;
}
 
int main(){ 
    
    #ifndef ONLINE_JUDGE
		//freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
 	
	//T{ solve(); }
	solve();
	
	return 0;
}


Measured memory_bytes: 3636
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

int dp[100100];

int main(){
  int N; cin >> N;
  int K; cin >> K;
  vector<int> h(N);
  rep(i,N) cin >> h[i];
  rep(i,100100){
    dp[i]=INF;
  }
  dp[0]=0;
  rep(i,N){
    for(int j=1;j<=K;j++){
      if(i+j<N) chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
    }
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#pragma endregion

int main(){
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n+1, 0);
    vector<ll> b(m+1, 0);
    int a_max = n;
    FORS(i,1,n) {
        cin >> a[i];
        a[i]+=a[i-1];
    }
    FORS(i,1,m) {
        cin >> b[i];
        b[i]+=b[i-1];
    }
    int ans=0;
    REPS(a_read, n){
        if (a[a_read]>k) continue;
        else{
            // decltype(b)::iterator itr;
            // if (a_read==a_max) itr = upper_bound(ALL(b), k-a[a_max]);
            // else itr = upper_bound(ALL(b), a[a_read+1]-a[a_read]);
            auto itr = upper_bound(ALL(b), k-a[a_read]);
            int b_read = (itr-b.begin())-1;
            ans = max(ans, a_read+b_read);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define ALL(i) (i).begin(),(i).end()
#define RALL(i) (i).begin(),(i).end(),greater<int>()
using namespace std;
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }

typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
#define TENFIVE2 200005

// #define int long long

signed main(){
    int N;
    vector<ll>v;
    cin>>N;

    rep(i,N){ll tmp;cin>>tmp;v.pb(tmp); }
    sort(ALL(v));
    ll n,r=-1;
    n = v[N-1];

    ll reg_r=-1;    
    rep(i,N){
        ll tmp =v[i];
        if(v[i] > n/2 ){
            if( reg_r< n- v[i]){
                r = v[i];
                reg_r = n-v[i];
            }            
        }else{
            if(reg_r < v[i]){
                r = v[i];
                reg_r =v[i];
            }
        }
    }

    cout<<n<<" "<<r<<endl;

    return 0;
}


Measured memory_bytes: 1400
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = list(input())
N = len(S) - 1

# 間に+を挟むかどうかでビット全探索
ans = 0
for bit in range(1<<N):
    s = ''
    for i, num in enumerate(S):
        if bit & 1<<i:
            s += num + '+'
        else:
            s += num
    ans += eval(s)
print(ans)


Measured memory_bytes: 3064
s = int(input())
a=s//100
b=s%100

if 1<=a<=12 and 1<=b<=12 :
    print("AMBIGUOUS")
elif (a==0 or a>12) and 1<=b<=12:
    print("YYMM")
elif (b==0 or b>12) and 1<=a<=12:
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int main(){
    long long ans;
    long int N;
    cin>>N;
    ans=(1+N)*(N)/2;
    long long ans3;
    long long ans5;
    long long ans15;
    long int n3=(N/3)*3;
    long int n5=(N/5)*5;
    long int n15=(N/15)*15;
    ans3=(3+n3)*(n3/3)/2;
    ans15=(15+n15)*(n15/15)/2;
    ans5=(5+n5)*(n5/5)/2;
    ans=ans-ans5-ans3+ans15;
    cout<<ans<<endl;

}

Measured memory_bytes: 3632
#include<iostream>
#include<map>
#include<vector>

using namespace std;

typedef pair<string,int> P;
typedef pair<int,int> Point;
typedef pair<Point,Point> PP;
map<string,int> M,MM;
map<string,PP> Disp;

vector<string> V;

bool isTouch(string s, int x, int y){
  Point p1 = Disp[s].first, p2 = Disp[s].second;

  return (p1.first <= x && x <= p2.first && p1.second <= y && y <= p2.second);
}

P find(int x, int y){
  P ans = P("OUT OF MAIN PANEL",10000);
  M["OUT OF MAIN PANEL"] = 100000;


  for(int i = 0; i < V.size(); i++)
    if(isTouch(V[i],x,y) && M[ans.first] > M[V[i]]) ans = P(V[i],MM[V[i]]);


  if(ans.first == "OUT OF MAIN PANEL") ans.second = 1;
  return ans;
}

PP getPoint(string s){
  s += ",";
  
  int data[4];
  int num = 0;
  int sum = 0;
  int pos = 0;

  while(num < 4){
    if(s[pos] == ','){
      data[num++] = sum;
      sum = 0;
    }else{
      sum *= 10;
      sum += s[pos]-'0';
    }
    pos++;
  }
  PP pp;
  
  pp.first = Point(data[0],data[1]);
  pp.second = Point(data[2],data[3]);

  return pp;
}

string check(int pos,string s){
 
  string out = "";

  for(int i = pos; i < s.length(); i++){
    out += s[i];
    if(s[i] == '>') break;
  }

  return out;
}


void solve(string s){
  int pos = 0;
  string tag = "</", name = "", between = "", tail = "";
  int num = 0;
  
  while(1){
    tag += s[++pos];
    if(s[pos] != '<' && s[pos] != '>') name += s[pos];
    if(s[pos] == '>') break;
  }

  string point = "";
  
  while(s[++pos] != '<') point+=s[pos];

  PP p = Disp[name] = getPoint(point);

  V.push_back(name);

  string child = "";
  string endofchild = "/<";
  int numofchild = 0;

  while(pos < s.length()){
    if(s[pos] == '<'){

      if(child == "" && s[pos+1] != '/'){
	child = check(pos,s);
	endofchild = "</";
	for(int i = 1; i < child.length(); i++) endofchild += child[i];
      }

      if(check(pos,s) == tag){
	while(s[pos] != '>') pos++;
	break;
      }

      if(check(pos,s) == endofchild){
	numofchild++;
	child = "";
      }
      num++;
    }
    between += s[pos++];
  }
  M[name] = num/2;
  MM[name] = numofchild;


  for(int i = pos+1; i < s.length(); i++)
      tail += s[i];
  if(between.length()) solve(between);
  if(tail.length()) solve(tail);
}

void init(){
  M.clear();
  MM.clear();
  Disp.clear();
  V.clear();
}

int main(){

  string s;
  int n;
  while(cin >> n && n){
 
    init();

    cin.ignore();

    getline(cin,s);
    solve(s);

    for(int i = 0; i < n; i++){
      int x,y;
      cin >> x >> y;
      P p =  find(x,y);
      cout << p.first << " " << p.second<< endl;
    }
  }

  return 0;
}

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

int main(){
	int m, f, r;
	
	while(1){
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1){
			break;
		}
		
		if(m == -1 || f == -1){
			cout << 'F' << endl;
		}else if(m + f >= 80){
			cout << 'A' << endl;
		}else if(m + f >= 65){
			cout << 'B' << endl;
		}else if(m + f >= 50){
			cout << 'C' << endl;
		}else if(m + f >= 30){
			if(r >= 50){
				cout << 'C' << endl;
			}else{
				cout << 'D' << endl;
			}
		}else{
			cout << 'F' << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
using ll = long long;
using ld = long double;
using namespace std;
ll MOD = 1e9 + 7;
//vector<ld> vec;
int main(){
    int n;
    cin>>n;
    if(n==1){
        cout<<1<<endl;
        return 0;
    }
    int max=0;
    vector<int> vec(n+100000);
    for(int i=0;i<n;i++){
        cin>>vec[i];
    }
    vector<int> reg(n+100000);
    for(int i=0;i<n;i++){
        if(vec[i]==0){
            reg[0]++;reg[1]++;
            continue;
        }
        reg[vec[i]-1]++;reg[vec[i]]++;reg[vec[i]+1]++;
    }
    sort(reg.begin(),reg.end(),greater<int>());
    cout<<reg[0]<<endl;
}
    


Measured memory_bytes: 1792
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<fstream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

struct AccSum{
    vector<ll> Ac;
    ll L;
    AccSum(vector<ll> &A){
        L = A.size();
        Ac.resize(L+1);
        FOR(i, 0, L){
            Ac[i+1] = Ac[i] + A[i];
        }
    }

    // sum of [a, b]
    ll sum(ll a, ll b){
        if(a<0) return -1;
        if(b>L-1) return -1;
        return Ac[b+1] - Ac[a];
    }
};

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

    // input
    ll N, K;
    cin >> N >> K;

    string s;
    cin >> s;
    ll L = s.size();

    // count 
    vector<ll> C;

    if(s[0]=='0'){
        C.push_back(0);
    }

    char current = s[0];
    ll count = 1;
    FOR(i, 1, L){
        char c = s[i];
        if(c==current){
            count++;
        }else{
            C.push_back(count);
            count = 1;
        }
        current = c;
    }
    C.push_back(count);

    if(s.back()=='0'){
        C.push_back(0);
    }

    ll black_num = C.size()/2;
    if(black_num <= K){
        // 全部1にできる
        ll sum = 0;
        for(ll c : C){
            sum += c;
        }
        p(sum);
        return 0;
    }

    // 累積和
    auto Ac = AccSum(C);
    ll max_sum = 0;

    for(int i=0; i<C.size()-2*K+1; i+=2){
        ll sum = Ac.sum(i, i+2*K);
        max_sum = max(max_sum, sum);
    }

    p(max_sum);
    
    return 0;
}


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

int main(){
    int N, ans = 0;
    cin >> N;
    vector<int> a(N);
    for(auto& x: a) cin >> x;
    unordered_map<string,int> mp;
    for(int i = 0; i < N; ++i){
        if     (   1 <= a[i] && a[i] <=  399) ++mp["gray"];
        else if( 400 <= a[i] && a[i] <=  799) ++mp["brown"];
        else if( 800 <= a[i] && a[i] <= 1199) ++mp["green"];
        else if(1200 <= a[i] && a[i] <= 1599) ++mp["mizu"];
        else if(1600 <= a[i] && a[i] <= 1999) ++mp["blue"];
        else if(2000 <= a[i] && a[i] <= 2399) ++mp["yellow"];
        else if(2400 <= a[i] && a[i] <= 2799) ++mp["orange"];
        else if(2800 <= a[i] && a[i] <= 3199) ++mp["red"];
        else ++mp["over"];
    }
    for(auto x: mp){
        if(x.first != "over") ++ans;
    }
    if(mp["over"] != 0){
        cout << max((int)ans,(int)1) << " " << ans + mp["over"] << endl;
    }
    else cout << ans << " " << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <functional>
using namespace std;

class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n;
        vector<int> s;
        in >> n;
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
            int tmp;
            in >> tmp;
            ans += tmp;
            s.push_back(tmp);
        }

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

        int i;
        for (i = 0; i < s.size(); i++)
        {
            if (s[i] % 10 == 0)
            {
                continue;
            }
            if (ans % 10 == 0)
            {
                ans -= s[i];
            }
            else
            {
                break;
            }
        }
        if (i == s.size())
        {
            ans = 0;
        }

        out << ans;
    }
};

void solve(std::istream& in, std::ostream& out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}


#include <fstream>
#include <iostream>


int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);


    istream& in = cin;


    ostream& out = cout;

    solve(in, out);
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
   int h,n,a;
   cin>>h>>n;
   for(int i=0; i<n; i++){
       cin>>a;
       h-=a;
   }
   if(h<=0){
       cout<<"Yes";
   }
   else{
       cout<<"No";
   }
}

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

int main(){
  int x,y;
  cin >> x >> y;
  int zx,zy;
  if(x==4||x==6||x==9||x==11){
    zx=0;
  }else if(x==2){
    zx=3;
  }else{
    zx=2;
  }
  if(y==4||y==6||y==9||y==11){
    zy=0;
  }else if(y==2){
    zy=1;
  }else{
    zy=2;
  }
  if(zx==zy){
    cout << "Yes" << endl;
  }else{
    cout << "No" <<endl;
  }
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define nl '\n'
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
#define debug(x) cerr << #x << " = " << (x) << endl;

// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	int x;
	cin >> x;
	cout << !x << endl;
}

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

int main(){
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	//startTime = clock();
	
	int T;
	//cin >> T;
	T = 1;
	while(T--){
		solve();
	}
	
	//cout << getCurrentTime() << endl;
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	ll n,arr[1000006][3],i,j,dp[1000006][3],ma=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	dp[0][0]=arr[0][0],dp[0][1]=arr[0][1],dp[0][2]=arr[0][2];
	for(i=1;i<n;i++)
	{
		dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=arr[i][1]+max(dp[i-1][0],dp[i-1][2]);	
		dp[i][2]=arr[i][2]+max(dp[i-1][0],dp[i-1][1]);
	}
	ma=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	cout<<ma<<endl;
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n,m;
	cin >> n >> m;
	int ans = mod;
	vector< pair <int,int> > v;
	for(int i = 0; i < m ; i++ ){
		int a,b;
		cin >> a >> b;
		a--;
		v.push_back({a,b});
	}
	for(int i=0;i<=1000;i++){
		int  k = i ;
		string s = to_string(k) ; 
		if(s.length()!=n) continue;
		bool ok = true;
		for(int j = 0; j < m; j++){
			if(v[j].ss != (s[v[j].ff]-'0')) ok = false;
		}
		if(ok){
			ans = i;
			break;
		}
	}
	if(ans == mod ) ans = -1;
	cout<<ans;
}

Measured memory_bytes: 3712
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int ama[52][52];
int main(){
    int n,m;
    cin>>n>>m;
    
    rep(i,m){
        int a,b;
        cin>>a>>b;
        ama[a][b]++;
        ama[b][a]++;
    }
    
    for(int i=1;i<=n;i++){
        int ans=0;
        for(int j=1;j<=n;j++){
            ans+=ama[i][j];
        }
    cout<<ans<<endl;
    }
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0;

const int MAX = 510000;
unsigned ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理、これも呼ぶ
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
   for (int i = 2; i < MAX; i++){
     fac[i] = fac[i - 1] * i % MOD;
     inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
     finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算関数
long long comb(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int n,k;    cin >> n >> k;
    COMinit();
    for(int i=1;i<=k;i++){
        cout << comb(n-k+1,i)*comb(k-1,i-1)%MOD << endl;
    }

}

Measured memory_bytes: 12160
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val slimeCount :Int = sc.nextInt()
  val slimes :String = sc.next()
  val slimeList :List[Char] = slimes.toCharArray.toList

  def go(count: Int)(slimes: List[Char]): Int = slimes match {
    case h::t if t.isEmpty => count
    case h::t if h == t.head => go(count)(t)
    case h::t => go(count + 1)(t)
  }

  println(go(1)(slimeList))
}

Measured memory_bytes: 31372
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, m = nm()
    X = nl()
    X = sorted(X)
    D = [X[i + 1] - X[i] for i in range(m - 1)]
    D = sorted(D, reverse=True)
    print(sum(D[n - 1:]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20492
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
#define MOD 1000000007
//scanf("%d", &a) '\n'

int main() {
	int x;
	cin >> x;
	int key=0;
	while (x >=100) { x = x-100; ++key; };

	if (5 * key < x) cout << 0 << endl;
	else cout << 1 << endl;

}
	

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		char[] b=sc.next().toCharArray();
		a=sc.next();
		System.out.println("A"+b[0]+"C");
	
	}
	
}

Measured memory_bytes: 9556
C = [[int(_) for _ in input().split()] for _ in range(3)]
D = [(C[_][1]-C[_][0], C[_][2] - C[_][0]) for _ in range(3)]
if D[0] == D[1] and D[0] == D[2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define int long long 

using namespace std;
typedef pair<int, int> pii;
const int N = 1e5 + 3;

int dist[N];
int n, q, k;
vector<pii> g[N];

void dfs(int u, int p, int d)
{
        dist[u] = d;
        for (auto &v: g[u])
        {
                if (v.second==p) continue;
                dfs(v.second, u, d + v.first);
        }
}

int32_t main()
{
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin >> n;
        for (int i=1; i<n; i++)
        {
                int x, y, c; cin >> x >> y >> c;
                --x; --y;
                g[x].push_back({c, y});
                g[y].push_back({c, x});
        }
        cin >> q >> k;
        --k;
        dfs(k, -1, 0);
        while (q--)
        {
                int a, b; cin >> a >> b;
                --a; --b;
                cout << dist[a] + dist[b] << '\n';
        }
        return 0;
}


Measured memory_bytes: 14336