akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cstdlib>
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;}

const long long mod = 1e9 + 7;
vector<long long> dp(1e5+10);

int main(){
    int n,m; cin >> n >> m;
    vector<bool> a(n+1,true); 
    for(int i = 0; i < m; i++){ int tmp; cin >> tmp; a[tmp] = false; }
    dp[0] = 1;
    //配るDP
    for(int now = 0; now < n; now++){
        for(int next = now+1; next <= min(n,now+2) ; next++){
            if(a[next]){
                dp[next] += dp[now];
                dp[next] %= mod;
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1024
N_W=list(map(int,input().split()))
N=N_W[0]
W=N_W[1]
items=[]
for i in range(N):
	sets=list(map(int,input().split()))
	items.append(sets)
V=0
for i in range(N):
	V=max(V,items[i][1])

f_inf=float('inf')

knapsack=[[f_inf for v in range(N*V+1)] for i in range(N+1)]
knapsack[0][0]=0

for i in range(N):
	for v in range(0,N*V+1):
		if v-items[i][1]>=0:
			knapsack[i+1][v]=min(knapsack[i+1][v],knapsack[i][v],knapsack[i][v-items[i][1]]+items[i][0])
		else:
			knapsack[i+1][v]=min(knapsack[i+1][v],knapsack[i][v])
value=0
for i in range(len(knapsack)):
	for j in range(len(knapsack[0])):
		if knapsack[i][j]<=W:
			value = max(value,j)
print(value)

Measured memory_bytes: 302648
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main() {
#ifdef ISMDEEP_LOCAL
    freopen("../in.txt", "r", stdin);
#endif
    double a, b, c, d, e, f;
    while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
        double x = (c * e - b * f) / (a * e - b * d);
        double y = (a * f - c * d) / (a * e - b * d);
        if (x == 0) x = 0.00;
        if (y == 0) y = 0.00;
        printf("%.3lf %.3lf\n", x, y);
    }
    return 0;
}


Measured memory_bytes: 3164
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N, M;
  cin >> N >> M;
  umll SC;
  vll V(3, -1);
  REP(i, 0, M) {
    ll s, c;
    cin >> s >> c;
    if (SC.find(s) != SC.end() && SC.find(s)->second != c) {
      cout << "-1" << endl;
      return 0;
    }
    SC[s] = c;
    if (N == 1) {
      V[2] = c;
    } else if (N == 2) {
      V[s] = c;
    } else {
      V[s - 1] = c;
    }
  }

  stringstream ss;
  bool begin = false;
  REP(i, 0, N) {
    if (SC.find(i + 1) != SC.end()) {
      ll a = SC.find(i + 1)->second;
      if ((!begin && a != 0) || begin) {
        ss << a;
        begin = true;
      }
    } else {
      if (begin) {
        ss << "0";
      }
    }
  }

  if (!begin) {
    if (N == 1) {
      cout << "0" << endl;
      return 0;
    } else if (N == 2) {
      if (V[1] != 0) {
        cout << "10" << endl;
        return 0;
      }
    } else {
      if (V[0] != 0) {
        cout << "100" << endl;
        return 0;
      }
    }
  }

  string result = ss.str();
  if (N != result.size()) {
    if (N == 3) {
      if (result.size() == 1) {
        if (V[0] == 0) {
          cout << "-1" << endl;
          return 0;
        }
        cout << "10" << result << endl;
        return 0;
      } else {
        if (V[0] == 0) {
          cout << "-1" << endl;
          return 0;
        }
        cout << "1" << result << endl;
        return 0;
      }
    } else if (N == 2) {
      if (V[1] == 0) {
        cout << "-1" << endl;
        return 0;
      }
      cout << "1" << result << endl;
      return 0;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)

n=int(input())

g =[[] for _ in range(n)]
ans=[0] * (n-1)

def dfs(v,c=-1,p=-1):
    k=1

    for u,ei in g[v]:
        if u == p: continue
        if k == c: k+=1

        ans[ei] = k
        k+=1
        dfs(u,ans[ei],v)

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

dfs(0)
mx=0

for i in range(n):
    mx = max(mx,int(len(g[i])))

print(mx)
for i in ans:print(i)

Measured memory_bytes: 85672
#include <iostream>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    
    long long  N;
    int ans = INT_MAX;
    cin >> N;
    
    for(int i = 1; i <= sqrt(N) ; i++){
        
        string A = to_string(i);
        string B = to_string(N / i);
        int keta_A = A.size();
        int keta_B = B.size();
        
        if(N%i == 0){
            ans = min(ans, max(keta_A, keta_B));
        }
        else continue;
    }
    
    cout << ans << endl;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 3e3 + 5;

int dp[2][MAXN][2];

inline void add(int &val, int add) {
	val += add;
	if (val >= MOD) {
		val -= MOD;
	}
}

void solve(){
	int n, m;
	scanf("%d%d", &n, &m);
	REPN(i, 1, n) {
		dp[0][i][0] = 1;
	}
	dp[0][0][1] = 1;
	REP(i, 0, m) {
		int ind = i & 1;
		REPN(j, 0, n) {
			dp[ind ^ 1][j][0] = dp[ind ^ 1][j][1] = 0;
		}
		REPN(j, 0, n) {
			REP(k, 0, 2) {
				REP(l, 0, 2) {
					if (j > 0) {
						if (j == 1 && k == 0) {
							add(dp[ind ^ 1][j - l][1], dp[ind][j][0]);
							//dp[ind ^ 1][j - l][1] = (dp[ind ^ 1][j - l][1] + dp[ind][j][0]) % MOD;
						} else {
							add(dp[ind ^ 1][j - l][k], dp[ind][j][k]);
							//dp[ind ^ 1][j - l][k] = (dp[ind ^ 1][j - l][k] + dp[ind][j][k]) % MOD;
						}
					}
					if (j < n) {
						add(dp[ind ^ 1][j + l][k], dp[ind][j][k]);
						//dp[ind ^ 1][j + l][k] = (dp[ind ^ 1][j + l][k] + dp[ind][j][k]) % MOD;
					}
				}
			}
		}
	}
	ll ans = 0ll;
	REPN(i, 0, n) {
		ans = (ans + dp[m & 1][i][1]) % MOD;
	}
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
import sys
s = input()

n = len(s)
m = int((n-1)/2)
b = s[:m]

for i in range(int(m/2)):
    if b[i:(i+1)] != b[(m-i-1):m-i]:
        print('No')
        sys.exit()
m = int((n+3)/2)
b = s[m-1:]
m= len(b)
for i in range(int(m/2)):
    if b[i:(i+1)] != b[(m-i-1):m-i]:
        print('No')
        sys.exit()
for i in range(int(n/2)):
    if s[i:(i+1)] != s[(n-i-1):n-i]:
        print('No')
        sys.exit()  
print('Yes')

Measured memory_bytes: 3188
#include<iostream>
#define int long long
using namespace std;
const int N=3005;
int f[N][N],ar[N];
signed main(){
	int n,i,j;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>ar[i];
		if(n%2==1){
			f[i][i]=ar[i];
		}
		else{
			f[i][i]=-ar[i];
		}
	}
	for(i=1;i<n;i++){
		for(j=1;j<=n-i;j++){
			if((n-i)%2==1){
				f[j][i+j]=max(f[j+1][i+j]+ar[j],f[j][i+j-1]+ar[i+j]);
			}
			else{
				f[j][i+j]=min(f[j+1][i+j]-ar[j],f[j][i+j-1]-ar[i+j]);
			}
		}
	}
	cout<<f[1][n];
}

Measured memory_bytes: 70016
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
 
using namespace std;
int main(){
    int n,m,c;
    std::cin >> n>>m>>c;
    int b[m];
    rep(i,m)std::cin >> b[i];
    std::vector<vector<int>> a(n,std::vector<int>(m));
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)std::cin >> a[i][j];
    }int ans=0;
    for(int i=0;i<n;i++){
        int k=0;
        for(int j=0;j<m;j++)k+=a[i][j]*b[j];
        if(k+c>0)ans++;
    }
    
    std::cout << ans << std::endl;
}




Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=2010,MOD=998244353;
int C[N*2][N*2],pw[N*2];
int n,K,ans;
int plu(int x,int y){return (1LL*x+y)%MOD;}
int mul(int x,int y){return 1LL*x*y%MOD;}
void prework(int n){
	C[0][0]=1;
	for (int i=1;i<=n;++i){
		C[i][0]=1; C[i][i]=1;
		for (int j=1;j<i;++j)
			C[i][j]=plu(C[i-1][j-1],C[i-1][j]);
	}
	pw[0]=1;
	for (int i=1;i<=n;++i) pw[i]=mul(pw[i-1],2);
}
int f(int x,int y,int z){
	if (y<0) return 0;
	int ret=0;
	for(int q=0;q<=z&&q<=x;++q)
		if (q+y-1<=z+y-1&&q+y-1>=0) 
			ret=plu(ret,mul(C[x][q],mul(pw[q],C[z+y-1][q+y-1])));
	return ret;
}

int main(){
#ifndef ONLINE_JUDGE
	//freopen("a.in","r",stdin);
#endif
	int cnt;
	scanf("%d%d",&K,&n);
	prework(n+K);
	for (int i=2;i<=2*K;++i){
		cnt=0;
		for (int j=1;j<=K;++j)
			if (1<=i-j&&i-j<=K) ++cnt;
		if (i&1)
			ans=f(cnt/2,K-cnt,n);
		else{
			ans=f((cnt-1)/2,K-cnt,n);
			ans=plu(ans,f((cnt-1)/2,K-cnt,n-1));
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 61696
// clang-format off
	#include <bits/stdc++.h>
	using namespace std; using ll = long long; using uint = unsigned int; using ull = unsigned long long;
	#define SFINAE(x, ...)	template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {};
	SFINAE(DefaultIO, decltype(cout << declval<T &>()))
	SFINAE(IsTuple, typename tuple_size<T>::type)
	SFINAE(Iterable, decltype(begin(declval<T>())))
	template <class T> constexpr char Space(const T &) { return (Iterable<T>::value or IsTuple<T>::value) ? '\n' : ' '; }
	template <auto &os> struct Writer {
		template <class T> void Impl(T const &t) const {
			if constexpr (DefaultIO<T>::value) os << t;
			else if constexpr (Iterable<T>::value) { int i = 0; for (auto &&x : t) ((i++) ? (os << Space(x), Impl(x)) : Impl(x)); }
			else if constexpr (IsTuple<T>::value) apply([this](auto const &... args) { int i = 0; (((i++) ? (os << ' ', Impl(args)) : Impl(args)), ...);}, t);
			else static_assert(IsTuple<T>::value, "No matching type for print");
		}
		template <class F, class... Ts> auto &operator()(F const &f, Ts const &... ts) const { return Impl(f), ((os << ' ', Impl(ts)), ...), os << '\n', *this; }
	};
	template <auto &is> struct Reader {
		template <class T> auto& Rd(T &t) const {
			if constexpr (DefaultIO<T>::value) is >> t;
			else if constexpr (Iterable<T>::value) for (auto &x : t) Rd(x);
			else if constexpr (IsTuple<T>::value) apply([this](auto &... args) { (Rd(args), ...); }, t);
			else static_assert(IsTuple<T>::value, "No matching type for read");
			return *this;
		}
		template <class T> auto operator[](T t) const { Rd(t); return t; }
		template <class... Ts> auto operator()(Ts... ts) const { (Rd(ts), ...); return tuple{move(ts)...}; }
	};
	#ifdef NARUT_LOCAL
	#define Debug(...) cerr << "\033[0;31m", Writer<cerr>{}(__VA_ARGS__), cerr << "\033[0m\n"
	#define ASSERT(...) if(not(__VA_ARGS__)) throw runtime_error("local assertion failed")
	#else
	#define Debug(...) 0
	#define ASSERT(...) 0
	#endif
	[[maybe_unused]] constexpr Reader<cin> Cin; [[maybe_unused]] constexpr Writer<cout> Cout;
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)
	#define let auto const

// clang-format on

auto Main() {
	auto s = Cin[""s];
	if (s == "RRR") {
		cout << 3;
	} else if (s.find("RR") != s.npos) {
		cout << 2;
	} else if (s.find("R") != s.npos) {
		cout << 1;
	} else {
		cout << 0;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	Main();
}


Measured memory_bytes: 3640
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

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

	vector<int> d(N);
	rep(i, N) {
		cin >> d.at(i);	
	}

	bitset<101> b;

	int j = 0;
	rep(i, N) {
		j = d.at(i);
		b.set(j, 1);
	}

	int ans = 0;
	rep(i, 101) {
		if (b.test(i)) ans++;
	}

	cout << ans << endl;
}

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

int main() 
{
    //dp
    ll d, g;
    cin >> d >> g;
    vector<ll> nb_problems(d);
    vector<ll> bonus_score(d);
    for (ll i=0; i<d; i++)
    {
        ll p, c;
        cin >> p >> c;
        nb_problems[i] = p;
        bonus_score[i] = c;
    }
    ll ans = INT_MAX;
    for(ll mask = 0; mask < (1<<d); mask++)
    {
        ll score = 0;
        ll probs = 0;
        vector<bool> active(d,false);
        for(ll i=0; i<d; i++) 
            if(mask & (1<<i))
            {
                active[i] = true;
                probs += nb_problems[i];
                score += nb_problems[i] * (i+1) * 100 + bonus_score[i];
            }
        ll i = d - 1;
        while (score < g && i >= 0)
        {
            if (active[i])
                i--;
            else 
            {
                ll rem = g - score;
                if (rem <= (nb_problems[i]-1)*(i+1)*100)
                {
                    score = g + 1;
                    probs += rem / ((i + 1) * 100) + ((rem % ((i + 1) * 100)) == 0 ? 0 : 1);
                    break;
                }
                else 
                {
                    score += (nb_problems[i]-1)*(i+1)*100;
                    probs += nb_problems[i] - 1;
                    i--;
                }
            }
        }
        if (score >= g)
            ans = min(ans, probs);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,in[6];
	int x[6]={1,5,10,50,100,500};
	while(cin>>n>>in[0]>>in[1]>>in[2]>>in[3]>>in[4]>>in[5],n){
		int ma=0;
		rep(i,6)ma+=x[i]*in[i];
		int out=inf;
		loop(i,n,ma+1){
			int co=0;
			int t=i;
			for(int j=5;j>=0;j--){
				int q=min(in[j],t/x[j]);
				co+=q;
				t-=q*x[j];
			}
			if(!t){
				t=i-n;
				for(int j=5;j>=0;j--){
					int q=t/x[j];
					co+=q;
					t-=q*x[j];
				}
				out=min(out,co);
			}
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 3020
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <array>
#include <algorithm>
#include <set>
#include <iomanip>
#include <cstdio>

using namespace std;

#define int long long

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

    int a, s;

    cin >> a >> s;

    int diff = s - a;

    int l = 0;
    for (int i = 1; i < diff; ++i)
    {
        l += i;
    }

    //cout << l << endl;
    cout << l - a << endl;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100100;
int A[MAX];
vector<int> g[MAX];

int get(int x)
{
	if (SZ(g[x]) == 0) return 0;
	vector<int> a;
	FOR (i, 0, SZ(g[x]))
	{
		int to = g[x][i];
		a.PB(get(to));
	}

	sort(ALL(a));
	reverse(ALL(a));

	int res = -INF;
	int d = 1;
	FOR (i, 0, SZ(a))
	{
		res = max(res, a[i] + d);
		d++;
	}

	return res;
}

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

	int n;
	scanf("%d", &n);
	FOR (i, 1, n)
	{
		scanf("%d", &A[i]);
		A[i]--;
		g[A[i]].PB(i);
	}

	cout<<get(0)<<endl;

}


Measured memory_bytes: 15488
#include<bits/stdc++.h>
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
const ll mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    double a[n];
    fr(i,0,n){
        cin>>a[i];
        a[i]=(a[i]+1)/2;
    }
    double sum=0,mx=0;
    fr(i,0,k)
    sum+=a[i];
    mx=sum;
    fr(i,k,n){
        sum+=a[i];
        sum-=a[i-k];
        mx=max(mx,sum);
    }
    cout<<fixed<<setprecision(15);
    cout<<mx;
}


Measured memory_bytes: 1792
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String line = reader.readLine();
			String[] sarray = line.split(" ", -1);
			int H = Integer.parseInt(sarray[0]);
			int W = Integer.parseInt(sarray[1]);
			int n = 0;
			if(H == 0 && W == 0){
				break;
			} else {
				for(int i = 0; i < H; i++){
					if(i % 2 == 0){
						for(int j = 0; j < W; j++){
							if(j % 2 == 0){
								System.out.print("#");
							} else {
								System.out.print(".");
							}
						}
					} else {
						for(int j = 0; j < W; j++){
							if(j % 2 == 1){
								System.out.print("#");
							} else {
								System.out.print(".");
							}
						}
					}
					System.out.println();
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 30744
from bisect import bisect_left, bisect_right

n = int(input())
stick = list(map(int, input().split()))
stick.sort()

count = 0
for i in range(n):
    for j in range(i + 1, n):
        l = bisect_right(stick, stick[j] - stick[i])
        r = bisect_left(stick, stick[i] + stick[j]) # [l, r) が範囲
        if j + 1 >= r:
            continue
        count += r - max(l, j + 1)
print(count)

Measured memory_bytes: 74768
#include<iostream>
#include<complex>
using namespace std;
typedef complex<double> xy_t;

double cross(xy_t a,xy_t b){
    return (conj(a)*b).imag();
}

int main(){
    double x[4],y[4];

    while(true){
        for(int i=0;i<4;++i){
            cin>>x[i]>>y[i];
        }
        if(!cin) break;

        xy_t a(x[0],y[0]), b(x[1],y[1]), c(x[2],y[2]), p(x[3],y[3]);
        double pab=cross(a-p,b-p),pbc=cross(b-p,c-p),pca=cross(c-p,a-p);
        bool ok=(pab*pbc>0 && pbc*pca>0);
        cout<<(ok?"YES":"NO")<<"\n";
    }
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long int lld;
const lld MAX=51;
const lld INF=99;
lld dp[MAX][MAX],work[MAX],a[MAX],b[MAX],n,cost;
lld clear_dp(){
    for(lld i=0;i<=50;i++) for(lld j=0;j<=50;j++) dp[i][j]=-1;
}
lld make_dp(lld x,lld y){
    if(x<y) return dp[x][y]=-1;
    if(x==y) return dp[x][y]=0;
    if(dp[x][y]==-1){
        dp[x][y]=INF;
        for(lld i=y+1;i<=x;i++){
            lld t=make_dp(x%i,y);
            if(t!=-1){
                if(work[i]==0) t=max(i,t);
                dp[x][y]=min(dp[x][y],t);
            }
        }
        if(dp[x][y]==INF) dp[x][y]=-1;
    }
    return dp[x][y];
}
int main(){
    scanf("%lld",&n);
    for(lld i=0;i<n;i++) scanf("%lld",&a[i]);
    for(lld i=0;i<n;i++) scanf("%lld",&b[i]);
    lld u=0;
    do{
        lld t;
        u=0;
        clear_dp();
        for(lld i=0;i<n;i++) {
            t=make_dp(a[i],b[i]);
            if(t==-1){
                printf("-1\n");
                return 0;
            }
            u=max(u,t);
        }
        if(u>0) cost+=(1ll<<u),work[u]=1;
    }while(u>0);
    printf("%lld\n",cost);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
int main(void){
  ll n;
  cin>>n;
  vl a(n);

  ll sum=0;
  rep(i,n){
    cin>>a[i];
    sum+=a[i];
  }
  ll suml=0;
  ll ans=llMAX;
  rep(i,n){
    suml+=a[i];
    ans=min(ans,abs((sum-suml)-suml));
  }
  cout<<ans;

  return 0;
}

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

int main() {
  int N,A,X=1,Ans=0;
  cin>>N;
  rep(i,N){cin>>A;
          if(A==X){X++;}else{Ans++;}
          }
  if(Ans==N){cout<<-1<<endl;}else{cout<<Ans<<endl;}
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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(){
    ll h,w,n;cin >> h >> w>>n;
    ll sr,sc;cin >> sr >>sc;
    string s,t;cin >> s >>t;
    bool ok=true;
    ll y=sr,x=sc;
    rep(i,n){
        if(s[i]=='U')y--;
        if(y<1)ok=false;
        if(t[i]=='D'){
            if(y!=h)y++;
        }
    }
    y=sr,x=sc;
    rep(i,n){
        if(s[i]=='D')y++;
        if(y>h)ok=false;
        if(t[i]=='U'){
            if(y!=1)y--;
        }
    }
    y=sr,x=sc;
    rep(i,n){
        if(s[i]=='R')x++;
        if(x>w)ok=false;
        if(t[i]=='L'){
            if(x!=1)x--;
        }
    }
    y=sr,x=sc;
    rep(i,n){
        if(s[i]=='L')x--;
        if(x<1)ok=false;
        if(t[i]=='R'){
            if(x!=w)x++;
        }
    }
    if(ok)cout <<"YES" <<endl;
    else cout <<"NO" <<endl;
}

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

using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;

int main() {
  int N;
  cin >> N;
  vector<LL> A(N,(LL)0), B(N,(LL)0);
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) cin >> B[i];
  LL sum = 0;
  LL base = 0;
  stack<LL> data;
  for(int i=0; i<N; i++) {
    sum += A[i] - B[i];
    data.push(sum);
    base += abs(sum);
  }
  data.pop();
  base -= sum;

  priority_queue<LL> pq;
  for(int i=0; i<N; i++)
    pq.push(-sum);
  while(!data.empty()) {
    LL cur = data.top();
    data.pop();
    if(cur<=0) {
      pq.push(0);
    }
    if(cur>0) {
      pq.push(-cur);
      pq.push(-cur);
   
      LL best = pq.top();
      pq.pop();
      base += best;
    }
  }
  
  
  cout << base << endl;
  
  return 0;
}



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

int as[100005];

int dp[100005][2];

int main(){
  int N;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&as[i]);
  }
  dp[0][0]=1;
  dp[0][1]=1;

  for(int i=0;i<N-1;i++){
    dp[i+1][0]=dp[i+1][1]=std::min(dp[i][0],dp[i][1])+1;
    if(as[i]<=as[i+1]){
      dp[i+1][0]=std::min(dp[i+1][0],dp[i][0]);
    }
    if(as[i]>=as[i+1]){
      dp[i+1][1]=std::min(dp[i+1][1],dp[i][1]);
    }
    //printf("dp[%d][0]=%d\n",i,dp[i][0]);
    //printf("dp[%d][1]=%d\n",i,dp[i][1]);
  }
  printf("%d\n",std::min(dp[N-1][0],dp[N-1][1]));
  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>

int main()
{
    int n,a[2][100];
    int i,j,k;
    int candy=0;
    scanf("%d", &n);

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

for (i = 0; i <n; i++){
int temp=0;
    for (j = 0; j <=i; j++){
    temp+=a[0][j];
    }  
for (k = i; k <n; k++){  
temp+=a[1][k];
}
if(temp>candy)candy=temp;
}
    printf("%d",candy);

    return 0;
}

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

int main(){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;

    if(a>=k){
        cout<<k<<endl;
    }else{
        int ans=0;
        int zan = k-a;
        ans+=a;
        if(b>=zan){
            cout<<ans<<endl;
        }else{
            cout<<ans-(zan-b)<<endl;
        }
    }


}


Measured memory_bytes: 3672
x = gets.chomp.split.map(&:to_i)
if ([1, 3, 5, 7, 8, 10, 12] & x).size == 2
  puts 'Yes'
elsif ([4, 6, 9, 11] & x).size == 2
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 3836
#include<iostream>
#include<string>
#include<vector>
#include <bits/stdc++.h>

using namespace std;

int N, M;
int ans=0;
int main(){
    N = 0;
    M = 0;
    
    cin>>N>>M;
  vector<int> X(M);
    if(N >= M){
        cout<<"0"<<endl;
    }
    else{
        for(int i=0; i<M; i ++){
            cin>>X[i];
        }

        sort(X.begin(), X.end());
        vector<int> Intervals(M-1);

        for(int i=0;i<M-1;i ++){
            Intervals[i] = abs(X[i+1]-X[i]);
        }
        sort(Intervals.begin(), Intervals.end());

        for(int i=0;i<M-N;i++){
            ans = ans + Intervals[i];

        }
        cout<<ans<<endl;

    }
    
    return 0;

}



Measured memory_bytes: 1024
f;main(n,i,r,x){
	for(;scanf("%d",&n),n;){
		for(f=r=i=0;i<n;i++)if(scanf("%d",&x),x)if(r++,x>1)f=1;
		printf(f?"%d\n":"NA\n",r+1);
	}
	exit(0);
}

Measured memory_bytes: 600
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	double w;

	while(scanf("%lf", &w) != EOF){

		if(w<=48)
			printf("light fly\n");
		else if(w>48 && w<=51)
			printf("fly\n");
		else if(w>51 && w<=54)
			printf("bantam\n");
		else if(w>54 && w<=57)
			printf("feather\n");
		else if(w>57 && w<=60)
			printf("light\n");
		else if(w>60 && w<=64)
			printf("light welter\n");
		else if(w>64 && w<=69)
			printf("welter\n");
		else if(w>69 && w<=75)
			printf("light middle\n");
		else if(w>75 && w<=81)
			printf("middle\n");
		else if(w>81 && w<=91)
			printf("light heavy\n");
		else
			printf("heavy\n");

	}
	return 0;
}

Measured memory_bytes: 608
//Programa en C++14 (compatible en c++11) para calcular el valor
//del 10Dq y B de un complejo d^6 octaedrico de campo alto segun 
//Tanabe-Sugano.
//El programa solo calcula el valor de 10Dq y B para 2 transiciones 
//observadas (caso observado en la sesion).
//Facultad de Ciencias e Ingenieria, Seccion Quimica PUCP, Junio 
//de 2018
//Autores del programa : Guillermo Guerrero y Alberto Flores
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC target("tune=native")
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define REP(i,x,y) for(ll (i)=(x);(i)<(y);(i)++)
#define RREP(i,x,y) for(ll (i)=(x);(i)>=(y);(i)--)
#define sqr(x) ((x)*(x))
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define fst first
#define snd second
#define itm1 fst
#define itm2 snd.fst
#define itm3 snd.snd
#define oo 200000000000
//#define EPS 1e-9
#define MOD 1000000007
#define MAXN 99
#define cot 20
//#define N 300005
//#define min -9042414321442
#define INF 1065435634
#define N1 90
typedef long double ld;
typedef  long long ll;
//typedef short int ll;
//typedef ll ll;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef pair<ll,ii> tri;
typedef vector<ll> vi;
typedef vector<vi> vv;
#define N 100055   
#define M 31
//#define cap 1000000000
#define bas 10

inline ll ma(ll a, ll b){ return ((a-b>0)? a:b);}
inline ll mi(ll a, ll b){return ((a-b>0)? b:a);}
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

int main(){
  fastio;
  ll n; cin>>n;
  n>999? cout<<"ABD"<<"\n": cout<<"ABC"<<"\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



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

	ll x;
	cin >> x;

	if (x >= 30)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3632
N, K = map(int, input().split())
p = list(map(int, input().split()))

# サイコロ（1...p）の期待値は(1+p)/2
cum_sum = [0]
for i in range(0, N):
    cum_sum.append(cum_sum[i] + (1 + p[i]) / 2)
# print(cum_sum)
# 調べる区間は[1,...,K],...,[N-K+1,...N]
ans = 0
for i in range(1, N - K + 2):
    temp = cum_sum[i + K - 1] - cum_sum[i - 1]
    # print(temp)
    ans = max(ans, temp)
print(ans)


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

int main()
{
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1 + a2 + a3 > 21)
        cout << "bust" << endl;
    else
        cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main() {
	int n;
	bool ret = false;
	cin >> n;
	while (1) {
		if (n % 10 == 7) {
			ret = true;
			break;
		}
		if (n / 10 > 0) n /= 10;
		else {
			ret = false;
			break;
		}
	}
	if (ret) printf("Yes\n");
	else printf("No");
	return 0;
}

Measured memory_bytes: 3224
//37
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int n,q;
int p[100001];
bool m[100001];
vector<int> t[100001];

void dfs(int v,int pn){
  if(!m[v]){
    p[v]=pn;
    for(int i=0;i<t[v].size();i++){
      dfs(t[v][i],pn);
    }
  }
}

int main(){
  while(cin>>n>>q,n|q){
    fill(p,p+n+1,1);
    fill(m,m+n+1,false);
    m[1]=true;
    for(int i=1;i<=n;i++){
      t[i].clear();
    }
    for(int i=2;i<=n;i++){
      int pn;
      cin>>pn;
      t[pn].push_back(i);
    }
    long long s=0;
    while(q--){
      char e;
      int v;
      cin>>e>>v;
      if(e=='Q'){
	s+=p[v];
      }else{
	dfs(v,v);
	m[v]=true;
      }
    }
    cout<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 10164
s =int(input())

li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(li[s-1])

Measured memory_bytes: 3060
import copy
n = int(input())
ans = [1,2,3,4,5,6,7,8,9]
stock = ["1","2","3","4","5","6","7","8","9"]
stock2 = []
a = 2
def d(x):
    if x == 0:
        return(["0","1"])
    elif x == 9:
        return(["8","9"])
    else:
        return([str(x-1),str(x),str(x+1)])
if n > 9:
    while True:
        if len(ans) > n-1:
            print(ans[n-1])
            break
        for i in stock:
            s = ""
            x = d(int(i[-1]))
            #print(x,i)
            for j in x:
                s = i+j
                ans.append(int(float(s)))
                stock2.append(s)
        stock = copy.deepcopy(stock2)
        stock2 = []
else:
    print(ans[n-1])


Measured memory_bytes: 25292
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, m, a, sum = 0;

int main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> a;
		sum += a;
	}
	cout << max(n - sum, (ll)-1) << endl;
	return 0;
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	int N; 
	cin >> N;
	pi a;
	REP(i, 0, N){
		int b;
		cin >> b;
		a.PB(b);
	}
	sort(a.begin(), a.end());
	double result = a[0];
	REP(i, 1, N) result = (result + a[i])/2;
	cout << result;
	

}


Measured memory_bytes: 256
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=2019;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    vec r(2020, 0);
    string S; cin>>S;
    int N = SZ(S), res = 0, hoge = 1;
    r[0]++;
    rep(i, N){
        res = (res + hoge * (S[N-i-1] - '0')) % mod;
        r[res]++;
        hoge = (hoge * 10) % mod;
    }
    ll ans = 0;
    rep(i, 2019){
        ans += r[i] * (r[i] - 1) / 2;
    };
    printf("%lld\n", ans);
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
int main(){
	ll n;
	cin>>n;
	vector<ll> a,b;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		a.pb(x);
	}
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		b.pb(x);
	}
	ll ans = 0;
	for(int i=1;i<=29;i++){
		ll md = (1<<i);
		vector<ll> bm;
		for(int j=0;j<n;j++){
			bm.pb(b[j]%md);
		}
		sort(bm.begin(),bm.end());
		//for(int j=0;j<bm.size();j++){cout<<bm[j];}cout<<endl;
		ll cnt = 0;
		for(int j=0;j<n;j++){
			ll ca = a[j]%md;
			ll lef1 = max(md/2 - ca, (ll)0);
			ll rig1 = md/2 * 2 - ca;
			ll lef2 = md/2 * 3 - ca;
			ll rig2 = md/2 * 4 - ca ;
			//cout<<i<<j<<" "<<lef1<<rig1<<" "<<lef2<<rig2<<endl;
			ll c1 = lower_bound(bm.begin(),bm.end(),rig1) - lower_bound(bm.begin(),bm.end(),lef1);
			ll c2 = lower_bound(bm.begin(),bm.end(),rig2) - lower_bound(bm.begin(),bm.end(),lef2);
			cnt += (c1+c2);
		}
		if(cnt%2==1)ans+=(1<<(i-1));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7920
#include<iostream>
using namespace std;
int main(void){

int a,b;
cin>>a>>b;
if(a<b){
    cout<<"a < b" <<endl;
}

else if (a>b)
{
    /* code */
    cout<<"a > b"<<endl;
}else{
    cout << "a == b" <<endl;
}



}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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; }

using namespace std;
typedef pair<ll, ll> pint;

const int MOD = 1000000007;
void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }
}

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    if (B - 1 <= N) {
        cout << (A * (B-1))/ B << endl;
    } else {
        cout << (A * (N)) / B << endl;
    }

}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	for(char c='a';c<='z';c++){
		if(s.find(c)==-1){
			cout<<c<<endl;
			return 0;
		}
	}
	cout<<"None"<<endl;
	return 0;
}

Measured memory_bytes: 512
let [| l; m; |] = stdin.ReadLine().Split() |> Array.map int

match seq{l..m} |> Seq.exists (fun x -> x % 2019 = 0 ) with 
|true -> 0
|false -> 
    seq{for i in l..m do for j in i+1..m -> i,j} |> Seq.map (fun (x1, x2) -> (x1 % 2019, x2 % 2019))
    |> Seq.map (fun (x1,x2) -> x1 * x2 % 2019)
    |> Seq.min
|> stdout.WriteLine


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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    if(a.at(a.size()-1) == b.at(0) && b.at(b.size()-1) == c.at(0)) puts("YES");
    else puts("NO"); 
}

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

using namespace std;

long long A[101010],S[101010];
long long n,i,ans;

int main()
{
	scanf("%lld",&n);

	for(i=0;i<n;i++){
		scanf("%lld",A+i);
	}

	sort(A,A+n);

	for(S[0]=A[0],i=1;i<n;i++) S[i] = S[i-1]+A[i];

	for(i=n-1,ans=1;i>0;i--,ans++) if(S[i-1]*2<A[i]) break;

	printf("%lld\n",ans);
	
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<stdio.h>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109311;
const long double pi = 3.1415926535897932384626433;
typedef pair<int, int> P;
struct edge { int to, cost; };
int a[114514], b[114514];
int imos[300000];
vector<P>V;
map<int, int>M,M1;
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> a[i] >> b[i];
	rep(i, n) {
		M[a[i]]++;
		M[b[i]]++;
	}
	int cnt = 0;
	for (auto itr = M.begin(); itr != M.end(); itr++) {
		M1[itr->first] = cnt;
		cnt++;
	}
	rep(i, n) {
		a[i] = M1[a[i]];
		b[i] = M1[b[i]];
	}

	rep(i, n) {
		imos[a[i]]++;
		imos[b[i] + 1]--;
	}
	rep(i, 200005)imos[i + 1] += imos[i];
	int ans = 0;
	rep(i, 200005) {
		ans = max(ans, imos[i]);
	}
	//rep(i, 10)cout << imos[i] << endl;
	cout << ans << endl;

}


Measured memory_bytes: 31244
n, a, b = map(int, input().split())
if (a - 1) >= (n - b):
    count = (n-b)
    a = a + (n - b)
    b = n
else:
    count = (a - 1)
    b = b - (a - 1)
    a = 1

if ((b - a) % 2 == 0):
    print(min(min(b-1,n-a),(b-a)//2))
elif a == 1 and (b - a) % 2 != 0:
    print(min(min(b - 1, n - a), (b - 1 - a) // 2 + 1) + count)
elif b == n and (b - a) % 2 != 0:
    print(min(min(b - 1, n - a), (b - 1 - a) // 2 + 1)+count)
else:
    print(min(b-1,n-a)+count)

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

signed main(){
	int k;
	cin>>k;
	for(int i=0;i<k;i++) cout<<"ACL"; 
	return 0;
}


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

int main(){
  int N,X;
  cin >> N >> X;
  vector<int> m(N);
  for(int i=0;i<N;i=i+1)cin >> m.at(i);
  int sum=0;
  for(int x:m)sum = sum + x;
  X = X - sum;
  int min_m = 1001;
  for(int x:m){
    if(min_m > x)min_m = x;
  }
  int k = X/min_m;
  cout << N + k << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

#define INITIALIZE_INT 0//整数型の初期値
#define INPUT_END 0//入力の終了値
#define START_NUMBER 1//魔方陣に入る最初の数値
#define CALCULATION_HALF 2 //魔方陣のマスのセンター座標を求めるときに使う値
#define NO_CONTENTS 0//空のマスの値

enum
{
	OFF, //すべてのパネルが埋まっていない状態
	ON   //すべてのパネルが埋まっていない状態
};

void out_magic_square(short *x, short *y, unsigned short input_n);/*現在の座標が魔方陣の外に出た時、座標の修正を行う関数*/

int main(void)
{
	while(1)
	{
		short x = INITIALIZE_INT;//魔方陣のx座標
		short y = INITIALIZE_INT;//魔方陣のy座標
		
		unsigned short input_n = INITIALIZE_INT;//入力値n
		scanf("%hd", &input_n);
		
		/*入力の終了*/
		if(INPUT_END == input_n)
		{
			break;
		}
		
		unsigned short ix = INITIALIZE_INT;
		unsigned short iy = INITIALIZE_INT;
		
		unsigned short loop_flag = OFF;//すべてのマスが埋まっているかどうかのフラグ
		unsigned short center = INITIALIZE_INT;//センター座標を格納
		unsigned short number = START_NUMBER;//格納していく数字
		
		short magic_square[input_n][input_n];//魔方陣のマス
		
		/*魔方陣のマスの初期化*/
		for(iy = 0; iy < input_n; iy++)
		{
			for(ix = 0; ix < input_n; ix++)
			{
				magic_square[iy][ix] = NO_CONTENTS;
			}
		}
		
		/*最初の数字を入れるマスの座標を求める*/
		center = input_n / CALCULATION_HALF;
		x = center;
		y = center + 1;
		magic_square[y][x] = number;
		number++;
		
		while(1)
		{
			x++;
			y++;
			out_magic_square(&x, &y, input_n);
			
			/*中身のないマスに数字を入れる*/
			if(NO_CONTENTS == magic_square[y][x])
			{
				magic_square[y][x] = number;
				number++;
			}
			
			/*中身がある場合に行う*/
			else if(NO_CONTENTS != magic_square[y][x])
			{
				
				/*マスに数字が入るまで繰り返す*/
				while(1)
				{
					y++;
					x--;
					out_magic_square(&x, &y, input_n);
					if(NO_CONTENTS == magic_square[y][x])
					{
						magic_square[y][x] = number;
						number++;
						break;
					}
				}
			}
			
			/*魔方陣がすべての埋まっているか埋まっていないかの判定*/
			loop_flag = OFF;
			for(iy = 0; iy < input_n; iy++)
			{
				for(ix = 0; ix < input_n; ix++)
				{
					if(NO_CONTENTS == magic_square[iy][ix])
					{
						loop_flag = ON;
					}
				}
			}
			if(OFF == loop_flag )
			{
				break;
			}
		}
		
		/*結果の出力*/
		for(iy = 0; iy < input_n; iy++)
		{
			for(ix = 0; ix < input_n; ix++)
			{
				printf("%4d", magic_square[iy][ix]);
			}
			printf("\n");
		}
	}
	return 0;
}

/*自分がいる座標が魔方陣の外に出た時、座標の修正を行う関数*/
void out_magic_square(short *x, short *y, unsigned short input_n)
{
	if(*x >= input_n )
	{
		*x = 0;
	}
	if(*y >= input_n)
	{
		*y = 0;
	}
	if(*x < 0)
	{
		*x = input_n - 1;
	}
}

Measured memory_bytes: 616
k, n = input().split()
a = input().split()

max_interval = 0
for i in range( int( n ) - 1 ):
    interval = int( a[i+1] ) - int( a[i] )
    if max_interval < interval:
        max_interval = interval

interval = int( k ) - int( a[-1] ) + int( a[0] )
if max_interval < interval:
        max_interval = interval

print( int( k ) - max_interval )

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  vector<ll> x(6, 0);
  // 一番遅い箇所の移動時間を考え、他の移動時間を足す
  ll rateDeterminingStepValue = min({a, b, c, d, e});
  ll result = ceil((double) n / rateDeterminingStepValue) + 4;
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<iomanip>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}
int main(){
	int n;
	cin >> n;
	cout << (n+1)/2 << endl;
	
	return 0;
}


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

string FILENAME = "template";
#define io ifstream fin(FILENAME + ".in"); ofstream fout(FILENAME + ".out")
#define fwrite(X) fout << X;
#define fwriteln(X) fout << X << endl;

#define forl(V, N) for(int V = 0; V < N; V++)
#define fore(E, X) for(auto &E:X)
#define print(X) cout << X
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define rem(X) X.top(); X.pop()
#define mid(A, B) ((A+B) / 2)
#define setmin(A, B) A = min(A, B)
#define setmax(A, B) A = max(A, B)
#define graph unordered_map<int, unordered_set<int>>
#define vi vector<int>
#define pb push_back
#define ll long long

int main() {
    int N;
    cin >> N;
    vector<vi> active;
    forl(i, N) {
        int A, B, C;
        cin >> A >> B >> C;
        active.pb({A, B, C});
    }
    vector<vector<ll>> dp;
    forl(i, N) dp.pb({0, 0, 0});
    dp[0][0] = active[0][0];
    dp[0][1] = active[0][1];
    dp[0][2] = active[0][2];
    forl(i, N-1) {
        forl(j, 3){
            forl(k, 3) {
                if(k == j) continue;
                setmax(dp[i+1][k], active[i+1][k] + dp[i][j]);
            }
        }
    }
    println(max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2])));
}

Measured memory_bytes: 12336