akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <vector>

using namespace std;

int flood[20010];

int main() {
    int allFlood = 0, sum = 0;
    string s;
    stack<int> st;
    vector<int> v;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '\\') st.push(i);
        else if (s[i] == '/' && !st.empty()) {
            for (int j = st.top(); j < i; ++j) {
                flood[j]++;
                allFlood++;
            }
            st.pop();
        }
    }
    cout << allFlood << endl;
    for (int i = 0; i < s.size(); ++i) {
        if (flood[i]) sum += flood[i];
        else if (sum) {
            v.push_back(sum);
            sum = 0;
        }
    }
    cout << v.size();
    for (int i = 0; i < v.size(); ++i) cout << ' ' << v[i];
    cout << endl;
    return 0;
}


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

int main(void){
	int n;
	int *a;

	cin >> n;

	a = new int[n];
	for (int i = 0; i<n; i++){
		cin >> a[i];
	}

	for (int i = n-1; i >0; i--){
		cout << a[i] <<" ";
	}

	cout << a[0] << endl;

	return 0;
}

Measured memory_bytes: 1188
h,w,n = map(int, input().split())
stage = [input() for i in range(h)]
starts = [str(i) for i in range(n)]
goals = [str(i+1) for i in range(n)]
starts_y = [0 for i in range(n)]
starts_x = [0 for i in range(n)]
goals_y = [0 for i in range(n)]
goals_x = [0 for i in range(n)]

starts[0] = "S"
for y in range(h):
    for x in range(w):
        if stage[y][x] in starts:
            starts_y[starts.index(stage[y][x])] = y
            starts_x[starts.index(stage[y][x])] = x
        if stage[y][x] in goals:
            goals_y[goals.index(stage[y][x])] = y
            goals_x[goals.index(stage[y][x])] = x

move_y = [1,-1,0,0]
move_x = [0,0,1,-1]
sum = 0

for start_y, start_x, goal_y, goal_x in zip(starts_y, starts_x, goals_y, goals_x):
    bfs_map = [[-1 for j in range(w)] for i in range(h)]
    data_y = [start_y]
    data_x = [start_x]
    bfs_map[start_y][start_x] = 0
    goal = False

    while len(data_y) != 0 and not goal:
        y = data_y.pop(0)
        x = data_x.pop(0)
        goal = False

        for i in range(4):
            y += move_y[i]
            x += move_x[i]

            if y >= 0 and y < h and x >= 0 and x < w:
                if bfs_map[y][x] == -1 and stage[y][x] != "X":
                    bfs_map[y][x] = bfs_map[y-move_y[i]][x-move_x[i]]+1
                    data_y.append(y)
                    data_x.append(x)
                if bfs_map[goal_y][goal_x] != -1:
                    sum += bfs_map[goal_y][goal_x]
                    goal = True
                    break
            y -= move_y[i]
            x -= move_x[i]

print(sum)


Measured memory_bytes: 36512
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	long long int start, temp = 0, start2 = 0;
	int year, n, y, m, i, j;
	char a;
	double x;
	int ans[100], count = 0;

	cin >> m;
	for(i = 0;i < m;i++){
		cin >> start >> year >> n;
		for(j = 0;j < n;j++){
			cin >> a >> x >> y;
			start2 = start;
			if(a == '0'){
				for(int k = 0;k < year;k++){
					temp += (int)(start2 * x);
					start2 -= y;
				}
				ans[count] = start2 + temp;
				//cout << ans[count] << " " << start2 << " " << temp << endl;
				temp = 0;
				count++;
			}
			else if(a == '1'){
				for(int k = 0;k < year;k++){
					temp += (int)(start2 * x);
					start2 = start2 + temp - y;
					temp = 0;
				}
				ans[count] = start2;
				//cout << ans[count] << " " << start2 << " " << temp << endl;
				count++;
			}
		}
		sort(ans, ans+count);
		cout << ans[count-1] << endl;
		for(int k = 0;k < count;k++){
			ans[k] = 0;
		}
		count = 0;

	}

	return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr ll INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

ll N,K,cnt = 0,ans = 0;

void solve(auto &V){
    bool flag = 0;
    repp(i,40,0){
        vector<ll> W;
        ll bit = (1LL << i); 
        ll Y = 0;
        REP(j,V.size()){
            if((V[j] & bit) == bit){
                W.pb(V[j]);
                ++Y;
            }
        }
        if(Y >= K){
            ans |= bit;
            V.swap(W);
        }
    }
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    cin >> N >> K;
    vector<ll> A(N),V;
    REP(i,N){cin >> A[i];}
    REP(i,N){
        ll sum = 0;
        REPP(j,i,N){
            sum += A[j];
            V.pb(sum);
        }
    }
    sort ALL(V);
    reverse ALL(V);
    solve(V);
    cout << ans << endl;
}

Measured memory_bytes: 6384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Objects;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		// 自前の例
		assert Objects.equals(
				solve(4, 5, new int[][] { { 1, 4, 1 }, { 2, 3, 1 }, { 3, 2, 1 }, { 3, 4, 1 }, { 1, 2, 1 } }), "inf");
		// 問題の例
		assert Objects.equals(solve(3, 3, new int[][] { { 1, 2, 4 }, { 2, 3, 3 }, { 1, 3, 5 } }), "7");
		assert Objects.equals(solve(2, 2, new int[][] { { 1, 2, 1 }, { 2, 1, 1 } }), "inf");
		assert Objects.equals(solve(6, 5, new int[][] { { 1, 2, -1000000000 }, { 2, 3, -1000000000 },
				{ 3, 4, -1000000000 }, { 4, 5, -1000000000 }, { 5, 6, -1000000000 } }), "-5000000000");

		int n = cin.nextInt();
		int m = cin.nextInt();
		int[][] abcs = new int[m][];
		for (int i = 0; i < abcs.length; i++)
			abcs[i] = new int[] { cin.nextInt(), cin.nextInt(), cin.nextInt() };

		String ans = solve(n, m, abcs);
		cout.println(ans);
	}

	private static String solve(int n, int m, int[][] abcs) {
		// https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm
		long[] dist = new long[n + 1];
		Arrays.fill(dist, Long.MAX_VALUE / 2);
		dist[1] = 0;
		int[][] edges = new int[abcs.length][];
		for (int i = 0; i < abcs.length; i++)
			edges[i] = new int[] { abcs[i][0], abcs[i][1], -abcs[i][2] };
		for (int i = 2; i < dist.length; i++)
			for (int[] e : edges)
				dist[e[1]] = Math.min(dist[e[1]], dist[e[0]] + e[2]);
		long ans = dist[n];
		// negative-weight cycleの扱いがwikiと違う理由
		// wikiの場合、グラフの中のどこかに含まれるとアウト
		// この問題の場合、1-nの経路の中に含まれるとアウト
		for (int i = 2; i < dist.length; i++)
			for (int[] e : edges)
				dist[e[1]] = Math.min(dist[e[1]], dist[e[0]] + e[2]);
		if (ans != dist[n])
			return "inf";

		return Long.toString(-ans);
	}

	/**
	 * How to read input in Java — tutorial <br />
	 * By Flatfoot<br />
	 * http://codeforces.com/blog/entry/7018
	 */
	static class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new IllegalStateException(e);
				}
			return st.nextToken();
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException(e);
			}
			return str;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 23892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		double p = Math.pow((k-1), (n-1));
		System.out.println((int)(k*p));

	}

}


Measured memory_bytes: 21844
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#define curr(P, i) P[(i) % P.size()]
#define next(P, i) P[(i+1) % P.size()]
using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}
  point operator + (point p){return point(add(x,p.x), add(y,p.y));}
  point operator - (point p){return point(add(x,-p.x), add(y,-p.y));}
};

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

int is_point_on_line(point a, point b, point c) {
  return cross(b-a,c-a)==0.0 && dot(b-a,c-a)>-EPS && dot(a-b,c-b)>-EPS;
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {
  if(cross(a1-a2,b1-b2)==0){
    return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2) 
        || is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
  }
  else {
    return (cross(a2-a1, b1-a1)*cross(a2-a1, b2-a1)<EPS ) &&
           (cross(b2-b1, a1-b1)*cross(b2-b1, a2-b1)<EPS );
  }
}

int contain(point p, vector<point> ps){
  point a=p,b(1000000,p.y);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<ps.size();i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;

  int cnt=0,cnt1=0;
  for(int i=0;i<ps.size();i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  for(int i=0;i<ps.size();i++)
    if(is_intersected_ls(ps[i],next(ps,i),a,b))cnt++;
 
  return (cnt-cnt1)%2;
}


int main(void){
 
  point in[4],p;

  while(true){
    vector<point>ps(3);

    for(int i=0;i<3;i++)
      if(!(cin >> ps[i].x >> ps[i].y))return 0;

    cin >> p.x >> p.y;
    
    if(contain(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
N = int(input())
A = (int(i) // 400 for i in input().split())

m, d = [0] * 8, 0
for a in A:
    if a >= 8:
        d += 1
    else:
        m[a] = 1
s = sum(m)
if s > 0:
    print(s, s + d)
else:
    print(1, N)


Measured memory_bytes: 2940
import sys

def shuffle(str, h):
	head = str[0:h]
	tail = str[h:]
	shuffled_str = tail + head
	return shuffled_str

#fin = open("test.txt", "r")
fin = sys.stdin

while True:
	str = fin.readline()
	str = str.rstrip("\n")

	if(str == "-"):
		break

	m = int(fin.readline())

	for i in range(m):
		h = int(fin.readline())
		str = shuffle(str, h)

	print(str)

Measured memory_bytes: 7628
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int N = 0;

        for (int i = 0; i < s.length(); i++) {    //1文字ずつ足していく
            N += Integer.parseInt(s.substring(i, i + 1));
        }
        
        if (N % 9 == 0)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 49700
table = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    table[b - 1][f - 1][r - 1] += v

for i in range(len(table)):
    for  j in range(len(table[i])):
        for k in range(len(table[i][j])):
            print(' %d' %(table[i][j][k]), end = '')
        print('')
    if i != len(table) - 1:
        print('####################')



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


ll N;

struct pinfo {
	int p;
	int pos;
};




class Comp1 {
public:
	bool operator() ( const pinfo &l, const pinfo &r ){
		return l.p > r.p;
	};
};

class Comp2 {
public:
	bool operator() ( const pinfo &l, const pinfo &r ){
		return l.p > r.p;
	};
};

int pos[200005];

int next1[200005]; // pos -> next pos
int next2[200005]; // pos -> next next pos
int last1[200005];
int last2[200005];

int main(){
	cin >> N;
	vector<int> P(N);
	for ( int i = 0;i  < N; i++ ){
		cin >> P[i];
		pos[P[i]] = i;
	}
	
	for ( int i = 0; i < N; i++ ){
		next1[i] = next2[i] = N;
		last1[i] = last2[i] = -1;
	}
	
	// 全てのiについて、「次にP[i]以上の値がある位置」「次の次にP[i]以上の値がある位置」を調べる
	{
		priority_queue<pinfo,vector<pinfo>,Comp1> q1, q2;
		for ( int i = 0; i < N; i++ ){
			while ( !q2.empty() && q2.top().p < P[i] ){
				pinfo p = q2.top();
				q2.pop();
				next2[p.pos] = i;
			}
			
			while ( !q1.empty() && q1.top().p < P[i] ){
				pinfo p = q1.top();
				q1.pop();
				q2.push(p);
				next1[p.pos] = i;
			}
			
			q1.push({P[i],i});
		}
	}
	
	// 逆方向も調べる
	{
		priority_queue<pinfo,vector<pinfo>,Comp2> q1, q2;
		for ( int i = N-1; i >= 0; i-- ){
			while ( !q2.empty() && q2.top().p < P[i] ){
				pinfo p = q2.top();
				q2.pop();
				last2[p.pos] = i;
			}
			
			while ( !q1.empty() && q1.top().p < P[i] ){
				pinfo p = q1.top();
				q1.pop();
				q2.push(p);
				last1[p.pos] = i;
			}
			
			q1.push({P[i],i});
		}
	}
	
	
	
	
	//for ( int i = 0; i < N; i++ )		cout << last2[i] << " ";
	//cout << endl;
	//for ( int i = 0; i < N; i++ )		cout << last1[i] << " ";
	//cout << endl;
	//for ( int i = 0; i < N; i++ )		cout << i << " ";
	//cout << endl;
	//for ( int i = 0; i < N; i++ )		cout << next1[i] << " ";
	//cout << endl;
	//for ( int i = 0; i < N; i++ )		cout << next2[i] << " ";
	//cout << endl;
	
	ll sum = 0;
	for ( int i = 0; i < N; i++ ){
		sum += P[i] * ( 
			(ll)(next2[i]-next1[i]) * (i-last1[i]) +  // iより後方でP[i]が2番目になる(L,R)の個数
			(ll)(last1[i]-last2[i]) * (next1[i]-i)    // iより前方でP[i]が2番目になる(L,R)の個数
		);
	}
	
	
	cout << sum << endl;
	
	
	return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pr pair<ll, ll>
#define vct vector<ll>
#define vpt vector<pr>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define F(i, n) for (i = 0; i < (1LL*n); i++)
#define Fr(i, n) for (i = n - 1; i >= 0; i--)
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, int, custom_hash>
void prv(vct v)
{
    for (ll i = 0; i < v.size(); i++)
        cout << v[i] << " ";
    cout << "\n";
}
ll poww(ll x, ll y, ll m)
{
    ll res = 1;
    while (y)
    {
        if (y % 2 == 0)
        {
            x = (x * x) % m;
            y = y / 2;
        }
        else
        {
            res = (res * x) % m;
            y--;
        }
    }
    return res;
}
void deb(string s, ll n)
{
    cout << s << " : " << n << "\n";
}
void prn(ll n) { cout << n << "\n"; }
void prs(string n) { cout << n << "\n"; }
ll cntd(ll n){
    ll an=0;
    while(n){
        an+=(n%10);
        n/=10;
    }
    return an;
}
mat mt;
void setmtsize(ll m,ll n, ll ini=0){
    mt.resize(m,vector<ll>(n,ini));
}
void prmt(mat m){
    for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);
}

ll n, k, m, l, r, x, y, ans=0;
ll t, t1, t2;

ll i, j;
ll a, b;
ll mod = 1000000007;


void solve()
{
    cin>>n;
    ans=0;
    F(i,n)ans+=((i+1)*(n-i));
    
    F(i,n-1){
        cin>>t1>>t2;
        if(t1>t2)swap(t1,t2);
        ll tot=t1*((n-t2)+1);
        ans-=tot;
    }
    prn(ans);

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner in=new Scanner(System.in);
        int A=in.nextInt();
        int B=in.nextInt();
        int C=in.nextInt();
        int D=in.nextInt();
        int E=A+B;
        int F=C+D;
        if(E>F){
            System.out.println("Left");
        }
        if(E==F){
            System.out.println("Balanced");
        }
        if(E<F){
            System.out.println("Right");
        }
        
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int solve(int n) {
  int ret = 1;
  for (int b = 1; b <= n * 2; ++b) {
    for (int p = 2; p <= n * 2; ++p) {
      int v = pow(b, p);
      // cout << v << endl;
      if (v > n) {
        break;
      }
      ret = max(ret, v);
    }
  }
  return ret;
}

int main() {
  int x;
  cin >> x;
  cout << solve(x) << endl;
}


Measured memory_bytes: 384
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

t1 = 0
a.each_with_index do |i,index_i|
  a.each_with_index do |j,index_j|
    next if index_i > index_j
  	t1 += 1 if i > j
  end
end

tn = 0
b = a.sort.reverse
b.each_with_index do |i,index_i|
  b.each_with_index do |j,index_j|
    next if index_i > index_j
  	tn += 1 if i > j
  end
end

t_sum = k*t1 + (k*(k-1)/2)*tn
ans = t_sum % ((10**9) + 7)

puts ans

Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int main(){
    
    int N;

    cin >> N;
    
    int i;
    int ans = 0;
    int prev = -1;
    int count = 0;
    
    for(i=0;i<N;i++){
        int now;
        
        cin >> now;
        
        if(prev >= now){
            count++;
        }
        else{
            if(count > ans){
                ans = count;
            }
            count = 0;
        }
        
        prev = now;
        
    }
    
    if(count > ans){
                ans = count;
            }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{

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

Measured memory_bytes: 3632
import sys, math

readline = sys.stdin.readline

N = int(readline())

A = list(map(int, readline().split()))

a0 = sum(A[0:N:2]) - sum(A[1:N:2])
a = [a0]
for i in range(1, N):
    ai = A[i - 1] * 2 - a[i - 1]
    a.append(ai)

for ai in a:
    print(ai)


Measured memory_bytes: 61668
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
   int c[3][3];
   for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
         cin >> c[i][j];
      }
   }
   
   for (int i = 0; i < 2; i++) {
      if (c[i][1] - c[i][0] != c[i + 1][1] - c[i + 1][0]) {
         cout << "No" << endl;
         return 0;
      }
      if (c[i][2] - c[i][1] != c[i + 1][2] - c[i + 1][1]) {
         cout << "No" << endl;
         return 0;
      }
   }
   for (int j = 0; j < 2; j++) {
      if (c[1][j] - c[0][j] != c[1][j + 1] - c[0][j + 1]) {
         cout << "No" << endl;
         return 0;
      }
      if (c[2][j] - c[1][j] != c[2][j + 1] - c[1][j + 1]) {
         cout << "No" << endl;
         return 0;
      }
   }

   cout << "Yes" << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int r,g,b;
  cin >> r >> g >> b;
  if((r * 100 + g * 10 + b) % 4 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2000000000;
constexpr ll mod = 1000000007;

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B, K; cin >> A >> B >> K;
	vector<int>ans;
	rep(i, K) {
		if (A + i <= B) {
			ans.push_back(A + i);
		}

	}
	rep(i, K) {
		if (B - i >= A) {
			ans.push_back(B - i);
		}
	}
	SORT(ans);
	ans.erase(unique(ans.begin(), ans.end()), ans.end());
	rep(i, ans.size())cout << ans[i] << "\n";


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define RB rbegin()
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define MD 1000000007
#define PPF pop_front()
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;u.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>u,uc;
map<LL,LL>ww,cc;
LL ar[120005];
LL br[500005];
LL cr[500][500];
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c,str;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
      cin>>n>>m>>o;
      k=-m+o;
      if(k<=0)
      {
          cout<<"delicious"<<endl;
      }
      else if(k>n)
      {
          cout<<"dangerous"<<endl;
      }
      else
      {
          cout<<"safe"<<endl;
      }
    }
    return 0;
    //IN
    //AL
}


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

int ans;
int as[3];

int main() {
  for (int i=0; i<3; i++) {
    scanf("%d", &as[i]);
  }
  sort(as, as+3);
  for (int i=0; i<2; i++) as[i] = as[2] - as[i];
  ans += as[0]/2;
  ans += as[1]/2;
  if (as[0]%2 != as[1]%2) ans += 2;
  else if (as[0]%2 == 1) ans++;
  printf("%d\n", ans);
}


Measured memory_bytes: 256
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(1,n+1):
  for j in range(i+1,n+1):
    ans[(min(j-i,abs(i-x)+abs(j-y)+1))-1]+=1
for i in ans:
  print(i)

Measured memory_bytes: 3444
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

int main(){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	int l=0,r=0,sum=0,cnt=0,ans=0;
	char f='1';
	while(r<s.size()){
		if(s[r]==f){
			sum++;
		r++;
		}
		else if(f=='0'){
			f=s[r];
			sum++;
			r++;
			}
			else{
				if(cnt<k){
				cnt++;
			f=s[r];
				sum++;
				r++;
			}else{
				ans=max(ans,sum);
				f=s[r];
				sum++;
				r++;
				char f2=s[l];
				while(true){
					sum--;
					l++;
					if(f2=='1')
						f2=s[l];
					else if(s[l]=='1')
						break;
				}
			}
		}
	}
	ans=max(ans,sum);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
N = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for _ in range(N):
    s = input()

    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1

print(f"AC x {ac}")
print(f"WA x {wa}")
print(f"TLE x {tle}")
print(f"RE x {re}")


Measured memory_bytes: 9172
#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a=n%10;
    if (a==3) puts("bon");
    else if (a==0 || a==1 || a==6 || a==8) puts("pon");
    else puts("hon");
    return 0;
}


Measured memory_bytes: 1608
#create date: 2020-09-13 21:00

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    x = ni()
    print(abs(x-1))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int n, c;
string ans;

int conv(const deque<int> &d){
    if(d[0] == 0) return -1;
    int res = 0;
    rep(i, d.size()){
        res = res*10 + d[i];
    }
    return res;
}

bool is_prime(int n){
    if(n == 1) return false;
    for(int i = 2; i*i <= n; ++i){
        if(n%i == 0) return false;
    }
    return true;
}

void dfs(deque<int> &d){
    if((int)d.size() >= n*2){
        if(is_prime(conv(d))){
            string x(all(d));
            rep(i, x.size()) x[i] += '0';
            ans = max(ans, x);
        }
    } else {
        rep(i,10){
            d.push_back(i);
            d.push_front(i);
            dfs(d);
            d.pop_front();
            d.pop_back();
        }
    }
}

signed main(){
    while(cin >> n >> c){
        ans = "0";
        if(c < 0){
            if(n == 1){
                ans = "11";
            } else {
                ans = string(2*n,'9');
            }
        } else {
            deque<int> d;
            if(c < 0){
                dfs(d);
            } else {
                d = {c};
                dfs(d);
            }
            if(ans == "0"){
                rep(i,n){
                    d.push_back(9);
                    d.push_front(9);
                }
                ans = conv(d);
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3184
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    int N,S;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Read();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        long[,] dp = new long[N+1,N+1];
        for(int i=0;i<N;i++){
            dp[0,i] = i == 0 ? 1 : 0;
        }
        for(int i=1;i<N+1;i++){
            dp[i,0] = (dp[i-1,0]+dp[i-1,1]*2%Define.mod)%Define.mod;
            for(int j=1;j<N;j++){
                dp[i,j] = (dp[i-1,j-1]+dp[i-1,j+1]*2%Define.mod)%Define.mod;
            }
            dp[i,N] = dp[i-1,N-1];
        }
        sb.Append(dp[N,S]+"\n");
    }
    void Read(){
        N = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        S = s.Length;
    }    
}
public static class Define{
    public const long mod = 1000000007;
}

Measured memory_bytes: 198104
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b, c; cin >> a >> b >> c >> c;
	if (c % 2)cout << b - a << endl;
	else cout << a - b << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main( void ){
  int n, count = 0;
  scanf("%d\n", &n );

  int *a = ( int * )malloc( n * sizeof( int ) );
  for( int i = 0 ; i < n ; i ++ )
    scanf("%d", a + i );

  for( int i = 0; i < n; i ++ ){
    int mini = i;
    for( int j = i + 1; j < n; j ++ ){
      if( a[ j ] < a[ mini ] )
        mini = j;
    }
    if( i != mini ){
      int tmp = a[ mini ];
      a[ mini ] = a[ i ];
      a[ i ] = tmp;
      count ++;
    }
  }
  for( int i = 0; i < n - 1; i ++ )
    printf("%d ", a[ i ] );
  printf("%d\n%d\n", a[ n - 1 ], count );
  return 0;
}


Measured memory_bytes: 2148
#include <stdio.h>
int main (){
    int x,n[100],i,tmp,j,k;
    scanf("%d",&x);
    for(i=0;i<x;i++){
        scanf("%d",&n[i]);
    }
    for(i=0;i<x;i++){
      printf("%d",n[i]);
      if(i<x-1)printf(" ");
    }
    printf("\n");
    for(i=1;i<x;i++){
      tmp=n[i];
      j=i-1;
      while((j>=0)&&(n[j]>tmp)){
	n[j+1]=n[j];
	j--;
      }
      n[j+1]=tmp;
      for(k=0;k<x;k++){
	printf("%d",n[k]);
	if(k<x-1)printf(" ");
      }
      printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2128
#include <iostream>
#include <algorithm>

using namespace std;

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

    for (int i = 0; i < S.size(); ++i) {
        if (S.substr(i, S.size() - i) + S.substr(0, i) == T) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}

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

int main() {

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

  long long int t, n, inputx, inputy;

  while( true ) {

    cin >> t >> n;

    if ( t == 0 ) break;

    int map[200][200] = {};

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

      cin >> inputx >> inputy;

      map[ inputx + 100 ][ inputy + 100 ] = -1;

    }

    cin >> inputx >> inputy;

    queue<int> qx, qy;

    qx.push( inputx + 100 );
    qy.push( inputy + 100 );

    map[ qx.front() ][ qy.front() ] = 1;

    long long int ans = 1;

    while( qx.size() > 0 ) {

      int x = qx.front();
      int y = qy.front();
      qx.pop();
      qy.pop();

      for ( int i = 0; i < 6; i++ ) {

	if ( map[ x + dx[i] ][ y + dy[i] ] == 0 ) {

	  map[ x + dx[i] ][ y + dy[i] ] = map[x][y] + 1;
	  ans++;
	  if ( map[x][y] < t ) {
	    qx.push( x + dx[i] );
	    qy.push( y + dy[i] );
	  }

	}

      }

    }

    cout << ans << endl;

  }

  return 0;

}

Measured memory_bytes: 1372
#include <iostream>

int64_t solve(int64_t x) {
  if (x == 1) return 1;
  return 1 + 2 * solve(x / 2);
}

int main() {
  int64_t h;
  std::cin >> h;
  std::cout << solve(h) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
    int n,k=0,pick=0;
    scanf("%d",&n);
    int ar[n];
    for (int i=0;i<n;i++)
        scanf("%d",&ar[i]);
    sort(ar,ar+n);
    for (int i=0;i<n;i++)
    {
        if (pick<ar[i])
        {
            k++;
            pick=ar[i];
        }
    }
    printf ("%d\n",k);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
 
 
using namespace std;
 
 
 
int main()
    {
		ll t;
		t=1;
		//scanf("%lld",&t);
		while(t--)
		{
			ll a,b,c;
			cin>>a>>b>>c;
			if(a<c)
			{c = c-a;a=0;}
			else
			{a = a-c;cout<<a<<" "<<b<<endl;break;}
			
			if(b<c)b=0;
			else
			{
				b=b-c;cout<<a<<" "<<b<<endl;break;
			}
			
			cout<<a<<" "<<b<<endl;
			
			
		}
	
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#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 REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n;
    cin >> n;
    typedef tuple<string, int, int> sp;
    vector<sp> v;
    REP(i, n) {
        string s;
        int p;
        cin >> s;
        cin >> p;
        v.push_back(make_tuple(s, p, i+1));
    }
    sort(
        v.begin(),
        v.end(),
        [](sp const &lhs, sp const &rhs) {
            if (get<0>(lhs) != get<0>(rhs)) return get<0>(lhs) < get<0>(rhs);
            if (get<1>(lhs) != get<1>(rhs)) return get<1>(lhs) > get<1>(rhs);
            return true;
        }
    );
    REP(i, n) {
        cout << get<2>(v[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
n,m = map(int,input().split())
ans = [-1 for i in range(n)]
for i in range(m):
    s,c = map(int,input().split())
    s-=1
    if ans[s] == -1:
        ans[s] = c
    else:
        if c == ans[s]:
            continue
        else:
            print(-1)
            sys.exit()
if n != 1:
    if ans[0] == 0:
        print(-1)
        sys.exit()
    else:
        if ans[0] == -1:
            ans[0] = 1
        for i in range(n):
            if ans[i] == -1:
                ans[i] = 0
else:
    for i in range(n):
        if ans[i] == -1:
            ans[i] = 0
fans = ""
for i in range(n):
    fans+=str(ans[i])
print(fans)

Measured memory_bytes: 3064
<?php
  fscanf(STDIN, "%d %d", $n, $m);
  $str = "";
  for($i = 0; $i < $m; $i++) {
    $str .= "%d";
  }
  $homeworks = fscanf(STDIN, $str);
  $sumdays = $n - array_sum($homeworks);

  if($sumdays >= 0) {
    echo $sumdays;
  } else {
    echo "-1";
  }
?>

Measured memory_bytes: 16440
#include<bits/stdc++.h>
using namespace std;
const int maxn=209;

int n;

int a[maxn];
long long f[maxn];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	f[0]=1000;
	for(int i=1;i<=n;++i){
		f[i]=f[0];
		for(int j=1;j<i;++j){
			f[i]=max(f[i],f[j]);
			f[i]=max(f[i],f[j]/a[j]*a[i]+f[j]%a[j]);
		}
	}
	printf("%lld\n",f[n]);
	return 0;
}

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

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;


void solve(long long K, long long X) {
	K--;
	reps(i, X - K, X + K) {
		cout << i << " " ;
	}
	cout << X + K << endl;
}

signed main() {
	long long K;
	scanf("%lld",&K);
	long long X;
	scanf("%lld",&X);
	solve(K, X);
	return 0;
}


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

int main()
{
    int c[10][10];
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)cin>>c[i][j];

    for(int a1=-101;a1<=101;a1++)
    {
        int b1=c[1][1]-a1;
        int b2=c[1][2]-a1;
        int b3=c[1][3]-a1;
        for(int a2=-101;a2<=101;a2++)
        {
            if(c[2][1]-a2!=b1)continue;
            if(c[2][2]-a2!=b2)continue;
            if(c[2][3]-a2!=b3)continue;
            for(int a3=-101;a3<=101;a3++)
            {
                if(c[3][1]-a3!=b1)continue;
                if(c[3][2]-a3!=b2)continue;
                if(c[3][3]-a3!=b3)continue;
                return cout<<"Yes",0;
            }
        }
    }cout<<"No";

    return 0;
}


Measured memory_bytes: 256
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define rep(i,x,y) for(int i=x;i<=y;++i)

const int INF=1<<30;
using namespace std;

const int maxn=100000+10;
typedef long long ll;

ll h[maxn],t[maxn];

priority_queue<int>pq;

int n;ll a,b;
int check(int ans)
{
	int c=0;
	rep(i,1,n) {
		t[i]=max(h[i]-1ll*ans*b,0ll);
		if(t[i]>0) c+=(int)ceil(t[i]/1.0/(a-b));
		if(c>ans) return 0;
	}
	return 1;
}

int main()
{
	cin>>n>>a>>b;

	int M=0;
	rep(i,1,n) scanf("%lld",h+i),M=max(M,(int)(h[i]/b+1));
	int l=1,r=M,ans,mid;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int n,m;
int x,y,xs,ys;
ll a[2003];
ll b[2003];
bool vis[1009][1009];
int ans[1000004];
int main()
{
   // freopen ("jumping.in","r",stdin);
   _IOS();
    cin>>n;
    for(int i=1;i<=100;i++)
    {
        for(int j=1;j<=100;j++)
        {
            for(int k=1;k<=100;k++)
            {
                int q=(i*i)+(j*j)+(k*k)+i*j+j*k+i*k;
                ans[q]++;
            }
        }
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<endl;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
int cnt1[100003], cnt2[100003], n, x, mx1, mx2, x1, x2;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (i % 2 == 0) {
      cnt1[x]++;
      if (mx1 < cnt1[x]) mx1 = cnt1[x], x1 = x;
    } else {
      cnt2[x]++;
      if (mx2 < cnt2[x]) mx2 = cnt2[x], x2 = x;
    }
  }
  sort(cnt1, cnt1 + 100003);
  sort(cnt2, cnt2 + 100003);
  if (x1 != x2)
    cout << n - mx1 - mx2;
  else
    cout << n - max(mx1 + cnt2[100001], mx2 + cnt1[100001]);
}


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

namespace algorithm
{
	class Program
	{
		static void Main(string[] args)
		{
			//N も ( N + 1 ) ÷ 2 も素数
			int n = int.Parse(Console.ReadLine());
			List<int[]> m = new List<int[]>();
			for (int i = 0; i < n; i++)
			{
				m.Add(Array.ConvertAll(Console.ReadLine().Split(), int.Parse));
			}
			int[] num = new int[100000];
			int cnt = 0;
			bool[] list = getPrimeList(100000);
			for (int i = 0; i < num.Length; i++)
			{
				if (list[i] && list[(i + 1) / 2])
				{
					cnt++;
				}
				num[i] = cnt;
			}
			foreach (int[] tmp in m)
					Console.WriteLine(num[tmp[1]] - num[tmp[0] - 1]);



		}

		static bool[] getPrimeList(int n)
		{
			n++;
			var isPrime = new bool[n];
			for (int i = 2; i < n; i++) isPrime[i] = true;
			var sqrt = (int)Math.Sqrt(n);
			for (int i = 2; i <= sqrt; i++)
			{
				if (isPrime[i])
				{
					var j = i + i;
					while (j < n)
					{
						isPrime[j] = false;
						j += i;
					}
				}
			}
			return isPrime;
		}
	}

}



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

int main()
{
  stack<int> down_pos;
  stack<pair<int, int> > L;
  string field;
  cin >> field;
  for (int i = 0; i < field.size(); i++)
  {
    if (field[i] == '/' && !down_pos.empty())
    {
      int start_pos = down_pos.top();
      down_pos.pop();
      int amount = i - start_pos;
      for (int j = L.size() - 1; j >= 0; j--)
      {
        if (L.top().first > start_pos)
        {
          amount += L.top().second;
          L.pop();
        }
        else
        {
          break;
        }
      }
      L.push(make_pair(start_pos, amount));
    }
    else if (field[i] == '\\')
    {
      down_pos.push(i);
    }
  }

  int A = 0;
  vector<int> ans(L.size());
  for (int i = ans.size() - 1; i >= 0; i--)
  {
    ans[i] = L.top().second;
    A += ans[i];
    L.pop();
  }
  cout << A << endl;
  cout << ans.size();
  for (int i = 0; i < ans.size(); i++)
  {
    cout << " " << ans[i];
  }
  cout << endl;
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\contests\\stdout", "w", stdout);
    }

    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> cnt;
    FOR(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }

    if (cnt.size() == 3 && n%3==0){
        int n3 = n/3;
        bool ok = true;
        for(auto it : cnt)
            if (it.second != n3)
                ok = false;
        for(auto it : cnt){
            for(auto it2 : cnt){
                if (it.first != it2.first && cnt[it.first ^ it2.first] != n3)
                    ok = false;
            }
        }
        if (ok){
            cout << "Yes\n";
            return 0;
        }
    }
    if (cnt.size() == 2 && n%3 == 0){
        int n3 = n/3;
        bool ok = (cnt[0] == n3);
        ok &= cnt.rbegin()->second == 2*n3;
        if (ok){
            cout << "Yes\n";
            return 0;
        }
    }
    if (cnt[0] == n){
        cout << "Yes\n";
        return 0;
    }
    cout << "No\n";

    if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 4000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int x[N], y[N];
    rep(i, N) cin >> x[i] >> y[i];

    ll ans = INF2;
    rep(a, N) {
        rep(b, N) {
            rep(c, N) {
                rep(d, N) {
                    int dx = x[b] - x[a];
                    int dy = y[d] - y[c];
                    if (dx < 0 || dy < 0) continue;
                    int countK = 0;
                    rep(i, N) {
                        if (x[a] <= x[i] && x[i] <= x[b] && y[c] <= y[i] && y[i] <= y[d]) countK++;
                    }
                    if (countK >= K) ans = min(ans, (ll)dx * dy);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  COMinit();
  ll s;
  cin>>s;
  ll num=s/3;
  ll ans=0;
  for(int i=1;i<=num;i++){
    ll res=s-3*i;
    ll a=res+i-1;
    ll b=res;
    ans+=COM(a,b);
    ans%=MOD;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 15584
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		char[] c1 = new char[5];
		char[] c2 = new char[7];
		char[] c3 = new char[5];
		for (int i = 0; i < 5; i++) {
			c1[i] = s.charAt(i);
		}
		for (int i = 6; i < 13; i++) {
			c2[i-6] = s.charAt(i);
		}
		for (int i = 14; i < 19; i++) {
			c3[i-14] = s.charAt(i);
		}
		String s1 = new String(c1);
		String s2 = new String(c2);
		String s3 = new String(c3);

		System.out.println(s1+" "+s2+" "+s3);
	}
}


Measured memory_bytes: 21844