akhauriyash/Code-Regression huggingface dataset:
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, m;
int k[15];
int s[15][15];
int p[15];

int main(){
	cin >> n >> m;
	REP(i, m){
		cin >> k[i];
		REP(j, k[i]){
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	REP(i, m){
		cin >> p[i];
	}
	int ans = 0;
	REP(i, (1 << n)){
		int cnt = 0;
		REP(j, m){
			int num = 0;
			REP(l, k[j]){
				if(i & (1 << s[j][l]))num++;
			}
			if(num % 2 == p[j])cnt++;
		}
		if(cnt == m)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val s = sc.next
  val t = sc.next

  def solve(head: String, tail: String, sample: String): Boolean = {
    if (head + tail == sample) true
    else if (head.isEmpty) false
    else solve(head.substring(1), tail + head.substring(0, 1), sample)
  }

  println(if (solve(s, "", t)) "Yes" else "No")
}


Measured memory_bytes: 27456
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string>
#include<set>
#include<string.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int n, k;
	cin >> n >> k;
	set<int>d;
	int x;
	rep(i, k){
		cin >> x;
		d.insert(x);
	}
	int tmp;
	int cnt = 0;
	for (int i = n; i < 100000; i++){
		tmp = i;
		while (tmp>0){
			if (d.count(tmp % 10) != 0){
				cnt = 1;
				break;
			}
			tmp /= 10;
		}
		if (cnt == 1){
			cnt = 0;
			continue;
		}
		cout << i << endl;
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
h,n=[int(x) for x in stdin.readline().rstrip().split()]
ab=[]
for i in range(n):
    ab.append([int(x) for x in stdin.readline().rstrip().split()])

ans=[0]*(h+1)
for i in range(1,h+1):
    li = [ans[max(i-j[0],0)]+j[1] for j in ab]
    ans[i]=min(li)

print(ans[h])

Measured memory_bytes: 74920
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/

int main() {
	ll N; cin >> N;
	bool ok = true;
	VLL t(N+1), x(N+1), y(N+1);
	x[0] = y[0] =t[0]= 0 ;
	for (int i = 1;i<N+1;i++) {
		cin >> t[i] >> x[i] >> y[i];
	}
	for (int i = 1;i < N+1;i++) {
		if (x[i] + y[i] - x[i - 1] - y[i - 1] > (t[i]-t[i-1])) ok = false;
		else{
			if ((x[i] + y[i] - x[i - 1] - y[i - 1]) % 2 != 0) {
				if ((t[i] - t[i - 1])%2==0) ok = false;
			}
			else {
				if ((t[i] - t[i - 1]) % 2 != 0) ok = false;
			}
		}
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define pb push_back
#define fi first
#define SZ(x) (int((x).size()))
#define se second
#define ll long long
#define pq priority_queue
#define MP make_pair
#define pii pair<int,int>
#define mod 998244353
#define inf 0x3f3f3f3f
#define debug(x) cerr<<#x<<"="<<x<<'\n'
#define rep(i, a, b) for (int i=a; i<(b); i++)

const int maxn=3e5;

int n;
vector <int> edge[maxn];
vector <int> s;
ll tree[maxn*4],add[maxn*4];

void update(int c,int cl,int cr,int l,int r,ll val) {
	if (l<=cl&&cr<=r) {
		tree[c]+=(ll)(cr-cl+1)*val;
		add[c]+=val;
		return;
	}
	int mid=cl+cr>>1; 
	if (add[c]!=0) {
		tree[c<<1]+=(ll)(mid-cl+1)*add[c];
		add[c<<1]+=add[c];
		tree[c<<1|1]+=(ll)(cr-mid)*add[c];
		add[c<<1|1]+=add[c];
		add[c]=0;
	}
	if (l<=mid) update(c<<1,cl,mid,l,r,val); 
	if (r>mid) update(c<<1|1,mid+1,cr,l,r,val);
	tree[c]=tree[c<<1]+tree[c<<1|1];
	return;
}

int main(){
    std::ios::sync_with_stdio(false);
    memset(tree,0,sizeof(tree));
    memset(add,0,sizeof(add));
    cin>>n;
    rep(i,1,n) {
    	int u,v;
    	cin>>u>>v;
    	edge[u].pb(v);
    	edge[v].pb(u);
	}
	rep(i,1,n+1) sort(edge[i].begin(),edge[i].end());
	ll ans=0;
	rep(i,1,n+1) {
		s.clear();
		s.pb(0);
		rep(j,0,SZ(edge[i])) 
			if (edge[i][j]<i) s.pb(edge[i][j]);
		s.pb(i);
		int cur=1;
		for (int j=SZ(s)-2;j>=0;j--) update(1,1,n,s[j]+1,s[j+1],cur--);
		ans+=tree[1];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 37584
class SegmentTree:
    def __init__(self, N, func, I):
        self.sz = N
        self.func = func
        self.I = I
        self.seg = [I for i in range(self.sz * 2)]
 
    def assign(self, k, x):
        self.seg[k + self.sz] = x
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k //= 2
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])
 
    def query(self, a, b):
        R = self.I
        a += self.sz
        b += self.sz
        while a < b:
            if a % 2 == 1:
                R = self.func(R, self.seg[a])
                a += 1
            if b % 2 == 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a //= 2
            b //= 2
        return R

def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    from fractions import gcd
    N = int(readline())
    m = map(int,read().split())
    seg = SegmentTree(N , gcd , 0)
    for i in range(N):
        seg.assign(i , next(m))
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
    print(ans)

main()


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

int main(){
  int k;
  cin >> k;
  if(k%2==0 || k%5==0){
    cout << -1 << endl;
    return 0;
  }
  int seven = 7;
  for(int i = 1; i<=k; i++){
    if(seven%k == 0){
      cout << i << endl;
      return 0;
    }
    seven %= k;
    seven = seven*10 + 7;
  }
  cout << -1 << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	string s; cin >> s;
	bool isOK = true;
	if (s[0] != 'A') isOK = false;
	int cntC = 0;
	for (int i = 2; i < s.size() - 1; ++i)
	{
		if (s[i] == 'C')++cntC;
	}
	if (cntC != 1)isOK = false;
	if (isOK)
	{
		for (int i = 1; i < s.size(); ++i)
		{
			if (s[i] != 'C' && isupper(s[i]))isOK = false;
		}
	}
	if (isOK) cout << "AC" << endl;
	else cout << "WA" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    int h,w; cin >> h >> w;
    vs fig(h);
    rep(i,h) cin >> fig[i];
    
    rep(i,h){
        rep(j,w){
            //cout<<fig[(i)/2][j];
            cout<<fig[i][j];
            //cout<<fig[i][j];
        }
        cout<<endl;
        rep(j,w){
            //cout<<fig[(i)/2][j];
            cout<<fig[i][j];
            //cout<<fig[i][j];
        }
        cout<<endl;
    }
}

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;


int32_t main()
{
	GO;
	for (int i = 0; i < 5; i++) {
		int x;
		cin >> x;
		if (x == 0)
		{
			cout << i + 1 << endl;
			return 0;
		}
	}
	return 0;
}

//!

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll N;
	cin >> N;

	cout << (N * (N - 1) / 2);

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}


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

using ll = long long;

class Rolling_Hash{
private:
  ll n;
  static constexpr ll base1=1007,base2=2009;
  static constexpr ll mod1=(1e9+7),mod2=(1e9+9);
  vector<ll> hash1,hash2,mpow1,mpow2;
public:
  Rolling_Hash(const string& s){
    n=s.size();
    hash1.resize(n+1,0);
    hash2.resize(n+1,0);
    mpow1.resize(n+1,1);
    mpow2.resize(n+1,1);
    for(ll i=0;i<n;++i){
      hash1[i+1] = (hash1[i]*base1+s[i])%mod1;
      hash2[i+1] = (hash2[i]*base2+s[i])%mod2;
      mpow1[i+1] = (mpow1[i]*base1)%mod1;
      mpow2[i+1] = (mpow2[i]*base2)%mod2;
    }
  }
  auto get(ll l,ll r){
    ll lefval = hash1[r]-hash1[l]*mpow1[r-l]%mod1;
    ll rigval = hash2[r]-hash2[l]*mpow2[r-l]%mod2;
    if(lefval<0)lefval+=mod1;
    if(rigval<0)rigval+=mod2;
    return make_pair(lefval,rigval);
  }
  auto get_LCP(ll a,ll b){
    ll len = min( n-a+1,n-b+1 );
    ll low=0,high=len;
    while( high-low>1 ){
      ll mid=(high+low)>>1;
      if(get(a,a+mid)!=get(b,b+mid))high=mid;
      else low=mid;
    }
    return low;
  }
};

signed main(){

  int n;
  string s;
  cin>>n>>s;

  Rolling_Hash str(s);
  int l = 0;
  int r = n;
  auto chk = [&](int len)->bool{
    for(int i=0;i+len<=n;++i){
      for(int j=i+len;j+len<=n;++j){
        if(str.get(i,i+len)==str.get(j,j+len)){
          return true;
        }
      }
    }
    return false;
  };
  while(r-l>1){
    int len = (l+r)/2;
    if(chk(len))l=len;
    else r=len;
  }
  cout<<(l)<<endl;

}

Measured memory_bytes: 512
#include<iostream>
#include<string.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    int cost = 0;
    bool check = false;
    for(; cost <= 1250; cost++){
        // cout << "cost=" << cost <<
        //     " a=" << (int)(cost*0.08) << " " << a <<
        //      " b=" << (int)(cost*0.1) << " " << b << endl;
        if((int)(cost*0.08) == a && (int)(cost*0.1) == b){
            // cout << "here" << endl;
            check = true;
            break;
        }
    }
    cout << (check?cost : -1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define typeof(x) __typeof__(x)
#define int long long int
#define double long double
#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(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector

#define dump(x)  cerr << #x << " = " << (x) << 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) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const pair<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}


vector<int> frac;
void init_frac(int N) {
   frac.push_back(1);
   for (int i = 1; i <= N; i++) {
      frac.push_back(mod(frac[i-1] * i));
   }
}
int powM(int x, int n) {
   int res = 1;
   while (n > 0) {
      if ((n & 1) == 1) {
         res = mod(res * x);
      }
      x = mod(x * x);
      n >>= 1;
   }
   return res;
}
int inverseM(int x) {
   return powM(x, MOD-2);
}
int comb(int n, int r) {
   if (n < 0 || n-r < 0 || r < 0) {
      return 0;
   }
   return mod(frac[n] * inverseM(mod(frac[n-r]*frac[r])));
}

signed main()
{
   int N, M; cin >> N >> M;

   vector<bool> isprime((int)pow(M,0.5)+1, true);
   isprime[0] = isprime[1] = false;
   for(int i = 2; i*i <= M; i++) {
      if (isprime[i]) {
         for (int j = 2; (i*j)*(i*j) <= M; j++) {
            isprime[i*j] = false;
         }
      }
   }
   dump(isprime)

   map<int,int> p_num;
   int tmpM = M;
   for(int i = 2; i*i <= M; i++) {
      if (!isprime[i]) continue;
      while (tmpM % i == 0) {
         p_num[i]++;
         tmpM /= i;
      }
   }
   if (tmpM != 1) p_num[tmpM]++;
   dump(p_num)

   init_frac(N + 50);
   int ans = 1;
   EACH(i, p_num) {
      ans = mod(ans * comb(N-1 + i->second, i->second));
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 1404
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

#n = int(input())
a,b = [int(i) for i in readline().split()]
#lr = [[int(i)-1 for i in readline().split()] for _ in range(q)]


c = 0
while c*(a-1) +1 < b:
    c += 1

print(c)









Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	static long lcm(long a, long b){
		return a * b / gcd(a, b);
	}
	static long gcd(long a, long b){
		if(a < b){
			return gcd(b, a);
		}
		long mod = a % b;
		if(mod == 0){
			return b;
		}else{
			return gcd(b, mod);
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		System.out.println(lcm(a, b));
	}
}


Measured memory_bytes: 22996
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

const INF: i32 = 1000000000;

fn main() {
    input! {
        n: usize,
        m: usize,
        x: i32,
        ca:[(i32,[i32;m]);n],
    }

    let mut ans: i32 = INF;

    for bit in 0..(1 << n) {
        let mut price = 0;
        let mut smart = vec![0i32; m];
        for i in 0..n {
            if (bit >> i) & 1 == 1 {
                price += ca[i].0;

                for j in 0..m {
                    smart[j] += ca[i].1[j]
                }
            }
        }

        if smart.iter().fold(true, |isok, &s| isok && s >= x) {
            ans = std::cmp::min(price, ans)
        }
    }

    // for bit in 0..(1 << n) {
    //     let mut price = 0;
    //     let mut smart = vec![0i32; m];
    //     for i in 0..n {
    //         if (bit >> i) & 1 == 1 {
    //             // 合計金額を加算
    //             price += ca[i].0;

    //             // アルゴリズムの数だけ回す
    //             for j in 0..m {
    //                 // 教科書の理解度を加算する
    //                 smart[j] += ca[i].1[j]
    //             }
    //         }
    //     }

    //     // 全ての理解度がxを超えてるか判断
    //     if smart.iter().fold(true, |isok, &s| isok && s >= x) {
    //         // ansとpriceを比較して小さい方をansに代入
    //         ans = std::cmp::min(price, ans);
    //     }
    // }

    if ans >= INF {
        println!("-1")
    } else {
        println!("{}", ans)
    }
}


Measured memory_bytes: 2108
S = str(input())
check1 = 0
for i in range(len(S)):
    if i % 2 == 0 and S[i] != "0":
#         print(i,'yes')
        check1 += 1
    if i % 2 != 0 and S[i] == "0":
#         print(i,"no")
        check1 += 1
# print(check1)

check2 = 0
for i in range(len(S)):
    if i % 2 == 0 and S[i] != "1":
#         print(i,'yes')
        check2 += 1
    if i % 2 != 0 and S[i] == "1":
#         print(i,"no")
        check2 += 1
# print(check2)

print(min(check1,check2))

Measured memory_bytes: 3188
a = []
for i in range(3):
    line = list(map(int, input().split()))
    a.append(line)
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b: a[j][k] = 0
bingo = False
for i in range(3):
    if a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0: bingo = True
    if a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0: bingo = True
if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0: bingo = True
if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0: bingo = True

if bingo: print('Yes')
else: print('No')

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int k = scanner.nextInt();
        if (b - a + 1 <= 2 * k) {
            for (int i = a; i <= b; i++) {
                System.out.println(i);
            }
        } else {
            for (int i = a; i < k + a; i++) {
                System.out.println(i);
            }
            for (int j = b - k + 1; j <= b; j++) {
                System.out.println(j);
            }
        }
    }
}

Measured memory_bytes: 23252
n,m=map(int,input().split())
ll=[]
rr=[]
for i in range(m):
    l,r=map(int,input().split())
    ll.append(l)
    rr.append(r)
if min(rr)<max(ll):
    print(0)
else:
    print(min(rr)-max(ll)+1)

Measured memory_bytes: 11016
n,q = map(int,input().split())
process = []
for i in range(n):
    name,time = input().split()
    process.append([name,int(time)])
elap = 0
out = []
while len(process) > 0:
    name,time = process.pop(0)
    temp_q = q
    while True:
        if time <= 0:
            out.append([name,elap])
            break
        if temp_q <= 0:
            process.append([name,time])
            break
        time -= 1
        temp_q -= 1
        elap += 1
for name,time in out:
    print(name,time)


Measured memory_bytes: 14672
#include <bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
using namespace std;
 
int h,n,a[1001],b[1001],dp[40001],res=0x3f3f3f3f;
 
int main() {
	ios::sync_with_stdio(false);
	cin >> h >> n;
	rb(i,1,n)cin >> a[i] >> b[i];
	memset(dp,0x3f,sizeof(dp));
	dp[h]=0;
	rb(i,1,n){
		rl(j,h,0){
			dp[max(j-a[i],0)]=min(dp[max(j-a[i],0)],dp[j]+b[i]);
		}
		res=min(res,dp[0]);
	}cout<<res;
	return 0;
}

Measured memory_bytes: 384
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d\n" @@ fun a -> a in
  if as_.(0) <> 0
  then print_endline "-1"
  else if
    Array.init (n - 1) (( + ) 1)
    |> Array.to_list
    |> List.exists (fun i -> as_.(i) - as_.(i - 1) > 1)
  then print_endline "-1"
  else begin
    Array.init (n - 1) (( + ) 1)
    |> Array.map (fun i ->
        if as_.(i) = as_.(i - 1) + 1 then 1
        else as_.(i))
    |> Array.fold_left ( + ) 0
    |> Printf.printf "%d\n"
  end

Measured memory_bytes: 12928
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	int sum = 0;
	int maxv = 0;
	while (n--)
	{
		int x;
		cin >> x;
		sum += x;
		maxv = max(maxv, x);
	}
	if (maxv < sum - maxv) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

int N;

void func(){

	double minimum = (double)BIG_NUM,tmp;
	int ans_S,ans_A,ans_C,M=256,R[N+1],input[N+1],O[N+1],check[256];

	for(int i = 1; i <= N; i++)scanf("%d",&input[i]);

	for(int s = 0; s <= 15; s++){
		for(int a = 0; a <= 15; a++){
			for(int c = 0; c <= 15; c++){
				R[0] = s;
				for(int i = 1; i <= N; i++){
					R[i] = (a*R[i-1]+c)%M;
				}

				for(int i = 0; i <= 255; i++)check[i] = 0;

				for(int i = 1; i <= N; i++){
					O[i] = (input[i]+R[i])%M;
					check[O[i]]++;
				}

				tmp = 0.0;
				for(int i = 0; i <= 255; i++){
					if(check[i] == 0)continue;
					tmp += (double)-1*((double)check[i]/(double)N)*log((double)check[i]/(double)N);
				}

				if(minimum - tmp > 0.0000000001){
					minimum = tmp;
					ans_S = s;
					ans_A = a;
					ans_C = c;
				}
			}
		}
	}

	printf("%d %d %d\n",ans_S,ans_A,ans_C);

}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

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

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

  N = N % 500;
  if ( A - N > 0 || A - N == 0) {
    cout << " Yes " << endl;
   }
  else if ( A - N < 0 ){
     cout << " No " << endl;
   }
} 

Measured memory_bytes: 3640
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Numerics.BitOperations;

namespace ABC175
{
    class SolverB
    {
        static void Main()
        {
            SetOut(new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false});
            new SolverB().Solve();
            Out.Flush();
        }

        public void Solve()
        {
            var N = Get.Int();
            int[] L = Get.Ints();
            Array.Sort(L);
            int len = L.Length;
            long ans = 0;
            for(int i=0; i<len; i++){
                for(int j=i+1; j<len; j++){
                    for(int k=j+1; k<len; k++){
                        if(L[i]+L[j] > L[k] && L[i] != L[j] && L[j] != L[k] && L[k] != L[i]){
                            ans++;
                            // WriteLine($"{L[i]}, {L[j]}, {L[k]}");
                        }
                    }
                }
            }
            WriteLine(ans);
        }




        static class Get
        {
            public static string Str() => ReadLine().Trim();
            public static int Int() => int.Parse(Str());
            public static long Long() => long.Parse(Str());
            public static double Double() => double.Parse(Str());
            public static string[] Strs() => Str().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            public static int[] Ints() => Strs().Select(int.Parse).ToArray();
            public static long[] Longs() => Strs().Select(long.Parse).ToArray();
            public static double[] Doubles() => Strs().Select(double.Parse).ToArray();
            static bool TypeEq<T,U>() => typeof(T).Equals(typeof(U));
            static T TypeConv<T,U>(U u) => (T)Convert.ChangeType(u, typeof(T));
            static T TypeConv<T>(string s) => TypeEq<T, int>() ?   TypeConv<T, int>(int.Parse(s))
                                        : TypeEq<T, long>() ?       TypeConv<T, long>(long.Parse(s))
                                        : TypeEq<T, double>() ?     TypeConv<T, double>(long.Parse(s))
                                        : TypeConv<T, string>(s);
            public static (T,U) Tuple<T,U>() {string[] strs = Strs(); T t = TypeConv<T>(strs[0]); U u = TypeConv<U>(strs[1]); return(t,u);}
            public static (T,U,V) Tuple<T,U,V>() {string[] strs = Strs(); T t = TypeConv<T>(strs[0]); U u = TypeConv<U>(strs[1]); V v = TypeConv<V>(strs[2]); return(t,u,v);}
        }
    }
}


Measured memory_bytes: 28128
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, a[N], b[N];
main() {
  file("threesum");
  ios;
  cin >> n;
  fo(i, 1, n, 1) cin >> a[i];
  foo(i, n, 1, 1) {
    int cnt = 0;
    fo(j, i, n, i) cnt += b[j];
    if (cnt % 2 == a[i]) continue;/*
    fo(j, i, n, i) {
      if (!b[j]) {
        b[j] = 1;
        break;
      }
    }*/
    b[i]^=1;
  }
  vi ans;
  fo(i, 1, n, 1) {
    int cnt = 0;
    fo(j, i, n, i) cnt += b[j];
    if (cnt % 2 != a[i]) return !(cout << -1);
    if (b[i]) ans.eb(i);
  }
  cout << ans.size() << '\n';
  for (int it : ans) cout << it << " ";
  return 0;
}
/**

*/


Measured memory_bytes: 2936
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define re register
#define For(i, j, k) for(re int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(re int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(re int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 111, M = 31624;
const ll INF = 5e16;
const ll P = 1e9 + 7;

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread (buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

	#define dd ch = getchar()
	inline ll read() {
		re ll x = 0; re int f = 0; re char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar (x % 10 | 48);
	}

	inline void wrn ( ll x ) { write (x); putchar (' '); }

	inline void wln ( ll x ) { write (x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn (x), wln (y); }

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	ll n, k, cc = 0, L[M << 1], R[M << 1], f[N][M << 1];
	
	/*
		n/1 + n/2 + n/3 + n/4 + ... + n/(n-1) + n/n
	*/
	
	inline ll power ( ll a, ll b, ll res = 1 ) {
		for (; b; b >>= 1, a = a * a % P) 
			res = (b & 1)? res * a % P: res; return res;
	}
	
	inline ll Inv ( ll a ) { return power(a, P - 2); }
	
	inline ll dfs ( ll x, ll y, ll res = 0 ) {
		if (x == k) return y;
		for (ll l = 1, r; l <= y; l = r + 1) 
			r = min (n, n / (n / l)), 
			res = (res + dfs(x + 1, n / l) * (r - l + 1) % P) % P;
		return res;
	}
	
	inline void Add ( ll &a, ll b ) { (a += b) >= P && (a -= P); }
	
	int main() {
		n = read(), k = read(); 
		for (ll l = 1, r; l <= n; l = r + 1) 
			L[++cc] = l, R[cc] = r = min (n, n / (n / l));
		For ( i, 1, cc ) f[1][i] = R[i];
		For ( i, 2, k ) For ( j, 1, cc ) 
			f[i][j] = f[i][j - 1], 
			Add(f[i][j], f[i - 1][cc - j + 1] * (R[j] - L[j] + 1) % P);
		return wln (f[k][cc]), 0;
	}
	
}

int main()
{
	return Cesare::main();
}

/*
10 2

10 3
*/






Measured memory_bytes: 53504
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli a,b,i,y1,y2;
    cin>>a>>b;
    for(i=1;i<=1e4;i++)
    {
        y1=0.08*i;
        y2=0.1*i;
        if(y1==a && y2==b)
        {
            cout<<i<<"\n";
            return 0;
        }
    }
    cout<<-1<<"\n";
}

Measured memory_bytes: 3664
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<unordered_set>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MOD = 1000 * 1000 * 1000 + 7;
const int MAX = 1000 * 1000 + 47;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	double d0, x;
	cin >> n >> d0 >> x;

	double ans = 0;
	RFOR(k, n + 1, 1)
	{
		//cout << d0 << " " << x << endl;
		ans += (2 * d0 + x * (2 * k - 1)) * k / (2.0 * k);
		if (k == 1) break;

		double x1 = (2 * x + k * x) / k;
		double d1 = (2 * (k + 1) * d0 + 5 * x) / (2.0 * k);
		x = x1;
		d0 = d1;
	}

	cout << fixed << setprecision(12) << ans << endl;
}

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

using namespace std;
int main(void){
    string a;
    cin>>a;
    int b=0;
    for(int i=0; i<a.length();i++){
        b=b+(a[i]-48);
    }
    if(b%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3696
#define alphanso                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL)
#include <bits/stdc++.h>
using namespace std;
int main()
{
	alphanso;
	int n, i, x, flag = 0;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> x;
		if (x & 1)
			flag++;
	}
	flag & 1 ? cout << "NO" : cout << "YES";
	return 0;
}

Measured memory_bytes: 3636
#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 (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N; cin>>N;
    vector<ll> dp(3,0);
    rep(i,N){
        ll a,b,c; cin>>a>>b>>c;
        a += max(dp[1],dp[2]);
        b += max(dp[0],dp[2]);
        c += max(dp[0],dp[1]);
        dp[0] = a;
        dp[1] = b;
        dp[2] = c;
    }
    cout<<max({dp[0],dp[1],dp[2]})<<endl;
}

Measured memory_bytes: 3556
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e5+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(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; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

int main()
{
	int ans = 1;
	int n, d;
	cin >> n >> d;

	int range = 2 * d + 1;
	int cost = range;

	while (cost < n)
	{
		cost += range;
		++ans;
	}

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

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

int main(){
  string a;
  cin >> a;
  if(a == "A")
    cout << "T"<< endl;
  if(a == "T")
    cout << "A"<< endl;
  if(a == "C")
    cout << "G"<< endl;
  if(a == "G")
    cout << "C"<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL mod = 1e9+7;
string  s[1000];
LL dp[1000][1000] = {0};

int main(){
    LL H, W;
    cin >> H >> W;
    for(int i = 0;i < H;i++)    cin >> s[i];
    dp[0][0] = 1;
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(i+1 < H && s[i+1][j] == '.'){
                dp[i+1][j] += dp[i][j];
                dp[i+1][j] %= mod;
            }
            if(j+1 < W && s[i][j+1] == '.'){
                dp[i][j+1] += dp[i][j];
                dp[i][j+1] %= mod;
            }
        }
    }
    cout << dp[H-1][W-1] << endl;
}

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

bool solve() {
    string S;
    cin >> S;
    regex r( R"(^A?KIHA?BA?RA?$)" );
    return regex_match(S,r);
}

int main() {
    string ans = solve() ? "YES" : "NO";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let X: i64 = sc.get();
    if X >= 30 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2112
def main():
    n,l = map(int,input().split())
    tot = int(l*n + (n+1)*n/2 - n)
    res = tot - l
    for i in range(2,n+1):
        if abs(l+i-1) < abs(tot - res):
            res = tot - (l+i-1)
    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
use proconio::{fastout, input};
use std::cmp::min;
use std::collections::BinaryHeap;

const M: u64 = 0xffffffffffffffff;

#[derive(Debug)]
struct Node {
    t: u64,
    c: usize,
    d: usize,
    n: Vec<(usize, usize, usize)>,
    s: Vec<u64>,
}

#[fastout]
fn main() {
    input! {
    in_n: u64, in_m: u64, in_s: usize,
    in_ns: [[usize; 4]; in_m], in_cs: [[usize; 2]; in_n]};
    let mut nodes = Vec::new();
    let size = (in_n * 50 + 1) as usize;

    for in_c in &in_cs {
        nodes.push(Node {
            t: M,
            c: in_c[0],
            d: in_c[1],
            n: vec![],
            s: vec![M; size],
        });
    }

    for in_n in &in_ns {
        nodes[in_n[0] - 1].n.push((in_n[1] - 1, in_n[2], in_n[3]));
        nodes[in_n[1] - 1].n.push((in_n[0] - 1, in_n[2], in_n[3]));
    }

    let mut queue = BinaryHeap::new();

    if in_s < size {
        queue.push((M, 0 as u64, 0, in_s));
    } else {
        queue.push((M, 0, 0, size - 1));
    }

    while !queue.is_empty() {
        let (_, t, i, s) = queue.pop().unwrap();

        if nodes[i].s[s] <= t {
            continue;
        }

        nodes[i].t = min(t, nodes[i].t);
        nodes[i].s[s] = t;

        if s + nodes[i].c < nodes[i].s.len() {
            let nt = t + nodes[i].d as u64;

            if nt < M {
                queue.push((M - nt, nt, i, s + nodes[i].c));
            }
        }

        for n in &nodes[i].n {
            let (ni, rs, rt) = *n;
            let nt = t + rt as u64;

            if rs > s {
                continue;
            }

            if nt < M {
                queue.push((M - nt, nt, ni, s - rs));
            }
        }
    }

    for n in nodes[1..].iter() {
        println!("{}", n.t);
    }
}


Measured memory_bytes: 11184
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		if (a + b > c + d) {
			pr.println("Left");
		} else if (a + b < c + d) {
			pr.println("Right");
		} else {
			pr.println("Balanced");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


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

using namespace std;
using ll = long long;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if (a + b > c + d) { cout << "Left" << endl; }
	else if (a + b < c + d) { cout << "Right" << endl; }
	else { cout << "Balanced" << endl; }

	return 0;
}


Measured memory_bytes: 256
//#include "stdc++.h"
#include <bits/stdc++.h>
#define int long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;



int32_t main()
{
    int n,m;
    cin>>n>>m;
    string a=to_string(n);
    string at=a;
    string b=to_string(m);
    string bt=b;

    for(int i=0;i<m-1;++i){
        a+=at;
    }

    for(int i=0;i<n-1;++i){
        b+=bt;
    }
    if(a>b)cout<<b;
    else
    {
        cout<<a;
    }
    
    

    cout<<'\n';
    
}

Measured memory_bytes: 256
k=int(input())
ans=[i for i in range(1,10)]
def dfs(x):
    if x>=3234566667:
        return
    for i in range(max(0,x%10-1),min(10,x%10+2)):
        ans.append(10*x+i)
        dfs(10*x+i)
for i in range(1,10):
    dfs(i)
print(sorted(ans)[k-1])

Measured memory_bytes: 19852
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
vector<char> Alphabet = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
vector<char> alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
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; }


int main()
{
  cout << fixed << setprecision(10);
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll M = -9223372036854775808;
  vector<ll> vec(4);
  vec = {a*c,a*d,b*c,b*d};
  rep(i,4)
  {
    M = max(vec[i],M);
  }
  cout << M << endl;
  return 0;
}


Measured memory_bytes: 3628