akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

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

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)



int main() {
	ll N;
	std::cin >> N;
	vll dp(N + 1, 1e9);
	dp[0] = 0LL;

	repeq(i, 1, N) {

		for(ll j=6;j<=i;j*=6) {
			if (j <= i) {
				dp[i] = min(dp[i - j] + 1, dp[i]);
			}
		}

		for(ll j=9;j<=i;j*=9) {
			if (j <= i) {
				dp[i] = min(dp[i - j] + 1, dp[i]);
			}
		}

		dp[i] = min(dp[i - 1] + 1,dp[i]);

	}
	std::cout << dp[N] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main(void) {
    int M,N,i,a,b;
    bool s[200010] = {} ;
    bool t[200010] = {} ;
    bool pos = false;
    scanf("%d %d", &N, &M);

    for (i = 0 ; i < M ; i++ ) {
        scanf("%d %d",&a, &b);
        if (a == 1) s[b] = true;
        if (b == N) t[a] = true;
    }

    for(i = 0 ; i < N ; i++ ) {
        if(s[i] && t[i]) {
            pos = true;
            break;
        }
    }

    if (pos == true) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}



Measured memory_bytes: 640
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))[a-x:]
q = sorted(list(map(int, input().split())))[b-y:]
r = sorted(list(map(int, input().split()))+p+q)[::-1]

print(sum(r[:x+y]))


Measured memory_bytes: 22504
#include <iostream>
#include <vector>
#define llint long long

using namespace std;

llint T;
llint a, b, c, d;

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

int main(void)
{
	cin >> T;
	for(int t = 0; t < T; t++){
		cin >> a >> b >> c >> d;
		if(d < b || a < b){
			cout << "No" << endl;
			continue;
		}
		if(c >= b){
			cout << "Yes" << endl;
			continue;
		}
		llint g = gcd(b, d);
		a = a%b%g;
		a = (a+b-g)%b;
		if(a > c) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long

using namespace std;

const int N=1e5+10;
int n,a[N],ans; ll sum[N];

int main(){
	scanf("%d",&n);
	rep (i,1,n) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	rep (i,1,n) sum[i]=sum[i-1]+a[i];
	rep (i,1,n){
		ll x=sum[i]; int las=i,fl=1;
		while (2*x<a[n]){
			int p=upper_bound(a+1,a+1+n,2*x)-a-1;
			if (p>las) x+=sum[p]-sum[las],las=p;
			else{fl=0; break;}
		}
		ans+=fl;
	}
	printf("%d\n",ans);
	return 0;
}

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

#define bstN 500000
struct bst{
  int size;
  int t[bstN];
  int lc[bstN];
  int rc[bstN];
   
  void init(){
    size=0;
  }
   
  void insert(int v){
    int i=0;
    while(0<=i&&i<size){
      int& child=(v<t[i]?lc[i]:rc[i]);
      if(child==-1)child=size;
      i=child; 
    }
    lc[size]=rc[size]=-1;
    t[size++]=v;
  }

  bool find(int v){
    int i=0;
    while(0<=i&&i<size){
      if(t[i]==v)return true;
      i=(v<t[i]?lc[i]:rc[i]);      
    }
    return false;
  }
  
  void preord(int pos){
    if(pos==-1||pos==size)return;
    preord(lc[pos]);
    printf(" %d",t[pos]);
    preord(rc[pos]);
  }
   
  void inord(int pos){
    if(pos==-1||pos==size)return;
    printf(" %d",t[pos]);
    inord(lc[pos]);
    inord(rc[pos]);
  }
};
 
 
bst T;
 
int main(){
  T.init();
  int n,a;
  char str[100];
  scanf("%d",&n);
   
  while(n--){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&a);
      T.insert(a);
    }else if(str[0]=='f'){
      scanf("%d",&a);
      if(T.find(a))printf("yes\n");
      else printf("no\n");      
    }else{
      T.preord(0);
      printf("\n");
      T.inord(0);
      printf("\n");
    }
  }
 
  return 0;
}

Measured memory_bytes: 6292
#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    P ps[4];
    double x[4], y[4];
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
                &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]) != EOF){

        rep(i,4) ps[i] = P(x[i],y[i]);
        double ts[4];
        
        rep(i,4){
            P a = ps[i], b = ps[(i+1)%4], c = ps[(i+2)%4];
            a-=b; c-=b;
            double t = arg(a/c);
            ts[i]=t;
        }

        bool ok = true;
        rep(i,4){
            //cout << ts[i] << endl;
            if(ts[0]*ts[i]<0) ok = false;
        }

        if(ok) puts("YES");
        else puts("NO");
    }
}

Measured memory_bytes: 1240
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <stdlib.h>
#include <stack>
#include <queue>
#include <bitset>
#include <memory.h>

using namespace std;



int main() {
    
    double x;
    
    cin>>x;

    double hig=x;
    double low=x;
    
    
    while(cin>>x){
        if(hig<x)hig=x;
        if(low>x)low=x;
    }
    cout<<hig-low<<endl;
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,m,l,a[100][100]={{}},b[100][100]={{}};
  long long cnt;
  cin >> n >> m >> l;
  for(int i=0; i<n; i++) {
      for(int j=0; j<m; j++) {
          cin >> a[i][j];
      }
  }
  for(int i=0; i<m; i++) {
      for(int j=0; j<l; j++) {
          cin >> b[i][j];
      }
  }
  for(int i=0; i<n; i++) {
      for(int j=0; j<l; j++) {
          cnt=0;
          for(int k=0; k<m; k++) {
              cnt+=a[i][k]*b[k][j];
          }
          if(j==0) {
              cout << cnt;
          }
          else {
              cout << " " << cnt;
          }
      }
      cout << endl;
  }
  return 0;
}


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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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

vector<int> sieve(int n) {/*{{{*/
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}/*}}}*/

int isprime(int x){
  if(x<=1) return 0;
  for(int i=2;i*i<=x;i++)
    if(x%i==0) return 0;
  return 1;
}

int solve(){
  int n;cin>>n;

  vi prime;
  rep(i, 2, 55556){
    if (isprime(i)) prime.pb(i);
  }

  vi prime51;
  rep(i, sz(prime)){
    if (prime[i]%5==1) prime51.pb(prime[i]);
  }
  dump(prime51);

  rep(i, n){
    cout << prime51[i] << (i==n-1 ? "\n" : " ");
  }

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 384
def main():
    n = int(input())
    P = list(map(int, input().split()))
    m = float('inf')
    cnt = 0
    for i in range(n):
        if P[i] < m:
            cnt += 1
            m = P[i]
    print(cnt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 24744
#include<iostream>
using namespace std;
int main(){
	int n,temp,last=0,count=0;

	cin >>n;
	for(int i=0;i<n;i++){
		cin >>temp;
		if(last!=0&&last==temp){
			count++;
			last=0;
			continue;
		}
		last=temp;
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
num = list(map(int,input().split()))
sumN = 0
for i in range(N):
    sumN += num[i]
ave = sumN//N
minN = 10**15
for j in range(-1,2):
    work = 0
    for k in range(N):
        work += pow(ave+j-num[k],2)
    minN = min(minN,work)
print(minN)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
void fast(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
}
int main(){
	
	int n;
	cin >> n;
	
	vector<vector<int>> counts(10 , vector<int>(10 , 0));
	for(int i = 1; i <= n; ++i){
		int l_d = i % 10;
		int f_d = i;
		while(f_d   >= 10){
			f_d /= 10;
		}
		++counts[f_d][l_d];
	}
	long long answer = 0;
	for(int i = 1; i <= 9; ++i){
		for(int j = 1; j <= 9; ++j){
			answer += (counts[i][j] *1ll* counts[j][i]);
		}
	}
	cout << answer << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG arc/arc062/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int N; 
    cin >> N;
    ll p1;
    ll p2;
    cin >> p1 >> p2;
    rep(i, N - 1){
        ll t, a;
        cin >> t >> a;
        ll k, j;
        if(p1 % t == 0) k = p1/t;
        else k = p1/t + 1;
        
        if(p2 % a == 0) j = p2/a;
        else j = p2/a + 1;

        ll l = max(k, j);
        p1 = t * l;
        p2 = a * l;
    }

    cout << p1 + p2 << "\n";
    return 0;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
s = input()
s = s.replace('AC','ac')
t = [0] * n
r = 0
for i in range(n):
    if s[i] == 'c':
        r += 1
    t[i] = r
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])

Measured memory_bytes: 11460
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>
#include <algorithm>

typedef long long int LLI;
using namespace std;

//--------------------
int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

void fun1(int N) {
    if (N == 1) {
        cout << "a" << endl;
        return;
    }
    if (N == 2) {
        cout << "aa" << endl;
        cout << "ab" << endl;
        return;
    }
    set<string> ans;
    ans.insert("aa");
    ans.insert("ab");

    for (int i = 3; i <= N; ++i) {
        set<string> currentAns;
        for (auto s : ans) {
            char lastChar = 'a';
            for (auto ch : s) {
                lastChar = max(ch,lastChar);
            }
            for (int ch = 'a'; ch <= lastChar + 1; ++ch) {
                currentAns.insert(s + string(1,ch) );
            }
        }
        ans = currentAns;

    }
    set<string>::iterator it = ans.begin();
    while (it != ans.end()) {
        cout << *it++ << endl;
    }
}

void func() {
    int N;
    cin >> N;
    fun1(N);
}

int main() {
    func();
//    fun1(4);
    return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
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;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

const long long MOD = 1000000007;

void solve(long long n, std::vector<long long> A){
    int ans=3;
    Vi color(3);
    REP(i,0,n){
        if(A[i]==0){
            if(color[0]==0) color[0]++;
            else if(color[1]==0) color[1]++;
            else if(color[2]==0) color[2]++;
            else{
                cout<<0<<endl;
                return;
            }
        }else{
            Vi tmp;
            REP(j,0,3) if(color[j]==A[i]) tmp.pb(j);
            if(tmp.size()==0){
                cout<<0<<endl;return;
            }
            ans = (ans*tmp.size())%MOD;
            color[tmp[0]]++;
        }
    }
    if(color[1]>0) ans= (ans*2)%MOD;
    cout<<ans<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(R, G);
  int ans = 2 * G - R;
  cout << ans << endl;

  return 0;
}



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

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

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

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N, A, B;
  cin >> N >> A >> B;
  string S;
  cin >> S;

  int tot = 1;
  int kaigai = 1;

  rep(i, N) {
    char c = S[i];
    if (c == 'c')
      cout << "No\n";
    else if (c == 'a') {
      if (tot <= A + B) {
        cout << "Yes\n";
        tot++;
      } else
        cout << "No\n";
    } else {
      if (tot <= A + B && kaigai <= B) {
        cout << "Yes\n";
        tot++, kaigai++;
      } else
        cout << "No\n";
    }
  }
}

Measured memory_bytes: 976
(n, k) = [int(i) for i in input().split(" ")]
h = [int(i) for i in input().split(" ")]

dp = [float("inf")] * n
dp[0] = 0

for i in range(0, n, 1):
  for j in range(1, k+1, 1):
    if i+j < n:
    	dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]))

print(dp[-1])

Measured memory_bytes: 55284
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0116
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {

                int[] HandW = RIntAr();
                if (HandW.Sum() == 0) break;

                int[,] dp = new int[HandW[0], HandW[1]];

                for (int i = 0 ; i < HandW[0] ; i++)
                {
                    string items = RSt();
                    for (int j = 0 ; j < HandW[1] ; j++)
                    {
                        if (items[j] == '.') dp[i, j] = j == 0 ? 1 : dp[i, j - 1] + 1;
                    }
                }

                int areaMax = 0;
                for (int i = 0 ; i < HandW[0] ; i++)
                {
                    for (int j = 0 ; j < HandW[1] ; j++)
                    {
                        if (dp[i, j] == 0) continue;

                        int curMaxArea = 0;
                        int minWidth = int.MaxValue;
                        for (int k = 0 ; k + i < HandW[0] ; k++)
                        {
                            if (dp[i + k, j] == 0) break;
                            minWidth = Math.Min(minWidth, dp[i + k, j]);
                            curMaxArea = Math.Max(curMaxArea, (k + 1) * minWidth);   
                        }
                        areaMax = Math.Max(areaMax, curMaxArea);
                    }
                }
                Console.WriteLine(areaMax);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 15712
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
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; }

int main() {
	int a, b;
	cin >> a >> b;
	ll ans = lcm(a, b);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const ll INF = 1e18+3;
const ll mod = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    ll total = 0;
    rep(i, N){
        cin >> A[i];
        total ^= A[i];
    }
    rep(i, N){
        cout << (A[i] ^total) << " ";
    }
}

Measured memory_bytes: 4764
$n, $m, $x = gets.chomp.split(' ').map(&:to_i)

$A = gets.chomp.split(' ').map(&:to_i)

$first = 0
$last = 0

def min(a, b)
  a > b ? b : a
end

$m.times do |i|
  if $A[i] < $x
    $first += 1
  else
    $last += 1
  end
end

puts min($first, $last)

Measured memory_bytes: 1788
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# rstrip().decode('utf-8')
# map(int,input().split())


def main():
	s=input().rstrip().decode('utf-8')
	n=len(s)//2
	
	a=s[:n]
	bb=s[::-1]
	b=bb[:n]
	
	ans=0
	
	for i in range(n):
		if a[i]!=b[i]:
			ans+=1
	print(ans)
	
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 3060
#include<stdio.h>
 
int main(){
	int a, b, i, ans = 0;
	while(scanf("%d", &a) != 0){
		if(a == 0) break;
		a /= 4;
		for(i = 0; i < a; i++){
			scanf("%d", &b);
			ans += b;
		}
		printf("%d\n", ans);
		ans = 0;
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;
const int N = 5e5 + 10;

void solve(){
     int d;cin >> d;
     if(d==25) cout <<"Christmas";
     else if(d==24) cout <<"Christmas Eve";
     else if(d==23) cout <<"Christmas Eve Eve";
     else cout << "Christmas Eve Eve Eve";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3536
N = int(input())
L = [_ for _ in map(int,input().split())]
res = 0
for x in L:
  if x <= N:
    res += 1
    N = x #最小上書き。次にresが増えるのは後々の要素で最小より小さいのが出てきたとき。
print(res)
#みんなもtabulationミスってREには気をつけようね

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

using namespace std;

int main()
{
	int t;
	t=1;
	while(t--)
	{
	
	double d,t,s;
	cin>>d>>t>>s;
	
	if(  (d/s)<=t)
	cout<<"Yes\n";
	
	else
	cout<<"No\n";
	
	
	}



}


Measured memory_bytes: 3720
#include <stdio.h>

int main(void)
{
	int a[10];
	int hoge;
	int i, j, k, l;
	
	for (i=0; i<10; i++){
		scanf("%d", &a[i]);
	}
	
	for (j = 0; j <9; j++){
		for (k = 0; k < 9; k++){
			if (a[k] < a[k+1]){
				hoge = a[k];
				a[k] = a[k+1];
				a[k+1] = hoge;
			}
		}
	}
	
	for (l=0; l<3; l++){
		printf("%d\n", a[l]);
	}
	
	
	return (0);
}

Measured memory_bytes: 600
(let* ((n (read))
       (k (read))
       (a (make-array (list n)))
       (ok 0)
       (ng 0))
  (loop :for i :from 0 :to (1- n)
        :for x := (read)
        :do (setf (aref a i) x)
        :do (setf ok (max ok x)))
  ;
  (defun ev (n)
    (<= (loop :for x :across a
              :sum (1- (ceiling (/ x n))))
        k))
    
  ;
  (format t "~A~%"
          (loop :named main
                :if (= (- ok ng) 1)
                :do (return-from main ok)
                :else
                :do (let ((c (ceiling (/ (+ ok ng) 2))))
                      (if (ev c)
                          (setf ok c)
                          (setf ng c))))))


Measured memory_bytes: 78912
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n, k;
    cin >> n >> k;
    int a[n+1] = {};
    int b[n+1] = {};
    rep(i,n+1)b[i] = -1;
    srep(i,1,n+1) cin >> a[i];
    ll cnt = 0;
    ll mod;
    int x = 1;
    int ans = 1;
    b[1] = 0;
    while(true){
        cnt++;
        x = a[x];
        if(cnt == k){
            cout << x << endl;
            return 0;
        }
        if(b[x] != -1){
            mod = cnt - b[x];
            ans = x;
            k -= cnt;
            break;
        }else{
            b[x] = cnt;
        }
    }
    // cout << cnt << endl;
    k %= mod;

    rep(i,k){
        ans = a[ans];
    }
    
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 5176
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
    int N;
    cin >> N;
    vector<pair<int,int>> R(N);
    vector<pair<int,int>> B(N);
    for(int i = 0;i < N;i++) {
        int A,B;
        cin >> A >> B;
        R.at(i) = make_pair(B,A);
    }
    for(int i = 0;i < N;i++) {
        int A,C;
        cin >> A >> C;
        B.at(i) = make_pair(A,C);
    }
    sort(R.begin(),R.end());
  	reverse(R.begin(),R.end());
    vector<bool> A(N);
    sort(B.begin(),B.end());
    int ret = 0;
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < N;j++) {
            if(B.at(i).first > R.at(j).second && B.at(i).second > R.at(j).first && A.at(j) == false) {
                ret++;
                A.at(j) = true;
              	break;
            }
        }
    }
    cout << ret << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  ll x; cin >> x;
  for(ll i = 1; i <= x; i++)
    if(i * (i + 1) / 2 >= x){
      cout << i << endl;
      break;
    }
}

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

const ll MOD = 1e9 + 7;

bool cmp(int l,int r){return l>r;}

int main()
{
	int n,k; cin>>n>>k;
	map<int,int> mp;
	for(int i=0;i<n;i++){
		int x; cin>>x; mp[x]++;
	}

	if(mp.size() <= k) {cout<<"0"; return 0;}

	vector<int> a;

	for(auto t:mp){
		a.push_back(t.second);
	}
	int ans=0;
	sort(a.begin(), a.end(),cmp);

	for(int i=k;i<a.size();i++) ans += a[i];
	cout<<ans;	
}

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int n;
int a[100005];
int b[100005];

long long cur_inc, ans;

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d %d", &a[i], &b[i]);
	}
	for(int i = n; i >= 1; i--){
		int cur_mod = (a[i] + cur_inc) % b[i];
		if(cur_mod > 0){
			cur_inc += (b[i] - cur_mod);
			ans += (b[i] - cur_mod);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

	    int x = Integer.parseInt(br.readLine());
	    int result = x * x * x;

	    System.out.println(result);
	}

}

Measured memory_bytes: 24424
# ABC068C - Cat Snuke and a Voyage (ARC079C)
import sys
input = sys.stdin.readline

def main():
    N, M = tuple(map(int, input().split()))
    A = tuple(tuple(map(int, input().split())) for _ in range(M))
    S, D = set(), set()  # start, destination
    for a, b in A:
        if a == 1:
            S.add(b)
        if b == N:
            D.add(a)
    flg = S & D  # if the same X in both S & D -> possible
    print("POSSIBLE" if flg else "IMPOSSIBLE")


if __name__ == "__main__":
    main()

Measured memory_bytes: 37120
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    # A, B, K = get_inputs(int)
    # if A >= K:
    #     print(A-K, B)
    # elif A + B >= K:
    #     print(0, B - (K-A))
    # else:
    #     print(0, 0)

    # N = get_input(int)
    # n = X
    # while True:
    #     if is_prime(n):
    #         print(n)
    #         return
    #     else:
    #         n += 1

    N, K = get_inputs(int)
    R, S, P = get_inputs(int)
    T = get_input()

    points = {'r': R, 's': S, 'p': P}
    towin = {'r': 'p', 's': 'r', 'p': 's'}
    todraw = {'r': 'r', 's': 's', 'p': 'p'}

    ret = ''
    score = 0
    for i in range(N):
        if i < K:
            choice = towin[T[i]]
            ret += choice
            score += points[choice]
        else:
            if ret[-K] != towin[T[i]]:
                choice = towin[T[i]]
                ret += choice
                score += points[choice]
            else:
                choices = set(['r', 's', 'p'])
                choices -= set([ret[-K],])
                if i + K < len(T):
                    choices -= set([towin[T[i+K]],])
                choice = list(choices)[0]
                ret += choice


    print(score)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21680
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;

            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
N, M = map(int, input().split())
SC = [list(map(int,input().split())) for i in range(M)]

for i in range(1000) :
    if len(str(i)) != N :
        continue
    check = True
    for j in range(M) :
        if int(str(i)[SC[j][0]-1]) != SC[j][1] :
            check = False
    if check == False :
        continue
    else :
        print(i)
        exit()

print(-1)


Measured memory_bytes: 3188
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>

#include <numeric>

#include <map>

using namespace std;

typedef long long LL;

int n;

int main() {

    string s;
    cin >> s;
    if (s=="AAA" || s == "BBB") cout << "No";
    else cout << "Yes";

}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
n = int(input())

edge = [[] for i in range(n)]
ans = [-1] * n
odd = []
even =[]
nums = [[],[],[]]
for i in range(1,n+1):
    nums[i % 3].append(i)

def dfs(x, last = -1, d = 0):
    if d % 2 == 0: even.append(x)
    else: odd.append(x)
    for nxt in edge[x]:
        if nxt == last:continue
        dfs(nxt, x, d + 1)

for i in range(n-1):
    a, b = map(int, input().split())
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)

dfs(0)

zerocnt = len(nums[0])

if len(even) <= zerocnt:
    for even_node in even:
        ans[even_node] = nums[0].pop()
    rest = nums[0] + nums[1] + nums[2]
    for odd_node in odd:
        ans[odd_node] = rest.pop()

elif len(odd) <= zerocnt:
    for odd_node in odd:
        ans[odd_node] = nums[0].pop()
    rest = nums[0] + nums[1] + nums[2]
    for even_node in even:
        ans[even_node] = rest.pop()

# len
# nums[1] >= nums[2] >= nums[0] >= nums[1]-1
else:
    for num in nums[1]:
        ans[even.pop()] = num
    for num in nums[2]:
        ans[odd.pop()] = num
    rest = nums[0]
    for even_node in even:
        ans[even_node] = rest.pop()
    for odd_node in odd:
        ans[odd_node] = rest.pop()

print(*ans)

Measured memory_bytes: 207968
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
	string s;cin>>s;
	cout<<s.substr(0,s.size()-8)<<nnn;
    return 0;
}

Measured memory_bytes: 256
from itertools import combinations

N = int(input())
L = [int(x) for x in input().split()]

ans = 0
for a, b, c in combinations(L, 3):
    if a == b or b == c or c == a:
        continue
    if a + b > c and b + c > a and c + a > b:
        ans += 1

print(ans)

Measured memory_bytes: 9180
N,M=map(int,input().split())
ab=[]
for i in range(N):
    ab.append(list(map(int,input().split())))
cd=[]
for i in range(M):
    cd.append(list(map(int,input().split())))
def Mandis(x1,x2,y1,y2):
    e=abs(x1-x2)+abs(y1-y2)
    return e
for i in range(N):
    g=0
    for j in range(M-1):
        if Mandis(ab[i][0],cd[j+1][0],ab[i][1],cd[j+1][1])<Mandis(ab[i][0],cd[g][0],ab[i][1],cd[g][1]):
            g=j+1
    print(g+1)

Measured memory_bytes: 73452
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext()) {
      int[] a = new int[4];
      int[] b = new int[4];
      for (int i = 0; i < 4; i++) {
        a[i] = sc.nextInt();
      }
      for (int i = 0; i < 4; i++) {
        b[i] = sc.nextInt();
      }
      int hit  = 0;
      int blow = 0;
      for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
          if (b[j] == a[i]) {
            if (i == j) {
              hit++;
            }
            else {
              blow++;
            }
          }
        }
      }
      System.out.println(hit + " " + blow);
    }
  }
}

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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const ll mod = 1000000007;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string inp[2], s[2];
    cin >> n >> inp[0] >> inp[1];
    char buf = 0;
    REP(i, n){
        if(buf != inp[0][i]){
            s[0] += inp[0][i];
            s[1] += inp[1][i];
        }
        buf = inp[0][i];
    }

    ll ans = 1;
    if(s[0][0] != s[1][0]) ans = 2; // 横ドミノ
    REP(i, s[0].size() - 1){
        if(s[0][i] == s[1][i]){ // 縦ドミノ
            if(s[0][i + 1] == s[1][i + 1]){ // 縦ドミノ
                ans = ans * 2 % mod;
            }else{ // 横ドミノ
                ans = ans * 2 % mod;
            }
        }else{ // 横ドミノ
            if(s[0][i + 1] == s[1][i + 1]){ // 縦ドミノ
            }else{ // 横ドミノ
                ans = ans * 3 % mod;
            }
        }
    }

    cout << ans * 3 % mod << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//int[] sumArray = new int[1000000000];

		StringBuffer sb = new StringBuffer();

//		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
//
//		for(int i = 1;i < 1_000_000_000 ; i++){
//			long sum = (long)i*(i + 1)/2;
//
//			//System.out.println("add "+sum+" (i = "+i+")");
//			map.put(sum, i);
//		}
//		System.out.println("Init finished");

		while(true){
			int n = Integer.parseInt(br.readLine());

			if(n == 0){
				break;
			}

			//合計が同じなら下から始めた方が多くのスペースを使えるので
			//しゃくとり法で探す
			int from = 1;
			int to = calcN(n);
			long sum = calcSum(to);

//			while(sum != n){
////				System.out.println("from "+from+" to "+to +" current sum "+sum);
////				if(from == 1){
////					try {
////						Thread.sleep(100);
////					} catch (InterruptedException e) {
////						// TODO 自動生成された catch ブロック
////						e.printStackTrace();
////					}
////				}
//
//				if(sum < n){
//					to++;
//					sum += to;
//				}
//				else if(sum > n){
//					sum -= from;
//					from++;
//
////					long diff = sum - n;
////					int tmpN = calcN(diff + calcSum(from - 1));
////					System.out.println("diff "+diff+" tmpN " + tmpN);
////					sum -= calcSum(tmpN) - calcSum(from -1);
////					from = tmpN + 1;
//				}
//			}

			int m = 0;
			int a = 0;
			for(int i = calcN(n); i >= 1; i--){
				if(2*n % i == 0){
					int tmp2a = 2*n/i - i + 1;

					if(tmp2a%2 == 0 && tmp2a >= 2){
						m = i;
						a = tmp2a/2;
						break;
					}
				}
			}

			//System.out.println(from + " " + (to - from + 1));
//			sb.append(from + " " + (to - from + 1)+"\n");
			sb.append(a + " " + m+"\n");
		}

		System.out.print(sb);

	}

	static int calcN(long sum){
		return (int) Math.ceil((-1 + Math.sqrt(1 + (double)8*sum))/2);
	}

	static long calcSum(long n){
		return (n*(n + 1)/2);
	}
}



Measured memory_bytes: 25776
MOD = 10**9 + 7

S = input()
L = len(S)
memo = [[0 for i in range(14)] for j in range(L + 1)]
dp = [[0 for i in range(14)] for j in range(L + 1)]

dp[0][0] = 1

for k in range(L):
    for m in range(13):
        if S[k] == '?':
            for i in range(10):
                dp[k + 1][(m * 10 + i) % 13] += dp[k][m]
        else:
            dp[k + 1][(m * 10 + int(S[k])) % 13] += dp[k][m]

        for i in range(13):
            dp[k+1][i] %= MOD

print(dp[L][5])


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

int main(){
    string s; cin >> s;
    int n = s.size();
    for(int i = n-2; i > 0; i-=2){
        string t = s.substr(0, i);
        if(t.substr(0,i/2) == t.substr(i/2,i/2)) {
            cout << t.size() << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384
a,b,c=gets.split.map &:to_i
j,r=0,[]
99.times{
  break if [a,b,c].count(&:odd?)>0
  x=b/2+c/2,c/2+a/2,a/2+b/2
  j=-1 and break if r.include?(x)
  r.push(x)
  a,b,c=x
  j+=1 
}
p j

Measured memory_bytes: 2044
#include<iostream>
using namespace std;
int n;
int dp[100005];
int mincost(int a[])
{
 
    
   dp[0]=a[0];
   dp[1]=abs(a[1]-a[0]);
   dp[2]=min(dp[1]+abs(a[2]-a[1]),abs(a[2]-a[0]));
   for(int i=3;i<n;i++)
    {
        dp[i] = min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
    }
  
  return dp[n-1];
}
  
int main()
{
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  int ans = mincost(a);
  cout<<ans;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>

int main(){
    int n;
    int x[2][200000];
    scanf("%d",&n);
    for (int i = 0; i < n; ++i){
        scanf("%d",&x[0][i]);
        x[1][i]=x[0][i];
    }
    std::sort(x[1],x[1]+n);
    int mid=n>>1;
    int left=x[1][mid];
    int right=x[1][mid-1];
    for (int i=0;i<n;i++){
        if (x[0][i]<=right){
            printf("%d\n", left);
        }
        else{
            printf("%d\n", right);
        }
    }
    return 0;
}


Measured memory_bytes: 3712
#include<stdio.h>
#include<stdbool.h>

int main(void){
   char s[10];
   int n=0;
   scanf("%s",s);
   for(int i=0;s[i]!='\0';i++){
      n++;
   }
   char t[n+1];
   scanf("%s",t);
   bool judge=true;
   for(int j=0;j<n;j++){
      if(s[j]!=t[j]){
         judge=false;
         printf("No");
         break;
      }
   }
   if(judge){
      printf("Yes");
   }

   return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int d;
  cin>>d;

  vector<ll> p(26);
  rep(i,26) cin>>p[i];

  vector<vector<ll>> q(d,vector<ll>(26));
  rep(i,d) {
    rep(j,26) {
      cin>>q[i][j];
    }
  }

  ll pre=0;
  vector<int> r(26,0);
  rep(i,d-5){
    ll ans=-INF;
    ll memo;
    rep(j,26){
      ll sum=pre;
      auto last=r;
      sum+=q[i][j];
      last[j]=i+1;
      rep(k,26){
        sum-=p[k]*(i+1-last[k]);
      }
      if(sum>ans) {
        memo=j;
        chmax(ans,sum);
      }
    }
    cout << memo+1 << endl;
    pre=ans;
    r[memo]=i+1;
  }

  ll answer=-INF;
  ll A,B,C,D,E;
  vector<int> zen(5);
  rep(i,26){
    rep(j,26){
      rep(k,26){
        rep(l,26){
          rep(m,26){
            zen[0]=i;
            zen[1]=j;
            zen[2]=k;
            zen[3]=l;
            zen[4]=m;

            ll sum=0;
            auto last=r;
            rep(n,5){
              sum+=q[d-5+n][zen[n]];
              last[zen[n]]=d-5+n+1;
              rep(o,26){
                sum-=p[o]*(d-5+n+1-last[o]);
              }
            }

            if(sum>answer) {
              A=zen[0];
              B=zen[1];
              C=zen[2];
              D=zen[3];
              E=zen[4];
            }
            chmax(answer,sum);

          }
        }
      }
    }
  }

  cout << A+1 << endl;
  cout << B+1 << endl;
  cout << C+1 << endl;
  cout << D+1 << endl;
  cout << E+1 << endl;
  
}

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

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define nl              "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)           (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)        cout << #x << " = " << x << endl
#define trace(x)        cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; //for storing unique elements
typedef tree<int , null_type , less_equal<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set; //for repeating elements
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void babuBhaiya()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	string s,t; cin>>s>>t;
	int ans = inf;
	for(int i = 0;i+len(t)<=len(s);i++){
		int cnt = 0;
		for(int j = 0;j<len(t);j++){
			cnt += s[i+j] != t[j];
		}
		ans = min(ans,cnt);
	}
	cout<<ans;
}

 
int32_t main()
{
    babuBhaiya();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int num1 = 0;
  int num2 = 0;
  cin >> num1 >> num2;
  double result = (num1 + num2) / 2.0;
  int compare = (num1 + num2) / 2;
  
  if (result + 0.9 >= compare + 1){
    result = compare + 1;
  }
  cout << result << endl;
}

Measured memory_bytes: 3764