akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
string a[51];
int cnt[51][27];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i];
		for(int j = 0; j < a[i].length(); j++)
		{
			cnt[i][a[i][j]-'a']++;
		}
	}
	string ans;
	for(int i=0;i<26;i++)
	{
		while(1)
		{
			bool pos=1;
			for(int j = 0; j < n; j++)
			{
				cnt[j][i]--;
				if(cnt[j][i]<0)
				{
					pos=0;
					break;
				}
			}
			if(pos) ans+=char('a'+i);
			else break;
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 256
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main(){
	NINJA;

	string a,b; cin >> a >> b;

	int n =sz(a);
	int cnt = 0;
	fo(i,n){
		if(a[i]!=b[i]) cnt++;
	}

	cout << cnt << endl;
	
	return 0;
}

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

using namespace std;
#define ll long long

const double pi = 3.141592653589793238;

int main()
{
    
    double a,b;
    int h,m;
    cin>>a>>b>>h>>m;

    double t1,t2;

    t1 = ((2*pi*h)/12) + (2 * pi* m)/(60 * 12);
    t2 = (2 * pi * m)/60;

    double ans = sqrt( (a * a) + (b * b) - 2 * a * b* cos(t1-t2));

    cout<<std::setprecision(20)<<ans<<endl; 

    return 0;
}


Measured memory_bytes: 4260
n, a, b = map(int, input().split())

mod = 10**9 + 7
res = pow(2, n, mod)

def cmb(n, r, mod):
    r = min(n-r, r)
    if r == 0:
        return 1
    over, under = 1, 1
    for i in range(1, r+1):
        over = over * (n-i+1) % mod
        under = under * i % mod
    inv = pow(under, mod-2, mod)
    return over * inv % mod


A = cmb(n, a, mod)
B = cmb(n, b, mod)

print((res - A - B - 1) % mod)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> m;
    for (ll i = 0; i < n; i++)
    {
        m[i]++;
    }

    for (ll i = 1; i < n; i++)
    {
        cin >> a[i];
        m[a[i] - 1]++;
    }
    for (auto t : m)
    {
        cout << t.second - 1 << endl;
    }
}

Measured memory_bytes: 17200
def b():
    ones, zeros, negatives, K = map(int, input().split())
    sum = 0
    if K > ones:
        sum += ones
        K -= ones
    else:
        sum += K
        K = 0
    if K > zeros:
        K -= zeros
    else:
        K = 0
    if K > negatives:
        sum -= negatives
        K -= negatives
    else:
        sum -= K

    print(sum)


##########
if __name__ == "__main__":
    b()


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

long koubai(long a,int b){
    
    int i=2;
    long c=a;
    while(c%b!=0){
        c=a*i;
        i++;
    }
   // cout<<c<<endl;
    return c;
}


int main(){
    int n;
    cin>>n;
    int suu[n];
    int ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ans+=a-1;
    }
    cout<<ans;

return 0;
}


Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
for i in range(N):
    A_sum.append(A[i]+A_sum[i])

B_sum = [0]
for i in range(M):
    B_sum.append(B[i]+B_sum[i])

max_count = 0
j = M
for i in range(N+1):
    if A_sum[i] > K:
        break

    while B_sum[j] + A_sum[i] > K:
        j -= 1
    max_count = max(max_count, i + j)
print(max_count)

Measured memory_bytes: 134132
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <stack>
#include <queue>
typedef long long ll;
using namespace std;

const ll MOD = 1e9+7;

int main(){
  ll i,j,k,n,m;
  cin >> n >> m;
  ll a[m];
  for(i=0;i<m;i++)cin >> a[i];
  ll dp[n+1]={};
  dp[0]=1;
  ll now=0;
  for(i=1;i<n+1;i++){
    if(a[now]==i){
      now++;
    }else{
      if(i>1)dp[i]+=dp[i-1]+dp[i-2];
      else dp[i]+=dp[i-1];
      dp[i]%=MOD;
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ll long long int
int main(void){
    // Your code here!
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 ll i,c,k,n;
 c=0;
 cin >> n;
 ll a[n];
 map<ll,vector<ll>> m;
 for(i=0;i<n;i++)
 {
  cin >> a[i];
  m[i+a[i]].pb(i);
 }
 for(i=0;i<n;i++)
 {
  k=i-a[i];
  if(m.find(k)!=m.end())
  {
   auto it=lower_bound(m[k].begin(),m[k].end(),i);
   c+=(ll)(it-m[k].begin());
  }
 }
 cout << c;
 return 0;
}

Measured memory_bytes: 27036
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int d=0,c=1,n,x,a;
	cin>>n>>x;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(d+a<=x)c++;
		d+=a;
	}
	cout<<c<<endl;
	return 0;
}

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

long long mod=1000000007;

long long modp(long long d,long long p){
    if (p==0){
        return 1 ;
    } else if (p==1){
        return d%mod ;
    } else if (p%2==0){
        return ((modp(d,p/2)%mod)*(modp(d,p/2))%mod)%mod;
    } else {
        return ((modp(d,p/2)%mod)*(modp(d,p/2))%mod)*d%mod;
    }
}

long long ncr(long long a,long long b){
    long long combinationans=1,combinationanss=1,combinationansm=1;
    for (long long i=0; i<b; i++){
        combinationanss=(combinationanss*(a-i))%mod;
        combinationansm=(combinationansm*modp(i+1,mod-2))%mod;
    }
    combinationans=(combinationanss*combinationansm)%mod;
    return (combinationans);
}

int main(void){
    long long n,m,p,ans=1;
    scanf("%lld%lld",&n,&m);
    p=m;
    for (long long i=2; i<=p; i++){
        long long count=0;
        while(p%i==0){
            p/=i;
            count++;
        }
        if (count!=0){
            ans=(ans*ncr(count+n-1,count))%mod;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}

struct UnionFind {
    vector<int> par, rank, diff_weight;

    UnionFind(int N) : par(N), rank(N), diff_weight(N) {
        rep(i, N) par[i] = i, rank[i] = 0, diff_weight[i] = 0;
    }

    int root(int x) {
        if (par[x] == x) return x;
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    int weight(int x) {
        root(x);
        return diff_weight[x];
    }

    int diff(int x, int y) {
        return weight(y) - weight(x);
    }

    bool unite(int x, int y, int w) {
        w += weight(x);
        w -= weight(y);
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) {
            swap(x, y);
            w = -w;
        }
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;

        return true;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    int N, M;
    bool flag = true;
    cin >> N >> M;

    UnionFind tree(N);
    rep(i, M)
    {
        int x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        if (tree.same(x, y)) {
            if (tree.diff(x, y) != z) {
                flag = false;
            }
        }
        else {
            tree.unite(x, y, z);
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for(int i = 0; i < N; ++i){
    cin >> H[i];
  }
  int maxL = 0;
  int tmpL = 0;
  for(int i = 0; i < N-1; ++i){
    if(H[i] >= H[i+1]){
      tmpL++;
    }else{
      tmpL = 0;
    }
    maxL = max(maxL, tmpL);
  }
  cout << maxL << endl;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var h = input[0];
            var w = input[1];
            var k = input[2];

            var grid = new string[6, 6];

            for (int i = 0; i < h; i++)
                for (int j = 0; j < w; j++)
                    grid[i, j] = "";

            int res = 0;

            for (int i = 0; i < h; i++)
            {
                var input1 = Console.ReadLine();
                for (int j = 0; j < w; j++)
                    grid[i, j] = input1[j].ToString();
            }

            for (int i = 0; i < 1 << h; i++)
            {
                for (int j = 0; j < 1 << w; j++)
                {
                    int thisi = i;
                    int thisj = j;
                    string strh = "";
                    string strw = "";
                    for (int l = 0; l < h; l++)
                    {
                        if ((thisi & 1) == 1)
                            strh += l.ToString();
                        thisi = thisi >> 1;
                    }
                    for (int l = 0; l < w; l++)
                    {
                        if ((thisj & 1) == 1)
                            strw += l.ToString();
                        thisj = thisj >> 1;
                    }

                    var thisgrid = new string[6, 6];
                    for (int l = 0; l < h; l++)
                        for (int q = 0; q < w; q++)
                            thisgrid[l, q] = grid[l, q];

                    for (int l = 0; l < strh.Length; l++)
                    {
                        int thish = int.Parse(strh[l].ToString());
                        for (int q = 0; q < w; q++)
                            thisgrid[thish, q] = "";
                    }

                    for (int l = 0; l < strw.Length; l++)
                    {
                        int thisw = int.Parse(strw[l].ToString());
                        for (int q = 0; q < h; q++)
                            thisgrid[q, thisw] = "";
                    }

                    int cnt = 0;
                    for (int l = 0; l < h; l++)
                        for (int q = 0; q < w; q++)
                            if (thisgrid[l, q] == "#")
                                cnt++;

                    if (k == cnt)
                        res++;

                }
            }

            Console.WriteLine(res);

        }


    }
}


Measured memory_bytes: 30588
n = int(input())
reds = []
for i in range(n):
    reds.append(tuple(map(int, input().split())))
reds = sorted(reds, key=lambda tup: tup[1], reverse=True)

blues = []
for i in range(n):
    blues.append(tuple(map(int, input().split())))
blues = sorted(blues, key=lambda tup: tup[0])

count = 0
for b in blues:
    paired = None
    for i in range(len(reds)):
        r = reds[i]
        if b[0] > r[0] and b[1] > r[1]:
            paired = i
            break
            
    if paired is not None:
        del reds[paired]
        count += 1

print(count)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
bool visited[100005];
stack<ll>s;
void addedge(vector< ll >adj[],ll u,ll v)
{
	adj[u].pb(v);
}
void topsort(vector<ll>adj[],ll vertex)
{
	visited[vertex]=true;
	for(int i=0;i<adj[vertex].size();i++)
	{
		if(visited[adj[vertex][i]]==true)
			continue;
		topsort(adj,adj[vertex][i]);
	}
	s.push(vertex);
}
void topologicalsort(vector<ll>adj[],ll v)
{
	for(int i=1;i<=v;i++)
	{
		if(visited[i]==true)
			continue;
		topsort(adj,i);
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,m,a,b,maxi=0;
	cin>>n>>m;
	ll dist[n+1]={0};
	vector<ll>adj[n+1];
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		addedge(adj,a,b);
	}
	topologicalsort(adj,n);
	while(!s.empty())
	{
		a=s.top();
		s.pop();
		for(int i=0;i<adj[a].size();i++)
		{
			if(dist[adj[a][i]]<dist[a]+1)
				dist[adj[a][i]]=dist[a]+1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(dist[i]>maxi)
			maxi=dist[i];
	}
	cout<<maxi<<endl;
	return 0;
}

Measured memory_bytes: 9472
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log,gcd
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')

#Pythonを用いる場合
#numpy 1.18.0, scipy 1.4.1, scikit-learn 0.22, numba 0.47.0, networkx 2.4
 
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
ans=[0,0,0,0]

for i in range(n):
    s=ss()
    if s=="AC":
        ans[0]+=1
    elif s=="WA":
        ans[1]+=1
    elif s=="TLE":
        ans[2]+=1
    else:
        ans[3]+=1

for i in range(4):
    if i==0:
        print("AC x "+str(ans[0]))
    elif i==1:
        print("WA x "+str(ans[1]))
    elif i==2:
        print("TLE x "+str(ans[2]))
    else:
        print("RE x "+str(ans[3]))
        


Measured memory_bytes: 37708
mod = 10 ** 9 + 7
S = input()[::-1]
W = [1, 10, 9, 12, 3, 4]

dp = [[0] * 13 for _ in range(len(S))]

for i, s in enumerate(S):
    if i == 0:
        if s == "?":
            for j in range(10):
                dp[0][j] = 1
        else:
            dp[0][int(s)] = 1
        continue

    w = W[i % 6]
    if s == "?":
        for n in range(10):
            r = (n * w) % 13
            for j in range(13):
                dp[i][(j + r) % 13] = (dp[i][(j + r) % 13] + dp[i - 1][j]) % mod

    else:
        n = int(s)
        r = (n * w) % 13
        for j in range(13):
            dp[i][(j + r) % 13] = (dp[i][(j + r) % 13] + dp[i - 1][j]) % mod

print(dp[len(S) - 1][5])


Measured memory_bytes: 61404
// ARC098A.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 3e5 + 200;

int pre[2][MAX_N], n;
char str[MAX_N];

int main()
{
    scanf("%d%s", &n, str + 1);
    for (int i = 1; i <= n; i++)
        pre[str[i] == 'E'][i]++, pre[0][i] += pre[0][i - 1], pre[1][i] += pre[1][i - 1];
    int ans = 1e9;
    for (int i = 1; i <= n; i++)
        ans = min(pre[0][i - 1] + pre[1][n] - pre[1][i], ans);
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    stack<ll> stk;
    string a;
    //cin>>a;
    while(cin>>a){ 
        //DEBUG(a);
        if(a[0]=='+' || a[0]=='-' || a[0]=='*'){
            ll sum =stk.top();
            stk.pop();
            //while(!stk.empty()){
                ll s=stk.top();
                stk.pop();
                //DEBUG(s);
                switch (a[0]){
                    case '+': sum = s+sum; break;
                    case '-': sum = s-sum; break;
                    case '*': sum = s*sum; break;
                }
            //}
            
            //DEBUG(sum);
            stk.push(sum);
        }else{
            //stk.push(stoi(a));
            stk.push(atoi(a.c_str()));
        }
    //}while(!cin.eof());
    }

    cout << stk.top() << endl;
    return 0;
}


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



int main(void)
{
	int n;
	cin >> n;

	vector <int> a;

	for (int i = 1; i <= n; i++) {
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
	}

	std::sort(a.begin(), a.end());

	int big = a.at(a.size()-1);
	double half = big*0.5;
	int down = a.at(0);
	int up = a.at(a.size()-2);

	for (int i = 1; i < a.size()-2; i++) {
		int tmp = a.at(i);
		if (tmp < half) {
			down = tmp;
		} else {
			up = tmp;
			break;
		}
	}

	double diff_d = half-(double)down;
	double diff_u = (double)up - half;

	if (diff_d < diff_u) {
		cout << big << " " << down << endl;
	} else {
		cout << big << " " << up << endl;
	}
	return 0;
}


Measured memory_bytes: 892
data = int(input())
up = data/100
down = data % 100
if(1 <= up and up <= 12):
    if(1 <= down and down <= 12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(1 <= down and down <= 12):
        print("YYMM")
    else:
        print("NA")

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

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
  ll N,ans=0;
  cin >> N;
  
  for(int i=1;i<N;i++){
  const auto &pf = prime_factorize(i);
    long long res = 1;
    for (auto p : pf) res *= p.second + 1;
    ans += res;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;



int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double v = a * a * b;
    double ans = 0;
    if(x < v/2) {
        ans = atan((a*b*b)/(2*x));
    } else {
        if(v != x) {
            ans = atan((2*(v-x)) / (a*a*a));
        }
    }
    ans *= (double)180/M_PI;
    cout << fixed << setprecision(10);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4076
A, B = map(int, input().split())
grid = [['#'] * 100 for _ in range(20)] + [['.'] * 100 for _ in range(20)]
A -= 1
cnt = 0
i = 0
j = 0
while cnt < A:
    grid[i][j] = '.'
    cnt += 1
    j += 2
    if j >= 100:
        i += 2
        j = 0
B -= 1
cnt = 0
i = 39
j = 0
while cnt < B:
    grid[i][j] = '#'
    cnt += 1
    j += 2
    if j >= 100:
        i -= 2
        j = 0
print(40, 100)
for row in grid:
    print(''.join(row))


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

int main(){
  long long H; cin >> H;
  long long count=0;
  long long now=1;
  while(true){
    if(H==0){
      break;
    }
    H/=2;
    count+=now;
    now*=2;
  }
  cout << count << endl;
  return 0;
}
    

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N-K):
  if A[K+i]/A[i] > 1:
    print('Yes')
  else:
    print('No')

# sum_A = [0]*N
# sum_A_k = 1
# for i in range(K):
#   sum_A_k = sum_A_k*A[i]
# sum_A[K-1] = sum_A_k

# for i in range(N-K):
#   sum_A[K+i] = sum_A[K-1+i]*A[K+i]/A[i]
#   if sum_A[K+i] > sum_A[K-1+i]:
#     print('Yes')
#   else:
#     print('No')

Measured memory_bytes: 31752
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<bool> snuke(n, true);
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int a;
            cin >> a;
            snuke[a - 1] = false;
        }
    }

    int ret = 0;
    for (auto x:snuke) {
        if (x)ret++;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3604
K,S = map(int, input().split())
count = 0
for i in range(K,-1,-1):
    if i <= S:
        z = i
        sum_xy = S - i
        for j in range(K, -1,-1):
            if j <= sum_xy:
                y = j
                if sum_xy - j <= K:
                    count += 1
    else:
        continue
print(count)

Measured memory_bytes: 41068
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
        int x,y;
        cin>>x>>y;
        for(int i=0;i<=x;i++){
             if(y==i*2+(x-i)*4){
                  cout<<"Yes"<<endl;
                  return 0;
             }
        }
        cout<<"No"<<endl;
        return 0;

     }


 


 






    





      

        


Measured memory_bytes: 3624
h, w = gets.split(" ").map(&:to_i)
map = Array.new(h)
h.times do |i|
  map[i] = gets.chomp.chars
end

def bfs(map, sx, sy)
  visited = Hash.new
  queue = []
  hop = []

  return 0 if map[sy][sx] == '#'

  step = 0
  key = "#{sx}.#{sy}"
  visited[key] = step
  queue.push([sx, sy, step])
  until queue.empty?
    x, y, step = queue.shift

    (0..3).each do |i|
      nx = x
      ny = y
      case i
      when 0
        nx = x - 1
      when 1
        nx = x + 1
      when 2
        ny = y - 1
      when 3
        ny = y + 1
      end

      key = "#{nx}.#{ny}"
      next if nx < 0 || nx >= map[y].size || ny < 0 || ny >= map.size
      next if visited.key?(key)

      visited[key] = step
      next if map[ny][nx] == '#'

      queue.push([nx, ny, step + 1])
      hop.push(step + 1)
    end
  end

  hop.max
end

result = 0
(0..(w - 1)).each do |x|
  (0..(h - 1)).each do |y|
    result = [result, bfs(map, x, y)].max
  end
end

puts result

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

    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846

    void solve(){
        int n;
        cin>>n;
        int total=0;
        for(int i=1;i<=n;i++){
            int x;
            cin>>x;
            if(i%2 && x%2)
                total++;
        }
        cout<<total;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;


/* UnionFind：素集合系管理の構造体(union by size)
    isSame(x, y): x と y が同じ集合にいるか。 計算量はならし O(α(n))
    unite(x, y): x と y を同じ集合にする。計算量はならし O(α(n))
    treeSize(x): x を含む集合の要素数。
*/
struct UnionFind {
    vector<int> size, parents;
    UnionFind() {}
    UnionFind(int n) {  // make n trees.
        size.resize(n, 0);
        parents.resize(n, 0);
        for (int i = 0; i < n; i++) {
            makeTree(i);
        }
    }
    void makeTree(int x) {
        parents[x] = x;  // the parent of x is x
        size[x] = 1;
    }
    bool isSame(int x, int y) { return findRoot(x) == findRoot(y); }
    bool unite(int x, int y) {
        x = findRoot(x);
        y = findRoot(y);
        if (x == y) return false;
        if (size[x] > size[y]) {
            parents[y] = x;
            size[x] += size[y];
        } else {
            parents[x] = y;
            size[y] += size[x];
        }
        return true;
    }
    int findRoot(int x) {
        if (x != parents[x]) {
            parents[x] = findRoot(parents[x]);
        }
        return parents[x];
    }
    int treeSize(int x) { return size[findRoot(x)]; }
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    int A[M], B[M], C[K], D[K];
    rep(i, M) cin >> A[i] >> B[i];
    rep(i, K) cin >> C[i] >> D[i];

    int friend_num[N] = {};
    vector<vector<int>> blocks(N);
    rep(i, M) {
        friend_num[A[i] - 1]++;
        friend_num[B[i] - 1]++;
    }
    rep(i, K) {
        blocks[C[i] - 1].push_back(D[i] - 1);
        blocks[D[i] - 1].push_back(C[i] - 1);
    }

    UnionFind tree(N);
    rep(i, M){
        if (!tree.isSame(A[i] - 1, B[i] - 1)) tree.unite(A[i] - 1, B[i] - 1);
    }
    rep(i, N){
        int ans = tree.treeSize(i) - 1;
        ans -= friend_num[i];
        rep(j, blocks[i].size()) {
            if(tree.isSame(i, blocks[i][j])) ans--;
        }
        cout << ans;
        if(i != N-1) cout << " ";
    }
    cout << endl;


    return 0;
}

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

#define int long long

int r, d, x;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> r >> d >> x;
	for (int i = 0; i < 10; i++)
		x = r * x - d, cout << x << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll>v(10000000,0);
void sieve(){
    v[1]=1;
    for(ll i=1; i<=10000000; i++){
       ll j=1;
       while(i*j<=10000000){
           v[i*j]=v[i*j]+1;
           j++;
       }
    }
}
int main(){
    sieve();
    ll x,sum=-1;
    cin>>x;
    for(ll i=1; i<=x;i++){
       sum=sum+i*v[i]; 
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 81256
#1.入力をちゃんと受け取る
#ex: 「２　5」　＝＞　a=2,b=5みたいにしないといけない
a, b = map(int, input().split())
#print(a)
#print(b)

#2.目的通りの計算をする
# ex: 2つの整数AとBの掛け算をやる
answer = a * b

#3.計算の結果を出力する　
print(answer)


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

#define MOD 1000000007
#define INF (1<<30)
#define NINF (1<<31)
#define INFL (1LL<<62)
#define NINFL (1LL<<63)

#define pe(str) return cout<<(str)<<endl,0
#define px(str) cout<<(str)<<endl,exit(0)
#define accu(ac,v) cout<<setprecision(ac)<<v<<endl
#define bpc(a) __builtin_popcount(a)
#define pr(str) cout<<(str)<<endl
#define prpr(str) cout<<str<<endl
#define db(str) cerr<<"debug:"<<(str)<<endl
#define dbdb(str) cerr<<"debugs:"<<str<<endl
#define re(i,n) for(int i=0;i<(n);i++)
#define rre(i,n) for(int i=(n);i>=0;i--)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b);i>=(a);i--)
#define bw(a,b,c) (((a)<=(b))&&((b)<=(c)))
#define hello cout<<"hello"<<endl
#define spre(a) setprecision(a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define IF(C,T,F) ((C)?(T):(F))
#define max3(a,b,c) max((a),max((b),(c)))
#define min3(a,b,c) min((a),min((b),(c)))
#define max4(a,b,c,d) max((a),max((b),max((c),(d))))
#define min4(a,b,c,d) min((a),min((b),min((c),(d))))
#define enl cout<<endl
#define declare(t,n) t n;cin>>n
#define EPS 1e-6
#define EPSIN(a,b) ((b)-EPS<=(a)&&(a)<=(b)+EPS)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<int> point;

template<class InputIterator>
void dump(InputIterator first,InputIterator last,char delim=' '){
	for(InputIterator it=first;it!=last;it++){
		if(it!=first)cout<<delim;
		cout<<*it;
	}
}

ull p(ull x,ull y){
	if(y==0) return 1;
	ull A=p(x,y/2)%MOD;
	// return (y&1?((A*A)%MOD*x)%MOD: (A*A)%MOD);
	return (y&1?((A*A)*x):(A*A));
}

template<class T>
void swp(T &a,T &b){
	T t=a; a=b; b=t;
}

template<class T>
int h(T first,string t){
	T it=first;
	int c=0;
	for(int i=0;i<t.size();i++){
		if(*it!=t[i]) c++;
		it++;
	}
	return c;
}

int main(void){
	int n;
	int f[100][10];
	int p[100][10];
	cin>>n;
	re(i,n)re(j,10)cin>>f[i][j];
	re(i,n)re(j,11)cin>>p[i][j];
	int m=NINF;
	rep(X,1,1<<10){
		int t=0;
		re(i,n){
			int k=0;
			re(XX,10){
				k+=f[i][XX]*((X>>XX)&1);
			}
			t+=p[i][k];
		}
		m=max(t,m);
	}
	px(m);
	return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    
    while True:
        n, x = tuple(map(int, sys.stdin.readline().split()))
        cnt = 0
        if n==0 and x ==0:
            break
        for i in range(1, n+1):
            for j in range(i+1, n+1):
                for k in range(j+1, n+1):
                    if i+j+k==x:
                        cnt+=1
        
        print(cnt)
                    
    

if __name__=='__main__':
    main()


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

vector<pair<char, ll>> RunLengthCompression(const string& s) {
  ll cur = 1;
  ll n = SZ(s);
  vector<pair<char, ll>> run;
  REP(i, n - 1) {
    if (s[i] == s[i + 1]) {
      cur++;
      continue;
    }
    run.push_back(make_pair(s[i], cur));
    cur = 1;
  }
  run.push_back(make_pair(s[n - 1], cur));
  return run;
}

int main() {
  string s;
  cin >> s;
  ll K;
  cin >> K;
  ll n = SZ(s);
  auto run = RunLengthCompression(s);
  ll m = SZ(run);
  // sが1種類の文字からなるとき
  if(m==1){
    cout << (ll) n*K/2 << endl;
    return 0;
  }
  // sが2種類以上の文字からなるとき
  ll a = 0;
  REP(i,m){
    a += run[i].second/2;
  }
  // sの両端が等しくないとき
  if(s[0] != s[n-1]){
    cout << (ll) a*K << endl;
    return 0;
  }
  // sの両端が等しいとき
  // (x,y,z)(x,y,z)(x,y,z) ==> (x),(y,z+x) (y,z+x),(y,z)
  ll b = a - run[0].second/2 - run[m-1].second/2 + (run[0].second+run[m-1].second)/2;
  cout << (ll) a + (K-1)*b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " ";cout << "\n"
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;string S;
    cin>> N >> S;
    ll s = S.size();
    rep(i,s){
        if(S[i] + N > 'Z'){
            S[i] = 'A' + (N - 'Z' + S[i] - 1);
        }
        else{
            S[i] += N;
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int x;
  cin>>x;
  if(x < 1200) {
    cout << "ABC" << endl;
  } else {
    cout << "ARC" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
from itertools import combinations_with_replacement as CwR

N,M,Q = map(int,input().split())

A = list(CwR(range(1,M+1),N))
lis = list()
for i in range(Q):
    a,b,c,d = map(int,input().split())
    a,b = a-1,b-1
    lis.append([a,b,c,d])

ans = 0
for A_ in A:
    tmp = 0
    for a,b,c,d in lis:
        if A_[b] - A_[a] == c:
            tmp += d
    ans = max(ans,tmp)

print(ans)


Measured memory_bytes: 84256
// J4180449 三宅亮輔
// 問題名
// - Marked Ancestor
// 問題URL
// - https://onlinejudge.u-aizu.ac.jp/problems/2170
// 所要時間
// - 30分
// 学んだこと
//
//
//

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll N, Q;
string A[100001];
ll B[100001];
ll p[100001];
ll par[100001];
bool marked[100001];

ll root(ll a) {
    if(a == par[a])
        return a;
    return par[a] = root(par[a]);
}

int main() {
    while(cin >> N >> Q) {
        ll ans = 0;
        if(N == 0 && Q == 0)
            break;
        par[1] = 1;
        p[1] = 1;
        marked[1] = true;
        for(ll i = 2; i <= N; i++) {
            cin >> p[i];
            par[i] = p[i];
            marked[i] = false;
        }
        for(ll i = 0; i < Q; i++) {
            cin >> A[i] >> B[i];
            if(A[i] == "M")
                if(marked[B[i]]) {
                    B[i] = 0;
                } else {
                    par[B[i]] = B[i];
                    marked[B[i]] = true;
                }
        }

        for(ll i = Q - 1; i >= 0; i--) {
            if(A[i] == "M") {
                par[B[i]] = p[B[i]];
            } else {
                ans += root(B[i]);
            }
        }

        cout << ans << endl;
    }
}


Measured memory_bytes: 11208
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        var A = sc.next().toInt()
        val B = sc.next().toInt()
        var C = sc.next().toInt()
        val D = sc.next().toInt()

        while (A > 0 && C > 0) {
            C -= B
            if (C <= 0) {
                pw.println("Yes")
                return
            }
            A -= D
        }
        pw.println("No")
    }
}


Measured memory_bytes: 36348
def main():
    N = int(input())
    S = input()
    max_count = 0
    totE, totW = 0, 0
    for c in S:
        if c == "E": totE += 1
        else: totW += 1

    countE, countW = 0, 0
    min_flip = float('inf')
    for i in range(N):
        f = countW  + totE-(S[i]=="E")- countE
        min_flip = min(min_flip, f)
        if S[i] == "E": countE += 1
        else: countW += 1

    return min_flip

if __name__ == '__main__':
    print(main())



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

int times = 0;

void swap(int &a, int &b)
{
	int temp;
	temp = a;
	a = b;
	b = temp;
	times++;
}

int main(void)
{
	int n, minj = 0;
	cin >> n;
	vector<int>A(n);
	for (int i = 0; i < n; i++)
		cin >> A[i];
	for (int i = 0; i < n; i++) {
		minj = i;
		for (int j = i + 1; j < n; j++) {
			if (A[j] < A[minj])
				minj = j;
		}
		if (i != minj)
			swap(A[minj], A[i]);
	}
	for (int i = 0; i < n; i++) {
		cout << A[i];
		if (i != n - 1)
			cout << " ";
		else
			cout << endl;
	}
	cout << times << endl;
	return 0;
}


Measured memory_bytes: 3104
#include<string>
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include <iomanip> // setprecisionを使用するのに必要

using namespace std;
#define d getchar()


int main() {

	int a, b, h, m;
	cin >> a >> b >> h >> m;
	double pi = 3.141592653589;
	double angH = h * 1.0 / 12 * pi * 2 + m * 1.0 / 12 / 60 * pi * 2;
	double angM = m * 1.0 / 60 * pi * 2;

	double ang;
	if (angH > angM) {
		ang = angH - angM;
	}
	else {
		ang = angM - angH;
	}

	if (ang > pi) {
		ang = 2 * pi - ang;
	}
	
	double l = a * a + b * b - 2 * a * b * cos(ang);
	l = sqrt(l);

	cout << setprecision(10) << l;

}


Measured memory_bytes: 4164
#include <iostream>
#include <string>
int main(){
std::string A,B;
std::cin >> A >> B;
if(A=="H" && B=="H")
std::cout << "H" << std::endl;
else if(A=="D" && B=="H")
std::cout << "D" << std::endl;
else if(A=="D" && B=="D")
std::cout << "H" << std::endl;
else
std::cout << "D" << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n,m,a[2000];
vector<int> t;
int main(){
  a[0]=0;
  while(cin>>n>>m&&n&&m){
    t.clear();
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
      for(int j=i;j<=n;j++){
	t.push_back(-(a[i]+a[j]));
      }
    }
    sort(t.begin(),t.end());
    int ans=0;
    for(int i=0;i<(int)t.size();i++){
      int x=-t[i];
      int y=m-x;
      if(y<0)continue;
      vector<int> :: iterator it;
      it = upper_bound(t.begin(),t.end(),-y);
      if(it==t.end())continue;
      int z = *it;
      ans=max(ans,x-z);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3176
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
	using namespace std;
	string s[111];
	signed main() {
		int n, l;
		cin >> n >> l;
		for (int i = 0; i < n; i++)cin >> s[i];
		sort(s, s + n);
		for (int i = 0; i < n; i++) {
			cout << s[i];
		}
		cout << endl;
		getchar(); getchar(); return 0;
}

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

#define scanll(a) scanf("%lld",&a)
#define printll(a) printf("%lld\n",a)


int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<b-a+1;
    for(int i=b-a+2;i<=b+a-1;i++)
        cout<<" "<<i;
    cout<<endl;


}


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

# N!の約数で約数をちょうど75個持つものは何個あるか
primes = []
primes4 = []
primes14 = []
primes24 = []
primes74 = []
for x in range(2,N//2+1):
    isPrime = True
    for i in range(2, x):
        if x % i == 0:
            isPrime = False
            break
    if isPrime:
        primes.append(x)


for p in primes:
    cnt = 0
    for i in range(1, 7):
        cnt += N // (p ** i)
    if cnt >= 74:
        primes74.append(p)
    if cnt >= 24:
        primes24.append(p)
    if cnt >= 14:
        primes14.append(p)
    if cnt >=4:
        primes4.append(p)



res = 0
n = len(primes)
n4 = len(primes4)
n14 = len(primes14)
n24 = len(primes24)
n74 = len(primes74)

# 3,25のパターン
res += (n-1)*n24

# 75のパターン
res += n74

# 3,5,5のパターン
if n4 >= 2:
    res += (n - 2) * n4 * (n4 - 1) // 2

# 5, 15 のパターン
if n14 > 0:
    res += (n4-1)*n14

print(res)


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <numeric>
#include <stack>
#include <vector>

using namespace std;

#define NMAX 100000

struct edge {
  int to, next;
};

struct UnionFind {
  vector<int> a;
  UnionFind(int n) : a(n) { iota(a.begin(), a.end(), 0); }
  int Find(int x) {
    if (x == a[x])
      return x;
    auto y = Find(a[x]);
    a[x] = y;
    return y;
  }
  // special union: also sets the representative to the second argument
  void Union(int x, int new_rep) {
    int repx = Find(x);
    int repy = Find(new_rep);
    a[repx] = new_rep;
    a[repy] = new_rep;
    a[new_rep] = new_rep;
  }
};

int main() {
  int n;
  cin >> n;
  vector<int> LE(n, -1), parent(n, -1);
  vector<edge> E(n);
  for (int i = 0, m = 0; i < n; ++i) { // n nodes
    int nch;
    cin >> nch;
    for (int j = 0, ch; j < nch; ++j) {
      cin >> ch;
      E[m] = {ch, LE[i]};
      LE[i] = m++;
      parent[ch] = i;
    }
  }

  {
    int q;
    cin >> q;
  }

  struct query {
    int src, dst, res;
  };
  vector<query> queries;

  struct query_ref {
    int other, idx;
  };
  vector<vector<query_ref>> match(n);
  vector<int> visited(n);

  for (int i = 0, u, v; cin >> u >> v; ++i) {
    queries.push_back({u, v, -1});
    match[u].push_back({v, i});
    match[v].push_back({u, i});
  }

  // the representative of the set associated with each node `u`
  // is the active node of greatest depth that is an ancestor of `u`
  UnionFind uf(n);

  stack<int> s;
  s.push(0);
  while (!s.empty()) {
    int u = s.top();
    s.pop();
    if (!visited[u]) {
      visited[u] = 1;
      s.push(u);
      for (query_ref &qr : match[u]) {
        if (visited[qr.other]) {
          queries[qr.idx].res = uf.Find(qr.other);
        }
      }
      for (int j = LE[u]; j != -1; j = E[j].next) {
        s.push(E[j].to);
      }
    } else { // visited
      if (parent[u] >= 0)
        uf.Union(u, parent[u]);
    }
  }

  for (query &quer : queries)
    cout << quer.res << endl;
}


Measured memory_bytes: 12924
#include<cstdio>

int s[110],n,m;

int main()
{
    int i,j,k,l;
    bool pass;
    while (1)
    {
        scanf("%d%d",&n,&m);
        if (n==0&&m==0) break;
        for (i=0;i<m;i++)
            scanf("%d",&s[i]);
        for (i=0;i<n;i++)
            for (j=0;j<m;j++)
            {
                scanf("%d",&k);
                s[j]-=k;
            }
        pass=true;
        for (i=0;i<m;i++)
            if (s[i]<0)
            {
                pass=false;
                break;
            }
        if (pass) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 732
import sys
n,a,b,c = map(int, input().split())
 
s = list()
for i in range(n):
    s.append(input())
 
r = list()
 
for i in range(n):
    if s[i]=='AB':
        if a>b:
            r.append('B')
            a=a-1
            b=b+1
        elif a<b:
            r.append('A')
            a=a+1
            b=b-1
        else:
            if i==n-1 or 'A' in s[i+1]:
                r.append('A')
                a=a+1
                b=b-1
            else: 
                r.append('B')
                a=a-1
                b=b+1
    elif s[i]=='AC':
        if a>c:
            r.append('C')
            a=a-1
            c=c+1
        elif a<c:
            r.append('A')
            a=a+1
            c=c-1
        else:
            if i==n-1 or 'A' in s[i+1]:
                r.append('A')
                a=a+1
                c=c-1
            else: 
                r.append('C')
                a=a-1
                c=c+1
    else:
        if b>c:
            r.append('C')
            b=b-1
            c=c+1
        elif b<c:
            r.append('B')
            b=b+1
            c=c-1
        else:
            if i==n-1 or 'B' in s[i+1]:
                r.append('B')
                b=b+1
                c=c-1
            else: 
                r.append('C')
                b=b-1
                c=c+1
    if min(a,b,c)<0:
        print('No')
        sys.exit()
 
 
print('Yes')
for str in r:
    print(str)

Measured memory_bytes: 17092
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

struct per{
    int x[17],y[17];
    int a;
}n[20];
int N;
int mx=0;

int main(){
    cin>>N;

    int a[N+1];
    for(int i=1;i<=N;i++){
        cin>>n[i].a;
        for(int j=1;j<=n[i].a;j++){
            cin>>n[i].x[j]>>n[i].y[j];
        }
    }
    for(int i=0;i<=N;i++){
        a[i]=0;
    }
    while(a[0]==0){
        int ans[N+1];
        for(int i=0;i<=N;i++){
            ans[i]=-1;
        }
        int f=0;
        for(int i=1;i<=N;i++){
            if(a[i]==0){

            }
            else{
                for(int j=1;j<=n[i].a;j++){
                    if(a[n[i].x[j]]!=n[i].y[j]){
                        f=1;
                        break;
                    }
                }
            }
            if(f){
                break;
            }
        }
        if(f){
        }
        else{
            int cc=0;
            for(int i=1;i<=N;i++){
                if(a[i]==1){
                    cc++;
                }
            }
            if(cc>mx){

                mx=cc;
            }
        }
        int zb=N;
        while(1){
            if(a[zb]==0){
                a[zb]=1;
                break;
            }
            else{
                a[zb]=0;
                zb--;
            }
        }

    }
    cout<<mx;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
const ll inf =1000000007;

void solve(){
    ll n,m;
    cin >> n>> m;
    for(ll i=0;i<m;i++){
        ll a;
        cin >> a;
        n-=a;
    }
    if(n<0) n=-1;
    kaku(n);
}

int main(){
    solve();
}

Measured memory_bytes: 3636