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

int main(){
    int n, cnt;
    cin >> n;
    cnt = 0;
    for(int i=n; i>0; i--){
        if(i>=1 && i<=9){
            cnt++;
            continue;
        }
        if(i>=100 && i<=999){
            cnt++;
            continue;
        }
        if(i>=10000 && i<=99999){
            cnt++;
            continue;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main(){
    int n;
    cin >> n;
    set<int> st;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int d; cin >> d;
        if(st.count(d) == 0) {
            st.insert(d);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

const int INF = 1e9;

typedef int Weight;
typedef int Flow;
struct Edge {
	int src, dest, rev;
	Flow cap;
	Weight cost;
	bool operator < (const Edge &rhs) const
	{
		return cost > rhs.cost;
	}
	Edge(int s, int d) : src(s), dest(d) { ; }
	Edge(int s, int d, int c) : src(s), dest(d), cost(c) { ; }
	Edge(int s, int d, int r, Flow cp, Weight cst) : src(s), dest(d), rev(r), cap(cp), cost(cst) { ; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int src, int dest, Flow cap)
{
	g[src].push_back(Edge{ src, dest, (int)g[dest].size(), cap, 0 });
	g[dest].push_back(Edge{ dest, src, (int)g[src].size() - 1, 0, 0 });
}

void add_edge(Graph &g, int from, int to, Flow cap, Weight cost)
{
	g[from].push_back(Edge(from, to, (int)g[to].size(), cap, cost));
	g[to].push_back(Edge(to, from, (int)g[from].size() - 1, 0, -cost));
}

Flow dfs(Graph &g, vector<bool> &used, int v, int t, Flow f)
{
	if (v == t) return f;
	used[v] = true;
	for (Edge& e : g[v])
	{
		if (!used[e.dest] && e.cap > 0)
		{
			Flow d = dfs(g, used, e.dest, t, min(f, e.cap));
			if (d > 0)
			{
				e.cap -= d;
				g[e.dest][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

Flow ford_fulkerson(Graph &g, int s, int t)
{
	Flow flow = 0;
	for (;;)
	{
		vector<bool> used(g.size(), false);
		Flow f = dfs(g, used, s, t, INF);
		if (f == 0) return flow;
		flow += f;
	}
}


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int v, e; cin >> v >> e;
	Graph g(v);
	REP(i, e)
	{
		int a, b, c; cin >> a >> b >> c;
		add_edge(g, a, b, c);
	}
	cout << ford_fulkerson(g, 0, v - 1) << endl;
	return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

int w,h,s[30][30],c[4],d[30][30][4],ans;

int encode(int y,int x){
    return w*y+x;
}

pii decode(int pos){
    return pii(pos/w,pos%w);
}

void dijkstra(){
    ans=inf;
    fill_n((int*)d,900*4,inf);
    d[0][0][0]=0;
    typedef tuple<int,int,int> triple;
    priority_queue<pair<int,triple>,vector<pair<int,triple>>,greater<pair<int,triple>>> que;
    que.push(make_pair(0,triple(0,0,0)));
    while(!que.empty()){
        pair<int,triple> p=que.top(); que.pop();
        int dist=p.first;
        int y=get<0>(p.second),x=get<1>(p.second),dir=get<2>(p.second);

        if(y==h-1 and x==w-1){
            ans=min(ans,dist);
            continue;
        }
        if(dist>d[y][x][dir]) continue;

        rep(i,0,4){
            int cost=c[i],ndir=(dir+i)%4;
            if(i==s[y][x]) cost=0;

            int ny=y+dy[ndir],nx=x+dx[ndir];
            if(ny<0 or h<=ny or nx<0 or w<=nx) continue;
            if(dist+cost<d[ny][nx][ndir]){
                d[ny][nx][ndir]=dist+cost;
                que.push(make_pair(d[ny][nx][ndir],triple(ny,nx,ndir)));
            }
        }
    }
}

void solve(){
    while(true){
        cin >> w >> h;
        if(w==0 and h==0) break;

        rep(y,0,h) rep(x,0,w) cin >> s[y][x];
        rep(i,0,4) cin >> c[i];

        dijkstra();

        cout << ans << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 1336
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] sunuke = new int [n];
		Arrays.fill(sunuke, 0);
		for (int i = 0;i < k; ++i){
			int d = scan.nextInt();
			for (int j = 0;j < d; ++j){
				int a = scan.nextInt();
				++sunuke[a-1];
			}
		}

		int ans = 0;
		for (int i :sunuke){
			if (i == 0)ans++;
		}
		System.out.print(ans);

	}
}

//end

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

const int N = 2e5 + 5;

int n, put[N];
char s[N];

int get(int st) {
    int cnt = 0;
    for (int i = st; i <= n; i += st) {
        if (put[i] == 1) ++cnt;
    }
    return cnt;
}

int main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
    }
    for (int i = n; i >= 1; i--) {
        int cnt = get(i);
        if (s[i] == '0' and cnt & 1) put[i] = 1;
        if (s[i] == '1' and !(cnt & 1)) put[i] = 1;
    }   
    int m = get(1);
    cout << m << '\n';
    for (int i = 1; i <= n; i++) {
        if (put[i]) {
            cout << i << ' ';
        }
    }
    return 0;
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> vvi(n, vector<int>(m));
    vector<int> cost(n);
    REP(i, n)
    {
        cin >> cost[i];
        REP(j, m)
        {
            cin >> vvi[i][j];
        }
    }
    int ans = 1e9;
    REP(i, 1 << n)
    {
        int sum = 0;
        vector<int> rikai(m, 0);
        REP(j, n)
        {
            if (i & (1 << j)) {
                sum += cost[j];
                REP(k, m)
                rikai[k] += vvi[j][k];
            }
        }
        bool f = true;
        REP(j, m)
        {
            if (rikai[j] < x) {
                f = false;
                break;
            }
        }
        if (f) {
            ans = min(ans, sum);
        }
    }
    if (ans == 1e9)
        cout << -1 << endl;
    else
        cout << ans << endl;
}

Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a>b)
	{
		cout<<"0";
	}
	else if(b>=a && c<b/a)
	{
		cout<<c;
	}
	else if(b>=a && c>=b/a)
	{
		cout<<b/a;
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int, a: "List[int]"):
    S = sum(a)
    L = [a[0]]
    for i in range(1, N):
        L.append(L[-1] + a[i])
    mx = 1e12
    for i in range(0, N-1):
        d = abs((S - L[i]) - L[i])
        mx = min(d, mx)
    print(mx)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 35768
#include <bits/stdc++.h>
using namespace std;
int main() {
 int N, K, d, a;
 cin >> N >> K;
 vector<vector<int>> vec(K);
 for(int i=0;i<K;i++) {
   cin >> d;
   for(int j=0;j<d;j++) {
     cin >> a;
     vec.at(i).push_back(a);
   }
 }
  vector<int> vec2;
  bool f = false;
  for(int i=1;i<N+1;i++) {
    f = false;
    for(int j=0;j<vec.size();j++){
      for(int k=0;k<vec.at(j).size();k++) {
        if(i == vec.at(j).at(k)) {
          f = true;
        }
      }
    }
    if(f) {
      vec2.push_back(i);
    }
  }
  cout << N - vec2.size() << endl;
}

Measured memory_bytes: 3644
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin>>n;
	vvi dp(n+1,vi(n+1));
	vp in;
	rep(i,n){
		int a;cin>>a;
		in.pb({-a,i});
	}
	sort(all(in));
	rep(i,n){
		int a=-in[i].first,b=in[i].second;
		int l=0,r=n-i;
		rep(j,i+1){
			cmax(dp[l+1][r],dp[l][r]+a*abs(b-l));
			cmax(dp[l][r-1],dp[l][r]+a*abs(r-b-1));
			l++;r++;
		}
	}
	int out=0;
	rep(i,n+1)cmax(out,dp[i][i]);
	cout<<out<<endl;
}







Measured memory_bytes: 34620
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from bisect import bisect_left

n = ni()
l = list(li())

l.sort()

ans = 0

for i in range(n):
    for j in range(i+1, n):
        k = bisect_left(l, l[i] + l[j])
        ans += (k - j - 1)

print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long
#define mk make_pair
#define hash hashh
using namespace std;
 
const int mod = 1e9 + 7;
const int inf = 1e9;
const int N = 3e5;

int main() {
	ll A, B, n;
	cin >> n >> A >> B;
	if (B < A) {
		cout << "0";
		return 0;
	}
	if (n == 1 && A != B) {
		cout << "0";
		return 0;
	}
	cout << (n - 2) * (B - A) + 1;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
            int[,] seat = new int[line[0] + 1, line[1] + 1];
            for (int i = 0; i < line[0]; i++)
            {
                var sumC = 0;
                var line2 = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
                for (int j = 0; j < line[1]; j++) {
                    seat[i, j] = line2[j];
                    sumC += line2[j];
                }
                seat[i, line[1]] = sumC;
            }

            for (int j = 0; j < line[1] + 1; j++)
            {
                var sumR = 0;
                for (int i = 0; i < line[0]; i++)
                {
                    sumR += seat[i, j];
                }
                seat[line[0], j] = sumR;
            }

            for (int i = 0; i < line[0] + 1; i++)
            {
                for (int j = 0; j < line[1] + 1; j++)
                {
                    if (j == line[1])
                    {
                        Console.WriteLine(seat[i, j]);
                    } else
                    {
                        Console.Write(seat[i, j] + " ");
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 18316
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI2(N, K);
  GI2(X, Y);
  int ans = 0;
  ans += min(K, N) * X;
  ans += max(0, N - K) * Y;
  print(ans);
  return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
c = [[] for i in range(0,h+2)]
ans = "Yes"
c[0] = ["."for i in range(0,w+2)]
c[h+1] = ["."for i in range(0,w+2)]
for i in range(1,h+1):
    d = []
    d = list(input())
    d.append(".")
    d.insert(0,".")
    c[i] = d
for j in range(1,h+1):
    for i in range(1,w+1):
        if c[j][i] == "#":
            flag = "No"
            if(c[j][i-1] == "#"):
                flag = "Yes"
            if(c[j][i+1] == "#"):
                flag = "Yes"
            if(c[j-1][i] == "#"):
                flag = "Yes"
            if(c[j+1][i] == "#"):
                flag = "Yes"
            if(flag == "No"):
                ans = "No"
print(ans)


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

int main(){
  string s;
  cin >> s;
  s = "$"+s;
  cerr << s << endl;
  vector<vector<int>> L(s.length(),vector<int>(26,-1));
  for(size_t i = s.length()-1; i > 0; --i){
    L[i-1] = L[i];
    L[i-1][s[i]-'a'] = i;
  }
  vector<vector<int>> D(s.length(),vector<int>(26));
  vector<int> E(s.length());
  for(size_t i = s.length()-1; i < s.length(); --i){
    for(int j = 0; j < 26; ++j){
      if(L[i][j] < 0) continue;
      D[i][j] = E[L[i][j]];
    }
    if(i == 0) continue;
    int t = *min_element(D[i].begin(), D[i].end());
    E[i] = t+1;
  }
  string ans;
  int idx = 0;
  while(1){
    int mi = *min_element(D[idx].begin(), D[idx].end());
    for(int i = 0; i < 26; ++i){
      if(D[idx][i] > mi) continue;
      ans += 'a'+i;
      idx = L[idx][i];
      break;
    }
    if(idx < 0) break;
  }
  cout << ans << endl;
}


Measured memory_bytes: 55600
#include <bits/stdc++.h>
using namespace std;
int dp[100200],h[100200];
int n,k;
int ds(int id) {
	if(id >= n) {return 1000000100;}
	if(id == n-1) {return 0;}
	if(dp[id] != -1) {return dp[id];}
	int val = 1000000100;
	for(int i=k;i>=1;i--) {
		val = min(val,ds(i+id)+abs(h[i+id]-h[id]));
	}
	return dp[id] = val;
}
int main() {
	scanf("%d %d ",&n,&k);
	memset(dp,-1,sizeof(dp));
	memset(h,0,sizeof(h));
	for(int i=0;i<n;i++) {
		int t;
		scanf("%d ",&t);
		h[i] = t;
	}
	printf("%d\n",ds(0));
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B, K;
    cin >> A >> B >> K;

    ll count = 0;
    for(ll i=max(A,B); i>=1; i--){
        if(A%i == 0 && B%i == 0){
            count++;
        }
        if(count == K){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3592
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void main() {
    int k;
    while ((k = readint) != 0) {
        auto xs = readints;
        writeln(xs.sum / (k - 1));
    }
}

Measured memory_bytes: 4156
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&b!=a)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = [list(map(int,input().split())) for i in range(n)]
a = [[] for i in range(n)]
for i in range(n):
    a[i] = [l[i][0]-l[i][1],l[i][0]+l[i][1]]
a = list(sorted(a,key=lambda x: x[1]))
s,t = [list(i) for i in zip(*a)]
x = t[0]
ans = n
for i in range(1,n):
    if x > s[i]:
        ans -= 1
    else:
        x = t[i]
print(ans)

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

using namespace std;

const int SIZE = 1 << 17;
int pointer = SIZE;
char buffer[SIZE];

char Advance() {
    if (pointer == SIZE) {
        fread(buffer, 1, SIZE, stdin);
        pointer = 0;
    }
    return buffer[pointer++];
}

int Read() {
    int answer = 0;
    char ch = Advance();
    while (!isdigit(ch))
        ch = Advance();
    while (isdigit(ch)) {
        answer = answer * 10 + ch - '0';
        ch = Advance();
    }
    return answer;
}

const int INF = 1000000000;

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    long long s;
    scanf("%lld", &s);
    long long t = s / INF, r = s % INF, a, b;
    if (!r) {
        a = t;
        b = 0;
    }
    else {
        a = t + 1;
        b = INF - r;
    }
    printf("%d %d %d %d %lld %lld\n", 0, 0, INF, 1, b, a);
    return 0;
}


Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <algorithm>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 300005;
int al[maxn], ar[maxn];
std::vector<int> tor[maxn];
int ans[maxn];

struct Tree {
	int lti, rti;
	int val;
};
#define self pool[now]
#define lt pool[self.lti]
#define rt pool[self.rti]
Tree pool[maxn * 20];
int pp;

void lain(int &now, int L, int R, int p) {
	pool[++ pp] = self;
	now = pp;
	/* debug("%d %d %d %d\n", now, L, R, p); */
	++ self.val;
	if(L == R) return;
	int M = (L + R) >> 1;
	if(p <= M) lain(self.lti, L, M, p);
	else lain(self.rti, M + 1, R, p);
}

int query(int now, int L, int R, int l, int r) {
	if(!now or r < L or l > R) return 0;
	if(l <= L and R <= r) return self.val;
	int M = (L + R) >> 1;
	return query(self.lti, L, M, l, r) + query(self.rti, M + 1, R, l, r);
}

int T[maxn];

int main() {
	int n = read, m = read;

	for(int i = 1; i <= n; i ++) {
		read(al[i], ar[i]);
		tor[al[i]].push_back(ar[i]);
	}

	for(int l = 0; l <= m; l ++) {
		if(l) T[l] = T[l - 1];
		for(int r : tor[l])
			lain(T[l], 0, m, r);
	}

	for(int d = 1; d <= m; d ++)
		for(int t = 0; t <= m / d; t ++) {
			int l = t * d + 1, r = t * d + d;
			ans[d] += query(T[r], 0, m, r, m) - query(T[l - 1], 0, m, r, m);
		}

/* 	for(int t = 0; t <= m; t ++) */
/* 		for(int d = 1; d <= (t ? m / t : m); d ++) { */
/* 			int l = t * d + 1, r = t * d + d; */
/* 			if(r > m) break; */
/* 			/1* debug("%d %d : %d %d\n", t, d, l, r); *1/ */
/* 			/1* for(int i = 1; i <= n; i ++) *1/ */
/* 			/1* 	if(l <= al[i] and al[i] <= r and ar[i] >= r) *1/ */
/* 			/1* 		++ ans[d]; *1/ */
/* 			ans[d] += query(T[r], 0, m, r, m) - query(T[l - 1], 0, m, r, m); */
/* 			/1* debug("%d %d\n", query(T[r], 0, m, r, m), query(T[l - 1], 0, m, r, m)); *1/ */
		/* } */

	for(int i = 1; i <= m; i ++)
		printf("%d\n", ans[i]);
}


Measured memory_bytes: 78720
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n){
        cin >> c[i];
        rep(j, m)cin >> a[i][j];
    }

    bool able = false;
    int cost = 1001001001;
    rep(i, (1 << n)){
        int sum = 0;
        vector<int> b(m, 0);
        rep(j, n){
            if(1 & (i >> j)){
                sum += c[j];
                rep(k, m)b[k] += a[j][k];
            }
        }
        bool val = true;
        rep(j, m)if(b[j] < x)val = false;
        if(val && sum < cost){
            able = true;
            cost = sum;
        }
    }

    if(able)cout << cost << endl;
    else cout << -1 << endl;
    
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
 
using namespace std;
 
int main(){
 
    ll a,b;
    cin >> a >> b;

    if(a <= b){
        if(a*b >= 0){
            cout << b-a;
        }else if(a+b >= 0){
            cout << b+a+1;
        }else{
            cout << -a-b+1;
        }
    }else{
        if(a*b > 0){
            cout << a-b+2;
        }else{
            cout << llabs(a+b)+1;
        }
    }

    return 0;
}

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

int main() {

	string X, Y;
	cin >> X >> Y;

	if (X[0] == Y[2] && X[1] == Y[1] && X[2] == Y[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in(),Q=in();
	vector<priority_queue<int>> S(N);
	REP(i,Q){
		int q=in();
		int t=in();
		if(!q){
			S[t].push(in());
		}
		else if(q==1){
			if(!S[t].empty()) out(S[t].top());
		}
		else{
			if(!S[t].empty()) S[t].pop();
		}
	}

	return 0;
}


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

int main(void) {
  int a, b;
  cin >> a >> b;
  if(a >=13) {
  cout << b << endl;
  }else if(12 >= a && a >= 6) {
  cout << b/2 << endl;
  }else {
    cout << "0" << endl;
  }

}


Measured memory_bytes: 256
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define bug2(v1,v2)               cerr<<#v1<<" = "<<(v1)<< ' ' << #v2<<" = "<<(v2)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
//const ll mod = 998244353;
const ll mod = 1000000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
ll a[MAX],b[MAX];


int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;

cin >> n;
map<ll,ll> mp;
fr(i,0,n){
	cin >> k;
	mp[k]++;
}
vll v;
for(auto x:mp)
	v.pb(x.F);
if(v.size()<3){
	cout << 0;
	return 0;
}
ll ans = 0;
fr(i,0,v.size()-2)
{
	fr(j,i+1,v.size()-1)
	{
		fr(k,j+1,v.size())
			if(v[i]+v[j]>v[k])
				ans+= (mp[v[i]]*mp[v[j]]*mp[v[k]]);
	}
}
cout << ans;
  
 eNd();
  return 0;
 
}

Measured memory_bytes: 3632
N,D = map(int,input().split())
X=[]
for i in range(N):
    X.append(list(map(int, input().split())))
    
ans=0

for i in range(N):
    for j in range(N):
        if i < j:
            dist=0
            for k in range(D):
                dist += (X[i][k] - X[j][k])**2
            dist = dist ** 0.5
            if round(dist,0) == dist:
                ans += 1
           
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
   
    string a;
    cin >> a;
    char s=a[0];
    int count=0;
    for(int i=1;i<a.size();i++){
     if(a[i]!=s){count++;s=a[i];}
     }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
 unsigned long long A;
 unsigned long long B;
 unsigned long long K;
 unsigned long long out;
 
 scanf("%llu %llu %llu",&K,&A,&B);

 if (B>A+1)
 {
  if(K>A)
  {
   out=A+(B-A)*((K-(A-1))/2);
   out=out+(K-(A-1))%2;
  }else{
   out=1+K;
  }
 }else{
  out=1+K;
 }
 printf("%llu\n",out);
 return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        long[] x = in.nl(n);
        for (int i = 0; i < n; i++) x[i] -= (i+1);
        Arrays.sort(x);
        long neg = 0, pos = 0;
        for (int i = 1; i < n; i++) pos += x[i]-x[0];
        long min = pos+neg;
        for (int i = 1; i < n; i++) {
            pos -= (n-i)*(x[i]-x[i-1]);
            neg += i*(x[i]-x[i-1]);
            min = Math.min(min, pos+neg);
        }
        out.println(min);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 45908
H, W = map(int,input().split())
S = [list(input()) for i in range(H)]

for h in range(H) :
    for w in range(W) :
        if S[h][w] == "#" :
            pass
        else :
            k = 0
            for a in range(-1,2) :
                for b in range(-1,2) :
                    if h+a >= 0 and w+b >= 0 and S[h+a:] :
                        if S[h+a:][0][w+b:] :
                            if S[h+a][w+b] == "#" :
                                k += 1
            S[h][w] = str(k)

ans = ["".join(list(S[h])) for h in range(H)]
for h in range(H) :
    print(ans[h])

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;

void solve() {
	ll d,n;
	cin>>d>>n;vll A(n),dist;
	for(int i=0;i<n;i++) cin>>A[i];
	for(int i=0;i+1<n;i++)
		dist.pb(A[i+1]-A[i]);
	dist.pb(d-A[n-1]+A[0]);
	cout<<d-*max_element(all(dist));
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

	//ll t;cin>>t;while(t--)
	solve();

}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
template <class c> struct rge { c b, e; };
template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; }
template <class c> auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c> char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
template <class c> typename enable_if<sizeof dud<c>(0)!=1, debug&>::type operator<<(c i) {cerr << boolalpha << i; return * this; }
template <class c> typename enable_if<sizeof dud<c>(0)==1, debug&>::type operator<<(c i) {return * this << range(begin(i), end(i)); }
template <class c, class b> debug & operator <<(pair < b, c > d) {
  return * this << "(" << d.first << ", " << d.second << ")";
}
template <class c> debug & operator <<(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  return * this << "]";
}
#else
template <class c> debug & operator <<(const c&) { return * this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


typedef long long ll;
typedef long double ld;

#define ar array

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound 

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

int main() {
	int k;
	cin >> k;
	string s;
	cin >> s;
	if (s.size() <= k) {
		cout << s << endl;
		return 0;
	}
	cout << s.substr(0,k)+"...\n";
    return 0;    
}


Measured memory_bytes: 3608
#include <atcoder/twosat>
#include <iostream>
#include <vector>

using namespace std;
using namespace atcoder;

int main() {
    int n, d;
    cin >> n >> d;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    // ts[i] = (i-th flag is located on x[i])
    two_sat ts(n);

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (abs(x[i] - x[j]) < d) {
                // cannot use both of x[i] and x[j]
                // not (x[i] : True and x[j] : True)
                // equal 
                // (x[i] : False or x[j] : False)
                // equal 
                // (y[i] : True or y[j] : True)              
                ts.add_clause(i, false, j, false);
            }
            if (abs(x[i] - y[j]) < d) {
                ts.add_clause(i, false, j, true);
            }
            if (abs(y[i] - x[j]) < d) {
                ts.add_clause(i, true, j, false);
            }
            if (abs(y[i] - y[j]) < d) {
                ts.add_clause(i, true, j, true);
            }
        }
    }

    if (!ts.satisfiable()) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    auto answer = ts.answer();//[True or False] * len(ts.answer())
    for (int i = 0; i < n; i++) {
        if (answer[i])
            cout << x[i] << endl;
        else
            cout << y[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return int64(a)
}

func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanTextSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = scanText()
	}
	return a
}

func scanSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanFloatSlice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = scanFloat()
	}
	return a
}

func scanInt64Slice(n int64) []int64 {
	a := make([]int64, n)
	for i := int64(0); i < n; i++ {
		a[i] = scanInt64()
	}
	return a
}

// var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	// n := scanInt()

	input := scanSlice(2)
	n := input[0]
	k := input[1]

	arr := scanSlice(n)
	sort.Ints(arr)
	// fmt.Println(arr)

	// maze := make([]string, 0)

	amount := int64(0)

	for i := n - k - 1; i >= 0; i-- {
		temp := arr[i]
		amount += int64(temp)
	}

	fmt.Println(amount)

	// for i := 0; i < n; i++ {

	// }

	// fmt.Println(ans)

}

func calc() int {

	return 0

}

type position struct {
	x        int
	y        int
	distanse int
}

func binarySearch(arr []int, number int) int {

	l := -1
	r := len(arr)
	index := 0
	for {
		mid := l + (r-l)/2
		tmp := arr[mid]

		if r-l <= 1 || tmp == number {
			index = mid
			break
		} else if tmp < number {
			l = mid
		} else {
			r = mid
		}
	}
	return index
}

func factorial(n int) int64 {
	sum := int64(1)
	for i := 2; i <= n; i++ {
		sum *= int64(i)
	}
	return sum
}

func deleteNumOfArray(arr []int, position int) []int {
	left := arr[:position]
	r := arr[position+1:]
	appendArr := append(left, r...)
	return appendArr
}


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

ll mod = 1000000007;

ll add( ll x, ll y){
  ll wa = ( (x % mod) + (y % mod) ) % mod;
  return wa;
}
int main(){
  ll n,m;
  cin >> n >> m;
  set<ll> broken;
  for ( int i = 0; i < m; ++i ) {
    ll a;cin >> a;
    broken.insert(a);
  }
  vector<int> dp(n+5);
  dp[0] = 1;
  for ( ll i = 1; i <= n; ++i ) {
    if( broken.count(i) ) {
      dp[i] = 0;
    } else {
      dp[i] = (add(dp[i - 1], dp[i - 2]) % mod);
    }
  }

  cout << dp[n] % mod<< endl;
  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    double R;
    cin >> R;

    R *= 2 * 3.1415926536;
    printf("%.7lf\n", R);
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

vector<vector<int>> v(11111);
int color[11111];
int used[11111];
int c[5];
vector<pair<pair<int,int>,int>> order;
int n,m,distantColor;

int checkColor(int a){
	REP(i,5)c[i] = 0;
	REP(i,v[a].size()){
		c[color[v[a][i]]] = 1;
	}
	REP(i,4)if(!c[i+1])return i + 1;
	return -1;
}

bool readyDfs(int a,int par){
	REP(i,5)c[i] = 0;
	c[color[a]] = 2;
	REP(i,v[a].size()){
		if(used[v[a][i]] == par){
			c[color[v[a][i]]] = true;
		}
	}
	int cou = 0;
	REP(i,4){
		if(c[i+1])cou++;
	}
	return cou == 3;
}

void dfs(int a,int nowColor, int revColor, int par){
	color[a] = revColor;
	REP(i,v[a].size()){
		if(v[a][i] == par)continue;
		if(color[v[a][i]] == revColor){
			dfs(v[a][i], revColor, nowColor, a);
		}
	}
}

int draw(int a){
	int check = checkColor(a);
	if(check != -1)return check;
	REP(i,v[a].size())used[v[a][i]] = a;
	REP(i,v[a].size()){
		if(color[v[a][i]] == 0)continue;
		readyDfs(v[a][i], a);
		REP(j,4)if(c[j+1] == 0){
			dfs(v[a][i], color[v[a][i]], j + 1, a);
			check = checkColor(a);
			if(check != -1)return check;
		}
	}
	//Not reach
	exit(1);
	return -1;
}

int main(){
	
	cin >> n >> m;
	REP(i,n){
		int a,b;cin >> a >> b;
		order.PB(MP(MP(a,b),i));
	}
	REP(i,m){
		int a,b;cin >> a >> b;
		a--; b--;
		v[a].EB(b);
		v[b].EB(a);
	}
		
	sort(ALL(order));
	REP(i,n)color[order[i].SE] = draw(order[i].SE);
	
	REP(i,n)cout << color[i] << endl;
	
	return 0;
}



Measured memory_bytes: 3456
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#include <limits>
using namespace std;

#define int int64_t
#define pr(x) cout << x << endl;
#define vi vector<int>
#define vii vector< vector<int> >
#define mp make_pair
#define ii pair<int,int>
#define fr(i,x,n) for(i = x ; i< n ; i++)
#define f(i,n) for(i = 0 ; i< n ; i++)
#define ff first
#define ss second
#define pb push_back
#define SIZE 200001
#define mod 1000000007
#define int_max 1e12
void solve();
int dp[SIZE]={0};
 
int power(int a, int b)
{
    if(b==0) return 1;
    else if(b&1) return a*power(a*a,b/2);
    else return power(a*a, b/2);
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

int  j=1, n, t, m=0, dot=0, i,  l, r, k, q, a, x, y, z, n1, m1;

void solve()
{
//    cin >> t;while(t--)
   {
       cin >> n;
       cout << n*n*n;
   }
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=2
    k=1
    for i in range(1,1000):
        if k==n:
            print("Yes")
            break
        if k>n:
            print("No")
            sys.exit()
        k+=s
        s+=1
    lis=[[]for _ in range(s)]
    x=1
    for i in range(s-1):
        for j in range(i+1,s):
            lis[i].append(x)
            lis[j].append(x)
            x+=1
    print(len(lis))
    for l in lis:
        print(str(len(l))+' '+' '.join(map(str,l)))

    

if __name__=='__main__':
    main()

Measured memory_bytes: 9076
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];puts("");}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
// #define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

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

	int n;
	cin>>n;
	vvi out;
	rep(i,n)rep(j,i){
		if(i+j+2==n+(n+1)%2)continue;
		out.pb({j+1,i+1});
	}
	cout<<out.size()<<endl;
	for(auto a:out)cout<<a[0]<<" "<<a[1]<<endl;
}


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

string s;

int main(){
	
	std::cin >> s;
	if(s == "SUN") puts("7");
	if(s == "SAT") puts("1");
	if(s == "MON") puts("6");
	if(s == "TUE") puts("5");
	if(s == "WED") puts("4");
	if(s == "THU") puts("3");
	if(s == "FRI") puts("2");
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
 int S,h,m,s;
 scanf("%d", &S);
 h = S / 3600;
 m = (S - 3600 * h) / 60;
 s = S - 3600 * h - 60 * m;
 printf("%d:%d:%d\n", h, m, s);
 return 0;
}

Measured memory_bytes: 1852
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD  = int(1e9) + 7;

signed main()
{
  int n;
  cin >> n;
  cout << (180 * (n- 2)) << endl;
  return 0;
}



Measured memory_bytes: 256
def resolve():
    '''
    code here
    '''
    s = [item for item in input()]
    t = [item for item in input()]

    rs = ''.join(sorted(s))
    rt = ''.join(list(reversed(sorted(t))))


    if rs < rt:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    resolve()


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

using ll = long long;

ll N, M;
vector<ll> A(101);

void solve(){
    ll sum = 0;
    for(ll i = 1; i <= N; ++i){
        sum += A[i];
    }
    ll c = 0;
    for(ll i = 1; i <= N; ++i){
        if(sum <= 4 * M * A[i]) c++;
    }
    if(c >= M) cout <<"Yes";
    else cout << "No";
}
int main(){
    cin >> N >> M;
    for(ll i = 1; i <= N; ++i){
        cin >> A[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 256