akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
    int H, W;

    while (true) {
        cin >> H >> W;
        if (!(H | W)) {
            break;
        }

        for (int h = 1; h <= H; ++h) {
            for (int w = 1; w <= W; ++w) {
                if (w == 1 || h == 1 || w == W || h == H) {
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl; 
    }
}





Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    ll n, k, ans;
    cin >> n >> k;
    ans = 0;
    for(ll b = 1; b <= n; b++){
        if(b <= k) continue;
        ans += (n / b) * (b - k) + max(n % b - k + 1, 0ll);
    }
    if(k == 0) ans -= n;
    cout << ans << endl;
}

Measured memory_bytes: 256
#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 pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
    ll x;
    cin >> x;
    for(ll a = -1000; a <= 1000; a++){
        for(ll b = -1000; b <= 1000; b++){
            if(pow(a, 5) - pow(b, 5) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}  

Measured memory_bytes: 4060
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD=1e9+7;

//const int MOD=998244353;
const double PI=3.14159265359;





int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n,m;
    cin>>n>>m;
    
    vector<vector<int>> v(n+1);
    
    while(m--){
        int x,y;
        cin>>x>>y;
        
        if(!v[x].size()) v[x].push_back(y);
        else v[x][0]=min(y, v[x][0]);
        
    }
    
    int curx=-1, cury=-1, ct=0;
    
    
    for(int i=1; i<=n; i++){
        if(!v[i].size()) continue;
        
        if(i>=cury){
            curx=i;
            cury=v[i][0];
            ct++;
        }
        else{
            curx=i;
            cury=min(cury, v[i][0]);
        }
    }
    
    
    cout<<ct;
    
    
    
    
    
    
    
    
   
    return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

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

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	VL s(n);
	cin >> s;
	SORT(s);
	LL ans = 0;
	for (int i = 0; i < n; i++) {
		ans += s[i];
	}
	if (ans % 10 == 0) {
		for (int i = 0; i < n; i++) {
			if (s[i] % 10 != 0) {
				ans -= s[i];
				cout << ans << endl;
				return 0;
			}
		}
		cout << 0 << endl;
		return 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
x, y = map(int, input().split())

if x % y == 0:
    print(-1)
    sys.exit(0)
i = 2
while(True):
    v = x * i
    if v > 10 ** 18:
        print(-1)
        sys.exit(0)
    if v % y != 0:
        print(v)
        sys.exit(0)
    i += 1

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 505*505;
int n,a[N],x[N],q[N],sz,id[N];
bool cmp(int a, int b){
	return x[a]<x[b];
}
void GG(){puts("No");exit(0);}
int main() {
	read(n);rep(i,1,n)read(x[i]),a[x[i]]=i;
	rep(i,1,n)id[i]=i;sort(id+1,id+n+1,cmp);
	rep(i,1,n)rep(j,1,id[i]-1)q[++sz]=id[i];
	rep(i,1,n)rep(j,id[i]+1,n)q[++sz]=id[i];
	int f=1;rep(i,1,n*n)if(!a[i])a[i]=q[f++];
	
	static int buc[N];rep(i,1,n*n)buc[a[i]]++;
	rep(i,1,n)if(buc[i]!=n)GG();
	rep(i,1,n){
		int cnt=0;rep(j,1,x[i])cnt+=a[j]==i;
		if(cnt!=i)GG();
	}
	puts("Yes");
	rep(i,1,n*n)printf("%d ",a[i]);
	return 0;
}


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

using namespace std;

string str;

long long cnt;

void Sum(string s) {

	string temp;

	for (char c : s) {

		if (c == '+') {

			cnt += atoll(temp.c_str());
			temp = "";

		}
		else
			temp += c;

	}

	cnt += atoll(temp.c_str());

}

void backtrack(int num, string s) {

	if (num == str.length()) {

		Sum(s);
		return;

	}
	
	backtrack(num + 1, s + str[num]);

	if(num > 0)
		backtrack(num + 1, s + "+" + str[num]);

}

int main() {

	cin >> str;

	backtrack(0, "");

	cout << cnt;

	return 0;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define fcout cout << fixed << setprecision(10)
int main(){
    int x,y;
    cin>>x>>y;
    cout<<(x%y?x:-1);
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;

int K;

void solve() {
    int asn = 0;
    FOR (i, 1, K + 1)
        FOR (j, 1, K + 1)
            FOR (k, 1, K + 1)
                ans += gcd(gcd(i, j), k);
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> K;


    solve();
    return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <vector>
#include <string>

using ll = long long;

using namespace std;

ll pow5(ll x) {
    return x * x * x * x * x;
}

void solve() {
    ll x;
    cin >> x;

    for (ll a = -200; a <= 200; ++a) {
        for (ll b = -200; b <= 200; ++b) {
            ll diff = pow5(a) - pow5(b);
            if (diff == x) {
                cout << a << " " << b << '\n';
                return;
            }
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    solve();
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int amari = N * 100 % 108;
  int culA = N / 1.08 + 1;
  int culB = culA * 1.08;
    if(amari == 0){
      cout << N / 1.08 << endl; 
    }
    else if(culB == N){
      cout << culA << endl;
    }
    else{
      cout << ":(" << endl;
    }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'
#define int ll

using namespace std;

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

const int INF = 1e9 + 7, N = 2e5 + 87;

int n, q, l[N], r[N], ct = 1, a[N], inv[N], ans[N];
vi G[N];
void dfs(int u, int p = -1) {
	l[u] = ct;
	for(int v:G[u])
		if(v != p) {
			dfs(v, u);
		}
	r[u] = ct;
	inv[ct] = u;
	ct++;
}

int32_t main()
{
	IO_OP;
	
	cin >> n >> q;
	for(int i=0;i<n-1;i++) {
		int a, b;
		cin >> a >> b;
		G[a].PB(b);
		G[b].PB(a);
	}
	dfs(1);
	while(q--) {
		int p, x;
		cin >> p >> x;
		int ll = l[p], rr = r[p];
		a[ll] += x, a[rr+1] -= x;
	}
	for(int i=1;i<=n;i++) {
		a[i] += a[i-1];
		ans[inv[i]] = a[i];
	}
	for(int i=1;i<=n;i++)
		cout << ans[i] << " ";
}



Measured memory_bytes: 30592
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  A = sorted(list(map(int, input().split())))

  not_divisible = [False]*(10**6+1)
  for i in range(N):
    not_divisible[A[i]] = True

  prev = 0
  for i in range(N):
    if not_divisible[A[i]]:
      j = A[i] + A[i]
      while j <= A[-1]:
        not_divisible[j] = False
        j += A[i]
    if prev == A[i]:
      not_divisible[A[i]] = False
    prev = A[i]

  cnt = 0
  for i in range(N):
    if not_divisible[A[i]]:
      cnt += 1

  print(cnt)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 104292
#include<bits/stdc++.h>
using namespace std;
const int MAX =2e5+5;
long long  n, f[MAX],dp[MAX],a[MAX],h[MAX];
long long get(long  long idx){
    long long res=0;
    for(;idx;idx-=(idx &(-idx)))
        res=max(res,f[idx]);
    return res;
}
void modify(long long idx, long long val){
    for(;idx<MAX;idx+=(idx &(-idx))){
        f[idx]=max(f[idx],val);
    }
}

int main(){
    cin>>n;
    for(int i=1;i<=n;i++)   cin>>h[i];
    for(int i=1;i<=n;i++)   cin>>a[i];
    long long ans=0;
    for(int i=1;i<=n;i++){
        dp[i]=get(h[i])+a[i];
        ans=max(dp[i],ans);
        modify(h[i],dp[i]);
    }
    cout<<ans;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,a;
  while(cin >> n >> m){
    if(n == m && n == 0) break;
    vector<pll> d(n);
    a = 0;
    rep(i,n){
      cin >> d[i].se >> d[i].fi;
      a += d[i].se * d[i].fi;
    }
    sort(all(d),greater<pll>());
    rep(i,n){
      if(m <= 0) break;
      ll k = min(m,d[i].se);
      a -= k * d[i].fi;
      m -= k;
    }
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 3368
//12/04/2020
#include<bits/stdc++.h>
#include<cmath>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug printf("Debug\n");
#define en '\n'


#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
struct OverloadedNode{
    ll val,pos;
    bool operator < (const OverloadedNode &rhs) const {
        if(val==rhs.val) return pos<rhs.pos;
        else return val<rhs.val;
    }
};
//Algos
template<typename T> using Pbds=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//typedef tree<OverloadedNode,null_type,less<OverloadedNode>,rb_tree_tag,tree_order_statistics_node_update>OverloadedPbds;

//Number Theory
template <typename T> T BigMod (T b,T p,T m){if (p == 0) return 1;if (p%2 == 0){T s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
template <typename T> T ModInv (T b,T m){return BigMod(b,m-2,m);}
template <typename T> T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}

//Geometry
template <typename T> T Dis(T x1,T y1,T x2, T y2){return sqrt( SQR(x1-x2) + SQR(y1-y2) );}
template <typename T> T Angle(T x1,T y1,T x2, T y2){ return atan2( double(y1-y2) , double(x1-x2));}


/*Containers*/
//vector<ll>v;
//deque<ll>dq;
//stack<ll>stk;
//map<ll,ll>mp;
//unordered_map<ll,ll>ump;
//set<ll>st;
//multiset<ll>mst;
//unordered_set<ll>ust;
//unordered_multiset<ll>umst;
//priority_queue<ll,deque<ll>,greater<ll>>pq;
//Pbds<ll>ost;
/*OverLoaded Containers*/
//vector<OverloadedNode>v;
//deque<OverloadedNode>dq;
//stack<OverloadedNode>stk;
//map<OverloadedNode,OverloadedNode>mp;
//set<OverloadedNode>st;
//multiset<OverloadedNode>mst;
//priority_queue<OverloadedNode>pq;
//OverloadedPbds oost;
/*Global Variables*/

int main(){
    _fastio
    ll n;
    cin>>n;
    ll ans=(n*(n+1))/2;
    ll x=n/3;
    x=(x*(x+1))/2;
    ans-=(x*3);
    x=n/5;
    x=(x*(x+1))/2;
    ans-=(x*5);
    x=n/15;
    x=(x*(x+1))/2;
    ans+=(x*15);
    cout<<ans<<en;



    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define ll long long
#define i1 int128_t
#define vi vector<long long>
#define st set<long long>
#define uset unordered_set<long long>
#define si set<long long>:: iterator
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(long long i=a; i<b; i++)
#define fs(i,a,s) for(long long i=a; s[i]!='\0'; i++)
#define endl "\n"

int main(){

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif

	ll t;
	cin>>t;
	ll wa=0, tle=0, ac=0, re=0;

	while(t--){

		string s;
		cin>>s;

		if(s[0]=='A')
			ac++;
		else if(s[0]=='W')
			wa++;
		else if(s[0]=='T')
			tle++;
		else
			re++;
	 }

	 cout<<"AC x "<<ac<<endl;
	 cout<<"WA x "<<wa<<endl;
	 cout<<"TLE x "<<tle<<endl;
	 cout<<"RE x "<<re<<endl;

	 // fclose(stdin);
	 // fclose(stdout);
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <cctype>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>
#include <limits.h>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

const ll MOD = 1000000007;

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //問題文中の添え字が0-indexか1-indexか確認!

    ll n;
    std::cin>>n;
    std::string s;
    std::cin>>s;
    std::vector<ll> a(52);
    ll itr=-1;
    char temp='-';
    rep(i,0,s.size()){
        if(temp!=s[i]){
            itr++;
            a[itr]++;
            temp=s[i];
        }else{
            a[itr]++;
        }
    }
    std::cin>>s;

    ll ans,prev;
    if(a[0]==1){
        ans=3;
        prev=1;
    }else{
        ans=6;
        prev=2;
    }
    rep(i,1,itr+1){
        if(a[i]==1){
            if(prev==1){
                ans=(ans*2)%MOD;
            }
            prev=1;
        }else{
            if(prev==1){
                ans=(ans*2)%MOD;
            }else{
                ans=(ans*3)%MOD;
            }
            prev=2;
        }
    }
    std::cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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; }
typedef pair <ll,ll> P;
ll sign(ll A){
    return (A>0)-(A<0);
}
int main()
{
    ll A,B,C;
    cin >> A >> B >> C;
    ll ans = 0;
    if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
        print(0);
        return 0;
    }
    while (A != B || B != C) {
        ll tmpA = (B+C) / 2;
        ll tmpB = (A+C) / 2;
        ll tmpC = (B+A) / 2;
        if(tmpA % 2 != 0 || tmpB % 2 != 0 || tmpC % 2 != 0) {
            print(ans+1);
            return 0;
        }
        
        A = tmpA;
        B = tmpB;
        C = tmpC;
        ans++;
    }
    print(-1);
    return 0;
}

Measured memory_bytes: 256
#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(){
  int a,b,m;
  cin >> a >> b >> m;
  vector<int> A(a);
  vector<int> B(b);
  vector<int> x(m);
  vector<int> y(m);
  vector<int> c(m);
  rep(i,a) cin >> A[i];
  rep(i,b) cin >> B[i];
  rep(i,m) cin >> x[i] >> y[i] >> c[i];
  int ans;
  ans = *min_element(A.begin(), A.end()) + *min_element(B.begin(), B.end());
  //cout << ans << endl;
  rep(i,m){
    ans = min(ans,A[x[i]-1] + B[y[i]-1] - c[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2176
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main() {

    int N,A,B;
    cin >> N >> A >> B;
    int out = 0;
    for(int i = 1; i <= N; i++){
        int j = i/10000 + (i%10000)/1000 + (i%1000)/100 + (i%100)/10 + i%10;
        if(j >= A && j <= B) out += i;
    }
    cout << out << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
///1<<3シフト演算子 とは　0001の1を三つずらして1000にする, これは8を表しておりつまりbitは0から7まで
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
#define PI 3.14159265359
#define MOD 1000000007
using namespace std;
using ll = long long;
using ld = long double;

//条件式 ? 真の場合の文 : 偽の場合の文
//string S  S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換
//binary_search(all(p),x) bool型

int main(){

    int k;
    cin >> k;
    string s;
    cin >> s;
    if(s.size() <= k) cout << s << endl;
    else{
        rep(i,k) cout << s.at(i);
    
    cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
def main():
    INF = float("inf")

    N, M = map(int, input().split())

    N2 = 2 ** N
    dp = [INF] * N2
    dp[0] = 0

    for _ in range(M):
        a, b = map(int, input().split())
        C = [int(i) for i in input().split()]
        mask = sum(1 << (c - 1) for c in C)
        for i in range(N2):
            if dp[i | mask] > dp[i] + a:
                dp[i | mask] = dp[i] + a

    ans = dp[-1]
    print(-1 if ans == INF else ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define M 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define tr(x,it) for(auto it = x.begin();it!=x.end();++it)
#define fpresent(x,c) ((c).find(x) != (c).end())  //set,map
#define present(c,x) (find(all(c),x) != (c).end()) //vector
#define pb push_back 
#define mp make_pair
#define setv(ar, val) memset(ar, val, sizeof(ar));
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

int main()
{
    // freopen("input.in","r",stdin);
    // freopen("output.in","w",stdout);
    fastio;
    cin.tie(NULL);
    ll n,m,wt,i,j,k,ans=0;
    cin>>n>>wt;
    vector<ll> w(n), v(n), dp(wt+1, -1);

    for(i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    dp[0] = 0;
    for(i=0;i<n;i++){
        for(j=wt; j>=w[i]; j--){
            dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
        }
    }

    for(i=0;i<=wt;i++)
        ans = max(ans, dp[i]);

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1024
listA = []
num = int(input())
for i in range(num):
    command = input().split()
    if command[0] == "0":
        listA.append(int(command[1]))
    elif command[0] == "1":
        print(listA[int(command[1])])
    elif command[0] == "2":
        listA.pop(-1)


Measured memory_bytes: 13372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define opt ios_base::sync_with_stdio(false); cin.tie(NULL);

void freak__()
{
    int a,b;
    cin >> a >> b;
    if(a==b) cout << a+b;
    else if(abs(b-a)==1) cout << a+b;
    else cout << 2*max(a,b)+-1;
    cout << "\n";
}

int main()
{
    opt;
    freak__();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define INF 100000000
#define mod 1000000007
using namespace std;
int keta(int n,int k){return (n/int(pow(10,double(k-1)))) % 10;} //nの下からk桁目
ll gcd(ll n,ll m){
	if(n<m){ll a=m;m=n;n=a;}
	ll r=n%m;
	while(r!=0){
		n=m;
		m=r;
		r=n%m;
	}
	return m;
}
ll lcm(ll n,ll m){
	return n*m/gcd(n,m);
}

int main(){
	int n;
	cin>>n;
	vector<int> a;
	a.resize(n);
	rep(i,n){
		cin>>a[i];
	}
	int b=0;
	int ans=0;
	rep(i,n){
		if(a[i]==i+1){
			if(b==0){
				ans++;
				b++;
			}else{
				b=0;
			}
		}else{
			b=0;
		}
	}
	cout<<ans<<endl;
}


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

ll n;
ll val[102],w[102];
ll memo[102][100005];

ll fil(ll id,ll W)
{
    if(id>=n)return 0;
    if(memo[id][W]!=-1)return memo[id][W];

    ll ans=0;
    ans=max(ans,fil(id+1,W));
    if(W-w[id] >=0)ans=max(ans,val[id]+fil(id+1,W-w[id]));

    return memo[id][W]=ans;
}
int main()
{
    ll W;
    cin>>n>>W;
    for(ll i=0;i<n;i++)
    {
        cin>>w[i]>>val[i];
    }
    memset(memo,-1,sizeof(memo));
    cout<<fil(0,W)<<endl;
}


Measured memory_bytes: 80000
#include <stdio.h>
#include <vector>
using namespace std;

vector<int> ans;

int main(void)
{
	int n, i;

	scanf("%d" ,&n);

	if (n == 0)
	{
		printf("0");
		return 0;
	}

	for (i = 0; n != 0; i++)
	{
		if ((n + (int)1e9) % 2 == 1)
		{
			ans.push_back(1);
			n--;
		}
		else
			ans.push_back(0);

		n /= -2;
	}

	for (i = ans.size() - 1; i >= 0; i--)
		printf("%d" ,ans[i]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define hell 998244353  
#define endl "\n"
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX_SIZE 1000000000000000


int32_t main()  
{   
    io

    int n;
    cin>>n;

    cout<<(n*(n-1)/2);

return 0;
}   

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

string a;

int main()
{
	cin>>a;
	if(a.back()=='2' or a.back()=='4' or a.back()=='5' or a.back()=='7' or a.back()=='9') cout<<"hon";
	else if(a.back()=='0' or a.back()=='1' or a.back()=='6' or a.back()=='8') cout<<"pon";
	else cout<<"bon";
}

Measured memory_bytes: 3584
//Volume5-0522
import java.util.Scanner;
import java.util.regex.Pattern;

class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		Pattern JOI = Pattern.compile("^JOI.*"),
				IOI = Pattern.compile("^IOI.*");


		String s;
		int    jcnt,icnt;
		while(sc.hasNext()){
			s = sc.nextLine();
			jcnt=0; icnt=0;
			while(!s.isEmpty()){
				if     (JOI.matcher(s).matches()){jcnt++;}
				else if(IOI.matcher(s).matches()){icnt++;}
				s = s.substring(1);
			}
			System.out.printf("%d\n%d\n",jcnt,icnt);
		}
	}
}

Measured memory_bytes: 27072
using System;
using System.Linq;
using System.Collections.Generic;

namespace agc030_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var text = Console.ReadLine();
            var list = text.Split(' ').Select(x => int.Parse(x)).ToList();

            var a = list[0];
            var b = list[1];
            var c = list[2];

            var d = c - (a - b); 

            if (d < 0){
                d = 0;
            }

            Console.WriteLine(d);
        }
    }

    class hero
    {
        public int index;
        public int battle;

    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int k,n;cin>>k>>n;
	int a[n+1];
	rep(i,n) cin>>a[i];
	sort(a,a+n);
	a[n]=a[0]+k;
	int s=0;
	rep(i,n){
		int y=a[i+1]-a[i];
		s=max(y,s);
	} 

	cout<<k-s<<"\n";
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

    int A, B, T; cin >> A >> B >> T;
    cout << B*(T/A) << "\n";
 

    return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fromIntegral . fst . fromJust . BS.readInteger

getInt = readInt <$> BS.getLine
getString = BS.unpack <$> BS.getLine

summary :: String -> Int -> String
summary [] 0 = []
summary _ 0 = "..."
summary [] _ = []
summary (x:xs) k = x : summary xs (k-1)

main = do
  k <- getInt
  s <- getString
  putStrLn $ summary s k

Measured memory_bytes: 3796
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a,b,anst,ans;
int main()
{
	scanf("%d%d",&a,&b);
	if(b==1) { cout<<0<<endl; return 0; }
	anst=1; ans=a;
	--a;
	while(ans<b)
	{
		++anst;
		ans+=a;
	}
	printf("%d\n",anst);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//int a[6]= {100,101,102,103,104,105},n,dp[1000002];
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(d==1)
        printf("1");
    else
        printf("0");
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int[] V = new int[N];
		int[] C = new int[N];
		int ans = 0;
		for (int i = 0; i < N;i++) {
			V[i] = reader.nextInt();
		}
		for (int i = 0; i < N;i++) {
			C[i] = reader.nextInt();
			ans += Math.max(0, V[i]-C[i]);
		}

		System.out.println(ans);
		reader.close();

	}
}





Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

class BIT
{
public:
    vector<int> bit;
    int M;

    BIT(int M):
        bit(vector<int>(M+1, 0)), M(M) {}

    int sum(int i) {
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, int x) {
        if (i > M) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }
};

void add_b(int l, int r, BIT &b0, BIT &b1, int n){
    b1.add(l, 1);
    b1.add(r + 1, -1);
    b0.add(l, n - l);
    b0.add(r + 1, l - n);
}

signed main(){

    int n, m; cin >> n >> m;
    vec a(n); readvec(a);

    //得する回数を b0.sum(x) + x * b1.sum(x) とする
    BIT b0(m + 1), b1(m + 1);
    int s = 0;

    REP(i, n - 1){
        if(a[i] < a[i + 1]){
            s += a[i + 1] - a[i];
            add_b(a[i] + 1, a[i + 1], b0, b1, 0);
        }
        if(a[i] > a[i + 1]){
            s += (m - a[i]) + 1 + (a[i + 1] - 1);
            add_b(a[i] + 1, m, b0, b1, 0);
            add_b(1, a[i + 1], b0, b1, m - a[i]);
        }
    }

    int ans = 0;
    FOR(i, 1, m + 1){
        ans = max(ans, b0.sum(i) + i * b1.sum(i));
    }

    ans = s - ans;
    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1e9+7
#define EPS 1e-8
#define INF 1e9+10
#define INFL 1e18
typedef long long ll;
using namespace std;
int main()
{
   int a;
   string s;
   cin >> a >> s;

   cout << ((a<3200) ? "red" : s ) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



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

	ll c = 100;
	ll ans = 0;
	while (1) {
		ans += 1;
		c *= 1.01;
		if (c >= x) {
			cout << ans << endl;
			return 0;
		}
	}
}




Measured memory_bytes: 3680
#064-C
n=int(input())
A=list(map(int,input().split()))
s=set()
cnt=0
for a in A:
    c=a//400
    if c>=8:
        cnt+=1
    else:
        s.add(c)
m=len(s)
if m:
    M=m+cnt
else:
    m=1
    M=cnt
print(m,M)

Measured memory_bytes: 3064
#include <cstdio>
#include <vector>

int main() {
  int H, W;
  size_t N;
  scanf("%d %d %zu", &H, &W, &N);

  std::vector<int> c;
  for (size_t i=1; i<=N; ++i) {
    int a;
    scanf("%d", &a);
    for (int j=0; j<a; ++j)
      c.emplace_back(i);
  }

  for (int i=0, oft=0; i<H; ++i, oft+=W) {
    if (i % 2 == 0) {
      for (int j=0; j<W; ++j) {
        printf("%d%c", c[oft+j], j+1<W? ' ':'\n');
      }
    } else {
      for (int j=0; j<W; ++j) {
        printf("%d%c", c[oft+W-j-1], j+1<W? ' ':'\n');
      }
    }
  }
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;
const int maxn=1005;
char str[maxn][maxn];
bool vis[maxn][maxn];
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};
queue<pii> q1,q2;

int main()
{
	ios::sync_with_stdio(false);
	mes(vis,0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	int ans=0;
	int stx,sty,edx,edy;
	cin>>stx>>sty>>edx>>edy;
	stx--,sty--,edx--,edy--;
	rep(i,0,n) cin>>str[i];
	q1.push(mp(stx,sty));
	q2.push(mp(stx,sty));
	vis[stx][sty]=1;
	
	while(!q1.empty())
	{
		while(!q1.empty())
		{
			q2.push(q1.front());
			rep(i,0,4)
			{
				int xx=q1.front().fi+dx[i],yy=q1.front().se+dy[i];
				if(xx<0||xx>=n||yy<0||yy>=m||vis[xx][yy]||str[xx][yy]=='#') continue;
				vis[xx][yy]=1;
				if(xx==edx&&yy==edy)
				{
					cout<<ans<<"\n";
					return 0;
				}
				q1.push(mp(xx,yy));
			}
			q1.pop();
		}
		ans++;
		while(!q2.empty())
		{
			rept(i,-2,2)
			{
				rept(j,-2,2)
				{
					int xx=q2.front().fi+i,yy=q2.front().se+j;
					if(xx<0||xx>=n||yy<0||yy>=m||vis[xx][yy]||str[xx][yy]=='#') continue;
					vis[xx][yy]=1;
					if(xx==edx&&yy==edy)
					{
						cout<<ans<<"\n";
						return 0;
					}
					q1.push(mp(xx,yy));
				}
			}
			q2.pop();
		}
	}
	cout<<"-1\n";
	return 0;
}

Measured memory_bytes: 5676
#include <cstdio>
#define R register
int N, A, B;
bool Move(R int &a, R int &b)
{
	if(a < b - 1) a++;
	else if(a > b + 1) a--;
	else return 1;
	return 0;
}
int main()
{
	scanf("%d %d %d", &N, &A, &B);
	for(R int i = 1;; i++)
	{
		if(i & 1 && Move(A, B))
		{
			puts("Borys");
			return 0;
		}
		else if(!(i & 1) && Move(B, A)) 
		{
			puts("Alice");
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

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

    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];

    int ans = A[0] - 1;
    int m = 1;
    rep2(i, 1, N) {
        if (A[i] <= m) {
            continue;
        } else if (A[i] == m + 1) {
            m = m + 1;
        } else {
            ans += A[i] / (m + 1) - (A[i] % (m + 1) == 0);
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 1024
function main(input) {
  var a = input[1].trim().split(" ").map(e => parseInt(e, 10));
  var a_max = 10**6+1;
  var dp = new Array(a_max+1).fill(0);
  for(var i of a){
    dp[i]++;
  }
 
  for(var i=1;i<=a_max;i++){
    if(dp[i]==0){ 
    } else {
	    for(var j=i+i;j<=a_max;j+=i){
    	  if(dp[j]!=0){
        	dp[j]=0;
	      }
	    }
    }
  }
  console.log(dp.filter(function(x){return x==1}).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


Measured memory_bytes: 65916
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout<<"a > b"<<endl;
    }else if(a<b){
        cout<<"a < b"<<endl;
    }else{
        cout<<"a == b"<<endl;
    }
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define ri register int
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> poly;
#define pb push_back
const int rlen=1<<18|1,inf=0x3f3f3f3f;
const ll Inf=1e18;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read() {
  int ans=0;
  bool f=1;
  char ch=gc();
  while(!isdigit(ch)) f^=ch=='-',ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return f?ans:-ans;
}
inline ll readl() {
  ll ans=0;
  bool f=1;
  char ch=gc();
  while(!isdigit(ch)) f^=ch=='-',ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return f?ans:-ans;
}
inline int Read(char*s) {
  int tp=0;
  char ch=gc();
  while(!isdigit(ch)&&!isalpha(ch)) ch=gc();
  while(isdigit(ch)||isalpha(ch)) s[++tp]=ch,ch=gc();
  return tp;
}
namespace modular {
  const int mod=1e9+7;
  inline int add(int a,int b) { return a+b<mod?a+b:a+b-mod; }
  inline int dec(int a,int b) { return a<b?a-b+mod:a-b; }
  inline int mul(int a,int b) { return (ll)a*b%mod; }
  inline void Add(int&a,int b) { a=a+b<mod?a+b:a+b-mod; }
  inline void Dec(int&a,int b) { a=a<b?a-b+mod:a-b; }
  inline void Mul(int&a,int b) { a=(ll)a*b%mod; }
  inline int ksm(int a,int p) { int ret=1;for(;p;p>>=1,Mul(a,a)) (p&1)&&(Mul(ret,a),1);return ret; }
  inline int Inv(int a) { return ksm(a,mod-2); }
  inline int sqr(int a) { return mul(a,a); }
  inline int cub(int a) { return (ll)a*a%mod*a%mod; }
}
using namespace modular;
template<typename T> inline void ckmax(T&a,T b) { a<b?a=b:0; }
template<typename T> inline void ckmin(T&a,T b) { a>b?a=b:0; }
template<typename T> inline T gcd(T a,T b) { T t;while(b)t=a,a=b,b=t-t/a*a;return a; }
template<typename T> inline T Abs(T x) { return x<0?-x:x; }
inline int rd() { return rand()|(rand()<<15); }
const int N=5e5+5;
int n,vs[N],f[N];
ll res=0;
char s[N];
vector<int>e[N];
void dfs(int p) {
  vs[p]=1;
  for(ri i=(int)e[p].size()-1;~i;--i) {
    if(!vs[e[p][i]]) dfs(e[p][i]);
    ckmax(f[p],f[e[p][i]]+1);
  }
  res+=f[p];
}
int main() {
  #ifdef ldxcaicai
  freopen("lx.in","r",stdin);
  #endif
  scanf("%s",s+1),n=strlen(s+1);
  f[0]=-1;
  for(ri i=1;i<=n;++i) if(s[i]=='<') e[i+1].pb(i); else e[i].pb(i+1);
  for(ri i=1;i<=n+1;++i) if(!vs[i]) dfs(i);
  cout<<res;
  return 0;
}

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

using namespace std;
typedef long long ll;

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

    int n, k;
    cin >> n >> k;
    int ans=0;
    while(n) {
        ++ans;
        n/=k;
    }
    cout << ans;	
    return 0;
} 
 


Measured memory_bytes: 3544
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())

if N <= 999:
    print("ABC")
else:
    print("ABD")

Measured memory_bytes: 5076
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a==b)
    cout<<a*2<<endl;
  else if(a>b)
    cout<<(2*a)-1<<endl;
  else
    cout<<(2*b)-1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
	int x;
	cin >> x;
	long long int A, B;
	int flag=false;
	for (long long int i=-200; i<=200; i++) {
		for (long long int j=-200; j<=200; j++) {
			A=i*i*i*i*i;
			B=j*j*j*j*j;
			if (A-B==x) {
				cout << i << " " << j << endl;
				flag=true;
				break;
			}
		}
		if (flag) {
			break;
		}
	}
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;



int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n;
    cin >> n;
    cout << n * n * n;


    
}


Measured memory_bytes: 256