akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int N;
  cin >> N;
  vector<int> v(N);
  int minus = 0;
  for (int i = 0; i < N; i++) {
    cin >> v[i];
    if (v[i] < 0) minus++;
  }
  int ans = 0;
  int nearZero = INF;
  for (int i = 0; i < N; i++) {
    ans += abs(v[i]);
    nearZero = min(nearZero, abs(v[i]));
  }
  ans = (minus%2==0) ? ans : ans-nearZero*2;
  cout << ans << endl;
}


Measured memory_bytes: 1024
///******* In the name of Allah *******///

#include <bits/stdc++.h>
using namespace std;

long long int opponent[300013];
void Ok()
{
    long long int a,b,c = 0,d,e,f,g,t,s,i,j,k,l1,l2,m,n,r,sum,ans_1,ans_2,ans_3,cnt,Max,Min,flag,swi1,swi2;
    double aa,bb,cc,dd,ee,tot;
    char aaa[1013],bbb[1013],ccc[1013];

    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>opponent[i];
    }
    if(n==k)
    {
        cout<<"0"<<endl;
    }
    else if(n<k)
    {
        cout<<"0"<<endl;
    }
    else
    {
        ans_1 = n - k;
        sort(opponent+1,opponent+n+1);
        sum = 0;
        for(i=1;i<=ans_1;i++)
        {
            sum += opponent[i];
        }
        cout<<sum<<endl;
    }

    return;
}

int main()
{
    Ok();

    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<long long> A(X), B(Y), C(Z);

    for (int i = 0; i < X; i++) cin >> A[i];
    for (int i = 0; i < Y; i++) cin >> B[i];
    for (int i = 0; i < Z; i++) cin >> C[i];

    vector<long long> AB(X * Y);
    for (int i = 0; i < X; i++) {
        for (int j = 0; j < Y; j++) {
            AB[i * Y + j] = A[i] + B[j];
        }
    }

    sort(AB.begin(), AB.end(), greater<long long>());

    int ABsize = (int)AB.size() < K ? (int)AB.size() : K;

    vector<long long> ABC(ABsize * Z);
    for (int i = 0; i < ABsize; i++) {
        for (int j = 0; j < Z; j++) {
            ABC[i * Z + j] = AB[i] + C[j];
        }
    }

    sort(ABC.begin(), ABC.end(), greater<long long>());

    for (int i = 0; i < K; i++) {
        cout << ABC[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 31616
/*
*/
#define _CRT_SECURE_NO_WARNINGS

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>  
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <ctime>
#include <assert.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define eps 1e-10
#define M_PI 3.141592653589793
#define bs 1000000007;
#define bsize 512

const int N = 13031;

using namespace std;

string st;
int cnt[1000];

bool ok(char a, char b)
{
	if (cnt[a] > 0 && cnt[b] > 0)
		return 1;
	if (cnt[a] == 0 && cnt[b] == 0)
		return 1;
	return 0;
}

int main(){
	//freopen("beavers.in","r",stdin);
	//freopen("beavers.out","w",stdout);
	//freopen("F:/in.txt","r",stdin);
	//freopen("F:/output.txt","w",stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin >> st;
	for (int i = 0; i < st.size(); i++)
		cnt[st[i]]++;
	if (ok('N','S')&&ok('E','W'))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	cin.get(); cin.get();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())
#define ll long long

using namespace std;


#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

const ll inf =1000000007;
typedef pair<ll,ll> Pair;


typedef vector<ll> vl;

void csolve(){
    long double a,b;
    cin >> a >>b;
    kaku(floor(a*b));

    //printf("%.12f\n",ans);
}

void bsolve(){
    ll n;
    cin >> n;

    ll t=1000000000000000000;
    ll ans=1;
    bool u=false;//t超えた？
    bool ok=true;//０が出たか
    rep(i,n){
        ll a;
        cin >>a;

        if(ans!=0){
            if(t/ans < a) u=true;
        }

        ans*=a;

        if(a==0) ok=false;
    }
    if(u && ok) ans=-1;
    kaku(ans);
}

void asolve(){
    ll a,b;
    cin >> a >>b;
    kaku(a*b);
}

map< ll, ll > prime_factor(ll n) {
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

void dsolve(){
    ll n;
    cin >> n;
    map<ll,ll> mp=prime_factor(n);
    ll ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){

        for(ll i=1;i<=60;i++){
            if(itr->second >=i){
                mp[itr->first]-=i;
                ans++;
            }
            else{
                break;
            }
        }

    }
    kaku(ans);
}

int main(){
    bsolve();
}

Measured memory_bytes: 3632
#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
  string s;
  cin >> s;
  int count = 0;
  int n = s.size();
  REP(i, n) {
    if (s[i] != s[n - 1 - i]) count++;
  }
  REP(i, (n - 1) / 2 - 1) {
    if (s[i] != s[(n - 1) / 2 - i - 1]) count++;
  }
  for (int i = (n + 3) / 2 - 1; i < n; ++i) {
    if (s[i] != s[n - 1 - i]) count++;
  }
  if (count == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())

h_num, h_m = divmod(h, 2)
w_num, w_m = divmod(w, 2)

ans = 2 * h_num * w_num
if h_m == 1 and w_m == 1:
    ans += h_num + w_num + 1
elif h_m == 1:
    ans += w_num
elif w_m == 1:
    ans += h_num

if min(h, w) == 1:
    print(1)
else:
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <iterator>
#include <iomanip>
#include <climits>
using namespace std;


int main(){
    long long n, k;
    cin >> n >> k;
    vector<pair<long long, long long> > a(n);
    for(int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;
    long long ans = LLONG_MAX;
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < n; ++j)
            for(int l = 0; l < n; ++l)
                for(int m = 0; m < n; ++m){
                    long long x1 = a[i].first, x2 = a[j].first, y1 = a[l].second, y2 = a[m].second;
                    if(x1 > x2) swap(x1, x2);
                    if(y1 > y2) swap(y1, y2);
                    long long cnt = 0;
                    for(int MORE = 0; MORE < n; ++MORE){
                        if(a[MORE].first >= x1 && a[MORE].first <= x2){
                            if(a[MORE].second >= y1 && a[MORE].second <= y2) cnt++;
                        }
                    }
                    if(cnt >= k){
                        long long s = (x2 - x1) * (y2 - y1);
                        ans = min(ans, s);
                    }
                }
    cout << ans;
}


Measured memory_bytes: 3632
function f(n) {
	if (n % 2 == 0) {
		return n / 2;
	} else {
		return 3 * n + 1;
	}
}

function main(arg) {
	var tmp = Number(arg.split("\n")[0])
	var arr = []

	for(i = 0; i < 1000; i++) {
		if (i === 0) {
			arr.push(tmp)
			continue
		}

		var ai = f(arr[i - 1]);

		if (arr.indexOf(ai) >= 0) {
			break
		}
		arr.push(ai)
 	}

	 console.log(arr.length + 1)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 22080
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace std;

int n, k, x, y;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k >> x >> y;
	if(n <= k) cout << n * x << "\n";
	else cout << x * k + (n - k) * y << "\n"; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if ((abs(a-b)<=d && abs(b-c)<=d) || abs(c-a)<=d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){

    size_t n;
    std::cin >> n;

    size_t num = 1;
    for(size_t i = 0; i < n; i++){
        size_t a;
        std::cin >> a;

        if(a == num) num++;
    }

    if(num == 1){
        std::cout << -1 << std::endl;
    }else{
        std::cout << n - num + 1 << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;

ll gcd(ll x,ll y){
    if(y==0) return 0;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

int main(){
    int k,t;cin>>k>>t;
    vector<int> a(t);
    for(int i=0;i<t;i++) cin>>a[i];
    int m=*max_element(a.begin(),a.end());
    cout<<max(m-(k-k/2),0)*2-((k&1||m<=k/2)?0:1)<<endl;
    return 0;
}

Measured memory_bytes: 256
/*-------------------------------*
| Name: Ayush Kumar              |
| Site: atcoder                  |
| Email: ayushkr667@gmail.com    |
*-------------------------------*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define INF (ll) 1e18
const double PI = 3.141592653589793238460;

ll weigh[101], val[101];
ll dp[101][100001];
ll solve(ll n, ll w)
{
    if(w == 0)
        return 0;
    if(n == 0)
        return 0;

    if(dp[n][w] != -1)
        return dp[n][w];
    
    if(weigh[n] > w)
        return dp[n][w] = solve(n-1, w);

    else
    {
        return dp[n][w] = max( (val[n] + solve(n-1, w-weigh[n])), solve(n-1, w));
    }    
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    memset(dp, -1, sizeof(dp));
    ll w, n;
    cin>>n>>w;
    for (ll i = 1; i <= n; i++)
    {
        cin>>weigh[i]>>val[i];
    }
    cout<<solve(n, w);
    return 0;
}


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

int f[1<<21][22],n,K;
char c[1<<21];

int main()
{
	scanf("%d%d",&n,&K);
	for(int i=0;i<=n;++i)
	{
		scanf("%s",c);
		for(int j=0;j<(1<<i);++j) f[(1<<i)|j][i]=c[j]=='1';
	}
	for(int i=n;i>=0;--i)
		for(int s=0;s<(1<<i);++s)
			for(int j=i;j>=0;--j)
				if(f[(1<<i)|s][j])
				{
					int cur=f[(1<<i)|s][j];
					int a=s>>j;
					int b=s&((1<<j)-1);
					if(j) f[(1<<i-j)|a][0]+=cur;
					if(((1<<j)-1)&(~b))
					{
						int p=j-1;
						while((b>>p)&1) p--;
						f[(1<<(i-(j-1-p)))|(a<<p+1)|(b&((1<<p)-1))][p]+=cur;
					}
					if(b)
					{
						int p=j-1;
						while(!((b>>p)&1)) p--;
						f[(1<<(i-(j-1-p)))|(a<<p+1)|(1<<p)|(b&((1<<p)-1))][p]+=cur;
					}
					
				}
	for(int i=n;i>=0;--i)
		for(int j=0;j<(1<<i);++j)
			if(f[(1<<i)|j][0]>=K)
			{
				for(int k=i-1;k>=0;--k) printf("%d",(j>>k)&1);
				return 0;
			}
}


Measured memory_bytes: 181632
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int mod = 1000000007;
int extgcd(int a, int b ,int &x, int&y){
  int d = a;
  if( b != 0 ){
    d = extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1,y=0;
  }
  return d;
}
int mod_inverse( int a, int m ){
  int x, y ;
  extgcd( a, m , x, y);
  return (m+x%m)%m;
}

int main(){
   long long N,M,K;
   cin >> N >> M >> K;
   long long M2= M*M;
   long long N2 =N*N;
   long long coef = 1;
   for(int i=0; i<K-2; i++){
      coef *= N*M-2-i;
      coef %= mod;
      coef *= mod_inverse(i+1,mod);
      coef %= mod;
   }
   long long D=0;
   for(int i=1; i<=N-1; i++){
      D+=(N-i)*i;
      D%=mod;
   }
   D *= M2;
   D%=mod;
   long long D2=0;
   for(int i=1; i<=M-1; i++){
      D2+=(M-i)*i;
      D2%=mod;
   }
   D2*=N2;
   D2%=mod;
   cout << ((D+D2)*coef)%mod << endl;
   
   return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))

r = 0
ans = 0
for l in range(n):
    while r < n-1 and arr[r] >= arr[r+1]:
        r += 1

    ans = max(ans, r-l)
    #print(l,r)
    if r == l:
        r += 1

print(ans)


Measured memory_bytes: 14224
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N;
int a[3][101010];
int dp[101010][10];

int rec(int n, int pre) {
  if (n == N) return 0;
  if (dp[n][pre]) return dp[n][pre];

  int res = 0;
  for (int i = 0; i < 3; i++) {
    if (i != pre) {
      chmax(res, rec(n + 1, i) + a[i][n]);
    }
  }

  return dp[n][pre] = res;
}

signed main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[j][i];
    }
  }

  cout << rec(0, -1) << endl;
  return 0;
}


Measured memory_bytes: 16768
import scala.annotation.tailrec
import scala.io.StdIn._
object Main extends App {
  solve()
  @tailrec def solve(): Unit = {
    val n = readInt()
    if (n == 0) return
    val plants = Array.tabulate(n){_ ⇒
      val (Array(l), Array(p, a, b, c, d, e, f, s, m)) = readLine.trim.split(' ').splitAt(1) match {case (p, q) ⇒ (p, q.map(_.toInt))}
      Plant(l, p, a, b, c, d, e, f, s, m)
    }
    println(plants.sortWith{case (p, q) ⇒ if (p.efficient == q.efficient) p.name < q.name else p.efficient > q.efficient}.map{_.name}.mkString("", "\n", "\n#"))
    solve()
  }
  case class Plant(name: String, price: Int, bud: Int, youngLeaf: Int, leaf: Int, flower: Int, fruit: Int, fruitCount: Int, fruitPrice: Int, time: Int) {
    def wholeCycle: Int = bud + youngLeaf + leaf + (flower + fruit) * time
    def wholeBenefit: Int = time * fruitCount * fruitPrice - price
    def efficient: Double = (wholeBenefit / gcd(wholeCycle, wholeBenefit)).toDouble / (wholeCycle / gcd(wholeCycle, wholeBenefit))
  }
  def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
}


Measured memory_bytes: 53792
f = lambda:map(int,input().split())
w,h,n = f()
lx,rx,ly,ry = 0,w,0,h
for _ in range(n):
  x,y,a = f()
  if a==1:
    lx = max(lx,x)
  if a==2:
    rx = min(rx,x)
  if a==3:
    ly = max(ly,y)
  if a==4:
    ry = min(ry,y)
print(max(rx-lx,0)*max(ry-ly,0))

Measured memory_bytes: 3064
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 
#define MO 
int a[35]= {
0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
inline void _Sol_()
{
	int n;
	read(n);
	priE(a[n]);
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
/**CLICK ss---> ctrl+j**/
#define PI 2.0*acos(0.0)
#define ll              long long int
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        ((a)*(b))/gcd(a,b)
#define MOD             1000000007
#define mx              123456789
using namespace std;
void solve()
{
   string s, s1;
   cin>>s;
   cin>>s1;
   int cnt=0, i;
   for(i=0; i<s.size(); i++)
   {
       if(s[i]!=s1[i])
        cnt++;
   }
   cout<<cnt<<endl;
}
int main()
{
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

signed main() {
  int N, K;
  cin >> N >> K;
  vector<double> e(N);

  for(int i=0;i<N; i++) {
    int p;
    cin >> p;
    e[i] = (p * (p+1)) * 0.5 / (double)p;
  }

  vector<double> csum(N);
  csum[0] = e[0];
  for(int i=1;i<N; i++) csum[i] = csum[i-1] + e[i];

  //for(int i=0;i<N; i++) cerr << e[i] << "\t";
  //cerr << endl;
  //for(int i=0;i<N; i++) cerr << csum[i] << "\t";
  //cerr << endl;

  double m = csum[K-1];
  for(int i=K;i<N; i++) {
    m = max(m, csum[i] - csum[i-K]);
  }
  cout << fixed << setprecision(7) << m << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll mod=1e9;
const int inf=0x3f3f3f3f;
int isprime[1000004];
int out[1000004];
int main()
{
	vector<int> a;
	for (int i = 2; i <=1000000; i++)
	{
		if(isprime[i]==0) a.push_back(i);
		for (int j = 0; a[j] <=1000000/i ; j++)
		{
			isprime[a[j]*i]=1;
			if(i%a[j]==0) break;
		}
	}
	ll N;cin>>N;
	for (int i:a)
	{
		if(i>N) break;
		while (N%i==0)
		{
			out[i]++;
			N/=i;
		}
	}
	ll ans=0;
	if(N!=1) ans++;
	for (int i = 0; i <=1000000 ; i++)
	{
		int t=1;
		while(out[i]-t>=0)
		{
			ans++;
			out[i]-=t;
			t++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 7740
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long


signed main() {
	string O, E;
	cin >> O >> E;

	int lenO = O.length();
	int lenE = E.length();

	int lenMin = min(lenO, lenE);

	string amari = O.substr(lenMin, lenO - lenMin) + E.substr(lenMin, lenE - lenMin);

	string ans;
	REP(i, lenMin) {
		ans.push_back(O[i]);
		ans.push_back(E[i]);
	}

	ans = ans + amari;

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
struct edge { int to, cost; };
int n, m;
int k[12], p[12];
int s[12][12];
signed main() {
	cin >> n >> m;
	rep(i, m) { cin >> k[i]; rep(j, k[i])cin >> s[i][j]; }
	rep(i, m)cin >> p[i];
	int ans = 0;
	rep(i, (1 << n)) {
		int memo[12];
		int cnt = 0;
		fill(memo, memo + 12, 0);
		rep(j, n) {
			if ((i >> j) & 1) {
				memo[j + 1] = 1;
			}
		}
		rep(j, m) {
			int q = 0;
			rep(l, k[j]) {
				if (memo[s[j][l]])q++;
			}
			if (q % 2 == p[j])cnt++;
		}
		if (cnt == m)ans++;
	}
	cout << ans << endl;
	ggr
}


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

ll n,w, weight[100009], value[100009];
ll dp[100009][100];

int knapsack(int t_value, int index)
{
    if(index == n)
        return t_value==0?0:INT_MAX;

    if(dp[t_value][index]!=-1)
        return dp[t_value][index];

    // when we are not taking this value cause this current value is greter than the t_value we have
    ll ans = knapsack(t_value, index+1);
    // making the t_value same as it can't contribute to our t_value because it is greater than t_value;

    // including case
    if(value[index] <= t_value)
        ans = min(ans, weight[index] + knapsack(t_value - value[index], index + 1));

    // taking  minimum possible weight to take as large value we can take.

    return dp[t_value][index] = ans; // return the wieght for the t_value;
}

int solve(int t_value)
{
    for(int i = t_value; i>=0; i--)
    {
        if(knapsack(i,0) <=w) return i;
        // if this value can be achieved with weight less or equalto
            // given weight then return this value because this is the highest value we can achieved
            // because we are starting from sum(total sum of all the values.);
    }

    return 0;

}
 
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cin>> n>> w;

    memset(dp, -1, sizeof dp);

    ll total_value = 0;

    for(int i= 0; i<n; i++)
    {
        cin>>weight[i] >> value[i];
        total_value += value[i]; 
    }
   
   cout<<solve(total_value)<<endl;

    return 0;
}


Measured memory_bytes: 81704
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main() {
	int N, K;
	cin >> N >> K;
	if (N <= K) {
		cout << 0;
		return 0;
	}
	priority_queue<int>H;
	int num, sum = 0;
	rep(i, N) {
		cin >> num;
		sum += num;
		H.push(num);
	}
	rep(i, K) {
		sum -= H.top();
		H.pop();
	}
	cout << sum;
}

Measured memory_bytes: 2420
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,a,b,x;
int main(){
	scanf("%d",&n);
	scanf("%d",&a);
	b=a;
	fo(i,2,n){
		scanf("%d",&x);
		if (x>a) a=x;
		if (x<b) b=x;
	}
	printf("%d\n",a-b);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
int n,x,a;
int main(){
	cin>>n;
	a=n;
	while(a>0) x+=a%10,a/=10;
	if(n%x==0) cout<<"Yes";
	else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
  int x,a,b;
  cin>>x>>a>>b;

  cout<<(x-a)%b;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


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

int main(){
    int i, j, k, n, x, s;
    while(1){
        cin >> n >> x;
        if (n == 0 && x == 0) break;
        s = 0;
        for (i = 1; i < n + 1;i++){
            for (j = 1; j < n + 1;j++){
                if (i >= j) continue;
                for (k = 1; k < n + 1;k++){
                    if (j >= k || k <= i) continue;
                    if (i + j + k == x) s++;
                }
            }
        }
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#![allow(non_snake_case)]

fn main() {
    loop {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let A : isize = iter.next().unwrap().parse().unwrap();
        let O = iter.next().unwrap();
        let B : isize = iter.next().unwrap().parse().unwrap();

        let r = match O {
            "+" => A + B,
            "-" => A - B,
            "*" => A * B,
            "/" => A / B,
            _   => break
        };
        println!("{}", r);
    }
}



Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
int a,b;

bool judge(string x)
{
    string y=x;
    reverse(x.begin(),x.end());
    if(x==y)
    {
        return true;
    }
    else
    {
        return false;
    }
}
int main(void)
{
    stringstream os;
    string x;
    cin>>a>>b;
    int cnt=0;
    for(int i=a;i<=b;++i)
    {
        os<<i;
        os>>x;
        os.clear();
        if(judge(x))
        {
            cnt++;
        }
    }
    cout <<cnt <<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  vector<string> grades;
  while (true) {
    int m, f, r;
    fscanf(stdin, "%d %d %d", &m, &f, &r);
    if (m == -1 && f == -1 && r == -1) { break; }
    string grade;
    int sum = m + f;
    if (m == -1 || f == -1) { grade = "F"; }
    else if (sum >= 80) { grade = "A"; }
    else if (65 <= sum && sum < 80) { grade = "B"; }
    else if (50 <= sum && sum < 65) { grade = "C"; }
    else if (30 <= sum && sum < 50) {
      grade = "D";
      if (r >= 50) { grade = "C"; }
    }
    else if (sum < 30) { grade = "F"; }
    grades.push_back(grade);
  }
  for (int i = 0; i < grades.size(); ++i) {
    fprintf(stdout, "%s\n", grades[i].c_str());
  }
  return 0;
}

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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 3005;

ld dp[N][N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    dp[0][0]=1.00;
    rep(i,1,n+1){
        ld x;
        cin>>x;
        ll p=0,q=i;
        while(p<=i and q>=0){
            if(p-1>=0){
                dp[p][q] += dp[p-1][q]*x;
            }
            if(q-1>=0){
                dp[p][q] += dp[p][q-1]*(1.00-x);
            }
            p++;q--;
        }
    }
    ld ans=0;
    ll i=n,j=0;
    while(i>n/2){
        ans += dp[i][j];
        i--;j++;
    }  
    cout<<fixed<<setprecision(9)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 139648
n = int(input())
check = True
ss = ''
str_set = set()

for i in range(n):
  s = input()
  str_set.add(s)
  if ss != '':
    if ss[-1] != s[0]:
      check = False
      break  
  ss = s  
  
if len(str_set)!=n: check = False
  
if check:
  print('Yes')
else:
  print('No')

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

const ll maxN = 1000000000000001LL;

int main() {
  ll N;
  cin >> N;
  vector<ll> vec(1, 0);

  const ll base = 26;
  ll p = 1;
  ll sum = 0;
  while (true) {
    ll v = pow(base, p);
    if (sum + v > maxN) break;
    sum += v;
    vec.push_back(sum);
    p++;
  }

  auto itr = lower_bound(vec.begin(), vec.end(), N);
  int idx = distance(vec.begin(), itr);

  // cout << "-----" << endl;
  // rep(i, vec.size()) {
  //   cout << vec.at(i) << endl;
  // }
  // cout << "-----" << endl;

  ll tmp = N - vec.at(idx - 1);
  // cout << tmp << endl;
  string ans = "";
  rep(i, idx) {
    ans += "a";
  }
  // cout << ans << endl;
  int j = idx - 1;
  while (true) {
    // if (tmp == 26) {
    //   ans.at(j) = 'z';
    //   break;
    // }
    ll rest = tmp % 26;
    tmp /= 26;
    if (rest == 0) {
      rest = 26;
      // tmp--;
    } else {
      tmp++;
    }
    ans.at(j) = (char)(rest + 96);
    if (tmp == 1) {
      break;
    }
    j--;
  }

  cout << ans << endl;

  // if (itr == vec.end()) {
  //   cout << "not found" << endl;
  // } else {
  //   cout << idx << ' ' << *itr << endl;
  // }
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    string w[100];
    
    for(int i=0; i<n; i++){
        cin>>w[i];
        if(i>=1){
            if(w[i-1].back()!=w[i].front()){
                cout<<"No"<<endl;
                return 0;
            }
            for(int j=i-1; j>=0; j--){
                if(w[j]==w[i]){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.Char

decode pass offset = map (map (\c -> chr $ do
  let oldChar = ord c
  if oldChar == ord '.'
    then oldChar
    else do
      let newChar = oldChar - offset
      if newChar < ord 'a'
        then newChar + 26
        else newChar)) pass

decodeLists line = unwords $ search $ zipWith decode (take 26 $ repeat line) [1..26]

search :: [[String]] -> [String]
search [] = []
search (x:xs) = if elem "the" x || elem "this" x || elem "that" x 
                  then x
                  else search xs

main = do
  input <- (fmap words . lines) <$> getContents
  let ans = unlines $ fmap decodeLists input
  putStr ans

Measured memory_bytes: 3984
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a;
    cin >> a;
    // 出力
    if(a%2 == 0){
      cout << (a/2);
    }
    else {
      cout << (a/2+1);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;

const ll mod = 1000000007;
const int N = 2e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
ll dp[62][2][2][2];
int l[62], r[62];
void init(ll L, ll R) {
	mt(dp, -1);
	rep(i, 0, 61) {
		l[i] = r[i] = 0;
		if(L&(1ll<<i)) l[i] = 1;
		if(R&(1ll<<i)) r[i] = 1;
	}
}
// flagX = 1 if x > L
// flagY = 1 if y < R
// flagZ = 1 if x和y的二进制最高位的1的位置相同
// 下面DP的过程保证了y >= x， x >= L, y <= R
ll DP(int pos, int flagX, int flagY, int flagZ) {
	if(pos == -1) return 1;
	ll& ret = dp[pos][flagX][flagY][flagZ];
	if(ret != -1) return ret;
	ret = 0;
	// x 0 y 1
	if(flagZ && (flagX || l[pos]==0) && (flagY || r[pos]==1)) 
		ret += DP(pos-1, flagX, flagY, flagZ);
	// x 0 y 0
	if(flagX || l[pos]==0) 
		ret += DP(pos-1, flagX, r[pos]==1?1:flagY, flagZ);
	// x 1 y 1
	if(flagY || r[pos]==1)
		ret += DP(pos-1,l[pos]==0?1:flagX, flagY, 1);
	ret %= mod;
	// dd(pos);de(ret);
	return ret;
}
int main() {
	ll L, R;
	while(~scanf("%lld%lld",&L, &R)) {
		// dd(L);de(R);
		init(L, R);
		printf("%lld\n", DP(60, 0, 0, 0));
	}
    return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
PY = []
for i in range(M):
    temp1, temp2 = map(int, input().split())
    PY.append([i,temp1,temp2])

PY.sort(key=lambda val: val[2])
PY.sort(key=lambda val: val[1])

j = 0
city = 0

for i, value in enumerate(PY):
    if value[1] != city:
        j = 0
    j += 1
    value.append(j)
    city = value[1]

# print(PY)

PY.sort(key=lambda val: val[0])

for i in PY:
    ans = str(i[1]).zfill(6)+str(i[3]).zfill(6)
    print(ans)


Measured memory_bytes: 31012
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
  ll l,r,d,cnt=0;
  cin>>l>>r>>d;
  
  for(ll i=l;i<=r;i++)
  {
    if(i%d==0) cnt++;
  }
  cout<<cnt<<endl;
  
  return 0;
}


Measured memory_bytes: 3644
import collections


class Vector():
    def __init__(self):
        self.vector = collections.deque()

    def randomAccess(self, p):
        print(f'{self.vector[p]}')

    def push(self, d, x):
        if d == 0:
            self.vector.appendleft(x)
        elif d == 1:
            self.vector.append(x)
        return self

    def pop(self, d):
        if d == 0:
            self.vector.popleft()
        elif d == 1:
            self.vector.pop()


num_queue = int(input())
A = Vector()

for i in range(0, num_queue):
    queue = tuple(map(int, input().split(' ')))
    if queue[0] == 0:
        A.push(queue[1], queue[2])
    elif queue[0] == 1:
        A.randomAccess(queue[1])
    elif queue[0] == 2:
        A.pop(queue[1])


Measured memory_bytes: 22128
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>
#include <set>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x)
#define PUT(x) printf("%d\n",x)
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };


int main(void)
{
	int A, B, X;

	cin >> A >> B >> X;

	if (A <= X && X <= A + B) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}



	return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque
import pdb

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    t = S()
    cands = []
    ans = 'z' * 50
    for st_ix in range(len(s)):
        i = st_ix 
        cur_j = 0
        copy_s_list = list(s)
        is_cand = False 
        while cur_j < len(t) and st_ix + len(t) - 1< len(s):
            if s[i] == t[cur_j] or s[i] == '?':
                copy_s_list[i] = t[cur_j]
                cur_j += 1
                i += 1
                if cur_j == len(t):
                    is_cand = True
            else:
                break

        if is_cand: 
            for ix in range(len(copy_s_list)):
                if copy_s_list[ix] == '?':
                    copy_s_list[ix] = 'a'
            cands.append(''.join(copy_s_list))
    if cands == []:
        print("UNRESTORABLE")
    else:
        print(min(cands))

            
main()



Measured memory_bytes: 7612
import numpy as np

S = input()
S = list(S)
S = np.array(S)

index_black = np.where(S=="B")[0]
diff = np.array([i for i in range(len(S)-len(index_black),len(S))])
count = int(np.sum(np.abs(diff-index_black)))
print(count)

Measured memory_bytes: 23956
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) << endl
 
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = (1<<20);
const ll inf = 1e9+7;
const ll VAL = 20;
int main() {
	fastio;
	ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans = 0;
    while(a>=b){  b*=2;  ans++;	
    }
    while(c<=b){c*=2; ans++;
    }
    if(ans<=k) cout<<"Yes\n";
    else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n,k;
ll h[100002];
ll memo[100002];

ll dp(int i){
  
	if (i == n) return 0;
	if (memo[i] != -1) return memo[i];

	ll ans = dp(i+1) + (abs(h[i]-h[i+1]));

	for (int j = 1; j <= k; j++){
		if ((i+j) > n) break;

		ans = min(ans, dp(i+j) + (abs(h[i]-h[i+j])));
	}

	memo[i] = ans;

	return ans;
}

int main(){
	cin >> n >> k;
  
	memset(memo, -1, sizeof memo);
  
	for (int i = 0; i < n; i++){ cin >> h[i]; }
  
  	n--;
  
	cout << dp(0) << endl;
	return 0;
}

Measured memory_bytes: 11384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,end) for(ll i = 0; i < end ; i++ )
#define print(ans) cout << ans << endl;
typedef long long ll;
typedef vector<ll> vi;
double norm(ll x1, ll x2, ll y1, ll y2){
  return pow(pow(x1-x2,2) + pow(y1-y2, 2),0.5);
}
// x!
long long kaijou(int x){
  ll ideal = 1;
  rep(i, x){
    ideal *= x-i;
  }
  return ideal;
}
// sum(list)
double sum(vector<double> vec){
  return accumulate(vec.begin(), vec.end(), 0);
}

/// a^n (mod) mod-2 の処理は何度もするのであれば先に済ませるとよい。
long long exp(ll a, ll n, ll mod){
  ll m = n;
  if (a == 1) return 1;
  vector<ll> subvec;
  ll cnt = 0;
  while (m>0){
    if ((m&1) == 1){
      subvec.push_back(cnt);
    }
    m >>= 1;
    cnt ++;
  }
  ll res = 1;
  vector<ll> vec;
  rep(i, cnt){
    a %= mod;
    vec.push_back(a);
    a = a*a%mod;
  }
  for (auto& e : subvec) {
    res = res*vec[e]%mod;
  }
  return res;
}

int main() {
  ll N;
  cin >> N;
  for (int i = 1; i <10 ; i++){
    if(N%i == 0 and N/i < 10){
      print("Yes");
      return 0;
    }
  }
  print("No");
}



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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 2e5 + 100;

int n; ll a[N], L[N], R[N], ans = 0;


int main() {
	cin >> n;
	for(int i = 1;i <= n; ++i)
		cin >> a[i];
	L[1] = a[1] % mod;
	for(int i = 2;i <= n; ++i)
		L[i] = (L[i - 1] + a[i]) % mod;
	R[n] = a[n] % mod;
	for(int i = n - 1;i >= 1; --i)
		R[i] = (R[i + 1] + a[i]) % mod;
	for(int i = 1;i <= n; ++i)
		ans = (ans + (a[i] * (R[i + 1])) % mod) % mod;
	cout << ans << endl;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)

#define INF 2e9
#define ALL(v) v.begin(), v.end()

int main(){
  int n,y;
  int res1=-1,res2=-1,res3=-1;
  cin>>n>>y;
  rep(i,n+1){
    rep(j,n+1){
      int k=n-i-j;
      if(k<0)continue;
      int sum=10000*i+5000*j+1000*k;
      if(sum==y){
        res1=i;
        res2=j;
        res3=k;
        break;
      }
        }
  }
  cout<<res1<<" "<<res2<<" "<<res3<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
using ll=long long;
int main(){
ll n,d;
  cin>>n>>d;
  ll a[n]={},b[n]={},ans=0;
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    if(sqrt(pow(a[i],2)+pow(b[i],2))<=d) ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6660
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int a = in.nextInt();
        
        if (x < a) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}

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

#define itn int
#define vi vector<int>
#define pb push_back
#define srt sort(v.begin(), v.end())
#define retunr return

//int infiint = std::numeric_limits<int>::max();
//float infiflt = std::numeric_limits<float>::infinity();


int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "rt", stdin);

    string s;
    cin >> s;
    bool ok=0;
    for(int i=0; i<2; i++) {
    	if(s[i] != s[i+1]) {
    		cout << "Yes";
    		return 0;
    	}
    }

    cout << "No";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
	  String n = sc.next();
      
      if(n.contains("7")){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }     
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep (i, h) cin >> s[i];
    rep (i, h) {
        rep (j, w) {
            if (s[i][j] == '.') continue;
            bool ok = false;
            rep (k, 4) {
                int nx, ny;
                nx = i + dx[k], ny = j + dy[k];
                if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
                if (s[nx][ny] == '#') ok = true;
            }
            if (!ok) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 256