akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import Counter

input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

counter = Counter(A)
ans = 0
for value, count in counter.items():
    if value - 1 in counter:
        count += counter[value - 1]
    if value + 1 in counter:
        count += counter[value + 1]
    ans = max(ans, count)

print(ans)

Measured memory_bytes: 20976
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
A = iil()
mean = sum(A)/n
diff = max(A)
ans = 0
for i in range(n):
    if abs(A[i] - mean) < diff:
        ans = i
        diff = abs(A[i] - mean)
print(ans)

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

using namespace std;

#define int long long
#define F first
#define S second
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

typedef pair<int, int> P;

const int inf = 1LL << 55;

int G[505][505];

signed main()
{
  int n, m;
  while(cin >> n >> m, n || m) {
    fill(G[0], G[505], inf);
    int cnt = 0;
    map<string, int> stat;
    string s, p, g; cin >> s >> p >> g;
    stat[s] = cnt++; stat[p] = cnt++; stat[g] = cnt++;
    while(m--) {
      string a, b; int d, t;
      cin >> a >> b >> d >> t;
      if(stat.find(a) == stat.end()) stat[a] = cnt++;
      if(stat.find(b) == stat.end()) stat[b] = cnt++;
      G[stat[a]][stat[b]] = G[stat[b]][stat[a]] = d / 40 + t;
    }
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
	for(int k = 0; k < n; k++) G[j][k] = min(G[j][k], G[j][i] + G[i][k]);
      }
    }
    cout << G[stat[s]][stat[p]] + G[stat[p]][stat[g]] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 5072
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
            System.out.println("a < b");
        }else if(a == b){
            System.out.println("a == b");
        }else if(a > b){
            System.out.println("a > b");
        }
    }

}



Measured memory_bytes: 26416
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin>>x;
    ll m=sqrtl(x);
    for (int i=m;i>0;i--){
        if (x%i==0){
            cout<<x/i+i-2<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
ll mem[MAX_N];
int N;
int main() {

	int ret;
	cin >> N;
	mem[0] = 1;
	mem[1] = 1;
	rep(i, N+1){
		if (i >= 2) mem[i] = mem[i - 1] + mem[i - 2];
	}
	cout << mem[N] << endl;
}

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

typedef long long lint;
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const lint inv = MOD - 2;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct info{
    int x, y, h;

    bool operator<(const info & right) const {
        return h > right.h;
    }
};

int main(){
    int n;
    cin >> n;
    vector<info> v(n);
    rep(i, n){
        cin >> v[i].x >> v[i].y >> v[i].h;
    }
    SORT(v);
    bool flag = false;
    rep(cx, 101){
        rep(cy, 101){
            flag = true;
            int H = abs(v[0].x - cx) + abs(v[0].y - cy) + v[0].h;
            REP(i, 1, n){
                int tmp = abs(v[i].x - cx) + abs(v[i].y - cy);
                if(v[i].h > 0){
                    if(H - tmp != v[i].h){
                        flag = false;
                        break;
                    }
                }else{
                    if(H - tmp > v[i].h){
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                cout << cx << " " << cy << " " << H << endl;
                break;
            }
        }
        if(flag){
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
#define fin(ans) cout << (ans) << endl
const int INF = 1<<30;
const ll MOD = 1000000007;

int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    ll d = c - a - b;
    if(d>0&&4*a*b<d*d){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}


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

int main(){
    while(1){
        int h,w;
        cin>>h>>w;
        if(h==0 && w==0) break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(i%2==0){
                    if(j%2==0) cout<<"#";
                    else cout<<".";
                }   
                else{
                    if(j%2==0) cout<<".";
                    else cout<<"#";
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3000
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int n, m, d; cin >> n >> m >> d;
  if(d == 0){
    cout << fixed << setprecision(10) << (double)(m-1)/(double)n << endl;
  } else {
    cout << fixed << setprecision(10) << (double)(m-1)*2.0*(double)(n-d)/(double)n/(double)n << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#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()
{
    int N;
    string S;
    cin >> N >> S;

    int ans = 0;
    rep(i, N - 1) {
        int cnt = 0;
        rep(j, i) {
            bool flag = false;
            rep(k, j) {
                if (S[j] == S[k]) {
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                repd(k, i, N) {
                    if (S[j] == S[k]) {
                        flag = true;
                        break;
                    }
                }
                cnt += (flag ? 1 : 0);
            }
        }
        chmax(ans, cnt);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <stack>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

int main(void) {
	string s; cin >> s;
	stack<char> st;
	for(auto &a:s){
		if(a == 'B'){
			if(not st.empty()) st.pop();
		}
		else{
			st.push(a);
		}
	}
	std::vector<char> res;
	while(not st.empty()){ 
		res.push_back(st.top()); st.pop();
	}
	RFOR(i,0,res.size()){
		cout << res[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

	public static void main(String[] args)  {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();

		System.out.println(n % k == 0 ? 0 : 1);
	}

}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

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

void Main(){
    int n; ll w; cin >> n >> w;
    vector<vector<ll>> bag(4);
    ll w0;
    rep(i, n) {
        ll a, b; cin >> a >> b;
        if(i == 0) w0 = a;
        bag[a - w0].pb(b);
    }
    
    vi sz(4);
    rep(i, 4) {
        sort(rall(bag[i]));
        sz[i] = bag[i].size();
    }  

    ll ans = 0;
    rep(a,sz[0]+1) rep(b,sz[1]+1) rep(c, sz[2]+1) rep(d, sz[3]+1){
        if(a * w0 + b * (w0+1) + c * (w0+2) + d * (w0+3) <= w){
            ll tot = 0;
            rep(i, a) tot += bag[0][i];
            rep(i, b) tot += bag[1][i];
            rep(i, c) tot += bag[2][i];
            rep(i, d) tot += bag[3][i];
            chmax(ans, tot);            
        }
    }
    cout << ans << endl;    
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

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

    vector<int> b(a);
    sort(b.begin(), b.end());
    int b0 = b[n - 1];
    int b1 = b[n - 2];

    for (int i = 0; i < n; i++) {
        cout << (a[i] == b0 ? b1 : b0) << '\n';
    }
    cout << flush;

    return 0;
}

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

int main() {
        int cnt[26] = {};
        string x;
        char low[26] = {
                'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
        };
        char up[26] = {
                'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
        };

        int i, j;
        while(getline(cin, x)){
            for(i = 0; i < x.size(); i++){
                for(j = 0; j < 26; j++){
                    if(x[i] == low[j] || x[i] == up[j]) {
                        cnt[j]++;
                    }
                }
            }
        }

        for(i = 0; i < 26; i++){
            cout << low[i] << " : " << cnt[i] << endl;
        }
    }



Measured memory_bytes: 3228
package main

import (
	"fmt"
	"sort"
)

// ソートされている arr を受け取って、 target 以上となる最初の要素の index を返す
// 全ての要素が target 未満だった場合は、配列の長さを返す
func lowerBound(arr []int, target int) int {
	ng := -1
	ok := len(arr)

	for (ok - ng > 1) {
		mid := (ok + ng) / 2

		if (arr[mid] >= target) {
			ok = mid
		} else {
			ng = mid
		}
	}

	return ok
}

func main() {
	var N int
	fmt.Scan(&N)

	ls := make([]int, N)
	for i := range ls {
		fmt.Scan(&ls[i])
	}

	sort.Ints(ls)

	res := 0

	for aIdx := 0; aIdx <= N-3; aIdx++ {
		for bIdx := aIdx+1; bIdx <= N-2;  bIdx++ {
			a := ls[aIdx]
			b := ls[bIdx]
			cOverIdx := lowerBound(ls, a+b)
			// bIdx, [bIdx+1, bIdx+2, ..., cOverIdx-1], cOverIdx
			res += cOverIdx - 1 - bIdx
		}
	}

	fmt.Println(res)
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
	long int i, j;
	long int a, b;
	long int sum;
	long int max;
	long int count;
	long int heit;
	long int h[100000];
	
	scanf("%ld%ld", &a, &b);
	
	max = 1;
	count = 0;
	
	while(1) {
		if(max >= b) {
			break;
		}
		max += (a - 1);
		count++;
	}
	
	printf("%ld\n", count);
	
	return 0;
}


Measured memory_bytes: 128
INF = 1000000007

D, G = map(int, input().split())

p = []
c = []

for i in range(D):
    pi, ci = map(int, input().split())
    p.append(pi)
    c.append(ci)


def main():
    ans = INF

    # 2 ** D - 1 まで
    for b in range(2 ** D):
        num = 0
        pnt = 0

        # コンプリートしない MAX
        x = None

        # 得点が高い方から
        for i in range(D - 1, -1, -1):
            if b >> i & 1:
                num += p[i]
                # コンプリートする
                pnt += c[i] + 100 * (i + 1) * p[i]

            elif x is None:
                x = i

        # コンプリート オール
        if x is None:
            ans = min(ans, num)
            continue

        flg = True

        for i in range(p[x]):
            if G <= pnt:
                break

            pnt += 100 * (x + 1)
            num += 1

            # コンプリートした
            # 無効
            if i == p[x] - 1:
                flg = False

        if not flg:
            continue

        ans = min(ans, num)

    print(ans)
    return


main()


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	int H, W, N;
	string S, T;
	int x, y;
	cin >> H >> W >> N >> y >> x >> S >> T;
	x--, y--;

	int l = 0, r = W;//[l, r)の区間で存在したらセーフ
	if (S[N - 1] == 'L') {
		l++;
	}
	if (S[N - 1] == 'R') {
		r--;
	}
	for (int i = N - 2; i >= 0; i--) {
		if (T[i] == 'R') {
			l = max(0, l - 1);
		}
		if (T[i] == 'L') {
			r = min(W, r + 1);
		}
		if (S[i] == 'L') {
			l++;
		}
		if (S[i] == 'R') {
			r--;
		}
		if (r <= l) {
			cout << "NO" << endl;
			return 0;
		}
	}
	if (!(l <= x && x < r)) {
		cout << "NO" << endl;
		return 0;
	}

	int d = 0, u = H;//[d, u)の区間で存在したらセーフ
	if (S[N - 1] == 'D'){
		u--;
	}
	if (S[N - 1] == 'U') {
		d++;
	}
	for (int i = N - 2; i >= 0; i--) {
		if (T[i] == 'U') {
			u = min(H, u + 1);
		}
		if (T[i] == 'D') {
			d = max(0, d - 1);
		}
		if (S[i] == 'D') {
			u--;
		}
		if (S[i] == 'U') {
			d++;
		}
		if (u <= d) {
			cout << "NO" << endl;
			return 0;
		}
	}
	if (!(d <= y && y < u)) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 776
from collections import deque

n, q = map(int, input().split())

adj_list = [[] for _ in range(n + 1)]
val = [0] * (n + 1)
visited = [False] * (n + 1)

for i in range(n - 1):
    u, v = map(int, input().split())
    adj_list[u].append(v)
    adj_list[v].append(u)

for i in range(q):
    p, x = map(int, input().split())
    val[p] += x

dq = deque()
prev = -1
cur = 1
dq.append([cur, prev])

while len(dq) > 0:

    cur, prev = dq.popleft()
    if prev != -1:
        val[cur] += val[prev]
    visited[cur] = True

    for next in adj_list[cur]:
        if visited[next] is False:
            dq.append([next, cur])

print(*val[1:])


Measured memory_bytes: 64788
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n>>m;
vector<int>count(n);

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

for(int i = 0;i < n;i++){
  cout << count[i] <<endl;
}
}

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

struct UnionFind{
    vector<int> par, sz, cnt;
    vector<long long> sum;
    UnionFind(){}
    UnionFind(int n):par(n), sz(n, 1), cnt(n), sum(n){
        iota(par.begin(), par.end(), 0);
    }
    int find(int x){
        if(x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        x = find(x); y = find(y);
        if(x == y) return;
        if(sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        cnt[x] += cnt[y];
        sum[x] += sum[y];
        par[y] = x;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

struct edge{
    int u, v, w;
    bool operator<(const edge &e)const{
        return w < e.w;
    }
};

int main(){
    int n, m, ans = 0;
    cin >> n >> m;
    UnionFind uf(n);
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        uf.sum[i] = x;
    }
    vector<edge> es(m);
    for(int i = 0; i < m; i++){
        int a, b, y;
        cin >> a >> b >> y;
        es[i] = {a - 1, b - 1, y};
    }
    sort(es.begin(), es.end());
    for(auto e : es){
        if(!uf.same(e.u, e.v)){
            uf.unite(e.u, e.v);
        }
        int p = uf.find(e.u);
        if(uf.sum[p] >= e.w){
            ans += uf.cnt[p] + 1;
            uf.cnt[p] = 0;
        }else{
            uf.cnt[p]++;
        }
    }
    cout << m - ans << endl;
}

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

#define ll long long
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MD 1000000007

char sep[2] = {' ', '\n'};

int main() {
  int i, j, k, n, m, b, f, r, v;

  int room[4][3][10] = {};
  cin >> n;
  rep(i, n) {
    cin >> b >> f >> r >> v;
    b--, f--, r--;
    room[b][f][r] += v;
  }
  rep(i, 4) {
    rep(j, 3) rep(k, 10) {
      cout << " " << room[i][j][k];
      if (k == 9) cout << "\n";
    }
    if (i < 3) cout << "####################\n";
  }
  cout << flush;
  
  return 0;
}
  

Measured memory_bytes: 1168
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int S_length = S.length();
    while (true) {
      if (S.length() % 2 == 1) {
        S = S.substring(0, S.length() - 1);
      } else {
        String sub1 = S.substring(0, S.length() / 2);
        String sub2 = S.substring(S.length() / 2, S.length());
        if (S.length() < S_length && sub1.equals(sub2)) {
          System.out.println(sub1.length() * 2);
          return;
        } else {
          S = S.substring(0, S.length() - 1);
        }
      }
    }
  }
}

Measured memory_bytes: 23124
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for i in range(c+1):
    for j in range(b+1):
        for k in range(a+1):
            ans = 500*k + 100*j + 50*i
            if ans == x:
                cnt += 1
            if ans > x:
                break

print(cnt)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 0;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
char	s[100000];
int		ans[100000] = {0};
int		k[100000];
int main()
{
	int		a,b,c,i,j,n,m,x,y,r,l;

	scanf("%s", s);
	n = strlen(s);

	a = 'R';
	b = 0;
	for(i=1;i<=n-1;i++) {
		if (s[i]!=a) {
			if (a == 'R') {
				for(j=i-1;j>=b; j--) {
					k[j] = i - j; 
				}
				a = 'L';
				b = i;
			} else {
				for(j=b;j<=i-1; j++) {
					k[j] = j-b+1; 
				}
				a = 'R';
				b = i;
			}
			
		}
	}
	for(j=b;j<=n-1;j++) {
		k[j] = j-b+1;
	}
	if(DBG) for(i=0;i<n;i++) { printf ("%d ",k[i]); }
	if(DBG) ENTER;


	for(i=0;i<n;i++) {
		if (s[i]=='R') {
			if ( k[i]%2 == 0) ans[i+k[i]]++;
			else ans[i+k[i]-1]++;
		} else {
			if ( k[i]%2 == 0) ans[i-k[i]]++;
			else ans[i-k[i]+1]++;
		}
	}
	for(i=0;i<n;i++) {
		printf("%d",ans[i]);
		if (i!=n-1) {
			printf(" ");
		} else {
			printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 1280
import java.util.Scanner;                                                                     
class Main {
 
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
          double a = in.nextDouble();
          double c = (double)2*3.141592653589*a;
          double b = (double)a*a*3.141592653589;
          System.out.println(String.format("%.6f",b) + " " +String.format("%.6f",c));
    }
}

Measured memory_bytes: 28028
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<vector>
#include<algorithm>
#define ll long long
#define lowbit(x) x&-x
using namespace std;
int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a<b?b:a;}
int ab(int x){return x>0?x:-x;}
//int MO(int x){return x>=MOD?x-MOD:x;}
//void insert(int u,int v){tot++;e[tot].v=v;e[tot].from=first[u];first[u]=tot;}
/*------------------------------------------------------------*/
const int inf=0x3f3f3f3f,maxn=5010,N=4000000;

int n,a[2010],sum;
bitset<2000010>f;
int main(){
    n=read();
    for(int i=1;i<=n;i++)a[i]=read(),sum+=a[i];
    f[0]=1;
    for(int i=1;i<=n;i++){
    	f|=f<<a[i];
    }
    int now=0;
    for(int i=sum/2;i>=0;i--)if(f[i]){now=i;break;}
    printf("%d",sum-now);
    return 0;
}

Measured memory_bytes: 896
N = int(input())
H = [int(i) for i in input().split()]

c_list = []
c = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        c += 1
    else:
        c_list.append(c)
        c = 0
c_list.append(c)
print(max(c_list))

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

using ll = long long;

#define INF (1LL << 31 - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define fi first
#define se second

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int n;
ll ans;
vector<pair<int, int> > p;

int main() {
  init();

  cin >> n;

  p.resize(n);
  rep(i,n) {
    cin >> p[i].fi >> p[i].se;
  }

  sort(p.begin(), p.end());

  rep(i,n) {
    if (i == 0) {
      ans += p[i].fi;
    }
    else {
      ans += p[i].fi - p[i - 1].fi;
    }
    if (i == n - 1) ans += p[i].se;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define fr first
#define se second
#define r_0 return 0;
#define ll long long
#define pb push_back
#define TIME ios_base::sync_with_stdio(0)
using namespace std;
vector<ll>V,L,Q;
vector<string>P;
map<int,int>M;
set<char>S;
set<char>:: iterator it;
ll n,m,a,b,c,d,e,f,cnt,x,y,z,t;
string   s,p,ans,temp;
ll   arr[10001];
bool xy=0;
char bd;
int main()
{
    TIME;
    cin>>a>>b;
    if ((a+b)%2==0)
        cout<<(a+b)/2;
    else
        cout<<"IMPOSSIBLE";

}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF 1000000000
#define MOD 1000000007
#define M 998244353
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define endl "\n"
#define fori(i, a, b) for(i=a; i<b; i++)
#define ford(i, a, b) for(i=a; i>b; i--)
using namespace std;
const ll N = 500043;
ll fact[N];
ll add(ll x, ll y)
{
	x += y;
	while(x >= MOD) x -= MOD;
	while(x < 0) x += MOD;
	return x;
}
ll mul(ll x, ll y)
{
	return (x * 1ll * y) % MOD;
}
ll mulmod(ll a, ll b)
{
    ll res = 0;
    a = a % MOD;
    while (b>0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
        a = (a * 2) % MOD;
        b /= 2;
    }
    return res % MOD; 
}
ll binpow(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}
ll inv(ll x)
{
	return binpow(x, MOD - 2);
}
ll divide(ll x, ll y)
{
	return mul(x, inv(y));
}
void precalc()
{
	fact[0] = 1;
	ll i;
	fori(i, 1, N)
		fact[i] = mul(i, fact[i - 1]);
}
ll C(ll n, ll k)
{
	if(k > n)
	    return 0;
	return divide(fact[n], mul(fact[n - k], fact[k]));
}


int solve()
{
    int x, n, i;
    cin >> x >> n;
    vector<int> a(n);
    fori(i, 0, n)
    {
        cin >> a[i];
    }
    int y=x;
    while(true)
    {
        if(!count(a.begin(), a.end(), x))
            return x;
        if(!count(a.begin(), a.end(), y))
            return y;
        x--;
        y++;
    }
}

int main()
{
    io
    int t;
    t=1;
    // cin >> t;
    while(t--)
        cout << solve() << endl;
        // solve();
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

long long N;

int main() {
    while (cin >> N) {
        long long K = 1;
        bool exist = false;
        for (K = 1; K <= N; ++K) {
            if (K * (K+1) / 2 == N) {
                exist = true;
                break;
            }
        }
        
        if (!exist) {
            puts("No");
        }
        else {
            puts("Yes");
            cout << K+1 << endl;
            vector<vector<long long> > res(K+1, vector<long long>());
            long long sum = 1;
            for (int k = K; k >= 1; --k) {
                for (int i = 0; i < k; ++i) {
                    res[K-k].push_back(sum + i);
                    res[K-k + i + 1].push_back(sum + i);
                }
                sum += k;
            }
            
            for (int i = 0; i < K+1; ++i) {
                cout << res[i].size();
                for (int j = 0; j < res[i].size(); ++j) {
                    cout << " " << res[i][j];
                }
                cout << endl;
            }
        }
    }
}














Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#define SS(i) scanf("%s",i)
#define SC(i) scanf("%d",&i)
#define SCC(i,j) scanf("%d%d",&i,&j)
#define SCCC(i,j,z) scanf("%d%d%d",&i,&j,&z)
#define PR(i) printf("%d\n",i)
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define CL(i,x) memset(i,x,sizeof(i))
#define IN freopen("in.txt","r",stdin)
#define OUT  freopen("out.txt","w",stdout)
#define PB(i) push_back(i)
#define min(x,y) ((x>y)?(y):(x))
#define max(x,y) ((x<y)?(y):(x))
#define abs(i) (i<0?(-i):i)
#define lson x,m,rt<<1
#define rson m+1,y,rt<<1|1
using namespace std;
const int N=200000+10;

char m1[55][55], m2[55][55];
int n, m;
int judge(int h, int l)
{
    if(n-h+1 < m || n-l+1 < m) return 0;
    --h; --l;
    FF(i, 1, m)
    {
        FF(j, 1, m)
        {
            if(m1[i+h][j+l] != m2[i][j])
                return 0;
        }
    }
    return 1;
}

int main()
{



    SCC(n, m);
    FF(i, 1, n) SS(m1[i]+1);
    FF(i, 1, m) SS(m2[i]+1);
    ///
    int ok = 0;
    FF(i, 1, n)
    {
        FF(j, 1, n)
        {
            if(m1[i][j] == m2[1][1])
            {
                if(judge(i, j)){
                    ok = 1;
                    goto c;
                }
            }
        }
    }
    c:;
    if(ok) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE MultiWayIf #-}

showIs is it = show is++" "++show it

solve [] _ = []
solve ((a,i):as) (a1,i1) = showIs i1 i:solve as (a+a1,i)


main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  as <- map read.words <$> getLine :: IO [Integer]
  let ais = zip as [1..] :: [(Integer,Integer)]
      (maxA,maxI) = maximum ais
      (minA,minI) = minimum ais
      ans = if | minA >= 0 -> solve ais (maxA, maxI)
               | maxA < 0 -> solve (reverse ais) (minA, minI)
               | abs maxA >= abs minA ->
                  [showIs maxI i|(a,i)<-ais, a<0] ++
                  solve (map (\(a,i)->if a < 0 then (a+maxA,i) else (a,i)) ais) (maxA, maxI)
               | otherwise ->
                  [showIs minI i|(a,i)<-ais, a>=0] ++
                  solve (map (\(a,i)->if a >= 0 then (a+minA,i) else (a,i)) (reverse ais)) (minA, minI)
  print $ length ans
  putStr $ unlines ans


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

const long long INF = 1LL << 61;

int A[100005];
long long layer[100005];

long long maxPossible[100005];

int main(){
    int N;
    scanf("%d", &N);

    // edge case when N == 0

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

    if(N == 0){
        if(A[0] == 0){
            printf("0");
        }else if(A[0] == 1){
            printf("1");
        }else{
            printf("-1");
        }
        return 0;
    }

    if(A[0] > 1){
        printf("-1");
        return 0;
    }

    maxPossible[0] = 1-A[0];
    for(int i = 1; i <= N; i ++){
        maxPossible[i] = min(2*maxPossible[i-1]-A[i], INF);
        //printf("maxPossible[%d]=%lld\n", i, maxPossible[i]);
    }

    for(int i = 0; i <= N; i ++){
        if(maxPossible[i] < 0){printf("-1"); return 0;}
    }

    layer[N] = A[N];
    for(int i = N-1; i >= 0; i --){
        //if(layer[i+1]*2)
        layer[i] = min(layer[i+1], maxPossible[i]) + A[i];
        //printf("layer[%d]=%lld\n", i, layer[i]);
        /*if(i <= 62){
            layer[i] = min(layer[i], (1LL<<i));
        }*/
    }

    // Not done yet, still need to check validity of answer
    long long ans = 0;
    for(int i = 0; i <= N; i ++){
        ans += layer[i];
    }

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


Measured memory_bytes: 5768
#!usr/bin/env python3

def main():
    count = 1
    while True:
        x = int(input())
        if x == 0:
            break
        print('Case %d: %d' % (count, x))
        count += 1


if __name__ == '__main__':
    main()


# NOTE AOJ question URL (Repetitive Processing - Print Test Cases):
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_B

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;

    int s = 0;
    int t = N;
    while(t > 0) {
        s += t % 10;
        t /= 10;
    }
    if(N % s == 0) cout << "Yes";
    else cout << "No";
    cout << endl;

    return 0;
}


Measured memory_bytes: 3636
from itertools import permutations
from math import factorial
n = int(input())
t = [list(map(int, input().split())) for i in range(n)]
ans = 0
for p in permutations(range(n), n):
    ans += sum(((t[p[i]][0] - t[p[i + 1]][0])**2 + (t[p[i]][1] - t[p[i + 1]][1])**2)**0.5 for i in range(n - 1))
print(ans / factorial(n))

Measured memory_bytes: 9444
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b;
  cin >> a >> b;
  a--;
  int o = 1;
  for(int i=0; i<40; i++){
    if(o+i*a>=b){
      cout << i << endl;
      return 0;
    }
  }
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 n; cin >> n;
    maxheap<PII> ps_up;
    maxheap<PII> ps_down;
    PII tmp;  // parenthesis: f: min, s: fin
    string s;
    rep(i,n) {
        cin >> s;
        i32 n = 0, d = 0, f = 0;
        for(auto ch : s) {
            if(ch == '(') ++n;
            else --n;
            chmin(d, n);
        }
        f = n;
        tmp.first = d;
        tmp.second = f;
        if(f >= 0) ps_up.push(tmp);
        else {
            tmp.second = -f;
            tmp.first += tmp.second;
            ps_down.push(tmp);
        }
    }

    /**
     * minが大きい順に。
     */

    bool can = 1;
    i32 Now = 0;
    while(ps_up.size()) {
        tmp = ps_up.top(); ps_up.pop();
        if(Now + tmp.first < 0) can = 0;
        Now += tmp.second;
//        debug(Now);
    }

    i32 Now2 = 0;
    while(ps_down.size()) {
        tmp = ps_down.top(); ps_down.pop();
        if(Now2 + tmp.first < 0) can = 0;
        Now2 += tmp.second;
//        debug(Now);
    }

    if(Now != Now2) can = 0;

    cout << (can ? "Yes" : "No") << '\n';



    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 19052
#include <bits/stdc++.h>
typedef long long ll;
#define loop(n) for (ll i = 0; i < n; i++)
#define loopy(n) for (ll j = 0; j < n; j++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define oo 1e18
#define fr first
#define se second
using namespace std;
const int N = 5e5 + 10;
const int M = 1e7 + 10;
const ll mod = 1e9 + 7;
int main()
{
    ll n ; cin >> n ; 
    cout<<(n * (n-1l))/2l<<endl ;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);
parse_tuple!(A, B, C, D);
parse_tuple!(A, B, C, D, E);

// ===

fn main() {
    let (x, y): (i64, i64) = read();
    let mut count = 1;
    let mut last = x;
    loop {
        last *= 2;
        if last <= y {
            count += 1;
        } else {
            break;
        }
    }
    println!("{}", count);
}

Measured memory_bytes: 4352
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
# from bisect import *
# from collections import *
# from heapq import *
# import functools
# import itertools
# import math
INF = 500000
MOD = 10**9+7

N = int(input())
if N % 2:
    print(0)
else:
    ans = 0
    x = 10
    while x <= N:
        ans += N//x
        x *= 5
    print(ans)


Measured memory_bytes: 38256
// package Contest1#177;
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception{
        final long MOD = 1000000007;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        long sum = 0, sqSum = 0;

        for(int i=0; i<n; i++){
            int k = Integer.parseInt(st.nextToken());
            sum += (long)k;
            sqSum += (long)((long)(k)*(long)(k));

            sum %= MOD;
            sqSum %= MOD;
        }

        long ans = sum * sum;
        ans -= sqSum;
        ans = (ans%MOD + MOD) %MOD;
        if(ans %  2 == 1) ans+=MOD;
        ans /= 2;
        out.println(ans);
        out.close();
    }
}

Measured memory_bytes: 54404
from collections import Counter
n = int(input())
a = list(map(int, input().split( )))

ac = Counter(a)
al = 0
for k in ac:
    al+=ac[k]*(ac[k]-1)//2
for i in range(n):
    ack = ac[a[i]]
    al2 = al-ack*(ack-1)//2
    al2 += (ack-2)*(ack-1)//2
    print(al2)

Measured memory_bytes: 27036
def result(n)
  max = n / 4
  (0..max).each do |x|
    hoge = n - 4 * x
    return 'Yes' if hoge == 0
    return 'Yes' if hoge % 7 == 0
  end

  'No'
end

N = gets.chomp.to_i

puts result(N)

Measured memory_bytes: 1788
S = input()
N = len(S)
#oo
for x in range(N - 1):
    if (S[x] == S[x + 1]):
        print (x + 1, x + 2)
        exit()
#oxo
for x in range(N - 2):
    if (S[x] == S[x + 2]):
        print (x + 1, x + 3)
        exit()
        

print (-1, -1)


Measured memory_bytes: 44528
n = int(input())
num = list(map(int, input().split()))
ans = []
if n % 2 == 0:
    for i in range(n // 2):
        ans.append(num[n - 2 * i - 1])
    for i in range(n // 2):
        ans.append(num[i * 2])
else:
    for i in range(n // 2 + 1):
        ans.append(num[n - 2 * i - 1])
    for i in range(n // 2 ):
        ans.append(num[i * 2 + 1])

for i in ans:
    print(str(i) + " ", end = "")

Measured memory_bytes: 26180
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		for(int i = 1; i <= 50000; i++){
			if(Math.floor(i * 1.08) == N){
				myout(i);
				return;
			}
		}
		myout(":(");
	}
	//Method addition frame start



	//Method addition frame end
}


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

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

    int n = 0;
    int c = 0;
    for (int i = 0; 2 * i + 1 <= N; i++) {
        c = 0;
        for (int j = 0; (2 * j + 1 <= 2 * i + 1) && c < 9; j++) {
            if ((2 * i + 1) % (2 * j + 1) == 0) c++;
        }
        if (c == 8) n++;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256