akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	int n, m, i, j, num, index;
	int tmps, tmpc;
	map <int, int> cond;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> tmps >> tmpc;
		if (n > 1 && tmps == 1 && tmpc == 0) {
			cout << "-1" << endl;
			return 0;
		}
		
		if (cond.find(tmps) == cond.end())
			cond[tmps] = tmpc;
		else {
			if (cond[tmps] != tmpc) {
				cout << "-1" << endl;
				return 0;
			}
		}
	}
	num = 0;
	if (n > 1 && cond.find(1) == cond.end())
		cond[1] = 1;

	if (n == 1)
		num = cond[1];
	if (n == 2)
		num += cond[2] + cond[1] * 10;
	if (n == 3)
		num += cond[3] + cond[2] * 10 + cond[1] * 100;
	
	cout << num << endl;

	return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll n, k;
vector<ll> a;
const ll M = pow(10, 9) + 7;

vector<ll> fac(10000001);  //n!(mod M)
vector<ll> ifac(10000001); //k!^{M-2} (mod M)
ll mpow(ll x, ll n)
{ //x^n(mod M)
    ll ans = 1;
    while (n != 0)
    {
        if (n & 1)
            ans = ans * x % M;
        x = x * x % M;
        n = n >> 1;
    }
    return ans;
}
//conbination
ll comb(ll a, ll b)
{ //aCb(mod M)
    if (a == 0 && b == 0)
        return 1;
    if (a < b || a < 0)
        return 0;
    ll tmp = ifac[a - b] * ifac[b] % M;
    return tmp * fac[a] % M;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    fac[0] = 1;
    ifac[0] = 1;
    for (ll i = 0; i < 1000000; i++)
    {
        fac[i + 1] = fac[i] * (i + 1) % M;              // n!(mod M)
        ifac[i + 1] = ifac[i] * mpow(i + 1, M - 2) % M; // k!^{M-2} (mod M)
    }
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
    }
    sort(ALL(a));
    ll ans=0;
    for(int i=n-1;i>=0;i--){
        ans+=(comb(i+1,k)-comb(i,k))*a[i];
        ans=(ans+MOD)%MOD;
    }
    //cout << ans << "\n";
    for(int i=0;i<n;i++){
        ans-=(comb(n-i,k)-comb(n-i-1,k))*a[i];
        ans=(ans+MOD)%MOD;
    }
    cout << ans << "\n";
}



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

using namespace std;

int main(void){
    int s;
    cin>>s;
    long long a=s;
    map<int,int> count;
    count[a-1]=1;
    for(int i=2;i<=1000000;i++){
        if(a%2==0){
            a=a/2;
        }else{
            a=3*a+1;
        }
        count[a-1]++;
        if(count[a-1]==2){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int n, m,count=0;
	vector<int>num;
	vector<bool>flag;
	cin >> n >> m;
	num.resize(n);
	flag.resize(n);
	flag.assign(n, false);
	num.assign(n, 1);
	flag[0] = true;
	for (int i = 0; i < m; i++)
	{
		int t1, t2;
		cin >> t1 >> t2;
		if (flag[t1 - 1])flag[t2 - 1] = true;
		num[t2 - 1]++;
		if (num[t1-1] > 0)
			num[t1-1]--;
		 if (num[t1 - 1] <=0&&flag[t1-1])flag[t1-1] = false;
	}
	for (int i = 0; i < n; i++)
	{
		if (flag[i])count++;
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 640
#! /usr/local/bin/python3
# coding: utf-8

def swap(c, i, j):
    t = c[i]
    c[i] = c[j]
    c[j] = t

def bubble_sort(cs, f):
    c = cs[:]
    for i in range(len(c) - 1):
        for j in range(len(c) - 1, i, -1):
            if f(c[j - 1]) > f(c[j]):
                swap(c, j - 1, j)
            # print(i, j, c)
    return c

def selection_sort(cs, f):
    c = cs[:]
    for i in range(len(c)):
        minj = i
        for j in range(i, len(c)):
            if f(c[j]) < f(c[minj]):
                minj = j
        swap(c, i, minj)
        # print(c)
    return c

def to_group(c):
    b = {}
    for i in c:
        if not(i[1] in b):
            b[i[1]] = [i]
        else:
            b[i[1]] = b[i[1]] + [i]
    return b

def is_stable(c, s): 
    bc = to_group(c)
    bs = to_group(s(c, lambda x: x[1]))
    # print(bc)
    # print(bs)
    for k in bc:
        if bc[k] != bs[k]:
            return "Not stable"
    return "Stable"

n = int(input())
c = input().split()

print(" ".join(bubble_sort(c, lambda x: x[1])))
print(is_stable(c, bubble_sort))

print(" ".join(selection_sort(c, lambda x: x[1])))
print(is_stable(c, selection_sort))




Measured memory_bytes: 5616
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
using namespace std;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int main(){
    //std::stack<int> stack;
    long long  a,b;
    cin >> a >> b;
    long long ans = -1;
    for(int i = 1; i < 10000; i++){
        if((int)i*8/100 == a && (int)i*10/100 == b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

int main() {
	int H[300];
	int W[300];
	int count;
	int i = 0;

	while (1) {
		std::cin >> H[i] >> W[i];
		if (H[i] == 0 && W[i] == 0) {
			count = i;
			break;
		}
		i++;
	}

	for (i = 0; i < count; i++) {
		for (int j = 0; j < H[i]; j++) {
			for (int k = 0; k < W[i]; k++) {
				std::cout << '#';
			}
			std::cout << '\n';
		}
		std::cout << '\n';
	}

	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);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; }

typedef long long ll;

using namespace std;

pair<ll,ll> cal2(ll h,ll w)
{
  if(h%2==0||w%2==0)return (pair<ll,ll>){h*w/2,h*w/2};
  ll ma=max(h,w),mi=min(h,w);


  return (pair<ll,ll>){ma/2*mi,(ma/2+1)*mi};
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h,w;
  cin>>h>>w;
  if(h%3==0||w%3==0){cout<<0<<endl;return 0;}
  ll res=1e9;
  repi(i,1,h)
  {
    ll nh=h-i;
    ll ar=i*w;
    auto tp=cal2(nh,w);
    ll ma,mi;
    ma=max({ar,tp.first,tp.second});
    mi=min({ar,tp.first,tp.second});
    //cout<<ma<<mi<<endl;

    chmin(res,ma-mi);
  }
  repi(i,1,w)
  {
    ll nw=w-i;
    ll ar=i*h;
    auto tp=cal2(h,nw);
    ll ma,mi;
    ma=max({ar,tp.first,tp.second});
    mi=min({ar,tp.first,tp.second});
    //cout<<ma<<mi<<endl;
    chmin(res,ma-mi);
  }
  cout<<res<<endl;

  return 0;

}


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

namespace Dice_and_Coin
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] X = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] Y = new int[X[0]];
            double[] kakuritu = new double[X[0]];

            //何回コインを投げるか考える
            for(int i = 0; i < X[0]; i++)
            {
                int first = i + 1;          //さいころの目（１から）
                int count = 0;
                while (first < X[1])
                {
                    first = first * 2;
                    count++;
                }
                Y[i] = count;
            }

            //各さいころの目で勝つ確率を計算
            for (int i = 0; i < X[0]; i++)
            {
                double tmp = 0.0;
                tmp = (1.0 / X[0]) * System.Math.Pow((1.0 / 2), Y[i]);
                kakuritu[i] = tmp;
            }

            //各さいころの目での勝つ確率を合計する
            double ans = 0.0;
            for (int i = 0; i < X[0]; i++)
            {
                ans = ans + kakuritu[i];
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13340
// Etavioxy
#include<cstdio>
#include<cctype>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define il inline
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch; int f=1;
	while(!isdigit(ch=getchar())) f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar())) x=(x*10)+(ch^'0');
	return f*x;
}

enum{N=100023};

int a[N],b[N];

int main(){
	int n=ci(), m=ci(), s=ci();
	int mn=1e9;
	int ans=0;
	rep(i,1,n) mn=min(mn,a[i]=ci());
	ans+=mn;
	mn=1e9;
	rep(i,1,m) mn=min(mn,b[i]=ci());
	ans+=mn;
	rep(i,1,s){
		int x=ci(), y=ci();
		ans=min(ans,a[x]+b[y]-ci());
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;


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

  string x,y; cin>>x>>y;
  string ans;
  if(x < y) ans = "<";
  else if(x > y) ans = ">";
  else ans = "=";
  cout<<ans<<endl;
}


Measured memory_bytes: 256
// Print a Chessboard
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_C
//
// Accepted

#![allow(non_snake_case)]

use std::io::{BufRead, stdin};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    loop {
        let mut buf = String::new();
        stdin.read_line(&mut buf).unwrap();

        let mut data = buf.split_whitespace();

        let H: i32 = data.next().unwrap().parse().unwrap();
        let W: i32 = data.next().unwrap().parse().unwrap();

        if H == 0 && W == 0 {
            break;
        }

        for i in 1..(H + 1) {
            for j in 1..(W + 1) {
                if (i + j) % 2 == 0 {
                    print!("#");
                } else {
                    print!(".");
                }
            }
            println!();
        }
        println!()
    }
}


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

using namespace std;

typedef long long ll;

template<typename T>
void _dump(const char* s, T&& head)
{
  cerr << s << "=" << head << endl;
}

template<typename T, typename... Args>
void _dump(const char* s, T&& head, Args&&... tail)
{
  while (*s != ',')
    cerr << *s++;
  cerr << "=" << head << ",";
  _dump(s + 1, tail...);
}

template<typename T>
void _dumpv(const char* s, T&& v)
{
  cerr << *s << "=";
  for (auto it = v.begin(); it != v.end(); it++) {
    cerr << *it << " ";
  }
  cerr << endl;
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__)
#define dumpv(...) _dumpv(#__VA_ARGS__, __VA_ARGS__)
// #define dump(...)
// #define dumpv(...)

const ll MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("template.1", "r", stdin);

  int X, A;
  cin >> X >> A;
  if (X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
  return 0;
}


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

struct Node
{
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k)
{
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL)
  {
    y = x;
    if (z->key < x->key)
    {
      x = x->left;
    }
    else
    {
      x = x->right;
    }
  }

  z->parent = y;
  if (y == NIL)
  {
    root = z;
  }
  else
  {
    if (z->key < y->key)
    {
      y->left = z;
    }
    else
    {
      y->right = z;
    }
  }
}

void inorder(Node *u)
{
  if (u == NIL)
    return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u)
{
  if (u == NIL)
    return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main()
{
  int n, i, x;
  string com;

  scanf("%d", &n);

  for (i = 0; i < n; i++)
  {
    cin >> com;
    if (com == "insert")
    {
      scanf("%d", &x);
      insert(x);
    }
    else if (com == "print")
    {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}


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

void sinCout(string str){
	cout << str << endl;
}

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

	if(R < 1200) sinCout("ABC");
	else if(1200 <= R && R < 2800) sinCout("ARC");
	else sinCout("AGC");
}

Measured memory_bytes: 256
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		ArrayList<ArrayList<Info>> list = new ArrayList<ArrayList<Info>>();
		for(int i = 0; i < N; i++) list.add(new ArrayList<Info>());
		
		for(int i = 0; i < M; i++){
			int index = i;
			int P = sc.nextInt();
			int Y = sc.nextInt();
			Info f = new Info();
			f.index = i;
			f.year = Y;
			list.get(P-1).add(f);
		}
		
		for(int i = 0; i < N; i++) Collections.sort(list.get(i), new yearComparator());
		
		ArrayList<Info> ansList = new ArrayList<Info>();
		for(int i = 0; i < N; i++){
			ArrayList<Info> pList = list.get(i);
			for(int j = 0; j < pList.size(); j++){
				Info f = pList.get(j);
				String number = String.format("%06d%06d", (i + 1), (j + 1));
				f.number = number;
				ansList.add(f);
			}
		}
		
		Collections.sort(ansList, new indexComparator());
		
		for(Info f : ansList){
			System.out.println(f.number);
		}
		
		/*
		for(int i = 0; i < N; i++){
			for(Info f : list.get(i)){
				System.out.println(f.index + " " + f.year + " " + f.number);
			}
		}
		*/
	}
	
	public static class yearComparator implements Comparator<Info> {
		@Override
		public int compare(Info info1, Info info2) {
			return info1.year < info2.year ? -1 : 1;
		}
	}
	
	public static class indexComparator implements Comparator<Info> {
		@Override
		public int compare(Info info1, Info info2) {
			return info1.index < info2.index ? -1 : 1;
		}
	}
	
	public static class Info{
		int index = 0;
		int year = 0;
		String number = "";
	}
}

Measured memory_bytes: 163708
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

pair<ll,bool> eval(ll n,ll k){
    ll a = ((2*k)/n + 1 - n)/2;
    return make_pair(a,((2*a + n - 1)*n)/2 == k);
}

pair<ll,ll> solve(ll k){
    pair<ll,ll> ans = {0,0};
    for(int i = 1; i < 100000; i++){
        auto ret = eval(i,k);
        if(ret.first >= 1 && ret.second){
            ans = {ret.first,i};
        }
    }
    return ans;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    vector<pair<ll,ll>> ans;

    while(true){
        ll k;
        cin >> k;
        if(k == 0)break;
        ans.push_back(solve(k));
    }

    for(auto &x:ans){
        cout << x.first << " ";
        cout << x.second << endl;
    }

    return 0;
}


Measured memory_bytes: 3176
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#define long long
using namespace std;

int main(){
	int a,b,c,t;
	cin>>a>>b>>c;
	if(a%b==0){
		t=a/b;
	}
	else{
		t=a/b+1;
	}
	cout<<t*c;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

int main()
{

    long long unsigned int a, b, c;

    std::cin >> a >> b >> c;

    if(b / a >= c){
        std::cout << c;
    }
    else{
        std::cout << b / a;
    }
    
    return 0;

}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
typedef long long ll;
using ll = long long;
using vi = vector<int>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    ios::sync_with_stdio(false);
    ll a, b, x;
    cin >> a >> b >> x;

    ll ans = (b / x + 1) - ((a-1) / x + 1);
    if(a == 0) ans = b / x + 1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		while(true){
			int n = Integer.parseInt(std.next());
			if(n==0){break;}

			double score[] = new double[n];
			double ave = 0;
			for(int i=0; i<n; i++){
				score[i] = Double.parseDouble(std.next());
				ave += score[i];
			}
			ave /= n;
			double sd = 0;
			for(int i=0; i<n; i++){
				sd += Math.pow((score[i]-ave),2);
			}
			sd /= n;
			sd = Math.pow(sd, 0.5);

			System.out.println(String.format("%.5f", sd));
		}
	}
}

Measured memory_bytes: 32148
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define EE emplace
#define RB rbegin()
#define MD 1000000007
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define PPF pop_front()
#define EB emplace_back
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;u.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>u;
map<LL,LL>ww,cc;
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
LL ar[100];
LL dxx[]= {-1,0,1,0};
LL dyy[]= {0,1,0,-1};
LL dx[]= {2,1,-1,-2,-2,-1,1,2};
LL dy[]= {1,2,2,1,-1,-2,-2,-1};
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
        cin>>n;
        if(n>=400&& n<=599)
        {
            k=8;
        }
        if(n>=600 && n<=799)
        {
            k=7;
        }
        if(n>=800 && n<=999)
        {
            k=6;
        }
        if(n>=1000 && n<=1199)
        {
            k=5;
        }
        if(n>=1200 && n<=1399)
        {
            k=4;
        }
        if(n>=1400 && n<=1599)
        {
            k=3;
        }
        if(n>=1600 && n<=1799)
        {
            k=2;
        }
        if(n>=1800 && n<=1999)
        {
            k=1;
        }
        cout<<k<<endl;
    }
    return 0;
    //IN
    //AL
}


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

int main() {
	string S;
	cin>>S;
	int flag = 1;
	for(int i=0;i<S.length();i++){
		if((i+1)%2==0){
			// L,U,D
			if(S[i]=='R'){
				flag = 0;
				break;
			}
		}	
		else{
			// R,U,D
			if(S[i]=='L'){
				flag = 0;
				break;
			}
		}
	}
	if(flag==0)
		cout<<"No";
	else
		cout<<"Yes";
		
	return 0;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  vector<int> bricks(N);
  for (int i = 0; i < N; ++i)
    cin >> bricks[i];

  int cur = 1;
  int ret = 0;
  for (int i = 0; i < N; ++i) {
    if (bricks[i] == cur) {
      ++cur;
    } else {
      ++ret;
    }
  }

  if (cur == 1)
    cout << -1 << endl;
  else
    cout << ret << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(int argc, char *argv[])
{
  vector<int> S;
  int q = 0;
  int t = 0;
  int C = 0;
  int n = 0;
  int s = 0;


  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    S.push_back(s);
  }
  sort(S.begin(), S.end());

  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> s;
    int start = 0;
    int end = S.size();
    while (start < end) {
      // cout << start <<" "<< end << "\n";
      if (S[(int)((end + start)/2)] < s) {
	start = (int)((end+start)/2)+1;
      }else if(S[(int)((end + start)/2)] > s){
	end = (int)((end + start)/2);
      }
      else{
	C++;
	break;
      }
    }
      
  }
  cout << C << "\n";
  return 0;
}



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

static class DrawingLots
{
    static void Main()
    {
        var v = int.Parse( Console.ReadLine() );
        var h = int.Parse( Console.ReadLine() );

        Enumerable.Repeat<Func<string>>( Console.ReadLine, h )
            .Select( x => x().Split( ',' ).Select( int.Parse ).OrderBy( y => y ).ToArray() )
            .Aggregate( Enumerable.Range( 1, v ), Sandwich )
            .ToList()
            .ForEach( Console.WriteLine );
    }

    static IEnumerable<int>
        Sandwich(IEnumerable<int> bans, int[] meat)
    {
        bans = bans.ToArray();
        foreach( var x in bans.Take( meat[0] - 1 ) )
            yield return x;
        yield return bans.ElementAt( meat[1] - 1 );
        foreach( var x in bans.Skip( meat[0] ).Take( meat[1] - meat[0] - 1 ) )
            yield return x;
        yield return bans.ElementAt( meat[0] - 1 );
        foreach( var x in bans.Skip( meat[1] ) )
            yield return x;
    }
}

Measured memory_bytes: 18872
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;

class Switches
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var switches = int.Parse(input[0]);
        var number = int.Parse(input[1]);
        var ans = 0;

        int[][] list = new int[number][];
        int[] switchOn = new int[number];

        for(var i = 0; i < number; i++)
        {
            var info = Console.ReadLine().Split(' ');
            
            list[i] = info.Select(int.Parse).ToArray();

        }

        var checkRemaind = Console.ReadLine().Split(' ');
        bool flag = true;

        for (var i = 0; i < Math.Pow(2, switches); i++)
        {
            for(var j = 0; j < switches; j++)
            {
                if((i >> j & 1)== 1)
                {
                    for(var k = 0;k < number; k++)
                    {
                        for(var l = 1;l <= list[k][0];l++)
                        {
                            if((j + 1) == list[k][l])
                            {
                                switchOn[k]++;
                            }
                        }
                    }
                }
            }

            for(var n = 0; n < switchOn.Length; n++)
            {
                    if(switchOn[n] % 2 != int.Parse(checkRemaind[n]))
                    {
                        flag = false;
                    }
            }

            for(var m = 0; m < switchOn.Length; m++)
            {
                switchOn[m] = 0;
            }

            if (flag)
            {
                ans++;
            }
            flag = true;

        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13396
#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, C, K, ans = 0;
    cin >> N >> C >> K;
    vector<int> T(N + 1, 2e9);
    rep(i, N) cin >> T[i];

    sort(all(T));
    T[N] = 0;
    int cnt = 1;
    int s = T[0] + K;
    repd(i, 1, N) {
        if (s >= T[i]) {
            cnt++;
        }
        else {
            s = T[i] + K;
            cnt = 1;
            ans++;
        }
        if (cnt >= C) {
            ans++;
            cnt = 0;
            s = T[i + 1] + K;
        }
        //cout << s << endl;
    }

    //cout << ans << " " << cnt << endl;
    if (cnt != 0) ans++;
    if (C == 1) ans = N;

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

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

int n,s,ans = 0;

//???????????°??????????¨???????????????°????????°
void dfs(int i,int sum,int num){
    
    if(num == n){
        
        if(sum == s){
            ans++;
        }
        return;
    }
    if(i == 10){
        return;
    }
    //i????????°??????,??????????????°????¶?????????????
    dfs(i+1,sum,num);
    //i????????¶
    dfs(i+1,sum + i,num+1);
}

int main(){

    while(cin >> n >> s){
        if(n == 0 && s == 0){
            break;
        }
        dfs(0,0,0);
        cout << ans << endl;
        ans = 0;
    }

    return 0;
}

Measured memory_bytes: 2980
package main

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

func gcd(x, y int) {
	for {
		if x == 0 || y == 0 {
			fmt.Println(0)
			return
		} else if x == 1 || y == 1 {
			fmt.Println(1)
			return
		} else if x > y && x%y == 0 {
			fmt.Println(y)
			return
		} else if y > x && y%x == 0 {
			fmt.Println(y)
			return
		} else if x == y {
			fmt.Println(x)
			return
		}
		tmp := y
		y = x % y
		x = tmp
	}
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	s := sc.Text()
	x, err := strconv.Atoi(s)
	if err != nil {
		panic(err)
	}

	sc.Scan()
	s = sc.Text()
	y, err := strconv.Atoi(s)
	if err != nil {
		panic(err)
	}

	gcd(x, y)
}



Measured memory_bytes: 1088
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll count(ll N, ll sum){//A+Bの数を数える
  ll result = N/sum;
  return result;
}
int main(){
  ll N, A, B;
  cin >> N >> A >> B;
  ll sum = A+B;
  ll mod = N % sum;
  ll re = count(N, sum);
  if (mod < A){//A側にいる
    ll result = N-(B*re);
    cout << result << endl;
  }
  else{
    ll result = (re + 1) * A;
    cout << result << endl;
  }
}

Measured memory_bytes: 256
s = input()
first = int(s[0:2])
last = int(s[2:4])

if 1 <= first <= 12:
    first_flag = 0
elif first > 12 or first == 0:
    first_flag = 1
else:
    first_flag = 2

if 1 <= last <= 12:
    last_flag = 0
elif last > 12 or last == 0:
    last_flag = 1
else:
    last_flag = 2

if first_flag == last_flag == 0:
    print("AMBIGUOUS")
elif first_flag + last_flag == 1:
    if first_flag == 1:
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")


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

int main(){
  int N, M;
  int A[110];
  cin >> N >> M;
  for (int i = 0; i < N; ++i) cin >> A[i];
  sort(A, A + N, greater<int>());
  int sum = accumulate(A, A + N, 0);
  if(A[M-1]*4*M < sum)cout << "No" <<endl;
  else cout << "Yes" << endl;
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <stack>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <list>
using namespace std;

int main()
{
  int N,K; cin >> N;
  string s; cin >> s;
  cin >> K;
  
  for(int i = 0; i < N; i++){
    if(s.at(i) == s.at(K-1)) cout << s.at(i);
    else cout << '*';
  }
  
  cout << endl;
}

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

using namespace std;

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

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

  return 0;
}

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

int main(){
    string s, t;
    cin >> s;
    cin >> t;
    int n = s.length();
    if (t.length() == n+1){
        for (int i=0; i<n; i++){
            if (s[i] != t[i]){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio>

#define nl '\n'

using namespace std;

string s;

int main(){
    cin >> s;
    if(s == "ABC") {
        cout << "ARC";
    } else {
        cout << "ABC";
    }
} 
//g++ -std=c++14 comp.cpp -o c && c.exe
//g++ -std=c++14 comp.cpp -o c; ./c.exe
//g++ -std=c++14 comp.cpp && ./a.out


//Surely this is going to AC


Measured memory_bytes: 3520
#include<stdio.h>
int p[100010]={0};
int d[100010]={0};
int S[100010]={0};//サイズ用配列 未実験
int Find(int a,int b){
  int r,n;
  for(r=a;p[r];r=p[r]);
  for(;n=p[a];a=n)p[a]=r;
  for(r=b;p[r];r=p[r]);
  for(;n=p[b];b=n)p[b]=r;
  return a-b?1:0;
}
void Union(int a,int b){
  if(Find(a,b)){
    for(;p[a];a=p[a]);
    for(;p[b];b=p[b]);
    d[a]<d[b]?(p[a]=b):(p[b]=a);
    if(d[a]==d[b])d[a]++;
    S[a]=S[b]=S[a]+S[b];
  }
}
int main(){
  int n,m,k,i,a,b,o,c[100010]={};
  for(i=0;i<100010;i++)S[i]=1;
  scanf("%d %d %d",&n,&m,&o);
  while(m--){
    scanf("%d %d",&a,&b);
    Union(a,b);
    c[a]++;
    c[b]++;
  }
  while(o--){
    scanf("%d %d",&a,&b);
    if(Find(a,b)==0){
      c[a]++;
      c[b]++;
    }
  }
  for(i=1;i<=n;i++){
    for(a=i;p[a];a=p[a]);
    S[i]=S[a];
  }
  ///for(i=0;i<n;i++)printf("%d %d\n",S[i+1],c[i+1]);printf("\n");
  for(i=1;i<=n;i++)printf("%d%c",S[i]-c[i]-1,n==i?'\n':' ');
  return 0;
}

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

using namespace std;

int main(int argc, char const* argv[])
{
  string S;
  cin >> S;

  int count = 0;
  if (S.at(1) == 'R') {
    ++count;
    if (S.at(0) == 'R') {
      ++count;
    }
    if (S.at(2) == 'R') {
      ++count;
    }
  } else {
    if (S.at(0) == 'R') {
      ++count;
    } else if (S.at(2) == 'R') {
      ++count;
    }
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 3512
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  vector<vector<int32_t>> A(3, vector<int>(3,0));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  int32_t N;
  cin >> N;
  for (int k = 0; k < N; k++) {
    int32_t b = 0;
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (A[i][j] == b) {
          A[i][j] = 0;
        }
      }
    }
  }

  bool bingo = false;
  //yoko
  for (int i = 0; i < 3; i++) {
    if (A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0) {
      bingo = true;
      break;
    }
  }
  //tate
  for (int i = 0; i < 3; i++) {
    if (A[0][i] == 0 && A[1][i] == 0 && A[2][i] == 0) {
      bingo = true;
      break;
    }
  }
  //naname
  if (A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0) {
    bingo = true;
  }
  if (A[2][0] == 0 && A[1][1] == 0 && A[0][2] == 0) {
    bingo = true;
  }
  if (bingo == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }


  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <cmath>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

typedef long long LL;
int n,m,tot,prm[10000],ans;
LL a[100100];
bool flag[100100];
struct data
{
    LL x;
    bool flag;
    bool operator<(const data &t) const
    {
        return x<t.x;
    }
} b[100100];

LL getLL()
{
    char ch;
    while (!isdigit(ch=getchar()));
    LL x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

void solve(LL x)
{
    LL u=1,v=1;
    for (int i=1; i<=tot; ++i)
    {
        int p=prm[i];
        if (!(x%p))
        {
            int cnt=0;
            for (; !(x%p); x/=p,(++cnt)%=3);
            repu(i,1,cnt)
                u*=p;
            repu(i,1,(3-cnt)%3)
                v=(1LL<<60)/v<p?1LL<<60:v*p;
        }
    }
    if (x>1)
    {
        LL t=sqrt(x);
        if (t*t==x)
            u*=x,v=(1LL<<60)/t<v?1LL<<60:v*t;
        else
            u*=x,v=(1LL<<60)/x/x<v?1LL<<60:v*x*x;
    }
    if (u<v)
        b[++m]=(data){u,0};
    else
        b[++m]=(data){v,1};
}

int main()
{
    repu(i,2,2200)
        if (!flag[i])
        {
            prm[++tot]=i;
            for (int j=i*2; j<=2200; flag[j]=1,j+=i);
        }
    prm[tot+1]=1e6;
    n=getLL();
    repu(i,1,n)
        solve(getLL());
    sort(b+1,b+1+m);
    for (int i=1,j; i<=m; i=j)
    {
        int cnt=0;
        for (j=i; j<=m && b[i].x==b[j].x; cnt+=b[j].flag,++j);
        ans+=b[i].x>1?max(cnt,j-i-cnt):1;
    }
    printf("%d\n",max(ans,1));
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define  all(v)     (v).begin(),(v).end()
#define  rall(v)    (v).rbegin(),(v).rend()
#define  pb         push_back
#define  eb         emplace_back
#define  mp         make_pair
#define  ff         first
#define  ss         second
#define  pf         push_front
#define  bs         binary_search
#define  lb         lower_bound
#define  ub         upper_bound
#define  dec(x)   fixed<<setprecision(x)
#define  lcm(a,b)   (a*b/__gcd(a,b))
const ll inf=LLONG_MAX;
const ll mod=1e9+7;
const ld pi=acos(-1);
                    
void solution(){
    ll n,x,t;
    cin>>n>>x>>t;
    ll ans=ceil(n*1.0/x*1.0);
    cout<<ans*t;
    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t;
    t=1;
   // cin>>t;
    while(t--){
        solution();
        cout<<"\n";
    }
    return 0;
}


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

const int N=100005;
const long long inf=1000000000000000ll;
int n,m,s,t;
long long ans[N];

struct G
{
	int inQ[N],Q[N],st,ed;
	long long dis[N];
	int cnt,h[N],to[N+N],las[N+N],c[N+N];
	void insert(int u,int v,int w)
	{
		las[++cnt]=h[u],h[u]=cnt,to[cnt]=v,c[cnt]=w;
		las[++cnt]=h[v],h[v]=cnt,to[cnt]=u,c[cnt]=w;
	}
	void spfa()
	{
		memset(dis,-1,sizeof(dis));
		int x,i;
		dis[Q[0]]=0,inQ[Q[0]]=1;
		while(st!=ed)
		{
			x=Q[st++],st%=N,inQ[x]=0;
			for(i=h[x];i;i=las[i])
			    if(dis[to[i]]==-1||dis[x]+c[i]<dis[to[i]])
			    {
			    	dis[to[i]]=dis[x]+c[i];
			    	if(!inQ[to[i]])
			    	{
			    		inQ[to[i]]=1;
			    		Q[ed++]=to[i],ed%=N;
			    	}
			    }
		}
	}
}G1,G2;

int main()
{
	scanf("%d%d%d%d",&n,&m,&s,&t);
	int i,u,v,w,x;
	for(i=1;i<=m;i++)
	{
		scanf("%d%d%d%d",&u,&v,&w,&x);
		G1.insert(u,v,w);
		G2.insert(v,u,x);
	}
	G1.st=0,G1.ed=1,G1.Q[0]=s;
	G2.st=0,G2.ed=1,G2.Q[0]=t;
	G1.spfa();
	G2.spfa();
	for(i=1;i<=n;i++)
		ans[i]=G1.dis[i]+G2.dis[i];
	for(i=n-1;i>=1;i--)
	    ans[i]=min(ans[i],ans[i+1]);
	for(i=1;i<=n;i++)
	    printf("%lld\n",inf-ans[i]);
	return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> g(N);
    vector<ll> cost(N);
    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        g[a - 1].emplace_back(b - 1);
        g[b - 1].emplace_back(a - 1);
    }
    REP(i, Q) {
        int p, q;
        cin >> p >> q;
        cost[p - 1] += q;
    }
    vector<bool> vis(N, true);
    queue<int> que;
    que.push(0);
    vis[0] = false;
    while (!que.empty()) {
        int now = que.front();
        que.pop();
        ll c = cost[now];
        REP(i, g[now].size()) {
            int nxt = g[now][i];
            if (vis[nxt]) {
                cost[nxt] += c;
                que.push(nxt);
                vis[nxt] = false;
            }
        }
    }
    print(cost);

    return 0;
}

Measured memory_bytes: 16372
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// 75 = 3*5*5 = (2+1)+(4+1)+(4+1)
// 75 = 75 = (74+1)
// 75 = 3*25 = (2+1)+(24+1)
// 75 = 15*5 = (14+1)+(4+1)
// auto MP = PrimeFac(N);
// for(auto i : MP){
//   cout << i.first << " " << i.second << endl;
// }
map<ll, ll> mp;

void PrimeFac(ll n){
  ll cnt = 0;
  while(n%2 == 0){
    n /= 2;
    cnt++;
  }
  if(cnt != 0) mp[2] += cnt;
  for(ll i = 3; i*i <= n; i += 2){
    cnt = 0;
    while(n%i == 0){
      n /= i;
      cnt++;
    }
    if(cnt != 0) mp[i] += cnt;
  }
  if(n != 1) mp[n] += 1;
  return;
}

ll nCr(ll n, ll r){
  if(n == r) return 1;
  if(n-r < r) r = n-r;
  if(r == 0) return 0;
  if(r == 1) return n;
  ll res = 1;
  for(ll i = 1; i <= r; i++){
    res *= n--;
    res /= i;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N; cin >> N;
  for(ll i = 1; i <=N; i++){
    PrimeFac(i);
  }
  int cnt74 = 0, cnt24 = 0, cnt14 = 0, cnt4 = 0, cnt2 = 0;
  for(auto i : mp){
    if(i.second >= 74) cnt74++;
    if(i.second >= 24) cnt24++;
    if(i.second >= 14) cnt14++;
    if(i.second >= 4) cnt4++;
    if(i.second >= 2) cnt2++;
  }
  ll ans = 0;
  ans += cnt74;  // a^74
  ans += ((cnt2-1) > 0 ? (cnt2-1) : 0) * cnt24;  // a^2 * b^24
  ans += ((cnt4-1) > 0 ? (cnt4-1) : 0) * cnt14;  // a^4 * b^14
  ans += ((cnt2-2) > 0 ? (cnt2-2) : 0) * nCr(cnt4, 2);  // a^2 * b^4 * c^4
  cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def eratosthenes(n):
    p = []
    t = [-1] * n

    for i in range(2, int(math.ceil(math.sqrt(n)))):
        if t[i] == -1:
            p.append(i)
            t[i] = i
            for j in range(2*i, n, i):
                if t[j] == -1:
                    t[j] = i

    for j in range(i+1, n):
        if t[j] == -1:
            p.append(j)
            t[j] = j

    return p, t

P, T = eratosthenes(10**6+1)

class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

def factor(a):
    ps = Counter()
    k = set()
    while a != 1:
        f = T[a]
        if a % f == 0:
            k.add(f)
        while a % f == 0:
            ps[f] += 1
            a //= f
    return ps, k

@mt
def slv(N, A):
    lcm = Counter()
    for a in A:
        ps, fs = factor(a)
        for k in fs:
            lcm[k] = max(lcm[k], ps[k])

    M = Mod(10**9+7)
    l = 1
    for k, v in lcm.items():
        l = M.mul(l, M.pow(k, v))

    ans = 0
    for a in A:
        ans = M.add(ans, M.div(l, a))
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))

    N = 10000
    # A = [random.randint(1, 10**6) for _ in range(N)]
    # print(slv(N, A))


if __name__ == '__main__':
    main()


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

int main(){
    int k;
    scanf("%d",&k);
    if(k%2==0||k%5==0){
        printf("-1");
    }else{
        ll cnt=0,sum=0;
        while(true){
            cnt++;
            sum=sum*10+7;
            if(sum%k==0){break;}
            else sum%=k;
        }
        printf("%lld",cnt);
    }
    return 0;
}


Measured memory_bytes: 3820
#include<stdio.h>
#include<math.h>
int main()
{
    int n,m,k,i,j,z;
    scanf("%d%d",&n,&m);
    double a[n][m];
    for(i=0;i<n;i++)
    for(j=0;j<m;j++)
    {
    	scanf("%lf",&a[i][j]);
	}
	double s=0;int ss=0;
	for(i=0;i<n;i++)
	{s=0;
	for(j=i+1;j<n;j++)
	{ s=0;
	for(z=0;z<m;z++)
	{
		s+=((a[i][z]-a[j][z])*1.0*(a[i][z]-a[j][z]));
	}
	    s=sqrt(s);
	    
	           if(s==(int)s)
	             ss++;
    }
	}
    printf("%d\n",ss); 
     
    
    
}

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

int main()
{
    char c=getchar();
    char ch[5];
    int t=1;
    while(c!='\n')
    {
        if(t==1||t==2||t==3)
            ch[t-1]=c;
            t++;
            c=getchar();
    }
    ch[3]='\0';
    puts(ch);
    return 0;
}


Measured memory_bytes: 1532
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main() {
    
    ll n;
    cin >> n;
    vll x(n);
    rep (i, n) cin >> x[i];
    ll r = 100000000000000000;
    ll t = 0;
    
    for (int i=1; i<=100; i++) {
        rep (j, n) {
            t += (i-x[j]) * (i-x[j]);
            
        }
        if (r > t) r = t;
        t = 0;
    }
    
    
    cout << r;

}


Measured memory_bytes: 3624
n = gets.strip.to_i
array = gets.split.map(&:to_i)
puts array.join(' ') 
 
for i in 1..n-1 do
  key = array[i]
  j = i
  while j > 0 && array[j-1] > key do
    array[j] = array[j-1]
    j -= 1
  end
  array[j] = key
  puts array.join(' ')
end

Measured memory_bytes: 8932
def main():
    N = input()
    S = [str(i) for i in input()]
    K = int(input())

    target_char = S[K - 1]
    result_list = []

    for s in S:
        if target_char != s:
            result_list.append("*")
        else:
            result_list.append(s)

    print("".join(result_list))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, Z, W;
std::vector<LL>a;

int main()
{
	in >> N >> Z >> W;
	rep(i, N)
	{
		LL tmp;
		in >> tmp;
		a.push_back(tmp);
	}
	if (N == 1) { out << abs(a[0] - W) << std::endl; }
	else { out << std::max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])) << std::endl; }
	return 0;
}

Measured memory_bytes: 256