akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  string S; cin >> S;
  map<char, int> d;
  rep(i,S.size()) d[S[i]]++;
  
  bool NS = !((d['S']==0) ^ (d['N']==0));
  bool WE = !((d['E']==0) ^ (d['W']==0));
  
  if (NS && WE) cout << "Yes" << endl;
  else cout << "No" << endl;


  // cout << fixed << setprecision(6);
  return 0;
}



Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
c=[]
for m in range(n):
  i=n-m
  x=n//i
  b[i-1]=a[i-1]
  for j in range(2,x+1):
    b[i-1]+=b[j*i-1]
  b[i-1]%=2
  if b[i-1]==1:
    c.append(i-1)

print(len(c))
for i in range(len(c)):
  print(c[i]+1,end=' ')

Measured memory_bytes: 12056
import sys
def t(A,p,r):
 x=A[r][1];i=p-1
 for j in range(p,r):
  if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
 A[i+1],A[r]=A[r],A[i+1]
 return i+1
def k(A,p,r):
 if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
 for i in range(n-1):
  if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
 return'S'
n=int(input())
A=[(e[0],int(e[2:]),i)for i,e in enumerate(sys.stdin)]
k(A,0,n-1)
for e in[[s(A)+'table']]+A:print(*e[:2])


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

int main(){
    string s;
    cin >> s;
    vector<char> check{'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<bool> judge(check.size(), false);
    for(int i = 0;i < s.size();i++){
        for(int j = 0;j < check.size();j++){
            if(check.at(j) == s.at(i))judge.at(j) = true;
        }
    }
    for(int i = 0;i < judge.size();i++){
        if(!(judge.at(i))){
            cout << check.at(i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    string s;
    cin >> s;
    int C = 0;
    bool b = false;
    rep(i, s.size()) {
        if (s[i] == 'C') {
            C = i+1;
        }
        if (s[i] == 'F'&&C != 0) {
            b = true;
        }
    }
    cout << (b ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void add(string & ,string &,string &);
int main() {
	string a,b;
	int al,bl;
	int n;
	cin>>n;
	while(n--){
	        string ans="";
		cin>>a>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		al=a.size();
		bl=b.size();
		if(bl>al){
			swap(a,b);
			swap(al,bl);
		}
		for(int i=bl;i<al;i++){
			b+='0';
		}
		add(ans,a,b);
		if(ans.size()>80){
		  printf("overflow\n");
		}else{
		  reverse(ans.begin(),ans.end());
		  cout<<ans<<endl;
		}
	  	
	}
	return 0;
}
void add(string &ans,string &a,string &b){
	int x,y=0;
	int i;
	int al=a.size();
	for(i=0;i<al;i++){
		x=a[i]-'0'+b[i]-'0';
		if((x+y)>=10){
		        ans+= ((x+y)%10)+'0';
			y=1;
		}else{
		        ans+= (x+y)+'0';
			y=0;
		}
	}
	if(y==1)ans+='1';
}

Measured memory_bytes: 2988
#include<stdio.h>

int main(void){

int a[100][100];
int b[100];
int c[100] = {0};
int n,m;

scanf("%d %d",&n,&m);

for(int i = 0; i<n; i++){
   for(int j =0; j<m; j++){
   scanf("%d",&a[i][j]);
   }
}

for(int j = 0; j<m; j++){
   scanf("%d",&b[j]);
}

for(int i = 0; i < n; i++){
   for(int j = 0; j<m; j++){
    c[i] += a[i][j] * b[j];
    
}
}
for(int i =0; i<n; i++){
printf("%d\n",c[i]);
}
return 0;
}




Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

ll mygcd(ll A, ll B)
{
  ll a = A, b = B;
  while (a > 0 && b > 0)
  {
    b %= a;
    swap(a, b);
  }
  return b;
}

ll mylcm(ll A, ll B)
{
  ll G = mygcd(A, B);
  return A / G * B;
}

ll modpow(ll a, ll n, ll m)
{
  ll ret = 1;
  while (n > 0)
  {
    if (n % 2 == 1) ret = ret * a % m;
    a = a * a % m;
    n /= 2;
  }
  return ret;
}

ll modinv(ll a, ll m)
{
  ll b = m, x = 1, y = 0;
  while (b > 0)
  {
    ll q = a / b, r = a - q * b, s = x - q * y;
    a = b, b = r;
    x = y, y = s;
  }
  return mod(x, m);
}

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  vector<ll> P;
  for (ll n = 2; n <= 1e3 + 10; n++)
  {
    bool ok = true;
    for (auto p : P)
    {
      if (p * p > n)
      {
        break;
      }
      
      if (n % p == 0)
      {
        ok = false;
        break;
      }
    }
    if (ok)
      P.push_back(n);
  }
  //cerr << P.size() << endl;

  vector<ll> Q(1e6 + 10, 0);
  for (ll i = 0; i < N; i++)
  {
    map<ll, ll> mp1;

    ll a = A.at(i);

    for (ll j = 0; j < P.size(); j++)
    {
      ll p = P.at(j);
      if (p * p > a)
        break;

      while (a % p == 0)
      {
        a /= p;
        mp1[p]++;
        chmax(Q.at(p), mp1[p]);
      }
    }
    if (a != 1)
    {
      mp1[a]++;
      chmax(Q.at(a), mp1[a]);
    }
  }

  ll L = 1;
  for (ll i = 0; i < 1e6 + 10; i++)
  {
    if (Q.at(i) == 0)
      continue;
    L *= modpow(i, Q.at(i), MOD) % MOD;
    L %= MOD;
  }

  ll ans = 0;
  for (ll i = 0; i < N; i++)
  {
    ans += L * modinv(A.at(i), MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Inarr(a,n) for(ll i=0;i<n;i++)cin>>a[i]
const ll INF=1e18;
int main(){
    ll n,ans=0;
    cin>>n;
    vector<int>a(n),b(n),c(n);
    Inarr(a,n);
    Inarr(b,n);
    Inarr(c,n-1);
    for(int i=0;i<n;i++){
        ans+=b[a[i]-1];
        if(i<n-1&&a[i+1]-a[i]==1){
            ans+=c[a[i]-1];
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

ll mmod[100010][31];

int main(){
    ll n, m;
    cin >> n >> m;
    priority_queue<ll> que;
    rep(i, n){
        ll a; cin >> a;
        que.push(a);
    }
    rep(i, m){
        ll tmp = que.top(); que.pop();
        que.push(tmp/2);
    }
    ll ans = 0;
    while(!que.empty()){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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


vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

ll gcd(ll a, ll b){
   if (a%b == 0){
       return(b);
   }else{
       return(gcd(b, a%b));
   }
}

void solve() {
    int A, B, K; cin >> A >> B >> K;
    ll n = gcd(A, B);
    auto v = divisor(n);
    reverse(all(v));
    cout << v[K-1] << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

//2->3->1だったら3->1->2で登校する
int main(){
   int n; cin>>n;
   vector<int> a(n);
   rep(i,n) cin>>a[i];
   vector<int> ans(n);
   //a[i]-1はi+1番目
   rep(i,n) ans[a[i]-1]=i+1;
   rep(i,n) cout<<ans[i]<<endl;
   return 0;
}


Measured memory_bytes: 1664
#include <iostream>

int main()
{
    unsigned long long x;
    std::cin>>x;
    for (long long int i=-120; i<120; i++)
        for (long long int j=-120; j<120; j++)
        {
            long long a=i*i*i*i*i, b=j*j*j*j*j;
            if (a-b==x)
            {
                std::cout<<i<<" "<<j;
                return 0;
            }
        }
    return 0;
}


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

int main(){
  long n, d;
  cin >> n >> d;
  long x, y;
  int cnt=0;
  for(int i=0; i<n; i++){
    cin >> x >> y;
    if(x*x+y*y<=d*d)cnt++;
  }
  cout << cnt;
  return 0;
}

Measured memory_bytes: 3188
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = int.Parse(input.ReadLine());

        Func<int, int> func = (n) => {
            if (n % 2 == 0) return n / 2;
            return 3 * n + 1;
        };

        var hash = new HashSet<int>();
        hash.Add(s);

        var c = 1;
        while (true) {
            c++;
            s = func(s);
            if (hash.Contains(s)) {
                break;
            }
            hash.Add(s);
        }
        return c;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13280
import Control.Applicative

powMod _ 0 _ = 1
powMod base exponent modulus = ((if exponent `mod` 2 == 1 then base else 1) * powMod ((base * base) `mod` modulus) (exponent `div` 2) modulus) `mod` modulus

invMod x p = powMod x (p - 2) p

f 0 = 1

fallingFactorialMod _ 0 _ = 1
fallingFactorialMod 0 _ _ = 1
fallingFactorialMod x n p = (x * fallingFactorialMod (x - 1) (n - 1) p) `mod` p

combinationMod n k p = ((fallingFactorialMod n k p) * invMod (fallingFactorialMod k k p) p) `mod` p

main = do
  let p = 10 ^ 9 + 7
  [n, k] <- map read . words <$> getLine
  print $ combinationMod (n + k - 1) n (10 ^ 9 + 7)



Measured memory_bytes: 4204
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

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


void dfs(char** stage,int W,int H,int x,int y,char fruit){

	stage[y][x]='x';
	for(int i=-1;i<=1;i++){
		for(int j=-1;j<=1;j++){
			if(i*j!=0 || (i==j && j==0)) continue;
			int dx = x+i;
			int dy = y+j;

			if(dx<0 || dx>=W || dy<0 || dy>=H) continue;

			if(stage[dy][dx]!=fruit || stage[dy][dx]=='x') continue;
			dfs(stage,W,H,dx,dy,fruit);
		}
	}
}

int distribute(char** stage,int W,int H){
	int res=0;

	for(int x=0;x<W;x++){
		for(int y=0;y<H;y++){
			if(stage[y][x]=='x') continue;
			res++;
			char fruit = stage[y][x];
			dfs(stage,W,H,x,y,fruit);
		}
	}

	return res;
}


int main(){
	string str;
	while(getline(cin,str)){
		int W,H;		
		sscanf(str.c_str(),"%d %d",&H,&W);
		if(H==W && W==0) break;

		char** stage = new char*[H];
		for(int i=0;i<H;i++){
			stage[i] = new char[W];
		}

		for(int i=0;i<H;i++){
			getline(cin,str);
			for(int j=0;j<W;j++){
				stage[i][j] = str[j];
			}
		}

		cout << distribute(stage,W,H) << endl;

		for(int i=0;i<H;i++){
			delete[] stage[i];
		}
		delete[] stage;
	}
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n;
      map<ll,ll> mp;
      rep(i,n){
        cin>>a;
        if(mp[a]==i+1)ans++;
        mp[i+1]=a;
      }
      Cout(ans);
     

       
return 0;
}


Measured memory_bytes: 6528
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    long C = sc.nextLong();
    sc.close();
    if (A - C >= 0) {
      // Aが0以上の場合
      A = A - C;
      System.out.println(A + " " + B);
    } else {
      // Bが0以上の場合
      long D = C - A;
      if (B - D >= 0) {
        B = B - D;
        System.out.println(0 + " " + B);
      } else {
        System.out.println(0 + " " + 0);
      }
    }
  }
}


Measured memory_bytes: 21972
// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

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

int main(){
	fastIO;
	int n, temp = 0;
	LL now = 0;
	cin >> n;
	while (cin >> temp){
		now += temp;
	}
	int ans = now / n;
	printf("%d\n",ans);

	return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_T 100'000
i64 schedule[30][MAX_T + 2];

int main() {
    i64 N, C; cin >> N >> C;
    REP(i, N) {
        i64 s, t, c; cin >> s >> t >> c;
        c--;
        schedule[c][s]++;
        schedule[c][t + 1]--;
    }

    REP(i, 30) {
        for (i64 t = 1; t <= MAX_T + 1; t++) {
            schedule[i][t] += schedule[i][t - 1];
        }
    }

    i64 maxc = 0;
    REP(t, MAX_T + 2) {
        i64 c = 0;
        REP(i, 30) {
            if (schedule[i][t] > 0) c++;
        }
        chmax(maxc, c);
    }
    cout << maxc << endl;
    return 0;
}

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

#define ll long long
#define M 1000000007
using namespace std;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
	int n,m,k,a,b;
    cin>>n;
    cout<<2*3.1415*n;
    
    
}

Measured memory_bytes: 3820
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#include <unordered_map>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.0000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define SECOND_MOD 1000000009
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
using namespace std;
long long geko[200000] = {};
int main() {
#define int long long
	long long n, c;
	cin >> n >> c;
	vector<pair<long long, long long>> inputs;
	REP(i, n) {
		long long a, b;
		cin >> a >> b;
		inputs.push_back(make_pair(a, b));
	}
	long long ans = 0;
	for (int hogea = 0; hogea < 2; ++hogea) {
		long long now = 0;
		REP(i, 200000) {
			geko[i] = 0;
		}
		for (int i = 0; i < n; ++i) {
			now += inputs[i].second;
			geko[i] = now - inputs[i].first * 2LL;
			if (i != 0) {
				geko[i] = max(geko[i], geko[i - 1]);
			}
			else {
				geko[i] = max(geko[i], 0LL);
			}
			ans = max(ans, now - inputs[i].first);
		}
		now = 0;
		long long hoge = 0;
		for (int i = n - 1; i >= 1; --i) {
			now += inputs[i].second;
			hoge = max(hoge, now - (c - inputs[i].first));
			ans = max(ans, hoge + geko[i - 1]);
		}
		for (int i = 0; i < n; ++i) {
			inputs[i].first = c - inputs[i].first;
		}
		sort(inputs.begin(), inputs.end());
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3440
from collections import Counter
n = int(input())
d = [int(item) for item in input().split()]
m = int(input())
t = [int(item) for item in input().split()]

dcnt = Counter(d)
tcnt = Counter(t)

for key in tcnt.keys():
    if tcnt[key] > dcnt[key]:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 56920
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <cmath>
#include <functional>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
const int M = 1e9 + 7;
const int N = 2e5 + 10;
const int MAX = 1e9 + 1;
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};

int n;
ll mp[400][400];
ll mp2[400][400];

bool s() {
    int i, j, k;
    for (i = 1; i <= n; ++i) {
        for (j = 1; j <= n; ++j) {
            if (j == i)
                continue;
            for (k = j + 1; k <= n; ++k) {
                if (k == i)
                    continue;
                ll t = mp[j][i] + mp[i][k];
                if (t < mp[j][k])
                    return 0;
                if (t == mp[j][k])
                    mp2[j][k] = t;
                /*if (mp2[j][k] == 0)
                    mp2[j][k] = t;
                else
                    mp2[j][k] = min(mp2[j][k], t);*/
            }
        }
    }
    return 1;
}

int main() {
    int i, j;
    cin >> n;
    for (i = 1; i <= n; ++i) {
        for (j = 1; j <=n; ++j) {
            cin >> mp[i][j];
        }
    }
    if (!s()) {
        cout << -1 << endl;
        return 0;
    }
    ll sum = 0;
    for (i = 1; i <= n; ++i) {
        for (j = i + 1; j <= n; ++j) {
            if (!mp2[i][j]) {
                sum += mp[i][j];
            }
        }
    }
    cout << sum << endl;
    return 0;
}


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

#define ll long long int
#define pb push_back
#define f(i,x,y) for(i=x;i<y;i++)
#define vll vector<ll>
#define fast    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define mod 1000000007

vll factors(1000005,0);



int main()
{
    fast;
    ll n,i,a;
    cin>>n;
    
    vll v;
    
    f(i,0,n)
    {
        cin>>a;
        v.pb(a);
    }
    ll gcd=v[0];
    
    f(i,1,n)
    {
        gcd=__gcd(gcd,v[i]);
    }
    if(gcd!=1)
        cout<<"not coprime"<<endl;
    else
    {
        ll f=0;
        f(i,0,n)
        {
            ll num=v[i];
            
            ll j;
            for(j=1;j*j<=num;j++)
            {
                if(num%j==0)
                {
                    ll f1,f2;
                    f1=j;
                    f2=num/j;
                    
                    if(f1==f2)
                    {
                        f2=1;
                    }
                    
                    if(f1!=1)
                    {
                        if(factors[f1]!=0)
                        {
                            f=1;
                            break;
                        }
                        else
                            factors[f1]=1;
                    }
                    
                    if(f2!=1)
                    {
                        if(factors[f2]!=0)
                        {
                            f=1;
                            break;
                        }
                        else
                            factors[f2]=1;
                    }
                }
            }
            if(f==1)
                break;
        }
        if(f==1)
            cout<<"setwise coprime"<<endl;
        else
            cout<<"pairwise coprime"<<endl;
    }
    return 0;
}


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

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  int d;
  scanf("%d", &d);
  while(d--){
    int m, y, n, res = 0;
    scanf("%d%d%d", &m, &y, &n);
    int k, c;
    double rate;
    rep(i, n){
      int money = m;
      scanf("%d%lf%d", &k, &rate, &c);
      if(k){
	rep(i, y){
	  money +=  money * rate;
	  money -= c;
	}
      }else{
	int sum = 0;
	rep(i, y){
	  sum += money * rate;
	  money -= c;
	}
	money += sum;
      }
      //      printf("%d\n", money);
      res = max(res, money);
    }
    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1216
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse=True)

alice_score = 0
bob_score =0

for i,j in enumerate(a):
    if i % 2 == 0:
        alice_score += j
    else:
        bob_score += j

print(alice_score-bob_score)
        

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

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

  string n;
  cin >> n;
  int tot = 0;
  for (char &d : n) tot += d - '0';
  string ans = (stoi(n) % tot) ? "No" : "Yes";
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

#define ll long long
#define ld long double
#define int ll
#define ff first
#define ss second
#define rsz resize
#define ins insert 
#define mp make_pair
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define ft front() 
#define bk back()
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define deb(x) cout<<#x<<" "<<x<<'\n';
#define rep(i,a,b) for (int i = (a); i < (b); ++i)

const ll mod = 1e9+7; // 998244353;
const ll inf = 1e18; 
const ld pie = acos((ld)-1);

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



int32_t main(){
    
	int n;
	scanf("%lld",&n);
	vector<int> a(n);
	for(int i=0;i<n;++i){
		scanf("%lld",&a[i]);
	}

	int maxn=INT_MIN;
	ll sum=0;
	for(int i=0;i<n;++i){
		maxn = max(maxn,a[i]);
		sum+=maxn-a[i];
	}

	printf("%lld\n",sum);

	return 0;

	/*STUFF TO LOOK:	
		1. Check the constraints
		2. Corner cases(n==0||n==1)
		3. Variables in loops
		4. Make sure two ints aren’t multiplied to get a long long
		5. Don't use scanf or printf while using ios_base
		6. using the local variable of the same name when global variable was required to be used
	*/
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i=0; i<n; i++)
 
using namespace std;
const double PI = acos(-1);
using Graph = vector<vector<int>>;
 
int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll sum = 0;
	if (a >= k)
		sum = k;
	else if (a + b >= k)
		sum = a;
	else
		sum = a + -(k - b - a);
	cout << sum << endl;
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18


void bombSet(vector<vector<ll>> &bomb,ll x,ll y){
	if(bomb[x][y]>=10){
		REP(i,3){
			if(x+i-1>=bomb.size())continue;
			if(x+i-1<0)continue;
			REP(j,3){
				if(y+j-1>=bomb[0].size())continue;
				if(y+j-1<0)continue;
				bomb[x+i-1][y+j-1]++;
			}
		}
	}
}
int main(){
	ll h,w;
	cin>>h>>w;
	vector<vector<ll>> bomb(h,vector<ll>(w,0));
	REP(i,h){
		REP(j,w){
			char tmp;
			cin>>tmp;
			if(tmp=='#')bomb[i][j]=10;
		}
	}
	REP(i,h){
		REP(j,w){
			bombSet(bomb,i,j);
		}
	}
	
	REP(i,h){
		REP(j,w){
			if(bomb[i][j]>=10){
				cout<<'#';
			}else{
				cout<<bomb[i][j];
			}
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
    public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            while(true){
            int a = sc.nextInt();
            String str = sc.next();
            int b = sc.nextInt();
            int answer = 0;

            if(str.equals("+")){
                answer = a + b ;
            }else if(str.equals("-")){
                answer = a - b ;
            }else if(str.equals("*")){
                answer = a * b ;
            }else if(str.equals("/")){
                answer = a / b ;
            }else if(str.equals("?")){
                break ;
            }
            System.out.println(answer);
        }
            sc.close();
        }
    }


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

int main(){
    int n;
    cin >> n;
    vector<int> a;
    for(int i = 1;i <10;i++){
        for(int j = i;j < 10;j++){
            a.push_back(i*j);
        }
    }
    for(auto& b: a){
        if(n == b){
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
}

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

const int INF = 1001001001;

int main(){
	int n,m;
	cin >> n >> m;
	vector<pair<int,int>> s(n);
	vector<pair<int,int>> p(m);
	rep(i,n) cin >> s[i].first >> s[i].second;
	rep(i,m) cin >> p[i].first >> p[i].second;
	
	rep(i,n){
		int id = 0;
		int dist = INF;
		rep(j,m){
			if(dist > abs(s[i].first - p[j].first) + abs(s[i].second - p[j].second)){
				dist = abs(s[i].first - p[j].first) + abs(s[i].second - p[j].second);
				id = j;
			}
		}
		cout << id + 1 << endl;
	}
	
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;

bool kaibun(int i){
    string s = to_string(i);
    if(s[0] == s[4] && s[1] == s[3]) return 1;
    else return 0;
}

int main(){
    int A,B; cin >> A >> B;
    int ans = 0;
    for(int i=A;i<=B;i++){
        if (kaibun(i)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ",dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	int N,M; cin >> N >> M;
	V<int> f(M+2);
	while(N--){
		int l,r; cin >> l >> r; r++;
		int mn = 1e9;
		rep1(k,320){
			int x = (l+k-1)/k, y = (r+k-1)/k;
			chmin(y,mn);
			f[x]++,f[y]--;
			mn = x;
		}
		rep1(i,mn-1) if((l-1)/i<(r-1)/i){
			f[i]++,f[i+1]--;
		}
	}
	rep(i,M) f[i+1] += f[i];
	rep1(i,M) cout << f[i] << '\n';
}


Measured memory_bytes: 1280
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	static FastScanner sc;
	public static void main(String[] args){
		sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		out.println(solve());
		out.flush();
	}

	static int solve(){
		int N = sc.nextInt();
		int X = sc.nextInt();
		List<Integer> distList = new ArrayList<>();
		int dist;
		for(int i=0;i<N;i++){
			dist = Math.abs(sc.nextInt() - X);
			distList.add(dist);
		}
		int gcd = distList.get(0);
		for(int i=1;i<distList.size();i++){
			gcd = getGcd(distList.get(i), gcd);
		}
		return gcd;
	}

	static int getGcd(int x,int y){
		int tmp;
		if(x<y){
			tmp = y;
			y = x;
			x = y;
		}
		while(y!=0){
			tmp = x % y;
			x = y;
			y = tmp;
		}
		return x;
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 24660
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define For(i, a, n) for(long long i = a; (a < n) ? (i < n) : (i > n); (a < n) ? (i++) : (i--))
#define rep(i,n,b) for(int i=0;i<n;i=i+b)
#define ld long double 
using namespace std;
int main()
{
  string s;
  cin >> s;
  int l=s.length();
  int sum=0;
  for(int i=0;i<l;i++)
  {
    char ch1=s[i];
    int y=(char)ch1;
    sum=sum+(y-48);
  }
  if(sum%9==0)
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }
}

Measured memory_bytes: 3704
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
const LL mod=1e9+7;
LL fac[200010],inv[200010],f[100010],n,sum[100010],a[100010];
LL C(LL m,LL n) {return fac[m]*inv[m-n]%mod*inv[n]%mod;}
LL solve(LL m,LL n) {return C(m+n-1,n-1);}
void pre()
{
	inv[0]=inv[1]=fac[0]=fac[1]=1;
	for(LL i=2;i<=200000;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	for(LL i=2;i<=200000;i++) fac[i]=fac[i-1]*i%mod,inv[i]=inv[i]*inv[i-1]%mod;
	for(LL i=0;i<n;i++)
	{
		f[i]=fac[i]*fac[n-i-1]%mod*solve(n-i-1,i+2)%mod;
		sum[i]=(sum[i-1]+f[i])%mod;
	}
	//for(int i=0;i<n;i++) printf("f:%lld\n",f[i]);
}
LL ans=0;
int main()
{
	scanf("%lld",&n);
	pre();
	for(LL i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(LL i=1;i<=n;i++)
	{
		LL t=(sum[i-1]+sum[n-i]-fac[n])%mod;
		//printf("%lld %lld\n",i,t);
		(ans+=t*a[i]%mod)%=mod;
	}
	printf("%lld",(ans+mod)%mod);
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	string S;
	cin >> S;
	int N = S.size();
	int i = 0;
	vector<int> res(N);
	while (i < N) {
		int num1 = 0;
		while (S[i] == 'R') {
			++i;
			++num1;
		}
		int j = i;
		int num2 = 0;
		while (S[j] == 'L'){
			++j;
			++num2;
		}
		res[i - 1] = num1 / 2 + num1 % 2 + num2 / 2;
		res[i] = num1 / 2 + num2 / 2 + num2 % 2;
		i = j;
	}
	REP(i, N) cout << res[i] << " ";

	return 0;
}

Measured memory_bytes: 1104
#include <iostream>
#include <queue>
#include <map>
using namespace std;

typedef pair<int,int> pii;
int h,w;
int mp[101][101];
bool out[101][101];
int dx[2][6] = {{0, -1, 0, 1, 1, 1},
                {-1, -1, -1, 0, 1, 0}};
int dy[6] = {-1, 0, 1, 1, 0, -1};

int main() {
  cin>>w>>h;
  for (int i=0; i<h; ++i)
    for (int j=0; j<w; ++j)
      cin>>mp[i][j];
  queue<pii> q;
  for (int i=0; i<h; ++i)
    for (int j=0; j<w; ++j)
      if (i == 0 || i == h-1 || j == 0 || j == w-1)
        if (mp[i][j] == 0) { out[i][j] = true; q.push(make_pair(j,i)); }
  while(!q.empty()) {
    pii p = q.front(); q.pop();
    for (int k=0; k<6; ++k) {
      int nx = p.first + dx[p.second&1][k], ny = p.second + dy[k];
      if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
      if (out[ny][nx] || mp[ny][nx]) continue;
      out[ny][nx] = true;
      q.push(make_pair(nx,ny));
    }
  }

  int ans = 0;
  for (int i=0; i<h; ++i) {
    for (int j=0; j<w; ++j) {
      int p = 0;
      for (int k=0; k<6; ++k) {
        int x = j+dx[i&1][k], y=i+dy[k];
        if (x < 0 || y < 0 || x >= w || y >= h) {
          if (!out[i][j]) p++;
          continue;
        }
        if (!out[i][j] && out[y][x]) p++;
      }
      ans += p;
    }
  }
  cout<<ans<<endl;
}

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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll =  long long;
using P = pair<ll, ll>;


int main( void )
{
	ll n;
	cin >> n;

	string s = "";
	while ( n > 0 ) {
		n--;
		s = (char)('a' + (n % 26)) + s;
		n /= 26;
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3628
N = int(input())
H = [int(x) for x in input().split()]
cur = H[0]
maxstep = 0
step = 0
for h in H[1:]:
  if cur >= h:
    step += 1
  else:
    maxstep = max(maxstep, step)
    step = 0
  cur = h
else:
  maxstep = max(maxstep, step)
  
print(maxstep)

Measured memory_bytes: 14252
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  int *a, *b;
  int c[VMAX+1];
  int n, i, j;

  scanf("%d", &n);
  a = malloc(sizeof(int) * n + 1);
  b = malloc(sizeof(int) * n + 1);
  for(i = 0;i <= VMAX;i++){
    c[i] = 0;
  }
  for(i = 0;i < n;i++){
    scanf("%d", &a[i+1]);
    c[a[i+1]]++;
  }
  for(i = 1;i <= VMAX;i++){
    c[i] += c[i-1];
  }
  for(j = 1;j <= n;j++){
    b[c[a[j]]] = a[j];
    c[a[j]]--;
  }
  for(i = 1;i <= n;i++){
    if(i > 1) printf(" ");
    printf("%d", b[i]);
  }
  printf("\n");
  return 0;
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

combination comb(100005);

mint f(int n, int k){
  mint res = comb(n,k);
  res *= comb.fact[k];
  return res;
}

int k;
vector<int> to[100005];
mint ans;

void dfs(int v, int p = -1){
  for (int u : to[v]){
    if( u == p){
      continue;
    }else{
      dfs(u,v);
    }
  }
  int nk = (p==-1) ? k : k - 2;
  int c = (p==-1) ? to[v].size()+1 : to[v].size() - 1;
  ans *= f(nk, c);
}

int main(){

  int n;
  cin >> n >> k;
  rep(i,n-1){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans = 1;
  dfs(0);
  cout << ans.x << endl;
  return 0;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int x; cin>>x;
	int ret=1;
	for (int b=2; b<=1000; b++) {
		int t=b*b, p=0;
		while(1) {
			if(t>x) break;
			ret=max(ret,t);
			t*=b;
		}
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
from math import sqrt

def main():
    n = int(input())
    wi = 2
    cnt = 0
    d = defaultdict(lambda:0)
    fi = int(sqrt(1e12)+1)
    for i in range(2, fi):
        while n % i == 0:
            d[i] += 1
            n //= i
    if n != 1:
        d[n] = 1

    for val in d.values():
        x = val
        wi = 1
        while(x >= wi):
            x -= wi
            wi += 1
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9388
#include <stdio.h>
#include <stdlib.h>

int main() {
    int N, *L, max = 0, maxIndex, sum = 0;
    if (scanf("%d%*c", &N) == -1) return -1;
    L = (int *)malloc(sizeof(int) * N);
    if (!L) return -1;
    for (int i = 0; i < N; i++) {
        if (scanf("%d%*c", &L[i]) == -1) return -1;
        sum += L[i];
        if (L[i] > max) {
            max = L[i];
            maxIndex = i;
        }
    }
    sum -= L[maxIndex];
    if (max < sum) printf("Yes\n");
    else printf("No\n");
    free(L);
    return 0;
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int 
#define pb   push_back
#define mp   make_pair
#define F    first
#define S    second
int main()
{
       string s;
       ll i;
       cin>>s;
       for(i=0;i<3;i++){
              if(s[i]=='9'){
                     cout<<1;
              }
              else{
                     cout<<9;
              }
       }
}

Measured memory_bytes: 764
import java.util.*;
public class Main {
    
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int H = scanner.nextInt();
        int W = scanner.nextInt();
        int[][] a = new int[H][W];
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                a[i][j] = scanner.nextInt()%2;
            }
        }
        ArrayList<int[]> move = new ArrayList<>();
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W-1; j++) {
                if(a[i][j]==1){
                    a[i][j+1] = (a[i][j+1] + 1)%2;
                    move.add(new int[]{i,j,i,j+1});
                }
            }
        }
        for (int i = 0; i < H-1; i++) {
            if(a[i][W-1] == 1){
                a[i+1][W-1] = (a[i+1][W-1]+1)%2;
                move.add(new int[]{i,W-1, i+1,W-1});
            }
        }
        System.out.println(move.size());
        for (int i = 0; i < move.size(); i++) {
            int[] mv = move.get(i);
            System.out.println(
                String.format("%d %d %d %d",
                    mv[0] +1,
                    mv[1] +1,
                    mv[2] +1,
                    mv[3] +1));
        }
    }
}

Measured memory_bytes: 166268
#include <bits/stdc++.h>
 
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
#define pii pair<ll int, ll int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define repi(i, n) for(ll i=0; i<n; i++)
#define rep(i, a, b) for(ll i=a; i<=b; i++)
#define M 1000000007
#define INF 1e10

using namespace std;

int main() {
    ios
    ll n;
    cin>>n;
    vector <ll> a(n);
    repi(i, n) cin>>a[i];
    ll dp[n][n][2];
    repi(i, n) {
        dp[i][i][0] = a[i];
        dp[i][i][1] = -a[i];
    }
    for(ll j=1; j<n; j++){
        for(ll i=0; i+j<n; i++){
            dp[i][i+j][0] = max(a[i] + dp[i+1][i+j][1], a[i+j] + dp[i][i+j-1][1]);
            dp[i][i+j][1] = min(dp[i+1][i+j][0] - a[i], dp[i][i+j-1][0] - a[i+j]);
        }
    }
    cout<<dp[0][n-1][0]<<endl;
    return 0;
}


Measured memory_bytes: 85596