akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){
    char text[1201];
    char alphabet[27] = "abcdefghijklmnopqrstuvwxyz";
    int count[27] = {0};
    int j, q, k;
    
    //fgets(text, 1200, stdin);
    j = 0;
    while(fgets(text, 1200, stdin) != NULL){
        while(1){
            if(text[j] == 10){
                j = 0;
                break;
            }
        if(isupper(text[j]))
            text[j] = tolower(text[j]);
        switch(text[j]){
            case 'a': count[0] += 1; break;
            case 'b': count[1] += 1; break;
            case 'c': count[2] += 1; break;
            case 'd': count[3] += 1; break;
            case 'e': count[4] += 1; break;
            case 'f': count[5] += 1; break;
            case 'g': count[6] += 1; break;
            case 'h': count[7] += 1; break;
            case 'i': count[8] += 1; break;
            case 'j': count[9] += 1; break;
            case 'k': count[10] += 1; break;
            case 'l': count[11] += 1; break;
            case 'm': count[12] += 1; break;
            case 'n': count[13] += 1; break;
            case 'o': count[14] += 1; break;
            case 'p': count[15] += 1; break;
            case 'q': count[16] += 1; break;
            case 'r': count[17] += 1; break;
            case 's': count[18] += 1; break;
            case 't': count[19] += 1; break;
            case 'u': count[20] += 1; break;
            case 'v': count[21] += 1; break;
            case 'w': count[22] += 1; break;
            case 'x': count[23] += 1; break;
            case 'y': count[24] += 1; break;
            case 'z': count[25] += 1; break;
        }
        j++;
        }
    }
    for(q = 0; q < 26; q++){
        printf("%c : %d\n", alphabet[q], count[q]);
    }
    return 0;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll n,a,b; cin>>n>>a>>b;
	if(n==1) {
		cout << (a==b ? 1 : 0) << endl;
		return 0;
	}
	cout << max(0LL, (b-a)*(n-2) + 1) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;
vector<int> v;
int main()
{
	long long n,k,s,e,x,i;
	cin>>n>>k;
	int ara[n],vis[n+1]={0};
	for(i=0;i<n;i++){
		cin>>ara[i];
	}
	x=ara[0];
	vis[1]=1;
	while(k>0){
		i=x;
		vis[x]++;
		if(vis[x]==3){
			break;
		}
		if(vis[x]==2){
			v.push_back(x);
		}
		x=ara[x-1];
		k--;
	}
	if(k==0){
		cout<<i<<endl;
	}
	else{
		cout<<v[(k-1)%v.size()]<<endl;
	}
    return 0;
}

Measured memory_bytes: 5408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#define N 1000000007

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    ll sum = 0;
    ll max_a = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
        max_a = max(max_a, a[i]);
    }
    ll bound_max = max_a;
    ll bound_min = sum / (n + k);
    ll cur = (bound_max + bound_min) / 2;

    while (true) {
        if (bound_min + 1 >= bound_max)
            break;
        ll ncut = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] <= cur)
                continue;
            ll m = a[i] / cur + (a[i] % cur ? 1 : 0);
            ncut += m - 1;
        }
        if (ncut <= k) {
            bound_max = cur;
        } else {
            bound_min = cur;
        }
        cur = (bound_max + bound_min) / 2;
    }
    cout << bound_max << endl;
    return 0;
}

Measured memory_bytes: 4828
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int kotae;
int func(int t[],int pre){
	if(pre==0)
	return 1;
	for(int i=0;i<10;i++){
		if(t[i]>=3){
			t[i]-=3;
			if(func(t,pre-3))
				return 1;
			t[i]+=3;
		}else if(t[i]>=1&&t[i+1]>=1&&t[i+2]>=1){
			t[i]-=1;t[i+1]-=1;t[i+2]-=1;
			if(func(t,pre-3))
				return 1;
			t[i]+=1;t[i+1]+=1;t[i+2]+=1;
		}
	}
	return 0;
}
//0 1 2 3 4 5 6 7 8 9 0 0
//1 2 3 4 5 6 7 8 9 10 11 12
int main(){
	//r g b
	int t[3][11],n,num[9],e[3];
	char ch[9];
	cin>>n;
	while(n--){
		e[0]=e[1]=e[2]=0;
		for(int i=0;i<3;i++)
			memset(t,0,sizeof(t));
		for(int i=0;i<9;i++)
			cin>>num[i];
		for(int i=0;i<9;i++)
			cin>>ch[i];
		for(int i=0;i<9;i++){
			if(ch[i]=='G'){
				e[1]++;
				t[1][num[i]-1]++;
			}else if(ch[i]=='B'){
				e[2]++;
				t[2][num[i]-1]++;
			}else if(ch[i]=='R'){
				e[0]++;
				t[0][num[i]-1]++;
			}
		}
		kotae=0;
		for(int i=0;i<3;i++){
			if(e[i]%3!=0)
				break;
			if(func(t[i],e[i]))
			kotae=kotae+e[i]/3;
		}
		if(kotae==3)
		cout<<1<<endl;
		else cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
public class Main {
    public static void main(String[] args){
         
        try {
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String buf = br.readLine();
            StringTokenizer st=new StringTokenizer(buf," ");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
 
            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");
 
        } catch(IOException e) {
            System.err.println(e);
        }
    }
}

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


int main() {
    vector<char> vs(4);
    rep(i,4)cin>>vs[i];

    if(vs[0]==vs[1] || vs[1]==vs[2] || vs[2]==vs[3]) cout<<"Bad"<<endl;
    else cout<<"Good"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
using graph = vector<vector<int>>;

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n; cin >> n;
	double t, a; cin >> t >> a;
	int ans = 0;
	double tmp = 1000;
	for(int i = 0; i < n; i++){
		double b; cin >> b;
		if(tmp > abs(a - (t - b * 0.006))){
			tmp = abs(a -(t- b * 0.006));
			ans = i;
		}
	}
	ans++;
	cout << ans << endl;
} 


Measured memory_bytes: 256
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

S.append(0)

def func(x):
  S[n] = T[x] #番兵を付加
  i = 0
  while S[i] != S[n]:
    i += 1
    if i==n:
      return 0
  return 1

C = 0
for i in range(q):
  C += func(i)

print(C)


Measured memory_bytes: 6556
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;
#define no_way 100000000;


int d[400][400];


int main(int argc, char **argv){
	int cnt = 0;
	int n;
	while (cin >> n && n != 0) {
		cnt = 0;
		for (int i = 1; i <= n; i++) {
			int tmp = i;
			while (tmp % 5 == 0 && tmp != 0) {
				cnt++;
				tmp = tmp / 5;
			}
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	int r,D,x;
	cin >> r >> D >> x;

	for (int i = 0; i < 10; i++)
	{
		x = r*x-D;
		cout << x << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    rep (i, max(a, b)) cout << min(a, b); cout << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, M;
	Tuple[] edges;
	int[][] distMat;
	int result = 0;

	static class Tuple {
		int a, b, c;

		Tuple(String line) {
			String[] tokens = line.split(" ");
			a = Integer.parseInt(tokens[0]) - 1;
			b = Integer.parseInt(tokens[1]) - 1;
			c = Integer.parseInt(tokens[2]);
		}
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		M = Integer.parseInt(tokens[1]);
		edges = new Tuple[M];
		for (int i = 0; i < M; ++i) {
			edges[i] = new Tuple(in.readLine());
		}
		distMat = new int[N][N];
		for (int i = 0; i < N; ++i) {
			Arrays.fill(distMat[i], Integer.MAX_VALUE / 2);
		}
		for (int i = 0; i < N; ++i) {
			distMat[i][i] = 0;
		}
		for (int i = 0; i < M; ++i) {
			Tuple edge = edges[i];
			int a = edge.a;
			int b = edge.b;
			distMat[a][b] = edge.c;
			distMat[b][a] = edge.c;
		}
	}

	void calc() {
		for (int k = 0; k < N; ++k) {
			for (int i = 0; i < N; ++i) {
				for (int j = i + 1; j < N; ++j) {
					distMat[i][j] = Math.min(distMat[i][j], distMat[i][k] + distMat[k][j]);
					distMat[j][i] = distMat[i][j];
				}
			}
		}
		for (int i = 0; i < M; ++i) {
			Tuple edge = edges[i];
			int a = edge.a;
			int b = edge.b;
			if (distMat[a][b] < edge.c) {
				++result;
			}
		}
	}

	void showResult() {
		System.out.println(result);
	}
}

Measured memory_bytes: 27192
#include <stdio.h>
#include <string.h>

int main(void)
{
	char blood[3];
	int i, number, blood_num[4] = {0};
	
	while (scanf("%d,%s", &number, blood) != EOF){
		if (strcmp(blood, "A") == 0){
			blood_num[0]++;
		}
		else if (strcmp(blood, "B") == 0){
			blood_num[1]++;
		}
		else if (strcmp(blood, "AB") == 0){
			blood_num[2]++;
		}
		else if (strcmp(blood, "O") == 0){
			blood_num[3]++;
		}
	}
	
	for (i = 0; i < 4; i++){
		printf("%d\n", blood_num[i]);
	}
	
	return (0);
}

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

#define ll long long
#define pb push_back
#define endl "\n"
#define ff first
#define ss second
#define pll pair<ll,ll>

using namespace std;
const ll maxn=4e3+100;
const ll mod = 998244353;

ll a[maxn];
ll c[maxn];
ll d;
map<ll,ll> mp;
ll ax[maxn]= {0,1,0,-1};
ll ay[maxn]= {1,0,-1,0};
ll h[maxn][maxn];
bool dd[maxn][maxn];
void dfs(ll x1,ll y1 )
{
    ll z= h[x1][y1]+(1-dd[x1][y1]);
    for (int i=0;i<4;i++)
    {
        ll x= x1+ax[i];
        ll y= y1+ay[i];
        if (h[x][y]>z)
        {
            h[x][y]=z;
            dfs(x,y);

        }
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r",stdin);
  //  freopen("WEDDING.INP", "r", stdin);
   //  freopen("WEDDING.OUT", "w", stdout)
  ll n;
   cin>> n;
    for(int i=1;i<=n*n;i++)
    {
        ll x= (i+n-1)/n;
        ll y= i%n;
        if (y==0 ) y=n;
        h[x][y]=min(x,min(y,min(n-x+1,n-y+1)))-1;
      //   cout <<h[x][y]<<" "<<i<<endl;

    }
    ll ans=0;

    for (int i=1;i<=n*n;i++)
    {
        ll x1;
         cin>>x1;
          ll x= (x1+n-1)/n;
        ll y= x1%n;
        if (y==0 ) y=n;
        ans+=h[x][y];
        dd[x][y]=1;
        dfs(x,y);


    }
    cout <<ans<<endl;
}


Measured memory_bytes: 24984
N,K,C = map(int,input().split())
S = input()
L = []
R = []
point = 0
for i in range(K):
    while(S[point]!="o"):
            point += 1
    L.append(point)
    point += C+1
    
point = N-1
for i in range(K):
    while(S[point]!="o"):
            point -= 1
    R.append(point)
    point -= C+1
R = sorted(R)

for i in range(K):
    if(L[i] == R[i]):
        print(L[i]+1)

Measured memory_bytes: 20840
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
int dp[101][10001];
int v[100], w[100];
int main() {
	int N, W;
	cin >> N >> W;
	rep(i, N) {
		cin >> v[i] >> w[i];
	}
	REP(i, 1, N + 1) {
		rep(j, W + 1) {
			dp[i][j] = dp[i - 1][j];
			if (j >= w[i-1]) dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i-1]] + v[i-1]);
		}
	}
	cout << dp[N][W] << endl;
}

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

int main(){
  int arr[100000],input[50000],i,n,q,l,r,m,count=0;

  scanf("%d",&n);
  if(n>100000) exit(2);
  for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
  }
  scanf("%d",&q);
  if(q>50000) exit(2);
  for(i=0;i<q;i++){
    scanf("%d",&input[i]);
    l=0;
    r=n;
    while(l<r){
      m=(l+r)/2;
      if(arr[m]==input[i]){
	count++;
	  break;
      }else if(arr[m]<input[i]) l=m+1;
      else r=m;
    }
  }
  printf("%d\n",count);
  return 0;
}



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

#define long long long int
using namespace std;


#ifdef JUDGE
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#else
using std::cin;
using std::cout;
#endif

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(6);


    int n;
    cin >> n;
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << a[n - 1];
    return 0;


}


Measured memory_bytes: 256
#include<cstdio>
#include <algorithm>
#include <iostream>
#include <functional>
#include<cmath>
#include<string.h>

using namespace std;

int main(){
	int n,x[100],sum,ans,min=999999999;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&x[i]);
	for(int i=0;i<100;i++){
		sum=0;
		for(int j=0;j<n;j++){
			sum += (i-x[j])*(i-x[j]);
		}
		if(min>sum){
			min=sum;
			ans=i;
		}
	}
	printf("%d\n",min);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

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

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

class Fruit {
public:
    int time;
    int gain;
    string name;
    Fruit(string name) {
	time = 0;
	gain = 0;
	this->name = name;
    }
    bool operator< (const Fruit &a) const {
	if (gain * a.time == a.gain * time) return name < a.name;
	return gain * a.time > a.gain * time;
    }
};

signed main() {
    int N;

    while (cin >> N) {
	if (!N) break;

	vector<Fruit> fruits;
	rep(i, N) {
	    string L;
	    int P, A, B, C, D, E, F, S, M;
	    cin >> L >> P >> A >> B >> C >> D >> E >> F >> S >> M;

	    Fruit fruit = Fruit(L);
	    fruit.time = A + B + C;
	    fruit.time += (D + E) * M;
	    fruit.gain = S * F * M - P;
	    fruits.push_back(fruit);
	}
	sort(all(fruits));
	rep(i, N) {
	    cout << fruits[i].name << endl;
	}
	cout << "#" << endl;
    }


    return 0;
}

Measured memory_bytes: 3112
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{//try{
	auto N = my_readln().to!ulong();
	auto tokens = split(my_readln());
	auto A = tokens[0].to!ulong();
	auto B = tokens[1].to!ulong();
	ulong[3] cnt;
	foreach (token; split(my_readln()))
	{
		auto p = token.to!ulong();
		if (p <= A) ++cnt[0];
		else if (p <= B) ++cnt[1];
		else ++cnt[2];
	}
	writeln(min(min(cnt[0], cnt[1]), cnt[2]));
	stdout.flush();
	/*}catch (Throwable e)
	{
	writeln(e.toString());
	}
	readln();*/
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x1 , x2;
    cin >> x1 >> x2;
    
    if( x1 < x2) cout<< x2 - x1 << endl;
    else
    cout << x1 - x2 <<endl;
    
    return 0;
}




Measured memory_bytes: 3088
# -*-coding:utf-8 -*-

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

profits = []
z = 0

for i in range(n):
    profits.append(v[i] - c[i])
profits.sort()

#print(profits)
for i in range(n):
    p = profits.pop()
    #print(p)
    if p <= 0:
        print(z)
        exit()
    else:
        z += p
print(z)

Measured memory_bytes: 3060
def main():
    S = list(map(int, input().split('/')))
    if S[0] < 2019:
        print('Heisei')
    elif S[0] == 2019:
        if S[1] <= 4:
            print('Heisei')
        else:
            print('TBD')
    else:
        print('TBD')
 
 
main()

Measured memory_bytes: 2940
var fin = [];

for(var i = 0;i < 50;i++)
    fin[i] = [];

var dx = [1,1,1,0,0,-1,-1,-1];
var dy = [1,0,-1,1,-1,1,0,-1];

function dfs(i,j,h,w,map){
    fin[i][j] = false;

    for(var k = 0;k < 8;k++){
        var ii = i + dx[k],jj = j + dy[k];
        if(ii >= 0 && ii < h && jj >= 0 && jj < w && map[ii][jj] == 1 && fin[ii][jj])
            dfs(ii,jj,h,w,map);
    }
}

function Main(input){
    input = input.split("\n");
    var k = 0;
    while(1){
        input[k] = input[k].split(" ");
        var w = parseInt(input[k][0],10);
        var h = parseInt(input[k++][1],10);

        if(w == 0 && h == 0)
            break;

        var map = [];

        for(var i = 0;i < h;i++){
            map[i] = [];
            input[k] = input[k].split(" ");
            for(var j = 0;j < w;j++)
                map[i][j] = parseInt(input[k][j],10);
            k++;
        }

        for(var j = 0;j < h;j++){
            for(var l = 0;l < w;l++)
                fin[j][l] = true;
        }
        sum = 0;
        while(1){
            var flag = true;
            for(var j = 0;j < h;j++){
                for(var l = 0;l < w;l++){
                    if(map[j][l] == 1 && fin[j][l]){
                        sum++;
                        flag = false;
                        dfs(j,l,h,w,map);
                    }
                }
            }
            if(flag)
                break;
        }
        console.log(sum);
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

int main()
{
  int k, n, arr[200005];
  cin>>k>>n;
  int mx=0,ss=0;
  cin>>arr[0];
  for(int i=1;i<n;i++){
     cin>>arr[i];
      int dif=arr[i] - arr[i-1];
      mx = max(mx, dif);
    ss+=dif;
  }
  int dif = k-arr[n-1] + arr[0];
  ss+=dif;
  mx = max(mx, dif);
  cout<<ss-mx;
}

Measured memory_bytes: 1024
# include <iostream>
# include <string>

using namespace std;

int main() {
    string n; cin >> n;
    for (char c: n) {
        if (c == '1') cout << '9';
        else if (c == '9') cout << '1';
        else cout << c << endl;
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
#define llx(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len) {char ss[len];scanf("%s",ss);(st)=ss;}
using namespace std;
long long n,m,i,j,num[1005][5],x,ans,sum;
vector<long long> v;
string st;
int main()
{
	cin>>n>>m;
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=3;j++)
		{
			cin>>num[i][j];
		}
	}
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((+num[i][1])+num[i][2]+num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++)
	{
		sum+=v[i];
		//err<<v[i]<<' ';
	}
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((+num[i][1])+num[i][2]-num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++)
	{
		sum+=v[i];
		//cerr<<v[i]<<' ';
	}
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((+num[i][1])-num[i][2]+num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++) sum+=v[i];
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((+num[i][1])-num[i][2]-num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++) sum+=v[i];
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((-num[i][1])+num[i][2]+num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++) sum+=v[i];
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((-num[i][1])+num[i][2]-num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++)
	{
		//cerr<<v[i]<<' ';
		sum+=v[i];
	}
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((-num[i][1])-num[i][2]+num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++) sum+=v[i];
	ans=max(ans,sum);
	v.clear();
	for (i=1;i<=n;i++)
	{
		v.push_back((-num[i][1])-num[i][2]-num[i][3]);
	}
	sum=0;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (i=0;i<m;i++) sum+=v[i];
	ans=max(ans,sum);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
// Warshall–Floyd Algorithm

package main

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

var scanner = bufio.NewScanner(os.Stdin)

const INF = 2000000000

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		n, _ := strconv.Atoi(buf[0])
		m, _ := strconv.Atoi(buf[1])
		if n == 0 && m == 0 {
			break
		}
		c_matrix := make([][]int, m)
		for i := range c_matrix {
			c_matrix[i] = make([]int, m)
		}
		t_matrix := make([][]int, m)
		for i := range t_matrix {
			t_matrix[i] = make([]int, m)
		}
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf_ := strings.Split(scanner.Text(), " ")
			a, _ := strconv.Atoi(buf_[0])
			b, _ := strconv.Atoi(buf_[1])
			c, _ := strconv.Atoi(buf_[2])
			t, _ := strconv.Atoi(buf_[3])
			c_matrix[a-1][b-1] = c
			c_matrix[b-1][a-1] = c
			t_matrix[a-1][b-1] = t
			t_matrix[b-1][a-1] = t
		}
		c_dist := make([][]int, m)
		c_prev := make([][]int, m)
		t_dist := make([][]int, m)
		t_prev := make([][]int, m)
		for i := 0; i < m; i++ {
			c_dist[i] = make([]int, m)
			c_prev[i] = make([]int, m)
			t_dist[i] = make([]int, m)
			t_prev[i] = make([]int, m)
		}
		for i := 0; i < m; i++ {
			for j := 0; j < m; j++ {
				if c_matrix[i][j] == 0 {
					c_dist[i][j] = INF
					c_prev[i][j] = -1
				} else {
					c_dist[i][j] = c_matrix[i][j]
					c_prev[i][j] = i
				}
				if t_matrix[i][j] == 0 {
					t_dist[i][j] = INF
					t_prev[i][j] = -1
				} else {
					t_dist[i][j] = t_matrix[i][j]
					t_prev[i][j] = i
				}
			}
			c_dist[i][i] = 0
			t_dist[i][i] = 0
		}
		for k := 0; k < m; k++ {
			for i := 0; i < m; i++ {
				for j := 0; j < m; j++ {
					c_newlen := c_dist[i][k] + c_dist[k][j]
					if c_newlen < c_dist[i][j] {
						c_dist[i][j] = c_newlen
						c_prev[i][j] = c_prev[k][j]
					}
				}
			}
		}
		for k := 0; k < m; k++ {
			for i := 0; i < m; i++ {
				for j := 0; j < m; j++ {
					t_newlen := t_dist[i][k] + t_dist[k][j]
					if t_newlen < t_dist[i][j] {
						t_dist[i][j] = t_newlen
						t_prev[i][j] = t_prev[k][j]
					}

				}
			}
		}
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		for i := 0; i < k; i++ {
			scanner.Scan()
			buf_ := strings.Split(scanner.Text(), " ")
			p, _ := strconv.Atoi(buf_[0])
			q, _ := strconv.Atoi(buf_[1])
			r, _ := strconv.Atoi(buf_[2])
			switch r {
			case 0:
				fmt.Println(c_dist[p-1][q-1])
			case 1:
				fmt.Println(t_dist[p-1][q-1])
			}
		}
	}
}



Measured memory_bytes: 6004
# coding: utf-8

# 標準入力 <int>
K = int(input())

if K < 10:
  print(K)
  exit()

cnt = 9

ind = [i for i in range(1,10)]
tmp = ind

while cnt <= K:
  l = []
  for i in range(len(tmp)):
    if tmp[i] % 10 == 0:
      #print(tmp[i], "a")
      l.append(tmp[i] * 10 + tmp[i] % 10)
      l.append(tmp[i] * 10 + tmp[i] % 10 + 1)
      cnt += 2
    elif tmp[i] % 10 == 9:
      #print(tmp[i], "b")
      l.append(tmp[i] * 10 + tmp[i] % 10 - 1)
      l.append(tmp[i] * 10 + tmp[i] % 10)
      cnt += 2
    else:
      #print(tmp[i], "c")
      l.append(tmp[i] * 10 + tmp[i] % 10 - 1)
      l.append(tmp[i] * 10 + tmp[i] % 10)
      l.append(tmp[i] * 10 + tmp[i] % 10 + 1)
      cnt += 3
  tmp = l
  ind += l

#print(ind)
print(ind[K-1])


Measured memory_bytes: 12676
#include<cstdio>
#include<set>
#define LL long long
#define maxn 3005
#define mod 1000000007
using namespace std;
int n,m,dp[maxn][maxn][2],ans;
int main()
{
	scanf("%d%d",&n,&m);
	dp[0][0][1]=1;
	for(int i=1;i<=n;i++) dp[0][i][0]=1;
	for(int i=0;i<m;i++)
		for(int j=0;j<=n;j++)
			for(int k=0;k<2;k++)
			{
				if(j)
				{
					dp[i+1][j][k|(j==1)]=(dp[i+1][j][k|(j==1)]+dp[i][j][k])%mod;
					dp[i+1][j-1][k|(j==1)]=(dp[i+1][j-1][k|(j==1)]+dp[i][j][k])%mod;
				}
				if(j<n)
				{
					dp[i+1][j][k]=(dp[i+1][j][k]+dp[i][j][k])%mod;
					dp[i+1][j+1][k]=(dp[i+1][j+1][k]+dp[i][j][k])%mod;
				}
			}
	for(int i=0;i<=n;i++) ans=(ans+dp[m][i][1])%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 70656
import java.io.PrintWriter;
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		PrintWriter out = new PrintWriter(System.out);
		while(sc.hasNext()){
			int m = sc.nextInt();
			if(m == 0)break;
			String temp [][] = new String[2][m];
			for (int i = 0; i < m ; i++ ){
				temp[0][i] = sc.next();
				temp[1][i] = sc.next();
			}
			int n = sc.nextInt();
			String ans = "";
			for(int i = 0 ; i < n ; i++){
				ans = sc.next();
				for(int j = 0 ; j < m ; j++){
					if(( temp[0][j].equals(ans) )){
						ans = temp[1][j];
						break;
					}
				}
				out.print(ans);
			}
			out.println();
			out.flush();
		}
	}
}

Measured memory_bytes: 68660
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

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

using namespace std;

typedef long long ll;

struct union_find
{
private:
  vector<int> rank;
  void swap(int *x, int *y)
  {
    int tmp = *x;
    *x = *y;
    *y = tmp;
  }

public:
  vector<int> parent;
  int tree_num;
  void init(int nodenum)
  {
    parent.resize(nodenum, 0);
    for (int i = 0; i < nodenum; i++)
      parent[i] = i;
    rank.resize(nodenum, 0);
    tree_num = nodenum;
  }
  int find(int x)
  {
    if (parent[x] == x)
      return x;
    return parent[x] = find(parent[x]);
  }
  void unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if (x == y)
      return;
    if (rank[x] < rank[y])
      swap(&x, &y);
    rank[x]++;
    rank[y] = rank[x];
    parent[y] = x;
    tree_num--;
    return;
  }
};

int main(int argc, char const *argv[])
{
  ll n,m;
  cin >> n >> m;
  vector<ll> p(n);
  REP(i,n) {
    cin >> p[i];
    p[i]--;
  }
  union_find uf;
  uf.init(n);
  vector<pair<ll,ll>> xy(m+n);
  REP(i,m){
    ll x,y;
    cin >> x >> y;
    uf.unite(x-1,y-1);
    xy[i] = {x-1,y-1};
  }
  REP(i,n){
    xy[i+m] = {i,i};
  }
  std::map<ll,std::set<ll>> smap1;
  std::map<ll,std::set<ll>> smap2;
  for (auto ope : xy){
    ll x = ope.first;
    ll y = ope.second;
    ll root = uf.find(x);
    if (smap1.find(root) == smap1.end()) {
      smap1[root] = set<ll>();
      smap2[root] = set<ll>();
     }
      smap1[root].insert(x);
      smap1[root].insert(y);
      smap2[root].insert(p[x]);
      smap2[root].insert(p[y]);
  }
  ll ans = 0;
  for (auto itr = smap1.begin(); itr != smap1.end(); ++itr) {
    std::set<ll> res;
    auto mp2 = smap2[itr->first];
    std::set_intersection(ALL(itr->second),ALL(mp2),
    std::inserter(res,res.end()));
    ans += res.size();
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 33024
#include <stdio.h>
main(void)
{
  int n,i,j,a,b,c;
  int g[100][100];
  
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
    for(j=0;j<n;j++)
    {
        g[i][j]=0;
    }
 }
  
 for(i=0;i<n;i++)
 {
    scanf("%d%d",&a,&b);
    for(j=0;j<b;j++)
    {
        scanf("%d",&c);
        g[i][c-1]=1;
    }
 }
 
 for(i=0;i<n;i++)
 {
    for(j=0;j<n;j++)
    {
        if(j!=n-1) printf("%d ",g[i][j]);
        else printf("%d\n",g[i][j]);
    }
 }
 return 0;
}

Measured memory_bytes: 636
#include <stdio.h>
#include <iostream>
using namespace std;

int A,B,C,K,maks,temp;
int main (){
	cin >> A >> B >> C >> K;
	maks = max (A, max(B,C));
	temp = maks;
	for (int i=1; i<=K; i++){
		maks=maks*2;
	}
	cout << A+B+C -temp +maks ;
}

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

int main(){
    int A, B, X;
    cin >> A >> B >> X;

    if ((X-A)<=B && A<=X){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
#n = int(input())
#s = input()
a,b,c = map(int,input().split())
#da = list(map(int,input().split()))
#a = [int(input()) for i in 
if c-a-b < 0:
    print("No")
else:
    if 4*a*b < (c-a-b)**2:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(){
  string n;
  cin >> n;
  int size = n.size();
  bool except = true;
  for(int i = 1;i < size;i++){
   if(n[i] != '9') {
     except = false;
     break;
   }
  }
  int answer ;
  long double num = stoll(n);
  num = num / pow(10,size-1);
  if(except == true) answer = num + 9*(size-1);
  else answer = num + 9*(size-1) - 1;
  
  cout << answer << endl;
}

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

int main()
{
  double W,H,x,y;
  cin >> W >> H >> x >> y;
  double ans;
  int a=0;
  if(x*2==W && y*2==H) a=1;
  ans=W*H/2;
  cout << ans <<' '<< a << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int Ans=0;
  if (N%2==0){
    for (int i=0; i<N;i+=2){
      Ans=Ans-vec.at(i)+vec.at(i+1);
    }
  }
  else{
    for(int i=0; i<N-2; i+=2){
      Ans=Ans+vec.at(i)-vec.at(i+1);
    }
     Ans=Ans+vec.at(N-1);
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main()
{
    string n;
    cin >> n;
    int size = n.size();
    int sum = 0;

    rep(i, size)
    {
        int k = ctoi(n[i]);
        sum += k;
    }
    if (sum % 9 == 0)
        puts("Yes");
    else
        puts("No");
}

Measured memory_bytes: 3732
import java.util.Scanner

fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  val input:CharArray = (scanner.next() + scanner.next() + scanner.next() + scanner.next() + scanner.next() + scanner.next()).toCharArray().sorted().toCharArray()
  scanner.close()
  for (i in 0..4) {
    if (input[i+0] == input[i+1] && input[i+1] == input[i+2] && input[i+2] == input[i+0]) {
      print("NO")
      return
    }
  }
  print("YES")
}

Measured memory_bytes: 35912
void main() {
	"square1001".writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 2400
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;

int main() {
    ll k;
    ll ans=2;
    cin >> k;
    ll o=k-1,oo=k-1,kk=k;;
    if (k==2) {
        cout << 1 << endl;
        return 0;
    }
    ll u=2;
    while(true){
        if (u*u>kk) break;
        if (k%u==0){
            if ((k/u)%u==1) ans++;
            k/=u;
            continue;
        }
        k=kk;
        u++;
    }
    u=2;
    while(true){
        if (u*u>o) break;
        if (o%u==0){
            if (u*u!=o){
                ans+=2;
            }
            else{
                ans++;
            }
        }
        u++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
        int S;
        cin >> S;
        int s, m, h;
        s = S % 60;
        S /= 60;
        m = S % 60;
        S /= 60;
        h = S;
        cout << h << ":" << m << ":" << s << endl;
        return 0;
}

Measured memory_bytes: 1164
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main argv =
    let n = read int
    let hs = reads int
    List.fold (fun (s, t) h -> if t <= h then (s + 1, h) else (s, t)) (0, 0) hs
    |> fst
    |> printfn "%i"
    0

Measured memory_bytes: 14044
ans = Array.new
loop do
	num = gets.to_i
	if num == 0
		break
	end
	a1 = Array.new(num)
	a2 = Array.new(num)
	num.times do |i|
		d1,d2 = gets.split
		a1[i] ,a2[i] = d1.to_s.chomp,d2.to_s.chomp
		a1[i].strip!
		a2[i].strip!
	end
	
	n = gets.to_i
	str = ""
	n.times do 
		data = gets.to_s.chomp
		data.strip!
		num.times do |i|
			if data ==a1[i]
				data = a2[i]
				break
			end
		end
		str += data

	end
	
	ans.push(str)
end

ans.each do |n|
	puts n
end

Measured memory_bytes: 114084
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

class CSccPuzzle {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n,m;
        in>>n>>m;
        ll scc = min(n,m/2);
        n-=scc;
        m-=scc*2;
        scc += m/4;
        out<<scc<<endl;
	}
};


int main() {
	CSccPuzzle solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		//		int price[] = new int[n];

		PriorityQueue<Integer> price = new PriorityQueue<>(Comparator.reverseOrder());
		for ( int i = 0; i < n; i++ ) {
			price.add(in.nextInt());
		}

		while ( m > 0 ) {
			Integer p = price.poll();
			p /= 2;
			m--;
			price.add(p);
		}
		
		long sum = 0;
		for ( Integer p : price ) {
			sum += p;
		}
		System.out.println(sum);

		in.close();
	}
}

Measured memory_bytes: 57368
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <iomanip>
#include <vector>
using namespace std;

#define D

#ifdef D
int main(void)
{
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	vector<double> tmp(n);
	for (auto &a : x)
	{
		cin >> a;
	}
	for (auto &a : y)
	{
		cin >> a;
	}
	for (size_t i = 0; i < n; i++)
	{
		tmp[i] = abs(x[i] - y[i]);
	}
	double L1 = 0, L2= 0, L3= 0, Lmax= 0;
	for (auto a : tmp)
	{
		L1 += a;
		L2 += pow(a, 2);
		L3 += pow(a, 3);
		if (Lmax < a) Lmax = a;
	}
	L2 = sqrt(L2);
	L3 = pow(L3, 1.0 / 3);

	cout << fixed << setprecision(12) << L1 << endl;
	cout << fixed << setprecision(12) << L2 << endl;
	cout << fixed << setprecision(12) << L3 << endl;
	cout << fixed << setprecision(12) << Lmax << endl;


	return 0;
}
#endif // D

Measured memory_bytes: 3492
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

int main(){

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    for(int i=0;i<5;i++){
        cin>>a;
        if(a==0)cout<<i+1;
    }

}


Measured memory_bytes: 3536
while True:
    try:
        a,b,c,d,e,f = map(int,input().split())
        x = (c * e - b * f) / (a * e - b * d)
        y = (c * d - a * f) / (b * d - a * e)
        
        if x == 0:
            x = 0
        if y == 0:
            y = 0
        print(f"{x:.3f} {y:.3f}")
    except:
        break


Measured memory_bytes: 5628
import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())
def comb(n, k):
    return math.factorial(n) // (math.factorial(n - k) * math.factorial(k))

def era(n):
    lis = [i for i in range(3, n + 1, 2)]
    lis.insert(0, 2)
    for ll in lis:
        lis = [i for i in lis if (i == ll or i % ll != 0)]
    return lis


n = ni()
if n == 1:
    print(0)
    exit()
lis = era(n)
lis2 = [[lis[i], 0] for i in range(len(lis))]
for i in range(1, n + 1):
    for j in lis:
        count = 0
        while(i % j == 0):
            i //= j
            count += 1
        lis2[lis.index(j)][1] += count
c74 = 0
c24 = 0
c14 = 0
c4 = 0
c2 = 0
for i in range(len(lis2)):
    if lis2[i][1] >= 74:
        c74 += 1
    if lis2[i][1] >= 24:
        c24 += 1
    if lis2[i][1] >= 14:
        c14 += 1
    if lis2[i][1] >= 4:
        c4 += 1
    if lis2[i][1] >= 2:
        c2 += 1
ans = 0
ans += comb(c4, 2) * (c2 - 2)
ans += c24 * (c2 - 1)
ans += c14 * (c4 - 1)
ans += c74
print(ans)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define ret return
#define all(vl) vl.begin(),vl.end()
#define sor sort 
#define cl clear
#define m_p make_pair 
#define sz(a) a.size()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,c;
	cin>>a>>b>>c;
	ll h = a+b+c;
	if(h>=22)cout<<"bust\n";	
	else cout<<"win\n";
	return 0;
}

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

	
	int main() {

		#ifndef ONLINE_JUDGE
	        freopen("input.txt","r",stdin);
	        // freopen("output.txt","w",stdout);
	    #endif
	    ios::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	   
	    ll a,b,c,d;
	    cin>>a>>b>>c>>d;
	    cout<<max(a*c,max(a*d,max(b*c, b*d)));
	    return 0;
}



	


Measured memory_bytes: 3624
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	b%=MOD;
	int ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n; cin>>n;
	if(n%2) cout<<0<<"\n";
	else{
		n/=2;
		int ans=0;
		while(n){
			ans+=n/5;
			n/=5;
		}
		cout<<ans<<"\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#ifndef LIB_REPEAT_HPP
#define LIB_REPEAT_HPP
#define repeat(i,n) for (int i = 0; i < (n); ++i)
#define repeat_from(i,m,n) for (int i = (m); i < (n); ++i)
#define repeat_one(i,n) for (int i = 1; i <= (n); ++i)
#define repeat_rev(i,n) for (int i = (n)-1; 0 <= i; --i)
#define foreach(it, cont) for (typeof(cont.begin()) it = cont.begin(); it != cont.end(); ++it)
#endif
#ifndef LIB_TYPEDEF_LL_HPP
#define LIB_TYPEDEF_LL_HPP
typedef long long ll;
typedef unsigned long long ull;
#endif
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    int m; cin >> m;
    repeat (dataset,m) {
        ll money; int year; int n; cin >> money >> year >> n;
        ll result = 0;
        repeat (way,n) {
            bool is_compound; double rate; ll charge; cin >> is_compound >> rate >> charge;
            ll balance = money;
            if (is_compound) {
                repeat (y,year) {
                    balance += balance * rate - charge;
                }
            } else {
                ll interest = 0;
                repeat (y,year) {
                    interest += balance * rate;
                    balance -= charge;
                }
                balance += interest;
            }
            result = max(result, balance);
        }
        cout << result << endl;
    }
    return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
#define LOOP(val, times)   for(val = 0; val < (times); val++)
int main(){
  int j;  
  
  for(int i=0;;i++){
    int a;
    cin>>a;
    if(a==0){
      break;
    }
    if(i!=0){
      cout<<endl;
    }
    vector<int> aa(4);
    int minaa=10000000;
    int faa=0;
    LOOP(j,4){
      cin>>aa[j];
      faa+=aa[j];
      
    }
    vector<int> ff(4);
    for(int j=0;j<=aa[0];j++){
      for(int k=0;k<=aa[1];k++){
        for(int h=0;h<=aa[2];h++){
          for(int g=0;g<=aa[3];g++){
            
             if(j*10+k*50+h*100+g*500>=a){
              int sa=j*10+k*50+h*100+g*500-a;
              int yy=0;
              if(sa>=500){
                yy+=sa/500;
                sa%=500;
              }
              if(sa>=100){
                yy+=sa/100;
                sa%=100;
              }
              if(sa>=50){
                yy+=sa/50;
                sa%=50;
              }
              if(sa>=10){
                yy+=sa/10;
              } 
              if(minaa>faa-j-k-h-g+yy){
                ff[0]=j;
                ff[1]=k;
                ff[2]=h;
                ff[3]=g;
                minaa=faa-j-k-h-g+yy;
              }
            }
          }
        }
      }
    }
    if(ff[0]!=0){
      cout<<10<<" "<<ff[0]<<endl;
    }
    if(ff[1]!=0){
      cout<<50<<" "<<ff[1]<<endl;
    }
    if(ff[2]!=0){
      cout<<100<<" "<<ff[2]<<endl;
    }
    if(ff[3]!=0){
      cout<<500<<" "<<ff[3]<<endl;
    }
  }
}
    


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int N;
int dif[100100];

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> dif[i];
    }
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        dif[i] -= a;
    }
    sort(dif, dif + N, greater<int>() );
    int M = 0;
    bool flag = false;
    int sum = 0;
    for(int i = 0; i < N; i++){
        if(dif[i] < 0 && !flag){
            M = i;
            flag = true;
        }
        if(flag){
            sum += dif[i];
        }
    }
    if(sum == 0){
        printf("0\n");
        return 0;
    }
    int sum2 = 0;
    for(int i = 0; i < M; i++){
        sum2 += dif[i];
        if(sum2 + sum >= 0){
            printf("%lld\n", N - (M - 1 - i));
            //printf("%lld %lld\n", sum, sum2);
            return 0;
        }
    }
    printf("-1\n");


    return 0;
}
/*



*/




Measured memory_bytes: 1024
# ABC144 B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

N = ni()

for i in range(1,10):
    for j in range(1,10):
        if i*j == N:
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 3060
/*input
6 5
1 2
2 3
3 4
4 5
5 6
*/
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 64;

vector<int> g[MAXN];
bool used[MAXN];
int timer, tin[MAXN], fup[MAXN];
int cnt = 0;
int n,m;

void dfs (int v, int p = -1) {
    used[v] = true;
    tin[v] = fup[v] = timer++;
    for (auto to : g[v]) {
        if (to == p)  continue;
        if (used[to])
            fup[v] = min (fup[v], tin[to]);
        else {
            dfs (to, v);
            fup[v] = min (fup[v], fup[to]);
            if (fup[to] > tin[v])
                cnt++;
        }
    }
}

void find_bridges() {
    timer = 0;
    for (int i = 0; i < n; ++i)
        used[i] = false;
    for (int i = 0; i < n; ++i)
        if (!used[i])
            dfs (i);
}

int main(int argc, char const *argv[])
{
  scanf("%d%d",&n,&m);
  while (m--) {
    int a,b;
    scanf("%d%d",&a,&b);
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  find_bridges();
  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.algorithm, std.range,
    std.numeric, std.typecons;

void main()
{
    long n, k;
    readf("%d %d\n", &n, &k);
    auto hs = readln.strip.split.to!(long[]);

    writeln(hs.count!(h => h >= k));
}


Measured memory_bytes: 4104