akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
 
int main(){
  int cards[4][13] = {0};
  int i, j, n;
  int num[52], marknum;
  char mark[52];
   
  scanf("%d", &n);
   
  for(i=0; i<n; i++){
    scanf(" %c %d", &mark[i], &num[i]);
    switch(mark[i]){
    case 'S':
      marknum = 0;
      break;
    case 'H':
      marknum = 1;
      break;
    case 'C':
      marknum = 2;
      break;
    case 'D':
      marknum = 3;
      break;
    }
    cards[marknum][num[i]-1] = 1;
  }
   
 
   
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      switch(i){
      case 0:
        if(cards[0][j]==0){
          printf("S %d\n", j+1);
        }
        break;
      case 1:
        if(cards[1][j]==0){
          printf("H %d\n", j+1);
        }
        break;
      case 2:
        if(cards[2][j]==0){
          printf("C %d\n", j+1);
        }
        break;
      case 3:
        if(cards[3][j]==0){
          printf("D %d\n", j+1);
        }
        break;
      }
    }
  }
  return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int main() {
	multiset<int> st;
	int N; cin >> N;
	rep(i, N) {
		int x; cin >> x;
		st.insert(x);
	}
	int M; cin >> M;
	rep(i, M) {
		int x; cin >> x;
		if (st.count(x)) {
			st.erase(st.find(x));
		} else {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}

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

int main(){
  int m, f, r;
  while(true){
    cin >> m >> f >> r;
    if(m == -1 && f == -1 && r ==-1){
      break;
    }
    if((m == -1 || f == -1) || m + f < 30){
      cout << "F" << endl;
    }
    else if(m + f >= 80){
      cout << "A" << endl;
    }
    else if(m + f >= 65){
      cout << "B" << endl;
    }
    else if(m + f >= 50){
      cout << "C" << endl;
    }
    else if(m + f >= 30 && r >= 50){
      cout << "C" << endl;
    }
    else{
        cout << "D" << endl;
    }
  }
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  sort(a.begin(),a.end());
  a.erase(unique(a.begin(),a.end()),a.end());

  if(a.size() == n) cout << "YES"<<endl;
  else cout << "NO" << endl;;
  return 0;
}


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

int main()
{
    int n, i;
    int a[100];
    cin >> n;
	for(i = 0; i < n; i++){
        cin >> a[i];
	}
	for(i = 0; i < n - 1; i++){
		cout << a[n - 1 - i] << " ";
	}
    cout << a[0] << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;

#define FOR(_i, s, e) for(_i = s; _i < e; ++_i)
#define FOR_INV(_i, s, e) for(_i = e - 1; _i >= s; --_i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


using pos = std::pair<LONG, LONG>;


int main(){
    LONG i, j, k;
    LONG n, m, d;

    cin >> n >> m >> d;

    double ret;
    if(d == 0){
        ret = n;
    }
    else{
        ret = 2 * (n - d);
    }
    ret *= m - 1;
    ret /= n * n;

    cout << fixed << setprecision(7) << ret;
}


Measured memory_bytes: 3772
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
string ans;
int main(){
	cin>>n;
	char c[27];for(char ch='a';ch<='z';ch++)c[ch-'a']=ch;
	while(1){
		n--;
		ll t=n%26ll;
		n=n/26ll;
		ans+=c[t];
		if(n==0)break;
	}
	int len=ans.length();
	for(int i=len-1;i>=0;i--)printf("%c",ans[i]);
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
template<typename T> struct Dinitz{
	int n, source, sink;
	vector<vector<T>> adj;
	struct edge {
		int u;
		T flow, cap;
	};
	vector<edge> edges;
	Dinitz(int n, int source, int sink): n(n), source(source), sink(sink), adj(n) {}
	int add_edge(int a, int b, T abcap, T bacap = 0) {
		int result = edges.size();
		adj[a].push_back(edges.size());
		edges.push_back({b, 0, abcap});
		adj[b].push_back(edges.size());
		edges.push_back({a, 0, bacap});
		return result;
	}
	vector<int> mindist, position;
	bool bfs() {
		queue<int> q;
		fill(mindist.begin(), mindist.end(), INT_MAX / 2);
		mindist[source] = 0;
		q.push(source);
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			for (int edid: adj[v]) {
				edge &ed = edges[edid];
				if (ed.flow < ed.cap && mindist[ed.u] > mindist[v] + 1) {
					mindist[ed.u] = mindist[v] + 1;
					q.push(ed.u);
				}
			}
		}
		return mindist[sink] < n;
	}
	T dfs(int v, T maxf) {
		if (v == sink) return maxf;
		for (int &pos = position[v]; pos < (int)adj[v].size(); ++pos) {
			int edid = adj[v][pos];
			edge &ed = edges[edid], &reved = edges[edid ^ 1];
			if (ed.flow < ed.cap && mindist[ed.u] == mindist[v] + 1) {
				T f = dfs(ed.u, min(maxf, ed.cap - ed.flow));
				if (f > 0) {
					ed.flow += f;
					reved.flow -= f;
					return f;
				}
			}
		}
		return 0;
	}
	T maxflow() {
		T result = 0;
		mindist.resize(n);
		position.resize(n);
		while (bfs()) {
			T extra;
			fill(position.begin(), position.end(), 0);
			do {
				extra = dfs(source, numeric_limits<T> :: max());
				result += extra;
			} while (extra > 0);
		}
		return result;
	}
};
const int maxn = 111;
char g[maxn][maxn];
int in[maxn][maxn], out[maxn][maxn];
int main(){
	int n, m; cin >> n >> m;
	for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) cin >> g[i][j];
	int s = 0, t = 1, cnt = 2;
	for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) {
		in[i][j] = cnt++;
		out[i][j] = cnt++;
	}
	Dinitz<int> din(cnt, s, t);
	const int inf = 1<<20;
	for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) {
		if(i == 0 || j == 0 || i == n - 1 || j == m - 1){
			if(g[i][j] == 'X'){
				cout << -1 << endl;
				return 0;
			}
			din.add_edge(s, in[i][j], inf);
		}
		if(g[i][j] == 'X'){
			din.add_edge(in[i][j], out[i][j], inf);
			din.add_edge(out[i][j], t, inf);
		} else {
			din.add_edge(in[i][j], out[i][j], 1);
		}
		for(int dx : {-1, 0, 1}){
			for(int dy : {-1, 0, 1}){
				if(abs(dx) + abs(dy) == 1){
					int ni = i + dx, nj = j + dy;
					if(ni >= 0 && ni < n && nj >= 0 && nj < m){
						din.add_edge(out[i][j], in[ni][nj], inf);
					}
				}
			}
		}
	}
	cout << din.maxflow() << endl;
	return 0;
}


Measured memory_bytes: 2996
/*---------------------------------------------*/
/*
    ABC174 C
 */
/*---------------------------------------------*/

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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define repb(i, l, n) for (int64_t i = l; i < n; ++i)
#define repb2(i, l, n) for (int64_t i = l; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define Push_back(p, a, b) (p).push_back( make_pair( (a), (b) ) )

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;  } return 0;  }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;  } return 0;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

int main() {
    int64_t n;
    cin >> n;
    if ( n%2 == 0 ) {
        cout << -1 << endl;
    } else {
        int64_t num = 7;
        repb(i, 1, 10000000) {
            if (num%n == 0) {
                cout << i << endl;
                return 0;
            }
            num = num*10+7;
            num %= n;
        }
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3676
program main
  implicit none
  integer :: a0, b0, c0, a, b, c ,k

  read(*,*) a0, b0, c0
  k = 0
     
    do
       if(mod(a0,2) == 0 .and. mod(b0,2) == 0 .and. mod(c0,2) == 0) then
          if(a0 == b0 .and. b0 == c0) then
             write(*,*) -1
             stop
          else
             
             
         a = (b0 + c0) / 2
         b = (c0 + a0) / 2
         c = (a0 + b0) / 2

         a0 = a
         b0 = b
         c0 = c

         k = k + 1
         cycle
      
      end if

      else

         write(*,*) k

         exit

      end if


   end do
stop

end program main

 
 


Measured memory_bytes: 256
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) rrepi(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};
//}}}


int solve(){
  int h,w;cin>>h>>w;
  int m[h][w] = {};
  rep(i, h){
    rep(j, w){
      cin>>m[i][j];
    }
  }
  dump_2d(m,h,w);

  int cnt = 0;
  typedef tuple<int,int,int,int> op;
  vector<op> x;
  rep(i, h){
    rep(j, w){
      if (m[i][j]%2==1) {
        if (i==h-1 and j==w-1) continue;
        cnt++;
        if (j!=w-1) {
          m[i][j]--;
          m[i][j+1]++;
          x.pb(op(i,j,i,j+1));
        }
        else if(i!=h-1){
          m[i][j]--;
          m[i+1][j]++;
          x.pb(op(i,j,i+1,j));
        }
      }
    }
  }
  dump(cnt);
  dump(x);

  cout << cnt << endl;
  rep(i, sz(x)){
    cout << get<0>(x[i])+1 << " " << get<1>(x[i])+1 << " " << get<2>(x[i])+1 << " " << get<3>(x[i])+1 << endl;
  }

  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: 8432
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#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 FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,T,A;
    R(N,T,A);
    double mi=1e9;
    int id;
    FOR(i,1,N){
        int h;
        R(h);
        double v=T-h*0.006;
        if(abs(v-A)<mi){
            mi=abs(v-A);
            id=i;
        }
    }
    W(id);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n, x;
	scanf("%d %d", &n, &x);
	int sum = 0;
	int in;
	int count = 0;
	for(int i = 0; i < n; i++){
		scanf("%d", &in);
		if((sum = sum + in) <= x){
			count++;
		}
	}
	printf("%d\n", count + 1);
	return 0;
}


Measured memory_bytes: 128
S = input()
if "N" in S and "S" not in S:
  print("No")
elif "S" in S and "N" not in S:
  print("No")
elif "W" in S and "E" not in S:
  print("No")
elif "E" in S and "W" not in S:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    long long x;
    cin >> x;
    
    long long now = 100;
    
    int ans = 0;
    while (now < x) {
        now *= (1.01);
        ans++;
    }
    
    cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int n;
int l[100];
int ans;

int main(){
    cin >> n;
    rep(i,n){
        cin >> l[i];
    }
    sort(l,l+n);
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]+l[j]>l[k] && l[i] != l[j] && l[j] != l[k] && l[k] != l[i]){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;


return 0;
}

Measured memory_bytes: 3600
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int f(int n){
    if(n % 2 == 0) return n / 2;
    else return 3 * n + 1;
}
int main(){
    int s;
    cin >> s;
    vi a;
    a.pb(s);
    while(true){
        int x = f(a[a.size() - 1]);
        a.pb(x);
        for(int i = 0; i < a.size() - 1; i++){
            if(x == a[i]){
                cout << a.size();
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

#ifdef DEBUG
#define debug cout
#else
SS ss;
#define debug ss
#endif

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i)
#define repc(i,n) for(int i=0;i<=(n);++i)
#define repcn(i,m,n) for(int i=(m);i<=(n);++i)
#define repcd(i,n) for(int i=(n);i>=0;--i)
#define repcnd(i,m,n) for(int i=(n);i>=(m);--i)
#define repc0(i,n) for(i=0;i<=(n);++i)
#define repcn0(i,m,n) for(i=(m);i<=(n);++i)
#define repcd0(i,n) for(i=(n);i>=0;--i)
#define repcnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const Int INF = 4000000000000000000LL;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

Int dig(char c){
	if(isdigit(c))return c-'0';
	return c-'A'+10;
}

int main() {
	Int n,m,nn,mm,res,r;
	vector<pair<Int,Int> > p;
	string str;
	IL{
		cin>>n>>str;
		if(n==0)break;
		m=0;
		rep(i,sz(str)){
			m=m*n+dig(str[i]);
		}
		nn=n;
		p.clear();
		for(Int i=2;nn!=1;++i){
			if(nn%i==0){
				Int count=0;
				while(nn%i==0){
					++count;
					nn/=i;
				}
				p.PB(MP(i,count));
			}
		}
		res=INF;
		rep(j,sz(p)){
			mm=m;
			r=0;
			while(mm>0){
				mm/=p[j].first;
				r+=mm;
			}
			chmin(res,r/p[j].second);
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 932
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a * c, max(b * c, max(a * d, b * d))) << endl;
}


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

namespace ProgramingStudying2
{
    class Program
    {
        static void Main(string[] args)
        {
            var nw = Console.ReadLine().Split();
            var n = int.Parse(nw[0]);
            var W = int.Parse(nw[1]);

            var w = new int[n];
            var v = new long[n];

            for(int i = 0; i < n; i++)
            {
                var wv = Console.ReadLine().Split();
                w[i] = int.Parse(wv[0]);
                v[i] = long.Parse(wv[1]);
            }

            //i番目までの荷物から重さj以下となるように取った時の価値の総和の最大値
            var dp = new long[n + 1, W + 1];
            for(int i = 1; i <= n;i++)
            {
                for(int j = 0; j <= W; j++)
                {
                    if (j - w[i - 1] >= 0)
                    {
                        dp[i, j] = Math.Max(dp[i - 1, j], dp[i - 1, j - w[i - 1]] + v[i - 1]);
                    }
                    else
                    {
                        dp[i, j] = dp[i - 1, j];
                    }
                }
            }
            Console.WriteLine(dp[n, W]);
        }
    }
}



Measured memory_bytes: 105344
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    prev_p = 1
    g = []
    seen = [0]*N
    i = 0
    while True:
        if seen[prev_p-1]:
            break
        seen[prev_p-1] = i
        g.append(A[prev_p-1])
        prev_p = g[-1]
        i += 1
    g_periodic = g[seen[prev_p-1]:]  
    g_before = g[:seen[prev_p-1]]

    if K <= len(g_before):
        print(g_before[K-1])
    else:
        K_new = (K - len(g_before)) % len(g_periodic)
        print(g_periodic[K_new-1])
if __name__ == '__main__':
    main()

Measured memory_bytes: 96176
#include<stdio.h>
int main (void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    if(a<b && b<c){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a, n) a, a + n
#define F(i, n) for (i = 0; i < n; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;

int32_t main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll x, n = 100, y = 0;
  cin >> x;
  while (n < x)
  {
    n = (double)(n + n * .01);
    y++;
  }
  cout << y << endl;
}

Measured memory_bytes: 3652
import std;
enum inf(T)()if(__traits(isArithmetic,T)){return T.max/4;}
T scan(T=long)(){return readln.chomp.to!T;}
void scan(T...)(ref T args){auto input=readln.chomp.split;foreach(i,t;T)args[i]=input[i].to!t;}
T[] scanarr(T=long)(){return readln.chomp.split.to!(T[]);}
alias Queue=DList;auto enq(T)(ref Queue!T q,T e){q.insertBack(e);}T deq(T)(ref Queue!T q){T e=q.front;q.removeFront;return e;} 
alias Stack=SList;auto push(T)(ref Stack!T s,T e){s.insert(e);}T pop(T)(ref Stack!T s){T e=s.front;s.removeFront;return e;} 
struct UnionFind(T){T[T]u;ulong[T] rank;@property{bool inc(T e){return e in u;}auto size(){return u.keys.length;}auto dup(){T[] child=u.keys;T[] parent=u.values;auto res=UnionFind!T(child);child.each!(e=>res.add(e));size.iota.each!(i=>res.unite(child[i],parent[i]));return res;}}this(T e){e.add;}this(T[] es){es.each!(e=>e.add);}auto add(T a,T b=a){assert(b.inc);u[a]=a;rank[a];if(a!=b)unite(a,b);}auto find(T e){if(u[e]==e)return e;return u[e]=find(u[e]);}auto same(T a,T b){return a.find==b.find;}auto unite(T a,T b){a=a.find;b=b.find;if(a==b)return;if(rank[a]<rank[b])u[a]=b;else{u[b]=a;if(rank[a]==rank[b])rank[a]++;}}}
struct PriorityQueue(T,alias less="a<b"){BinaryHeap!(T[],less) heap;@property{bool empty(){return heap.empty;}auto length(){return heap.length;}auto dup(){return PriorityQueue!(T,less)(array);}T[] array(){T[] res;auto tp=heap.dup;foreach(i;0..length){res~=tp.front;tp.removeFront;}return res;}void push(T e){heap.insert(e);}void push(T[] es){es.each!(e=>heap.insert(e));}}T look(){return heap.front;}T pop(){T tp=look;heap.removeFront;return tp;}this(T e){ heap=heapify!(less,T[])([e]);}   this(T[] e){ heap=heapify!(less,T[])(e);}}
//END OF TEMPLATE

void main(){
    auto r=scan!long;
    (2*r*3.141592).writeln;
}


Measured memory_bytes: 3784
#include <stdio.h>
#include <math.h>

int main(void)
{
  double x1, x2, y1, y2;
  double ans = 0.0;

  scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

  ans = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));

  printf("%lf\n", ans);

  return 0;
}

Measured memory_bytes: 652
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=5010;
int n,a,b,c,ret;
ll fac[N],fnv[N];
int main() {
	scanf("%d%d%d%d",&n,&a,&b,&c);
	fac[0]=fnv[0]=1;
	rep(i,1,n+1) {
		fac[i]=fac[i-1]*i%mod;
		fnv[i]=powmod(fac[i],mod-2);
	}
	if (b%2!=0) {
		puts("0");
		return 0;
	}
	for (int p3=0;3*p3<=c;p3++) for (int p2=0;3*p3+p2<=c&&p2<=a;p2++) {
		int rc=c-3*p3-p2; int ra=a-p2;
		if (b) {
			int p1=b/2;
			ret=(ret+fac[ra+p1+p2+p3]*fnv[ra]%mod*fnv[p1]%mod*fnv[p2]%mod*fnv[p3]%mod*fac[p1+rc-1]%mod*fnv[p1-1]%mod*fnv[rc])%mod;
		} else if (rc==0) {
			ret=(ret+fac[ra+p2+p3]*fnv[ra]%mod*fnv[p2]%mod*fnv[p3])%mod;			
		}
	}
	printf("%d\n",ret);
}
/*

AA ra

BbBb p1+rc-1,rc

BCBbCb

BCBcCbcb

CAAC p2

CccCcc p3*/

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#pragma comment(linker, "/STACK:102400000,102400000")

using namespace std;

typedef long long LL;
const int MaxN = 15;
const int Inf = 0x3F3F3F3F;

struct Node
{
	int x1, x2, y1, y2;
	void init()
	{
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
		if (x1 > x2) swap(x1, x2);
		if (y1 > y2) swap(y1, y2);
	}
} node[MaxN];
int ret[MaxN];
int mx, my;
int N, K;

void dfs(int x1, int y1, int x2, int y2)
{
	int idx;
	int nx1, nx2, ny2;

	while (K < N)
	{
		idx = -1;
		for (int i = 0; i < N; ++i)
		{
			if (ret[i] == 0)
			{
				if (node[i].x1 >= x1 && node[i].x2 <= x2
					&& node[i].y1 >= y1 && node[i].y2 <= y2)
				{
					if (idx == -1 || node[i].x1 < node[idx].x1
						|| (node[i].x1 == node[idx].x1
						&& node[i].y1 <= node[idx].y1))
						idx = i;
				}
			}
		}
		if (idx == -1) break;
		ret[idx] = ++K;
		nx1 = node[idx].x1;
		nx2 = mx;
		ny2 = node[idx].y2;
		for (int i = 0;  i < N; ++i)
		{
			if (node[i].x1 >= node[idx].x2
				&& node[i].y1 < ny2 && node[i].y2 > ny2)
				nx2 = min(nx2, node[i].x1);
		}
		dfs(nx1, 0, nx2, ny2);
	}
}

int main()
{
	bool ok = false;
	while (scanf("%d", &N) == 1 && N)
	{
		if (ok) puts("");
		else ok = true;
		K = mx = my = 0;
		for (int i = 0; i < N; ++i)
		{
			node[i].init();
			ret[i] = 0;
			mx = max(mx, node[i].x2);
			my = max(my, node[i].y2);
		}
		dfs(0, 0, mx, my);
		for (int i = 0; i < N; ++i)
			printf("%d\n", ret[i]);
	}
    return 0;
}

Measured memory_bytes: 1040
import re

s2 = input().replace('?','.')
t = input()
a, b = len(s2), len(t)
ans = None

for i in range(a-b+1):
    s2_l = list(s2)
    t_l = list(t)
    if re.match(s2[i:i+b], t) is not None:
        for k in range(b):
            s2_l[i+k] = t_l[k]
        #ans = s2_l.replace(s2_l[i:i+b], t_l[0:b]).replace('.','a')
        ans = "".join(s2_l).replace('.','a')
if ans is None:
    print('UNRESTORABLE')
else:
    print(ans)

Measured memory_bytes: 3188
package main

import (
  "fmt"
)


func main() {
  var a, b int
  fmt.Scanf("%d %d", &a, &b)
  
  if (a + b) % 2 != 0 {
    fmt.Printf("IMPOSSIBLE\n")
  }else{
  	fmt.Printf("%d\n", (a + b) / 2)
  }
}

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

int main(void){
   
    int w, a, b;
    cin>>w>>a>>b;
    
    if(a<b){
    if(b-(a+w)>0){
    cout<<b-(a+w)<<endl;
    }else{
        cout<<0<<endl;
    }
    }else{
        if(a-(b+w)>0){
            cout<<a-(b+w)<<endl;
        }else{
            cout<<0<<endl;
        }
    }
}


Measured memory_bytes: 764
#include<stdio.h>
#define INFTY 1000000001
#define N 500000

void merge(int *, int ,int ,int);
void mergeSort(int *, int, int);

int n,count=0;

int main(){
  int A[N],i;
  
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  
  for(i=0 ; i<n ; i++){
    if(i==(n-1))
      printf("%d\n",A[i]);
    else
      printf("%d ",A[i]);
  }
  printf("%d\n",count);
  return 0;
}

void merge(int *A,int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int L[N];
  int R[N];
  int i,j,k;
  for (i = 0 ; i< n1 ; i++){
    L[i] = A[left + i];
  }
  for (i = 0 ; i<n2 ; i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k=left; k < right ; k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
    count++;
  }
}

void mergeSort(int *A, int left, int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}



Measured memory_bytes: 6508
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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;
}

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

    int N;
    cin >> N;
    vector<string> A(N);
    for (auto &&i : A) {
        cin >> i;
    }

    auto bubble    = A;
    auto selection = A;

    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j >= i + 1; j--) {
            if (bubble[j][1] < bubble[j - 1][1])
                swap(bubble[j], bubble[j - 1]);
        }
    }

    for (int i = 0; i < N; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            if (selection[j][1] < selection[minj][1]) {
                minj = j;
            }
        }
        swap(selection[i], selection[minj]);
    }
    auto print = [](auto v) {
        for (int i = 0; i < v.size(); i++) {
            cout << v[i];
            i == v.size() - 1 ? cout << '\n' : cout << ' ';
        }
    };
    print(bubble);
    std::cout << "Stable" << '\n';
    print(selection);
    bubble == selection ? std::cout << "Stable" << '\n'
                        : std::cout << "Not stable" << '\n';

    return 0;
}


Measured memory_bytes: 3228
a,b=map(int,input().split())
moji=input()

if moji[b-1]=="A":
  print(moji[:b-1]+"a"+moji[b:])
elif moji[b-1]=="B":
  print(moji[:b-1]+"b"+moji[b:])
else:
  print(moji[:b-1]+"c"+moji[b:])

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

int main() {
    int S;
    int h, m, s;

    cin >> S;

    h = S / 3600;
    m = (S % 3600) / 60;
    s = (S % 60) % 60;

    cout << h << ':' << m << ':' << s << endl;
}

Measured memory_bytes: 3076
import Prelude as P
import Data.List
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import Data.Graph
import Data.Vector.Unboxed as V (drop,take,sum,last,(!),fromList,Vector)
import Control.Monad
import Control.Monad.State
import Control.Monad.ST

type DP s = STUArray s (Int,Int) Int

dp_i :: DP s -> Vector Int -> Int -> Int  -> ST s ()
dp_i dparr as i j = do
  sums <- forM [i..j-1] $ \k -> do
    l <- readArray dparr (i,k)
    r <- readArray dparr (k+1,j)
    return $ l+r
  writeArray dparr (i,j) $ (minimum sums) + (V.sum $ V.take (j-i+1) $ V.drop (i-1) as)

solve :: Vector Int -> Int -> ST s Int
solve as n = do
  dparr <- newArray ((1,1),(n,n)) 0
  --forM_ [1..n] $ \i -> writeArray dparr (i,i) (as V.! (i-1))
  forM_ [1..n-1] $ \diff ->
    forM_ [1..n-diff] $ \i -> dp_i dparr as i (diff+i)
  readArray dparr (1,n)

main :: IO ()
main = do
  n <- read<$> getLine
  as <- map read.words <$> getLine
  print $ runST $ solve (V.fromList as) n

mod0 :: Int -> Int
mod0 n = mod n 1000000007


Measured memory_bytes: 3196
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
 
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; }
 
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  ll a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  
  if(v<=w) cout<<"NO"<<endl;
  else{
    if(t*(v-w)>=abs(a-b)){
      cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
  }
    
  return 0;
}

Measured memory_bytes: 3636
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())
    A = list(map(int,input().split()))
    ans = [0] * N

    for i in range(N-1):
        ans[A[i]-1] += 1

    print('\n'.join(map(str,ans)))
    
if __name__ == "__main__":
    main()

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

const int Maxfact = pow(10, 9);
typedef long long llong;
llong cnt = 0;

void merge(int A[], int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1+1], R[n2+1];
    for(int i=0; i<n1; i++){
        L[i] = A[left + i];
    }
    for(int j=0; j<n2; j++){
        R[j] = A[mid + j];
    }
    L[n1] = R[n2] = Maxfact+1;
    int l=0, r=0;
    for(int j=left; j<right; j++){
        if(L[l] <= R[r]){
            A[j] = L[l++];
        } else {
            A[j] = R[r++];
            cnt += n1-l;
        }
    }
}
void mergesort(int A[], int left, int right){
    if(left +1 < right){
        int mid = (left + right) / 2;
        mergesort(A, left, mid);
        mergesort(A, mid, right);
        merge(A, left, mid, right);
    }
}

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

    mergesort(A, 0, n);

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

    return 0;
}


Measured memory_bytes: 4772
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn main() {
    input!{
        mut abc: [i32;3],
    }
    abc.sort();
    if abc == vec![5,5,7]{
        println!("YES");
    }else{
        println!("NO");
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N, M;
  cin >> N >> M;
  vpll ed(M);
  vvl G(N + 1);
  rep(i, M){
    cin >> ed[i].first >> ed[i].second;

    G[ed[i].first].push_back(ed[i].second);
    G[ed[i].second].push_back(ed[i].first);
  }

  ll cnt = 0;
  ll st, gl;
  queue<ll> que;
  vl vis(N + 1);

  rep(i, M){
    st = ed[i].first;
    gl = ed[i].second;
    que.push(st);
    rep(k, N + 1)
      vis[k] = 0;

    vis[st] = 1;

    while(!(que.empty())){
      ll top = que.front();
      que.pop();

      
      rep(j, G[top].size()){
        if(vis[G[top][j]] == 1) continue;
        if((st == top) && (gl == G[top][j])) continue;
        if((st == G[top][j]) && (gl == top)) continue;

        vis[G[top][j]] = 1;
        que.push(G[top][j]);
      }
    }

    if(vis[gl] == 0)
      cnt++;
  }

  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if((s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2])||(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1])||(s[0]==s[3]&&s[2]==s[1]&&s[0]!=s[2])){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main { cout << "ai1333" << string(in() / 100, '3') << endl; }



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

using namespace std;
typedef long long ll;


int main() {
	
	string S;
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D >> S;
	A--, B--, C--, D--;

	//snuke able
	int cnt = 0;
	for (int i = A; i <= C; i++) {
		if (S[i] == '#') {
			cnt++;
		}
		else cnt = 0;
		if (cnt >= 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cnt = 0;

	//fnuke able
	for (int i = B; i <= D; i++) {
		if (S[i] == '#') {
			cnt++;
		}
		else cnt = 0;
		if (cnt >= 2) {
			cout << "No" << endl;
			return 0;
		}
	}

	if(C < D){
		cout << "Yes" << endl;
		return 0;
	}
	else {
		cnt = 0;
		for (int i = B - 1; i <= D + 1; i++) {
			if (S[i] == '.') {
				cnt++;
			}
			else cnt = 0;
			if (cnt >= 3) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int L,R;
	scan(L>>R);
	if(L/2019!=R/2019){
		prin(0);
		return 0;
	}
	L%=2019,R%=2019;
	if(R<L) R+=2019;
	int ans=INF;
	for(int i=L;i<=R;i++){
		for(int j=i+1;j<=R;j++){
			ans=min(ans,i*j%2019);
		}
	}
	prin(ans);
	return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    int k , n ;
    st s ;
    cin >> n >> k >> s ;

    if (s[k - 1] == 'A')
        s[k - 1] = 'a' ;
    if (s[k - 1] == 'B')
        s[k - 1] = 'b' ;
    if (s[k - 1] == 'C')
        s[k - 1] = 'c' ;

    cout << s ;

    return 0 ;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int X = sc.nextInt();
            int Y = sc.nextInt();

            int prise = 0;

            if (X == 1) {
                prise += 300000;
            } else if (X == 2) {
                prise += 200000;
            } else if (X == 3) {
                prise += 100000;
            }

            if (Y == 1) {
                prise += 300000;
            } else if (Y == 2) {
                prise += 200000;
            } else if (Y == 3) {
                prise += 100000;
            }

            if (X == 1 && Y == 1) {
                prise += 400000;
            }

            System.out.println(prise);
        }
    }

}


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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in));
        final String[] str = br.readLine().split(" ");
        final int W = Integer.parseInt(str[0]);
        final int H = Integer.parseInt(str[1]);
        final int x = Integer.parseInt(str[2]);
        final int y = Integer.parseInt(str[3]);
        final int r = Integer.parseInt(str[4]);
        final int cX1 = x - r;
        final int cX2 = x + r;
        final int cY1 = y - r;
        final int cY2 = y + r;

        if (0 <= cX1 && cX2 <= W && 0 <= cY1 && cY2 <= H) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;

#define ll long long

const int N = 402;
int a[N];
ll dp[N][N], sum[N];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		sum[i] = a[i];
		if (i > 0) {
			sum[i] += sum[i-1];
		}
	}
	for (int i = 2; i <= n; i++) {
		for (int l = 0, r = i - 1; r < n; l++, r++) {
			dp[l][r] = 2e18;
			for (int j = l + 1; j <= r; j++) {
				dp[l][r] = min(dp[l][r], dp[l][j-1] + dp[j][r] + sum[r] - (l - 1 < 0 ? 0 : sum[l-1]));
			}
		}
	}
	printf("%lld", dp[0][n-1]);
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int b[100005];
int a[100005];
int c[100005];
int main(){
    int x,y,al,bl,cl;
    cin>>x>>y>>al>>bl>>cl;
    for(int i=0;i<al;i++)
        cin>>a[i];
    for(int i=0;i<bl;i++)
        cin>>b[i];
    for(int i=0;i<cl;i++)
        cin>>c[i];
    sort(a,a+al,greater<int>());
    sort(b,b+bl,greater<int>());
    sort(c,c+cl,greater<int>());
    int p1=x-1;
    int p2=y-1;
    int p3=0;
    long long ans=0;
    while(p3<cl&&p1>=0&&p2>=0){
        int m;
        m=min(a[p1],b[p2]);
        if(m>=c[p3])
            break;
        else{
           ans+=c[p3];
           if(m==a[p1])
                p1--;
           else
                p2--;
         p3++;
        }
    }
    if(p1<0){
        while(p2>=0){
            if(b[p2]<c[p3]){
                ans+=c[p3];
                p2--;
                p3++;
            }
            else
                break;
        }
    }
    if(p2<0){
        while(p1>=0){
            if(a[p1]<c[p3]){
                ans+=c[p3];
                p1--;
                p3++;
            }
            else
                break;
        }
    }
    for(int i=0;i<=p1;i++)
        ans+=a[i];
    for(int i=0;i<=p2;i++)
        ans+=b[i];
    cout<<ans;


}


Measured memory_bytes: 1408