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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll nCrmod(ll n,ll r){ll x=1,y=1; rep(i,r){x=x*(n-i)%mod; y=y*(i+1)%mod;} return x*powmod(y,mod-2)%mod;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll l,r,ans=INF;
	cin >> l >> r;
	chmin(r,l+5000);
	for(ll i=l;i<r;i++){
		for(ll j=i+1;j<=r;j++){
			chmin(ans,i*j%2019);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

const int mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0) :x(x%mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
};

int rc(int br, int a, int y) {
	if (br == 0) {
		if (a == 0) {
			if (y == 0)return 0;
			else return 2;
		}
		else return 1;
	}
	else {
		if (a == 0) {
			if (y == 0)return 1;
			else return 0;
		}
		else return 1;
	}
}

int lc(int bl,int b,int x) {
	if (bl == 0) {
		if (b == 0) {
			if (x == 0)return 0;
			else return 1;
		}
		else return 1;
	}
	else {
		if (b == 0) {
			if (x == 1)return 0;
			else return 2;
		}
		else return 1;
	}
}


mint dp[61][3][3][2];

int main() {
	ll l, r;
	cin >> l >> r;
	dp[60][0][0][0] = 1;
	for (int i = 59; i >= 0; i--) {
		for (int a = 0; a < 2; a++)for (int b = 0; b < 2; b++)for (int c = 0; c < 2;c++) {
			mint pre = dp[i+1][a][b][c];
			int br = (r >> i) & 1;
			int bl = (l >> i) & 1;
			dp[i][rc(br,a,0)][lc(bl,b,0)][c] += pre;
			if (c)dp[i][rc(br,a,1)][lc(bl,b,0)][1] += pre;
			dp[i][rc(br,a,1)][lc(bl,b,1)][1] += pre;
		}
	}
	mint ans = 0;
	for (int a = 0; a < 2; a++)for (int b = 0; b < 2; b++)ans += dp[0][a][b][1];
	puts(ans.x);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define erep(i, n) for (int i = 0; i <= (int)(n); i++)

int main() {
    const ll MAX = 1000000000000000000;
    const ll LIMIT = (1LL<<63)-1;
    int n; cin >> n;
    vector<ll> a(n);
    rep (i, n) cin >> a[i];

    ll ans = 1;
    bool flag = true;
    bool zero = false;
    rep (i, n) {
        if (ans >= sqrt(LIMIT) && ans / sqrt(LIMIT) * a[i] >= sqrt(LIMIT)) flag = false;
        if (a[i] >= sqrt(LIMIT) && a[i] / sqrt(LIMIT) * ans >= sqrt(LIMIT)) flag = false;
        if (ans >= sqrt(LIMIT) && a[i] >= sqrt(LIMIT)) flag = false;
        ans *= a[i];
        if (a[i] == 0) zero = true;
        if (ans > MAX) flag = false;
    }
    if (zero) {
        cout << 0 << endl;
        return 0;
    }
    if (flag) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
}


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

int main() {
	int l, r, d;
	cin >> l >> r >> d;
	int cnt = 0;
	for (int i = l; i <= r; i++) {
		if (i % d == 0) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

using namespace std;

int n;
const int N = 110;
int A[N][N];
typedef pair<int, int> P;
vector<P> G[N];

int min_cost = 0;

void prim() {
    priority_queue<P, vector<P>, greater<P> > heap;
    heap.push({0, 1});
    vector<bool> vis(n + 1, false);
    vector<int> dis(n + 1, INT_MAX);

    while (!heap.empty()) {
        int u = heap.top().second, cost = heap.top().first;
        heap.pop();
        if (vis[u]) continue;
        vis[u] = true;
        min_cost += cost;
        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i].second, len = G[u][i].first;
            if (!vis[v] && len < dis[v]) {
                dis[v] = len;
                heap.push({len, v});
            }
        }
    }    
}

void kruskal() {

}

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> A[i][j];
            if (A[i][j] != -1) {
                G[i].push_back({A[i][j], j});
            }
        }
    }
    
    prim();
    cout << min_cost << endl;

    return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m);
  vector<long long int> b(n+2);
  long long int mod = 1000000007;
    
  for(int i=0;i<n+2;i++){
    b.at(i)=0;
  }
  b.at(1)=1;  
  for(int j=0;j<m;j++){
    cin >> a.at(j);
    b.at(a.at(j)+1)=-1;
  }  
  for(int k=1;k<=n;k++){
    if(b.at(k+1)==-1){
      b.at(k+1)=0;
      }else{
        b.at(k+1)+=(b.at(k)+b.at(k-1));
        b.at(k+1)=b.at(k+1)%mod;            
      }
    }  
  cout << b.at(n+1) << endl;
}

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

int main() {
	string S, T, U;
	int A, B;
	cin >> S >> T;
	cin >> A >> B;
	cin >> U;

	if(U == S) {
		cout << A - 1 << " " << B;
	}
	else {
		cout << A << " " << B - 1;
	}

}

Measured memory_bytes: 256
//#pragma comment(linker,"/STACK:16777216") /*16Mb*/
#pragma comment(linker,"/STACK:33554432") /*32Mb*/

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <cmath>
#include <list>
#include <iomanip>
#include <set>
#include <map>
#include <sstream>
#include <fstream>
#include <sstream>
#include <iterator>
#include <math.h>
using namespace std;

typedef  long long LL;
typedef  unsigned long long ULL;
typedef  long double LD;
typedef  pair<int, int> PII;
typedef  pair<long long, long long> PLL;
typedef vector<int> VI;

#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define RFOR(i,a,b) for(int (i)=(a)-1;(i)>=(b);--(i)) 
#define For(i,a,b) for(int (i)=(a);i<(b);++(i))
#define FoR(i,a,b) for(int (i)=(a)-1;(i)>=(b);--(i)) 
#define MP make_pair
#define MOD 1000000007
#define mod 1000000000
#define INF 1000000007
#define PB push_back
#define eps 1e-8
#define X first
#define Y second

LL N;

int main()
{
	cout.setf(ios::fixed, ios::floatfield);
	cout.precision(9);

	cin >> N;
	For(i, 1, 3501)
		For(j, 1, 3501)
	{
			LL dd = N * i * j;
			LL ll = 4LL * i * j - N * i - N * j;
			if (dd <= 0 || ll <= 0) continue;
			if (dd % ll == 0)
			{
				LL h = dd / ll;
				cout << i << " " << j << " " << h << endl;
				return 0;
			}
	}

	return 0;
}

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

int main() {
  int K;
  cin >> K;
  int finish = 0;
  int count = 0;
  int ans = -1;
  int S = 0;
  
  for (int i = 1; i <= K; i++) {
    S = (S * 10 + 7) % K;
    if (S == 0) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 998244353
#define inf 1e18 
 
using namespace std;
 
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int k,i;
    cin>>k;
    string s;
    cin>>s;
    if(s.length()<=k) cout<<s;
    else
    {
        for(i=0;i<k;i++) cout<<s[i];
        cout<<"...";
    }
}

Measured memory_bytes: 3552
N = int(input())
XY = [list(map(int, input().split())) for i in range(N)]
mods = [sum(xy) % 2 for xy in XY]
if not(sum(mods) == 0 or sum(mods) == N):
    print(-1)
    quit()

mod = mods[0] % 2
print(33 - mod)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
    D.append(1)
print(' '.join(map(str, D)))
for (x, y) in XY:
    temp = []
    for d in D:
        if x >= y and x + y >= 0:
            temp.append("R")
            x -= d
        elif x < y and x + y >= 0:
            temp.append("U")
            y -= d
        elif x >= y and x + y < 0:
            temp.append("D")
            y += d
        else:
            temp.append("L")
            x += d
    print(''.join(temp))

Measured memory_bytes: 44012
#include <stdio.h>

int main()
{
    int ans=0,n,x,l[100];
    int d= 0;
    scanf("%d %d",&n,&x);

    int i;

    for(i=0;i<n;i++)
    scanf("%d",&l[i]);

    while(1)
    {
        if(d > x || ans == n+1)
        break;

        d += l[ans];
        ans ++;
    };

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

Measured memory_bytes: 128
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[10^^5*2+2] LR, DU;

void main()
{
    auto hwn = readln.split.to!(int[]);
    auto H = hwn[0];
    auto W = hwn[1];
    auto N = hwn[2];
    auto rc = readln.split.to!(int[]);
    auto SR = rc[0];
    auto SC = rc[1];
    auto S = readln.chomp.to!(char[]);
    auto T = readln.chomp.to!(char[]);

    int a, b, c, d;

    a = 0, b = SC, c = SC, d = W+1;
    foreach (i; 0..N) {
        if (S[i] == 'L') {
            ++a;
        } else if (S[i] == 'R') {
            --d;
        }
        if (a == c || b == d || a+1 == d) {
            writeln("NO");
            return;
        }
        if (T[i] == 'L') {
            if (d <= W) {
                ++d;
            } else if (b > 0) {
                --b;
            }
        } else if (T[i] == 'R') {
            if (a > 0) {
                --a;
            } else if (c <= W) {
                ++c;
            }
        }
    }

    a = 0, b = SR, c = SR, d = H+1;
    foreach (i; 0..N) {
        if (S[i] == 'U') {
            ++a;
        } else if (S[i] == 'D') {
            --d;
        }
        if (a == c || b == d || a+1 == d) {
            writeln("NO");
            return;
        }
        if (T[i] == 'U') {
            if (d <= W) {
                ++d;
            } else if (b > 0) {
                --b;
            }
        } else if (T[i] == 'D') {
            if (a > 0) {
                --a;
            } else if (c <= W) {
                ++c;
            }
        }
    }

    writeln("YES");
}

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

int main() {
  char s[20][20];
  int c[20][20], d[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
  pair<int, int> p;
  queue<pair<int, int>> que;
  int h, w, o = 0;
  cin >> h >> w;
  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++)
      cin >> s[i][j];
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(s[i][j] == '.') {
        memset(c, -1, sizeof(int) * 400);
        c[i][j] = 0;
        que.push({i, j});
        while(que.size()) {
          p = que.front();
          que.pop();
          for(int m = 0; m < 4; m++) {
            int ny = p.first + d[m][0], nx = p.second + d[m][1];
            if(0 <= ny && ny < h && 0 <= nx && nx < w) {
              if(s[ny][nx] == '.' && c[ny][nx] == -1) {
                c[ny][nx] = c[p.first][p.second] + 1;
                que.push({ny, nx});
              }
            }
          }
        }
        for(int k = 0; k < h; k++)
          for(int l = 0; l < w; l++)
            if(s[k][l] == '.')
              o = max(o, c[k][l]);
      }
    }
  }
  cout << o << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int n,a,b;
	cin >> n >> a >>b;
	int mi = n * a;
	mi = min(mi,b);
	cout << mi << endl;
	return 0;

}


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

#define ll long long
#define pb push_back

const int maxn = 1e5 + 20;

vector<int> adj[maxn];

int from[maxn] , to[maxn] , w[maxn] , ind[maxn];

int val[maxn] , par[maxn];
ll sum[maxn];

bool reval[maxn];

vector<pair<int , int> > history;

bool cmp(int a , int b)
{
	return w[a] < w[b];
}

int root(int v)
{
	return par[v] < 0? v : root(par[v]);
}

void merge(int a , int b)
{
	a = root(a) , b = root(b);
	if(a == b)
	{
		history.pb({-1 , -1});
		return;
	}

	if(-par[a] < -par[b])
		swap(a , b);

	history.pb({b , par[b]});
	par[a] += par[b];
	par[b] = a;
	sum[a] += sum[b];
	adj[a].pb(b);
}

void undo()
{
	int v = history.back().first , sz = history.back().second;
	history.pop_back();
	if(v < 0)
		return;

	int u = par[v];

	adj[u].pop_back();
	sum[u] -= sum[v];
	par[v] = sz;
	par[u] -= par[v];
}

void put(int v)
{
	reval[v] = 1;
	for(auto u : adj[v])
		put(u);
}

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

	memset(par , -1 , sizeof par);

	int n , m;
	cin >> n >> m;

	for(int i = 0; i < n; i++)
		cin >> sum[i];

	for(int i = 0; i < m; i++)
	{
		int a , b;
		cin >> a >> b >> w[i];
		a-- , b--;

		from[i] = a , to[i] = b , ind[i] = i;
	}
	
	sort(ind , ind + m , cmp);

	for(int i = 0; i < m; i++)
		merge(from[ind[i]] , to[ind[i]]);

	int res = 0;
	for(int i = m - 1; i >= 0; i--)
	{
		int k = ind[i];
		if(!reval[from[k]])
		{
			int v = root(from[k]);
			if(sum[v] >= w[k])
				put(v);
			else
				res++;
		}

		undo();
	}

	cout << res << endl;
}










Measured memory_bytes: 7540
#include<iostream>
#include<queue>
#include<bitset>
#include<algorithm>
#include<climits>
#include<vector>
#include<deque>
#include<cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> P;
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define dump(a) rep(i,a.size()){ cout<<a[i]<<" "; } cout<<endl;
#define dumparr(a,n) rep(i,n){ cout<<a[i]<<" "; } cout<<endl;
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define INF INT_MAX/3
#define FINF DBL_MAX/3
#define EPS 1e-7
#define OUT1(n1) cout<<n1<<endl
#define OUT2(n1,n2) cout<<n1<<" "<<n2<<endl
#define OUT3(n1,n2,n3) cout<<n1<<" "<<n2<<" "<<n3<<endl
#define OUT4(n1,n2,n3,n4) cout<<n1<<" "<<n2<<" "<<n3<<" "<<n4<<endl
#define OUT5(n1,n2,n3,n4,n5) cout<<n1<<" "<<n2<<" "<<n3<<" "<<n4<<" "<<n5<<endl
#define OUT6(n1,n2,n3,n4,n5,n6) cout<<n1<<" "<<n2<<" "<<n3<<" "<<n4<<" "<<n5<<" "<<n6<<endl
#define OUT(n, ...) OUT##n(__VA_ARGS__)

/* 奇数の個数 a、4の倍数の個数 bを数える
 * a<=bならばOK
 */

int main(){
  ll n;
  ll a[100001];
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  ll x=0, y=0;
  rep(i,n){
    if(a[i]%4==0){
      x++;
    }else if(a[i]%2!=0){
      y++;
    }
  }
  if((x+y==n&&y<=x+1)||(y<=x)) OUT1("Yes");
  else OUT1("No");
  return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0152

"""
import sys
from sys import stdin
input = stdin.readline


def bowling_score(data):
    name_id = data[0]
    data = data[1:]

    frame = 1
    scores = [0] * 11

    while frame <= 10:
        if data[0] == 10:
            scores[frame] = data[0] + data[1] + data[2]
            data = data[1:]
            frame += 1
        elif data[0] + data[1] == 10:
            scores[frame] = data[0] + data[1] + data[2]
            data = data[2:]
            frame += 1
        else:
            scores[frame] = data[0] + data[1]
            data = data[2:]
            frame += 1
    return name_id, sum(scores[1:])


def main(args):
    while True:
        m = int(input())
        if m == 0:
            break
        results = []
        for _ in range(m):
            data = [int(x) for x in input().split()]
            name_id, score = bowling_score(data)
            results.append([-score, name_id])

        results.sort()
        for s, i in results:
            print(i, -s)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7836
#include<stdio.h>
#include<stdlib.h>
 
int main(void) {
  int n, l;
  int apl, sum;
  scanf("%d %d", &n, &l);

  if ( l >= 0 ) apl = l;
  else if ( l+n-1 >= 0 ) {
    apl = 0;
  } else {
    apl = l+n-1;
  }

  for ( int i = 1; i <= n; i++ ) {
    sum += l+i-1;
  }

  sum -= apl;
  printf("%d", sum);
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...) std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

int main()
{
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  rep(i, 0, n)
  {
    rep(j, i + 1, n)
    {
      auto ret = __builtin_ctz(i ^ j) + 1;
      std::cout << (j > i + 1 ? " " : "") << ret;
    }
    std::cout << std::endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;


class Point
{
public:
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(a * x, a * y); }
	Point operator / (double b) { return Point(x / b, y / b); }
	friend istream& operator >> (istream& s, Point p) {s >> p.x >> p.y;}

	double dot(Point a, Point b) { return a.x* b.x + a.y * b.y; }
	double abs() { return sqrt(norm()); }
	double norm() { return x * x + y * y; }

	bool operator <(const Point & p)const { return x != p.x ? x < p.x : y < p.y; }
	bool operator == (const Point & p) const { return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; }
};
typedef Point Vector;

struct Segment {
	Point p1, p2;
	Segment() {}
	Segment(Point p1, Point p2) :p1(p1), p2(p2) {}
};
typedef Segment Line;

double norm(Vector a) { return a.x* a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a)); }

double dot(Vector a, Vector b) { return a.x* b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x* b.y - a.y * b.x; }

int ccw(Point p0, Point p1, Point p2) {
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if (cross(a, b) < -EPS) return CLOCKWISE;
	if (dot(a, b) < -EPS) return ONLINE_BACK;
	if (a.norm() < b.norm()) return ONLINE_FRONT;
	else return ON_SEGMENT;
}

 
int main(){
  map<int,string> m;
  m[COUNTER_CLOCKWISE] = "COUNTER_CLOCKWISE";
  m[CLOCKWISE] = "CLOCKWISE";
  m[ONLINE_BACK] = "ONLINE_BACK";
  m[ONLINE_FRONT] = "ONLINE_FRONT";
  m[ON_SEGMENT] = "ON_SEGMENT";
  double x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  Point p1=Point(x1,y1),p2=Point(x2,y2);
  int q;cin>>q;
  while(q--){
    cin>>x1>>y1;
    cout << m[ccw(p1,p2,Point(x1,y1))] << endl;
  }
  return 0;
}


Measured memory_bytes: 3276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second

int n, m;

struct edge{ int to; int cost; };
vector<edge> G[110];
int mincost[110];
int res = 0;
bool used[110];//?????????????±???????????????????

int prim(){
	for (int i = 0; i < n; i++){
		mincost[i] = INF;
		used[i] = false;
	}
	mincost[0] = 0;

	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, 0));

	//cout << '!' << que.size() << endl;
	while (que.size()){
		P p = que.top(); que.pop();
		int v = p.second;

		if (used[v])continue;

		used[v] = 1;

		for (int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if (used[e.to])continue;
			if (mincost[e.to] > e.cost){
				mincost[e.to] = e.cost;
				que.push(P(e.cost, e.to));
			}
		}
	}

	REP(i, n){
		//cout << mincost[i] << endl;
		res += mincost[i];
	}
	return res;
}

int main(){
	while (cin >> n&&n){
		cin >> m;
		REP(i, m){
			int a, b, c;
			char k;
			cin >> a >> k >> b >> k >> c;
			G[a].push_back({ b, c });
			G[b].push_back({ a, c });
		}
		prim();
		int ans = 0;
		FOR(i,1, n){
			ans += (mincost[i] / 100 - 1);
			//cout << ans << endl;
		}
		cout << ans << endl;
		REP(i, 110)G[i].clear();
	}
}

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

using namespace std;

#define ll long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define mod 1000000007 //998244353
#define mii map<int, int>
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>

//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word



const long long N = 200005, INF = 2000000000000000000;
//lld pi = 3.1415926535897932;
int lcm(int a, int b)
{
  int g = __gcd(a, b);
  return a / g * b;
}
int power(int a, int b, int p)
{
  if (a == 0)
    return 0;
  int res = 1;
  a %= p;
  while (b > 0)
  { if (b & 1)
      res = (res * a) % p;
    b >>= 1;
    a = (a * a) % p;
  }
  return res;
}

int testcaseva;

int sq(int x) { return 1ll * x * x; }

void rec(int n) {
  int p = n;
  if (n == 0)
    return ;
  cout << p - n << " ";
  return rec(n - 1);


}
ll n,c;
ll ar[100005];
bool valid(int m,int c,int n){
    int cnt =0;
    int pr = INT_MIN;
    for(int i=0;i<n;i++)
    {
        if(ar[i]-pr >= m)
            cnt++ , pr = ar[i];
    }
    if(cnt >= c)
    return true;
    else return false;

}
int main() {
//#ifndef ONLINE_JUDGE
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);
//#endif
  // int t;
  // cin >> t;
  // while (t--)
  int t=1;
  //cin >> t;
  while(t--){
      int n;
      cin >>n;
      int ar[n];
      int ans=0;
      for(int i=0;i<n;i++){
        cin >>ar[i];
        if((i+1)%2==1 && ar[i]%2==1)
            ans++;
      }
      cout << ans;
  }
  return 0;
}


Measured memory_bytes: 3620
N = int(input())
A = list(map(int, input().split()))

cur = 0
d = {0: 1}
for i in range(N):
  cur = cur + A[i]
  d[cur] = d.get(cur, 0) + 1

ans = 0
for v in d.values():
  ans += v * (v-1) // 2

print(ans)

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

int main()
{
	int a,b,c,x,y;
	cin>>a>>b>>c;
	cin>>x>>y;
	int ans1=x*a+y*b;
	int ans=ans1;
	for(int i=0;i<=max(x,y);i++)
	{
		int temp=ans1;
		if(x>=i)
			temp-=i*a;
		else
			temp-=x*a;
		if(y>=i)
			temp-=i*b;
		else
			temp-=y*b;
		temp+=2*i*c;
		//cout<<temp<<" "<<ans<<endl;
		ans=min(temp,ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint fact[1000005], fact_inv[1000005];

llint pow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (pow(a, n-1)%mod)) % mod;
	}
	else{
		return pow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < 1000005; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	for(int i = 0; i < 1000005; i++){
		fact_inv[i] = pow(fact[i], mod-2);
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint n;

llint func(llint x)
{
	if(x < 2) return 0;
	llint N = n-3;
	llint K = (n-1) - x;
	
	if((N+1)/2 < K) return 0;
	llint ret = comb(N+1-K, K);
	ret *= fact[K], ret %= mod;
	ret *= fact[(n-1)-K], ret %= mod;
	return ret;
}

int main(void)
{
	cin >> n;
	if(n == 2){
		cout << 1 << endl;
		return 0;
	}
	
	make_fact();
	
	llint ans = (n-1) * func(n-1) % mod;
	for(int i = 1; i < n-1; i++){
		ans += mod - func(i);
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15872
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;

public class Main{
	
	public static void main(String[] args) throws IOException{
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		Scanner in = new Scanner(System.in);
		
		boolean[] c = new boolean[8];
		int t = 0;
		int N = in.nextInt();
                for(int i = 0; i < N; i++){
                   int r = in.nextInt();
                   if(r >= 3200) t++;
                   if(r >= 2800 && r < 3200) c[7] = true;
                   if(r >= 2400 && r < 2800) c[6] = true;
                   if(r >= 2000 && r < 2400) c[5] = true;
                   if(r >= 1600 && r < 2000) c[4] = true;
                   if(r >= 1200 && r < 1600) c[3] = true;
                   if(r >= 800 && r < 1200) c[2] = true;
                   if(r >= 400 && r < 800) c[1] = true;
                   if(r >= 1 && r < 400) c[0] = true;
                }
		int min = 0;
                for(int i = 0; i < 8; i++)
                    if(c[i]) min++;
		if(min == 0) System.out.println(1 + " " + t);
                else System.out.println(min + " " + (min + t));
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int M = 1000, C = 100, X = 10, I = 1;
int DIG[] = {M, C, X, I};
char S[] = "mcxi";

int m2i(string s)
{
    int ans = 0, num = 1, n;

    REP(s.size())
    {
        n = s[i] - '0';
        if(n > 1 && n <= 9){ num = n; continue;}
        rep(j, 4)if(s[i] == S[j]){ ans += num * DIG[j]; num = 1;}
    }

    return ans;
}

string i2m(int n)
{
    string ans = "";
    REP(4)
    {
        if(n / DIG[i] > 0)
        {
            if(n / DIG[i] > 1) ans += (n / DIG[i]) + '0';
            ans += S[i];
            n %= DIG[i];
        }
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    REP(n)
    {
        string s1, s2; cin >> s1 >> s2;
        int ans = m2i(s1) + m2i(s2);
        cout << i2m(ans) << endl;

    }

    return 0;
}

Measured memory_bytes: 1208
n, b, r = map(int, input().split())
# inputText1 = "8 3 4"
# inputText1List = inputText1.split()
# n = int(inputText1List[0])
# b = int(inputText1List[1])
# r = int(inputText1List[2])
if b == 0:
    print(b)
else:
    # i = (count // (b + r)) + 1 # 最大繰り返し数
    baseTextCount = b + r # 7
    i = n // baseTextCount
    mod = n % baseTextCount
    # print(i * b) # あまりを除いた青のボール数
    if mod < b:
        print(i * b + mod)
    else:
        print(i * b + b)


Measured memory_bytes: 2940
#-*- using:utf-8 -*-

X = int(input())

if 400<= X and X <= 599:
    print(8)
elif 600<= X and X <= 799:
    print(7)
elif 800<= X and X <= 999:
    print(6)
elif 1000<= X and X <= 1199:
    print(5)
elif 1200<= X and X <= 1399:
    print(4)
elif 1400<= X and X <= 1599:
    print(3)
elif 1600<= X and X <= 1799:
    print(2)
elif 1800<= X and X <= 1999:
    print(1)

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

using namespace std;

int main(){
        string s,t;

        cin >> s >> t;

        if (s[0] == t[0] && s[1] == t[1] && s[2] == t[2]){
                cout << "3" << endl;
        }
        else if (s[0] == t[0] && s[1] == t[1] && s[2] != t[2]){
                cout << "2" << endl;
        }
        else if (s[0] == t[0]  && s[1] != t[1] && s[2] == t[2]){
                cout << "2" << endl;
        }
        else if (s[0] != t[0] && s[1] == t[1] && s[2] == t[2]){
                cout << "2" << endl;
        }
        else if (s[0] == t[0] && s[1] == t[1] && s[2] != t[2]){
                cout << "2" << endl;
        }
        else if(s[0] != t[0] && s[1] != t[1] && s[2] == t[2]){
                cout << "1" << endl;
        }
        else if (s[0] != t[0] && s[1] == t[1] && s[2] != t[2]){
                cout << "1" << endl;
        }
        else if (s[0] == t[0] && s[1] != t[1] && s[2] != t[2]){
                cout << "1" << endl;
        }
        else {
                cout << "0" << endl;
        }
        return 0;
}

Measured memory_bytes: 3592
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
c = 0
for num in range(3, n+1, 2):
    d = 0
    for i in range(1, num+1):
        if num % i == 0:
            d += 1
    
    if d == 8:
        c += 1
print(c)

Measured memory_bytes: 3064
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<algorithm>
typedef signed long long int int64;
inline unsigned getint() {
	register char ch;
	while(!isdigit(ch=getchar()));
	register unsigned x=ch^'0';
	while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
	return x;
}
inline int64 min(const int64 &a,const int64 &b) {
	return a<b?a:b;
}
const int64 inf=0x7ffffffffffffff;
const int N=200001;
int n;
class FenwickTree {
	private:
		int64 val[N];
		int lowbit(const int &x) const {
			return x&-x;
		}
	public:
		FenwickTree() {
			std::fill(&val[0],&val[N],inf);
		}
		void modify(int p,const int64 &x) {
			while(p<=n) {
				if(x<val[p]) {
					val[p]=x;
				} else 
				p+=lowbit(p);
			}
		}
		int64 query(int p) const {
			int64 ret=inf;
			while(p) {
				ret=min(ret,val[p]);
				p-=lowbit(p);
			}
			return ret;
		}
};
FenwickTree ta;
class RevFenwickTree {
	private:
		int64 val[N];
		int lowbit(const int &x) const {
			return x&-x;
		}
	public:
		RevFenwickTree() {
			std::fill(&val[0],&val[N],inf);
		}
		void modify(int p,const int64 &x) {
			while(p) {
				if(x<val[p]) {
					val[p]=x;
				}
				p-=lowbit(p);
			}
		}
		int64 query(int p) const {
			int64 ret=inf;
			while(p<=n) {
				ret=min(ret,val[p]);
				p+=lowbit(p);
			}
			return ret;
		}
};
RevFenwickTree tb;
int64 f[N];
inline void modify(const int &p,const int64 x) {
	if(1) {
		f[p]=x;
		ta.modify(p,x-p);
		tb.modify(p,x+p);
	}
}
int main() {
	n=getint();
	int q=getint(),a=getint(),b=getint();
	std::fill(&f[0],&f[N],inf);
	modify(a,0);
	int64 sum=0;
	while(q--) {
		a=b;
		b=getint();
		sum+=abs(a-b);
		int64 t1=ta.query(b)+b,t2=tb.query(b)-b;
		modify(a,min(t1,t2)-abs(a-b));
	}
	int64 tmp=inf;
	for(register int i=1;i<=n;i++) {
		tmp=min(tmp,f[i]);
	}
	printf("%lld\n",tmp+sum);
	return 0;
}


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

int main() {
    int a,b;
    cin >> a >> b;
    for (int i = 0;i <= 1000;++i) if (i*108/100-i == a && i*11/10-i == b) {
        cout << i << endl;
        return 0;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k<=111){
     System.out.println(111);
    }else if(112<=k && k<=222){
       System.out.println(222);
    }else if(223<=k && k<=333){
       System.out.println(333);
    }else if(334<=k && k<=444){
       System.out.println(444);
    }else if(445<=k && k<=555){
       System.out.println(555);
    }else if(556<=k && k<=666){
     System.out.println(666);
    }else if(667<=k && k<=777){
     System.out.println(777);
    }else if(778<=k && k<=888){
     System.out.println(888);
    }else if(889<=k && k<=999){
    System.out.println(999);
  
  }}}
    
    
    

Measured memory_bytes: 21460
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,m,k,a[1000002],b[1000002],px[1000002],py[1000002],stkx[1000002],stky[10000002],tp1,tp2;
long long ans;
set<int>u,v;
signed main(){
	n=read(),m=read();ans=1ll*(n-2)*(n-2);a[0]=b[0]=n;
	for(re int i=1;i<=n;++i)a[i]=b[i]=n;
	for(re int i=1,x,y;i<=m;++i){
		x=read(),y=read();
		if(x==1){
			re int xx=tp1;
			if(y<a[i-1])stkx[++tp1]=i;
			a[i]=min(a[i-1],y);
			b[i]=b[i-1];
			set<int>::iterator it=u.lower_bound(y);
			if(it==u.begin()){
				
				ans-=b[i]-2;
			}
			else{
				--it;
			//	printf("%d\n",*it);
				re int l=1,r=xx,o=0;
				while(l<=r){
					re int mid=l+r>>1;
					if(a[stkx[mid]]<y)r=mid-1,o=mid;
					else l=mid+1;
				}
				ans-=b[stkx[o]]-2;
			}
			px[y]=i;
			u.insert(y);
		}
		else{//printf("%d\n",a[i-1]);
		re int yy=tp2;
			if(y<b[i-1])stky[++tp2]=i;
			b[i]=min(b[i-1],y);
			a[i]=a[i-1];
			set<int>::iterator it=v.lower_bound(y);
			if(it==v.begin()){
				ans-=a[i]-2;
			}
			else{
				--it;
				re int l=1,r=yy,o=0;
				while(l<=r){
					re int mid=l+r>>1;
					if(b[stky[mid]]<y)r=mid-1,o=mid;
					else l=mid+1;
				}
				ans-=a[stky[o]]-2;
			}
			py[y]=i;
			v.insert(y);
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 16276
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#define f cin
#define NMAX 200010
using namespace std;

//ifstream f("date.in");

long long int n, h[NMAX];
long long int dp[NMAX], k;

int main() {

    f >> n >> k ;
    for (int i = 0; i < n; ++i) {
        f >> h[i];
    }

    dp[0] = 0;
    // dp[1] = abs(h[1] - h[0]);

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + abs(h[i - 1] - h[i]);
        for (int j = 1; j <= k && i - j >= 0; ++j) {
            dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]));
        }
    }

    cout << dp[n - 1];

    return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  while (cin >> n, n) {
    while (n--) {
      int m, e, j;
      cin >> m >> e >> j;
      char a = 'C';
      int mean = (m + e + j) / 3;
      if (m == 100 || e == 100 || j == 100) a = 'A';
      else if ((m + e) / 2 >= 90) a = 'A';
      else if (mean >= 80) a = 'A';
      else if (mean >= 70) a = 'B';
      else if (mean >= 50 && (m >= 80 || e >= 80)) a = 'B';
      cout << a << "\n";
    }
  }
}



Measured memory_bytes: 2964
# 2019/04/10
# AtCoder Beginner Contest 098 - C

n = int(input())
s = input()
wl = [0]*(n+1)
el = [0]*(n+1)

for i in range(n):
    if s[i] == "W":
        wl[i+1] = wl[i] + 1
        el[i+1] = el[i]
    else:
        el[i+1] = el[i] + 1
        wl[i+1] = wl[i]

minp = 10**6
for i in range(n+1):
    chp = wl[i] + (el[n]-el[i])
    if chp < minp:
        minp = chp

print(minp)


Measured memory_bytes: 17536
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=9223372036854775806;
const int inf=2147483646;
short a[20],n,s=0;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>n;
	for (int i=0;i<n;i++)
		cin>>a[i];
	for (int i=1;i+1<n;i++)
		if (a[i-1]<a[i]&&a[i]<a[i+1]||a[i-1]>a[i]&&a[i]>a[i+1])
			s++;
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;
int main()
{
  double const PI = acos(-1.0);
  string line;
  double r;
  getline (cin,line);
  stringstream(line) >> r;
  cout << fixed << PI*r*r << ' ' << fixed << 2.0*PI*r << '\n';
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  long double a, ans=0;

  REP(i,n){
    cin>>a;
    ans+=1/a;
  }
  ans=1/ans;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int K = in.nextInt();
        long num = 0, d = 1;
        for(int i = 0; i < K; i++)  {
            num += d;
            if(calc(num + 2 * d) < calc(num + d)) {
                d *= 10L;
            }
            System.out.println(num);
        }
    }

    public static double calc(long num) {
        double n = (double) num;
        double sum = 0;
        while(num != 0L) {
            sum += num % 10;
            num /= 10;
        }
        return n / sum;
    }
}

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

typedef long long ll;

ll in[15][15];

int main()
{
    ll n,a,b,m,i,j,k,res=0;
    cin >> n >> m;
    for(i=0; i<10; i++)
    {
        for(j=0; j<10; j++)
        {
            cin >> a;
            in[i][j]=a;
        }
    }
    for(k=0; k<10; k++)
    {
        for(i=0; i<10; i++)
        {
            for(j=0; j<10; j++)
            {
                if(in[i][j]>(in[i][k]+in[k][j]))in[i][j]=in[i][k]+in[k][j];
            }
        }
    }



    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            cin >> a;
            if(a!=-1)
            {
                res+=in[a][1];
            }
        }
    }
    cout << res << "\n";



    return 0;
}



Measured memory_bytes: 256
/* Author rumoisen */
/* created 2018/11/08 */

#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <iostream>

using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

using namespace std;

int main(void)
{
    int n,a;
    cin>>n>>a;
    if(n%500<=a) yes();
    else no();
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int f(int a){
    string s = to_string(a);

    rep(i,0,sz(s)/2){
	if(s[i] != s[sz(s)-1-i])ret 0;
    }
    ret 1;
}

int main(){

    int a,b;
    cin >> a >> b;

    int c = 0;
    rep(i,a,b+1){
	if(f(i))c++;
    }
    P(c);
    
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  ll L, R; cin >> L >>R;
  if (R-L >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  int ans = INF;
  for (int i=L; i<=R; i++) {
    for (int j=i+1; j<=R;j++) {
      int t = (i % 2019) * (j % 2019) % 2019;
      ans = min(ans, t);
    }
 }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

void A_sort(double a[], int n);
using namespace std;

int main()
{
    int n;
    double a[51];

    cin >> n;
    for (int i = 0; i < n; ++i){

    cin >> a[i];
    
    }

    A_sort(a, n);
    a[0] = (a[0] + a[1]) / 2;
    if ( n > 1){
    for (int i = 2; i < n; ++i){

    a[0] = (a[0] + a[i]) / 2;
    
    }
    }
    cout << a[0] << endl;

    


    return 0;
}

void A_sort(double a[], int n){
    int v, j;
    for ( int i = 1 ; i < n ;i++){
        v = a[i];
        j = i -1;
        while (j >= 0 && a[j] > v){
            a[j + 1] = a[j];
            j--;
            a[j + 1] = v;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200050
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
using namespace std;
int n,ar[N],k;
int pr[N];
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>ar[i];
        ar[i]--;
    }
    if(ar[0]==0){
        cout<<"1";
        return 0;
    }
    memset(pr,-1,sizeof(pr));
    pr[0] = 0;
    int tmp = ar[0];
    int cur = 1;
    k--;
    while(pr[tmp]==-1){
        if(k==0){
            cout<<tmp+1;
            return 0;
        }
        pr[tmp] = cur++;
        tmp = ar[tmp];
        k--;
    }
    k%=(cur-pr[tmp]);
    while(k--){
        tmp = ar[tmp];
    }
    cout<<tmp+1;
        return 0;
}


Measured memory_bytes: 6736
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;

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


}


Measured memory_bytes: 256