akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fori(i,a,b)    for(int i=a;i<=b;i++)
#define ford(i,a,b)   for(int i=a;i>=b;i--)
#define all(a)        a.begin(), a.end()
#define in(c,x)       ((c).find(x) != (c).end())
#define isp(c,x)      (find(all(c),x) != (c).end())
#define pb             push_back
#define ppb            pop_back
#define sz(x)          (int)x.size()
#define fill(a,v)      memset(a, v, sizeof a)
#define fs first
#define sc second
#define ub upper_bound
#define lb lower_bound
#define en '\n'

typedef long long int lli;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair< int, int > pii;
typedef pair< lli, lli > plli;
typedef list<int> li;
typedef map<int, int> mi;
typedef map<lli, lli> mlli;
lli gcd(lli a,lli b){return (!b)?a:gcd(b,a%b);}
int t = 1; int ti;


struct FT{
    int N;
    vector<lli> ft;

    void init(int n){
        N = n;
        ft.assign(n + 1, 0);
    }

    void updateMax(int idx, lli val){
        while(idx <= N)	{
            ft[idx] = max(ft[idx], val);
            idx += idx & -idx;
        }
    }

    lli prefMax(lli idx){
        lli ans = 0;

        while(idx > 0)	{
            ans = max(ans, ft[idx]);
            idx -= idx & -idx;
        }

        return ans;
    }

};



const int N = 2e5 + 5;
lli h[N], a[N], n;

void solve(){
    cin>>n;

    fori(i, 1, n)
    cin>>h[i];

    fori(i, 1, n)
    cin>>a[i];

    FT cml;
    cml.init(n);

    lli ans = 0;

    fori(i, 1, n){
        lli val = cml.prefMax(h[i]-1);
        cml.updateMax(h[i], val + a[i]);
    }

    cout<<cml.prefMax(n);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // cin>>t;

    // for(ti= 1; ti <= t; ti++)
    solve();

//    cout<<"\nTHINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL";
}


Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const ll INF = 1e15;
const ld eps = 1e-9;
const db PI = atan(1) * 4;

template<typename T, typename S>inline bool upmin(T&a, const S&b) { return a > b ? a = b, 1 : 0; }
template<typename T, typename S>inline bool upmax(T&a, const S&b) { return a < b ? a = b, 1 : 0; }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }
ll pow(ll a, ll b) {
	if (b == 0) {
		return 1;
	}
	if (b == 1) {
		return a;
	}
	ll ans = pow(a, b / 2);
	ans *= ans;
	ans *= b % 2 == 1 ? a : 1;
	return ans;
}

namespace SOLVE {
	
	void main() {
		ll n;
		cin >> n;
		set<ll> primes;
		map<ll, ll> pcount;
		ll factor = 2;

		while (factor*factor <= n) {
			while (n % factor == 0) {
				primes.insert(factor);
				pcount[factor]++;
				n /= factor;
			}
			factor++;
		}

		if (n != 1) {
			primes.insert(n);
			pcount[n]++;
		}
		ll ans = 1;
		for (ll p : primes) {
			ll k = pcount[p];
			ans *= (pow(p, k) - pow(p, k - 1));
		}

		cout << ans << endl;
	}
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	//    in(t);
	t = 1;
	while (t--) {
		SOLVE::main();

	}

	return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define N 610
#define pb push_back
#define pii pair<int,int>
#define mkp(a,b) make_pair(a,b)
vector <pii> v[2];
int col[2][N][N];
inline void init(int w,int d) {
    for (int i=0;i<=d;i++) {
        int j=sqrt(d-i*i);
        if (i*i+j*j!=d) continue;
        v[w].pb(mkp(i,j)),v[w].pb(mkp(-i,-j));
        v[w].pb(mkp(-i,j)),v[w].pb(mkp(i,-j));
    }
}
inline void dfs(int x,int y,int c,int w,int n) {
    col[w][x][y]=c;
    for (auto &d:v[w]) {
        int _x=x+d.first,_y=y+d.second;
        if (_x<0 || 2*n<=_x || _y<0 || 2*n<=_y) continue;
        if (!col[w][_x][_y]) dfs(_x,_y,3-c,w,n);
    }
}
int main() {
    int n,d1,d2,cnt=0; 
    cin>>n>>d1>>d2;
    init(0,d1),init(1,d2);
    for (int i=0;i<=2*n-1;i++)
        for (int j=0;j<=2*n-1;j++) {
            if (!col[0][i][j]) dfs(i,j,1,0,n);
            if (!col[1][i][j]) dfs(i,j,1,1,n);
        }
    for (int i=0;i<=2*n-1;i++)
        for (int j=0;j<=2*n-1;j++)
            if (col[0][i][j]==1 && col[1][i][j]==1) {
                printf("%d %d\n",i,j);
                if ((++cnt)==n*n) return 0;
            }
    return 0;
}

Measured memory_bytes: 20608
#include<bits/stdc++.h>
using namespace std;
#define lol long long;
#define dob double;
//int a[100000];
// size_t a =s.length();
int main(){
  string s;
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(a+b)*c/2<<"\n";
  return(0);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define lli long long int
#define min(x,y) ((a)<(b)?(a):(b))
#define max(x,y) ((a)>(b)?(a):(b))
#define true 1
#define false 0


int main(void){
	int i,j;
	int h,w,w1;
	char **a;
	char **r;
	char **b;
	scanf("%d%d",&h,&w);
	a = calloc(sizeof(char*),h);
	r = calloc(sizeof(char*),h);
	b = calloc(sizeof(char*),h);
	for(i=0;i<h;i++){
		a[i] = calloc(sizeof(char),w);
		r[i] = calloc(sizeof(char),w);
		b[i] = calloc(sizeof(char),w);
		scanf("%s",a[i]);
	}
	for(i=0;i<h;i++){
		w1 = w-1;
		b[i][0] = '.';
		b[i][w1] = '#';
		r[i][0] = '#';
		r[i][w1] = '.';
		if(i%2){
			for(j=1;j<w-1;j++){
				b[i][j] = '#';
				r[i][j] = a[i][j];
			}
		}else{
			for(j=1;j<w-1;j++){
				r[i][j] = '#';
				b[i][j] = a[i][j];
			}
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			printf("%c", r[i][j]);
		}
		printf("\n");
	}
	printf("\n");
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			printf("%c", b[i][j]);
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 1408
a = []

for i in range(5):
    a.append(int(input()))


def ceil10(n):
    if n % 10 == 0:
        return n
    else:
        return ((n // 10) + 1) * 10


def min_1(a):
    a2 = list(filter(lambda a: a > 0, list(map(lambda e: e % 10, a))))

    if len(a2) == 0:
        return 10

    return min(a2)


ans = sum(map(ceil10, a)) - 10 + min_1(a)
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    int x,y; cin >> x >> y;
    cout << 6-x-y << endl;
    return 0;
}

Measured memory_bytes: 256
#define MOD_TYPE 1

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

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  string s;
  cin >> s;
  if (s == "SSS")
    cout << 0 << "\n";
  else if (s == "RRR")
    cout << 3 << "\n";
  else if (s == "SRR" or s == "RRS")
    cout << 2 << "\n";
  else
    cout << 1 << "\n";
}

int main()
{
  init_main();
  solve();
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(void){
  int a,b; 
  scanf("%d%d",&a,&b);
  if(a<6) {
    printf("0\n",b);
  }
  else if(a<13) {
    printf("%d\n",b/2);
  }
  else {
    printf("%d\n",b);
  }

}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
using ull = unsigned long long;

int main() {

    ull n;
    cin >> n;
    
    if(n % 2) {
        cout << "0" << endl;
        return 0;
    }


    ull count = 0;
    
    n /= 2;

    while(n > 0) {
        count += n / 5;
        n /= 5;
    }


    cout << count << endl;

    return 0;


}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int a,b;scanf("%d%d",&a,&b);
	if (a<=0&&b>=0) {puts("Zero");return 0;}
	if (a>0||(b-a)%2==1) puts("Positive"); else puts("Negative");
	return 0;
}


Measured memory_bytes: 128
N, M = list(map(int, input().split()))
PM = []
for i in range(M):
    p, s = input().split()
    PM.append([int(p), s])

PM.sort(key=lambda x:x[0])
# print(PM)


aw = []
for i in range(N+10):
    aw.append([0,0])

a_cnt = 0
w_cnt = 0
for p, m in PM:
    if aw[p][0] == 1:
        pass
    elif m == 'WA':
        aw[p][1] += 1
    elif m == 'AC':
        aw[p][0] = 1

for a, w in aw:
    if a == 1:
        a_cnt += 1
        w_cnt += w
print(a_cnt, w_cnt)

Measured memory_bytes: 32636
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl; 
	return 0;
}

Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
A.sort()
S=[]
s=0
for i in range(n):
    s+=A[i]
    S.append(s)
ans=1
for i in reversed(range(n-1)):
    if S[i]*2>=A[i+1]:
        ans+=1
    else:
        break
print(ans)

Measured memory_bytes: 14320
program main
	implicit none
	integer(8):: A,B,C,N,i,j,t,k,ka,kb
	read *, A,B
   	if(B>A)then
		N=A
		A=B
		B=N
	end if
	ka=A;kb=B
	
	!!!最大公約数を求める	
   	C=mod(a,b)
	do while (C/=0)
		A=B
		B=C
		C=mod(A,B)
	end do
	print '(I0)',(ka*kb)/B
	!print'(a)'!文字
	!print'(f0.14)'!double型
	
end program main

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	N, _ := strconv.Atoi(s)

	if N == 1 {
		fmt.Println("Hello World")
	} else if N == 2 {
		s, _ = r.ReadString('\n')
		s = strings.TrimRight(s, " \t\n")
		A, _ := strconv.Atoi(s)
		s, _ = r.ReadString('\n')
		s = strings.TrimRight(s, " \t\n")
		B, _ := strconv.Atoi(s)
		fmt.Println(A + B)
	}

}


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

int main(){
	vector<int> x (2);
	cin >> x[0] >> x[1] ;
	for (int i = 0; i < 2; ++i)
	{
		switch(x[i]){
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
				x[i] = 1;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				x[i] = 2;
				break;
			default:
				x[i] = 3;
				break;
		}
	}
	if (x[0] == x[1])
	{
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
# cording:utf-8
n,t_limit = (int(x) for x in input().split())
cost_list = list()
time_list = list()
while n >= 1:
    c,tn = (int(x) for x in input().split())
    if tn <= t_limit:
        cost_list.append(c)
        time_list.append(tn)
        n = n - 1
    else:
        n = n - 1
if not time_list:
    print('TLE')
else:
    best_cost = min(cost_list)
    print(best_cost)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int a,b,c,d,p,y,x,n;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	x=p*a;
	if(p>=c){
		y=(p-c)*d+b;
	}
	else{
		y=b;
	}
	if(x>y){
		printf("%d\n",y);
	}
	else{
		printf("%d\n",x);
	}
	
	return 0;
}



Measured memory_bytes: 2696
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if (c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
    else if (c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
    else if (b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else
        cout << b << " " << c << " " << a << endl;
}


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

template<typename T> using V = vector< T >;
using Vi = V<int>;

int main(){
    int n;
    cin>>n;
    Vi b(n-1);
    for(int i=0; i<n-1; i++) cin>>b[i];

    int total = 0;
    for(int i=0; i<n; i++){
        if(i==0){
            total += b[i];
        }else if(i==n-1){
            total += b[i-1];
        }else{
            total += min(b[i],b[i-1]);
        }
    }

    cout<<total<<endl;

    return 0;
}

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

bool cmp(const pair<int,int> &f, const pair<int,int> &s) {
    if (f.first == s.first) return f.second < s.second;
    return f.first > s.first;
}

int main() {
    int n, m;
    while (cin >> n >> m, n || m) {
        vector<pair<int,int> > v;
        for (int i = 1; i <= m; i++) {
            v.push_back(pair<int,int>(0, i));
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                int x; cin >> x;
                if (x) v[j].first++;
            }
        }

        sort(v.begin(), v.end(), cmp);
        for (int i = 0; i < m; i++) {
            cout << v[i].second << (i < m - 1 ? " " : "\n");
        }
    }

    return 0;
}

Measured memory_bytes: 2984
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }
        if (a[0] > a[1]) {
            swap(a, 0, 1);
        }
        if (a[1] > a[2]) {
            swap(a, 1, 2);
        }
        if (a[0] > a[1]) {
            swap(a, 0, 1);
        }
        System.out.println(a[0] + " " + a[1] + " " + a[2]);
    }
    static void swap(int[] a, int idx1, int idx2) {
        int tmp = a[idx1];
        a[idx1] = a[idx2];
        a[idx2] = tmp;
    }
}



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

using namespace std;
set<int> s1;
int main(){
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        int x;
        cin>>x;
        while(x--){
           // cout<<x<<endl;
            int y;
            cin>>y;
            s1.insert(y);
        }
    }
    cout<<n-(int)s1.size()<<endl;
}

Measured memory_bytes: 3604
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int D;
    cin >> D;

    vi c(26);
    REP(i, 26) cin >> c[i];

    vi last(26, 0);

    vi ans(D);
    REP(i, D) {
        vll s(26);
        REP(j, 26) cin >> s[j];

        vll p(26);
        ll p_all = 0;
        REP(j, 26) {
            p[j] = c[j] * (i + 1 - last[j]);
            p_all += p[j];
        }

        REP(j, 26) {
            s[j] -= p_all - p[j];
        }

        int idx = max_element(ALL(s)) - s.begin();

        last[idx] = i + 1;
        print(idx + 1);
    }
    
}


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

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ans = n;
    for (int i = 0; i < n - 1; i++) if (s[i] == s[i + 1]) ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
long a,b,c,d,e;
for(;;){
cin>>a>>b;
if(cin.eof())break;
c=a;d=b;
if(b>a){e=a;a=b;b=e;}
while(b!=0){
a%=b;e=a;a=b;b=e;
}
cout<<a<<" "<<(c/a)*d<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>

char s[3010];
char t[3010];
int dp[3010][3010];
int chmax(int a, int b)
{
	if (a > b)
		return a;
	return b;
}
int main(int argc, char const *argv[])
{
	scanf("%s%s", s, t);
	int lens = strlen(s);
	int lent = strlen(t);
	for (int i = 0; i < lens; i++)
	{
		for (int j = 0; j < lent; j++)
		{
			if(s[i]==t[j])
				dp[i+1][j+1] = chmax(dp[i+1][j+1], dp[i][j] + 1);
			dp[i+1][j+1] = chmax(dp[i+1][j+1], dp[i+1][j]);
			dp[i+1][j+1] = chmax(dp[i+1][j+1], dp[i][j+1]);
		}
	}
	int i = dp[lens][lent];
	char res[i];
	res[i] = '\0';
	while(lens > 0 && lent > 0)
	{
		if(dp[lens][lent] == dp[lens-1][lent])
			--lens;
		else if(dp[lens][lent] == dp[lens][lent-1])
			--lent;
		else
		{
			--i;
			res[i] = s[lens - 1];
			--lens;
			--lent;
		}
	}
	printf("%s\n", res);
	return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main(){
 int a,b;
 string op;
while(1){
 cin >> a >> op >> b;
if( op == "+" ){
    cout << a + b << endl;
}else if( op == "-" ){
    cout << a - b << endl;
}else if( op == "*"){
    cout << a * b << endl;
}else if( op == "/"){
    cout << a / b << endl;
}else break;
};
 return 0;
}

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

using namespace std;

using int64 = long long;

constexpr int DEBUG = 0;

struct Element {
  int index;
  int value;
};

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

  int n;
  cin >> n;
  vector<Element> es;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    es.push_back(Element({i, x}));
  }


  sort(es.begin(), es.end(), [](const auto& e1, const auto& e2) {
    return e1.value > e2.value;
  });

  set<int> s;
  s.insert(-1);
  s.insert(-2);
  s.insert(n);
  s.insert(n + 1);

  int64 count = 0;
  for (const auto& e : es) {
    int i = e.index;
    if (DEBUG) cout << "i: " << i << endl;
    s.insert(i);
    auto it = s.lower_bound(i);
    it--;
    int l1 = *it;
    it--;
    int l2 = *it;
    it++;
    it++;
    it++;
    int r1 = *it;
    it++;
    int r2 = *it;

    if (r1 < n) {
      int64 cr = r2 - r1;
      int64 cl = i - l1;
      count += cr * cl * e.value;
    }
    if (l1 >= 0) {
      int64 cr = r1 - i;
      int64 cl = l1 - l2;
      count += cr * cl * e.value;
    }
    if (DEBUG) cout << "count: " << count << endl;
  }
  cout << count << endl;
}

Measured memory_bytes: 5748
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
    int N;
    scanf("%d",&N);
    for(int i=0;i*4<=N;i++)
        for(int j=0;i*4+j*7<=N;j++)
            if(i*4+j*7==N){
                puts("Yes");
                return 0;
            }
    puts("No");
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>

using namespace std;

int main()
{
	int c1,c5,c10,c50,c100,c500;
	cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
	if(1 * c1 + 5 * c5 + 10 * c10 + c50 * 50 + c100 * 100 + c500 * 500 >= 1000)
	{
		cout << 1 << endl;
	}
	else

	{
		cout << 0 << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	
	//偶数＋偶数の数
	int ev = n*(n-1) / 2;
	
	//奇数＋奇数の数
	int od = m*(m-1) / 2;
	
	int ans = ev + od;
	cout << ans << endl;
	
}

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

int main() {
	string s;
	cin >> s;
	bool check[4];
	for(int i = 0; i < 4; i++){
		check[i] = false;
	}
	
	for(int i = 0; i < s.length(); i++){
		switch(s[i]){
			case 'N':
			check[0] = true;
			break;
			
			case 'W':
			check[1] = true;
			break;
			
			case 'S':
			check[2] = true;
			break;
			
			case 'E':
			check[3] = true;
			break;
		}
	}
	
	if((check[0] != check[2]) || (check[1] != check[3])){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
S=input()
N=len(S)

count=[0]*(N+1)
i=0
while i<N:
    if S[i]=='<':
        count[i+1]=count[i]+1
    i+=1

S=S[::-1]
count=count[::-1]
i=0
while i<N:
    if S[i]=='>':
        count[i+1]=max(count[i+1],count[i]+1)
    i+=1

print(sum(count))

Measured memory_bytes: 27068
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;
ll dp[60][60][2600];

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N,A;cin >> N >> A;
    int X[N];REP(i,N) cin >> X[i];
    dp[0][0][0] = 1;
    REP(i,N) REP(j,N) REP(k,2600){
        if(dp[i][j][k]){
            dp[i+1][j][k] += dp[i][j][k];
            dp[i+1][j+1][k + X[i]] += dp[i][j][k];
        }
    }
    ll ans = 0;
    REPP(i,1,N+1) ans += dp[N][i][i*A];
    cout << ans << endl;
}

Measured memory_bytes: 61696
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s;

signed main() {
	cin >> s;
	for (int i = 0; i < (int)s.size(); i++)cout << 'x';
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[100011],t[100011];
int ss,ts,nxt[100011][26],w[26];
int main()
{
	scanf("%s%s",s+1,t+1);
	ss=strlen(s+1); ts=strlen(t+1);
	for(int i=(ss<<1);i>ss;i--) w[s[i-ss]-'a']=i;
	for(int i=ss;i;i--)
	{
		for(int j=0;j<26;j++) nxt[i][j]=(w[j]>ss)?(w[j]-ss):w[j];
		w[s[i]-'a']=i;
	}
	int pos=w[t[1]-'a'],x=2,turn=0;
	for(;pos&&x<=ts;)
	{
		if(pos>=nxt[pos][t[x]-'a']) turn++;
		pos=nxt[pos][t[x]-'a']; x++;
	}
	if(pos==0) printf("-1");
	else printf("%lld\n",1ll*turn*ss+pos);
	return 0;
} 

Measured memory_bytes: 10624
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <math.h>

typedef unsigned long long ULONG;
typedef long long LONG;
using namespace std;

#define PI 3.1415926535897932384626433
#define _DBG_

#define BIG 10000000000 //10

#define LAST 10000000 //10^7

#define MOD (LONG)(10e8 + 7)




int main(void) {
	LONG N;
	cin >> N;

	if (N >= 30) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2005;
const int Q = 924844033;
int n , K;
int f[2][N][4];
int D[N] , P[N];

void add(int& A , int B) {
    A += B;
    if (A >= Q) {
        A -= Q;
    }
}

int main() {
    cin >> n >> K;
    if (K == 0) {
        D[0] = 1 , D[1] = 0;
        for (int i = 2 ; i <= n ; ++ i) {
            D[i] = (LL)(i - 1) * (D[i - 2] + D[i - 1]) % Q;
        }
        cout << D[n] << endl;
        return 0;
    }
    P[0] = 1;
    for (int i = 1 ; i <= n ; ++ i) {
        P[i] = (LL)P[i - 1] * i % Q;
    }
    int cur = 1 , nxt = 0;
    f[cur][0][0] = 1;
    for (int i = 1 ; i <= K ; ++ i) {
        for (int j = i ; j <= n ; j += K) {
            memset(f[nxt] , 0 , sizeof(f[nxt]));
            for (int k = 0 ; k <= n ; ++ k) {
                for (int l = 0 ; l < 4 ; ++ l) {
                    if (!f[cur][k][l]) {
                        continue;
                    }
                    int w = f[cur][k][l];
                    add(f[nxt][k][(l << 1) & 3] , w);
                    if ((~l & 2) && j - K > 0) {
                        add(f[nxt][k + 1][(l << 1) & 3] , w);
                    }
                    if (j + K <= n) {
                        add(f[nxt][k + 1][(l << 1 | 1) & 3] , w);
                    }
                }
            }
            swap(cur , nxt);
        }
        memset(f[nxt] , 0 , sizeof(f[nxt]));
        for (int k = 0 ; k <= n ; ++ k) {
            for (int l = 0 ; l < 4 ; ++ l) {
                if (!f[cur][k][l]) {
                    continue;
                }
                int w = f[cur][k][l];
                add(f[nxt][k][0] , w);
            }
        }
        swap(cur , nxt);
    }
    int res = 0;
    for (int i = 0 ; i <= n ; ++ i) {
        int w = (LL)f[cur][i][0] * P[n - i] % Q;
        if (i & 1) {
            add(res , Q - w);
        } else {
            add(res , w);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
string s;
int main() {
    int i, j;
    cin >> s;
    for (i=0; ; i++) if (s[i] == 'A') break;
    for (j=s.size()-1; ; j--) if (s[j]=='Z') break;
    cout << j - i + 1;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{long long c=0,c1=0,n=0;string s;
cin>>n;
    cin>>s;
    for(long long i=0;i<s.length();i++)
    {
        if(s[i]=='R')
        c++;
    }
    for(long long i=0;i<s.length();i++)
    {
        if(s[i]=='R'&&i>=c)
        c1++;
    }
    if(c1<=c&&c1<=(n-c))
    cout<<c1;
    else if(c<=(n-c))
    cout<<c;
    else
    cout<<n-c;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    ll L = 0;
    ll R = 1000000000 + 1;
    while(L+1 < R){
        ll X = (L+R)/2;
        ll sumk = 0;
        rep(i,N){
            sumk += (((A[i]+X-1)/X) - 1);
        }
        if(sumk <= K){
            R = X;
        }else{
            L = X;
        }
    }
    /*
     ans = 0;
    rep(i,N){
        sumk += (((A[i]+R-1)/R) - 1);
    }*/
    cout << R << endl;
}


Measured memory_bytes: 4760
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N,L;
  cin >> N >> L;
  vector<ll> A(N);
  rep(i,N){
    cin >> A[i];
  }
  rep(i,N-1){
    if(A[i]+A[i+1] >= L){
      cout << "Possible" << endl;
      rep(j,i){
        cout << j+1 << endl;
      }
      for(int j=N-2; j>=i; j--){
        cout << j+1 << endl;
      }
      return 0;
    }
  }
  cout << "Impossible" << endl;
  return 0;
}

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


#----------
A,B,C,D,E,F = list(map(int, input().rstrip().split()))

water_set=set()
for i in range( F // (A*100) + 1):
    for j in range( F // (B*100) + 1 ):
        volume_water = i*(A*100) + j*(B*100)
        
        if volume_water < F and volume_water != 0:
            water_set.add( volume_water )
        
water_list=sorted(water_set)
max_concent = -1
materials=[]
for w in water_list:
    max_sugar = (w // 100) * E

    sugar_set=set()
    for i in range( max_sugar // C + 1 ):
        for j in range( max_sugar // D + 1 ):
            volume_sugar = (i*C) + (j*D)
            
            if volume_sugar <= max_sugar and (w + volume_sugar) <= F:
                sugar_set.add( volume_sugar )
 
    sugar_list=sorted(sugar_set)
    for s in sugar_list:
        concent = s / (w + s) * 100
        if concent > max_concent:
            max_concent = concent
            materials = [w,s]
    
print( (materials[0] + materials[1]) , materials[1])


Measured memory_bytes: 3064
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;


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 yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
int main(){
 

    string s1,s2;
    cin>>s1;
    cin>>s2;
    bool ok=true;
    REP(i,s1.size()){
        if(s1[i]!=s2[s2.size()-1-i]){
            no;
            return 0;
        }
    }

    yes;


}


Measured memory_bytes: 764
#include<iostream>
using namespace std;
#include<cstring>
int main(){
  string s,ss,out;
  cin>>s>>ss;
  int sn,ssn;
  cin>>sn>>ssn;
  cin>>out;
  if(out[0]==s[0])
    cout<<sn-1<<' '<<ssn<<endl;
  else
    cout<<sn<<' '<<ssn-1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
int main(){
	int n;
	cin>>n;
	rep(l,n){
		if(l) cout<<endl;
		int m;
		cin>>m;
		// cout<<m<<endl;
		if(m==1){
			cout<<"#\n";
			continue;
		}
		if(m==2){
			cout<<"##\n";
			cout<<"# \n";
			continue;
		}
		if(m==3){
			/*
			###
			# #
			# #
			*/
			cout<<"###\n";
			cout<<"# #\n";
			cout<<"# #\n";
			// cout<<"\n";
			continue;
		}
		if(m==4){
			cout<<"####\n";
			cout<<"#  #\n";
			cout<<"#  #\n";
			cout<<"# ##\n";
			// cout<<endl;
			continue;
		}
		vector<vector<char> > vv;
		initvv(vv,m,m);
		rep(i,m){
			rep(j,m) vv[i][j]=' ';
		}
		rep(i,m){
			vv[0][i]='#';
			vv[m-1][i]='#';
			vv[i][m-1]='#';
			vv[i][0]='#';
		}
		vv[m-1][1]=' ';
		int x=m-1,y=2;
		int c=0;
		while(1){
			// cout<<x<<" "<<y<<endl;
			if(vv[x+dx[c]*2][y+dy[c]*2]==' '){
				x+=dx[c];
				y+=dy[c];
				vv[x][y]='#';
			}
			else if(vv[x+2*dx[(c+1)%4]][y+2*dy[(c+1)%4]]==' '&&vv[x+dx[(c+1)%4+dx[(c+2)%4]]][y+dy[(c+1)%4]+dy[(c+2)%4]]==' '){
				c++;
				c%=4;
				x+=dx[c];
				y+=dy[c];
				vv[x][y]='#';
			}
			else{
				break;
			}
		}
		/*
		######
		#    #
		# ## #
		# #  #
		# #  #
		# ####
		*/
		rep(i,m){
			rep(j,m){
				cout<<vv[i][j];
			}
			cout<<endl;
		}
		// cout<<endl;
	}
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(std::string C){
    char chr = C[0]+1;
    cout << chr << "\n";
}

int main(){
    std::string C;
    std::cin >> C;
    solve(C);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e18+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

/* template */

const double PI=3.14159265358979323846;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double r; cin >> r;
    double ans = 2.0*r*PI;
    cout << fixed << setprecision(15) << ans << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef tuple<string, int, int> mytuple;

bool mycompare(const mytuple &lhs, const mytuple &rhs)
{
  if (std::get<0>(lhs) != std::get<0>(rhs))
    return std::get<0>(lhs) < std::get<0>(rhs);
  if (std::get<1>(lhs) != std::get<1>(rhs))
    return std::get<1>(lhs) > std::get<1>(rhs);
  return std::get<2>(lhs) < std::get<2>(rhs);
}

int main()
{
  int N;
  cin >> N;
  vector<tuple<string, int, int>> vec(N);
  for (int idx = 0; idx < N; idx++)
  {
    string a;
    cin >> a;
    int b;
    cin >> b;
    vec[idx] = make_tuple(a, b, idx);
  }
  sort(vec.begin(), vec.end(), mycompare);
  for (int j = 0; j < N; j++)
  {
    cout << get<2>(vec[j]) + 1 << endl;
  }
  return 0;
}


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

int main(){
	int h,n,x,s=0;
	cin>>h>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		s+=x;
	}
	if(s>=h)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main() {
    int r = 1;
    string S;
    cin >> S;

    char p = S.at(0);
    rep(i,S.size()-1) {
        if(p == S.at(i+1))
            r++;
        else
            r=1;
        if(r>2)
            break;
        p = S.at(i+1);
    }
    
    cout << ((r>2) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
from collections import Counter


def prime_factorization(n):
    counter = Counter()
    max_pp = n
    while n % 2 == 0:
        counter[2] += 1
        n //= 2
    p = 3
    while p ** 2 <= max_pp:
        if n % p == 0:
            counter[p] += 1
            n //= p
        else:
            p += 2
    if n != 1:
        counter[n] += 1
    return counter


N = int(input())
prime_counter = prime_factorization(N)
ans = 0
for key in prime_counter.keys():
    for e in range(1, N):
        if prime_counter[key] >= e:
            prime_counter[key] -= e
            ans += 1
            e += 1
        else:
            break

print(ans)


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

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 (a>b) { a=b; return 1; } return 0; }
#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 all(x) (x).begin(),(x).end()

const ll INF = 1000000000000000000;

int main() {
    ll n;
    cin >> n;
    vector<ll> divs(1e6+1, 0);
    ll m = n;
    for (ll i=2; i*i<=n; ++i) {
        while(m%i==0) {
            divs[i]++;
            m /= i;
        }
    }
    vector<ll> step;
    step.push_back(0);
    step.push_back(1);
    ll ans = 0;
    if (m > 1) {
        ans++;
    }
    for (auto e: divs) {
        if (e == 0) {
            continue;
        } else {
            ll p = floor((-1+sqrt(1+8*e)) / 2);
            ans += p;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 11240
#include <stdio.h>
#include <string.h>

int main(void){
        int i,j,n,p1,p2;
        char rep[] = {"replace"}, rev[] = {"reverse"}, pri[] = {"print"};
        char jud[8];
        char m[1001],str[1001];

        scanf("%s\n%d",str,&n);

        for(i = 0; i < n; i++){
                scanf("%s %d %d",jud,&p1,&p2);

                if(strcmp(rep,jud) == 0){
                        scanf("%s",m);

                        for(j = 0; j < strlen(m); j++)
                                str[p1+j] = m[j];

                        //printf("%s\n",str);

                }else if(strcmp(rev,jud) == 0){
                        for(j = 0;j <= p2-p1; j++)
                                m[j] = str[p2-j];

                        for(j = p1; j <= p2; j++){
                                str[j] = m[j-p1];
                        }

                        //printf("%s\n",str);

                }else{

                        for(j = p1; j <= p2; j++)
                                printf("%c",str[j]);
                        puts("");
                }
        }
        return 0;
}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

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

int main() {
    ll L, R;
    cin >> L >> R;
    ll M = 2019;
    ll result = M;
    ll B = min(R, L + M + 1);
    for (ll i = L; i <= B; ++i) {
        for (ll j = i + 1; j <= B; ++j) {
            amin(result, (i * j) % M);
        }
    }
    cout << result << endl;


    return 0;
}



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

int main(){
   int n,l;
   cin >> n >> l;
   vector<string> s(n);
   for(int i=0;i<n;i++) cin >> s.at(i);
   sort(s.begin(), s.end());
   for(int i=0;i<n;i++) cout << s.at(i);
   cout << endl;
   return 0;
}

Measured memory_bytes: 3520
main = do
 [a,b,c,x,y] <- map read . words <$> getLine
 let
  buyc   = if a+b<2*c then 0 else min x y * 2
  buycc  = buyc + if a<2*c   then 0 else 2*x-buyc
  buyccc = buycc + if b<2*c   then 0 else 2*y-buycc
  buya   = max (x-buyccc`div`2) 0
  buyb   = max (y-buyccc`div`2) 0
 print $ buya*a+buyb*b+buyccc*c

Measured memory_bytes: 508
import sys

H, W = map(int, input().split())
G = [list(sys.stdin.readline().strip()) for _ in range(H)]

DP = [[0] * W for _ in range(H)]

DP[0][0] = int(G[0][0] == "#")
for i in range(1, H):
    DP[i][0] = DP[i - 1][0] + int(G[i][0] == "#" and G[i - 1][0] == ".")
for j in range(1, W):
    DP[0][j] = DP[0][j - 1] + int(G[0][j] == "#" and G[0][j - 1] == ".")

for i in range(1, H):
    for j in range(1, W):
        t = int(G[i][j] == "#")
        DP[i][j] = min(DP[i - 1][j] + int(t and G[i - 1][j] == "."), DP[i][j - 1] + int(t and G[i][j - 1] == "."))

print(DP[H - 1][W - 1])


Measured memory_bytes: 3188