akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll popcount(ll n){
    ll ret=0;
    while(n>0){
        ret+=n%2;
        n/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll h,n;cin>>h>>n;
    ll a[n],b[n];
    rep(i,0,n)cin>>a[i]>>b[i];
    ll dp[n+1][20001];
    rep(i,0,n+1)rep(j,0,20001)dp[i][j]=inf;
    dp[0][0]=0;
    rep(i,1,n+1){
        rep(j,0,20001){
            if(j<a[i-1]){
                dp[i][j]=min(dp[i][j],dp[i-1][j]);
            }
            else{
                ll u=min(dp[i-1][j],dp[i][j-a[i-1]]+b[i-1]);
                dp[i][j]=min(dp[i][j],u);
            }
        }
    }
    ll ans=inf;
    rep(i,h,20001){
        ans=min(ans,dp[n][i]);
        
    }
    //rep(i,0,20)cout<<dp[n][i]<<endl;
    cout<<ans<<endl;
}



Measured memory_bytes: 156672
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        Console.WriteLine(Console.ReadLine().Split().Select(int.Parse).Max() <= 8 ? "Yay!" : ":(");
    }
}


Measured memory_bytes: 28204
import sys
INF = 1_000_000_001
N = int(input())
A = input().split()
n = INF
for a in A:
    a = int(a)
    if a % 2 != 0:
        print(0)
        sys.exit()
    cnt = 0
    while a % 2 == 0:
        a = a >> 1
        cnt += 1
    n = min(n, cnt)
print(n)


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

int main() {

	int n; cin >> n;
	unordered_map<ll, ll> mp;
	for (int i = 0; i < n; i++) {
		ll a; cin >> a;
		mp[a]++;
	}
	vector<pair<ll,bool>> c;
	for (auto u : mp) {
		if (4 <= u.second) {
			c.push_back({ u.first,true });
		}
		else if (2 <= u.second) {
			c.push_back({ u.first,false });
		}		
	}
	sort(c.rbegin(), c.rend());
	ll l = -1;
	ll s = -1;
	for (int i = 0; i < c.size(); i++) {
		if (l == -1) {
			if (c[i].second) {
				cout << c[i].first * c[i].first << endl;
				return 0;
			}
			else {
				l = c[i].first;
			}
		}
		else if (s == -1) {
			s = c[i].first;
			break;
		}
	}
	if (c.size() < 2) cout << 0 << endl;
	else cout << l * s << endl;
    return 0;
}

Measured memory_bytes: 7200
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

/*template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
*/
int main(){
	int a,b;cin>>a>>b;

    int c=0;
    int b1=1;
    
    while(b1<b){
    	c++;
    	b1+=a;
    	b1--;
	}
	
	cout<<c<<endl;
	
    	
	return 0;
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int comparetor (const void * a, const void * b)
{
	return ( *(int*)a - *(int*)b );
}
int main()
{
    int n;  scanf("%d", &n);
    int *arr = malloc(n*sizeof(int));
    for(int i=0; i<n; i++)
        scanf("%d", &arr[i]);
    qsort(arr, n, sizeof(int), comparetor);
    double ans = (double)(arr[0]+arr[1])/2;
    for(int i=2; i<n; i++)
        ans = (double)(ans+arr[i])/2;
    printf("%lf\n", ans);
    return 0;
}

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


int main()
{
	unsigned long long n;
	vector<long long> list;

	cin >> n;
	for (unsigned long iN = 1; iN <= n; iN++)
	{
		long long num;
		cin >> num;
		list.push_back(num);
	}

	std::sort(list.begin(), list.end(), std::greater<int>());

	long long result = 0;
	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
		{
			result += list[i];
		}
		else
		{
			result -= list[i];
		}
	}

	cout << result << endl;
}

//int main()
//{
//	unsigned long n, a, b;
//
//	cin >> n >> a >> b;
//
//	unsigned long sum = 0;
//	for (unsigned long iN = 1; iN <= n; iN++)
//	{
//		unsigned long last = iN;
//
//		unsigned long rank10000 = last / 10000;
//		last -= rank10000 * 10000;
//
//		unsigned long rank1000 = last / 1000;
//		last -= rank1000 * 1000;
//
//		unsigned long rank100 = last / 100;
//		last -= rank100 * 100;
//
//		unsigned long rank10 = last / 10;
//		last -= rank10 * 10;
//
//		unsigned long rank1 = last;
//
//		unsigned long temp_sum = rank10000 + rank1000 + rank100 + rank10 + rank1;
//		if (temp_sum >= a && temp_sum <= b)
//		{
//			sum += iN;
//		}
//	}
//
//	cout << sum << endl;
//}

//int main()
//{
//	int coin500, coin100, coin50;
//	int x;
//
//	cin >> coin500 >> coin100 >> coin50 >> x;
//
//	int count_pattern = 0;
//	for (int i500 = 0; i500 <= coin500; i500++)
//	{
//		for (int i100 = 0; i100 <= coin100; i100++)
//		{
//			for (int i50 = 0; i50 <= coin50; i50++)
//			{
//				if (i500 * 500 + i100 * 100 + i50 * 50 == x)
//				{
//					count_pattern++;
//				}
//			}
//		}
//	}
//
//	cout << count_pattern << endl;
//}

//int main()
//{
//	int n;
//	vector<int> list;
//
//	cin >> n;
//
//	for (int i = 0; i < n; i++)
//	{
//		int num;
//		cin >> num;
//		list.push_back(num);
//	}
//
//	int proc_count = 0;
//	while (true)
//	{
//		bool valid = true;
//		for (int i = 0; i < n; i++)
//		{
//			if (list[i] % 2 > 0)
//			{
//				valid = false;
//				break;
//			}
//			else
//			{
//				list[i] /= 2;
//			}
//		}
//
//		if (valid == true)
//		{
//			proc_count++;
//		}
//		else
//		{
//			break;
//		}
//	}
//
//	cout << proc_count << endl;
//}

//int main()
//{
//	string str;
//
//	cin >> str;
//
//	int count_one = 0;
//
//	if (str[0] == '1')
//	{
//		count_one++;
//	}
//	
//	if (str[1] == '1')
//	{
//		count_one++;
//	}
//
//	if (str[2] == '1')
//	{
//		count_one++;
//	}
//
//	cout << count_one << endl;
//}


//int main()
//{
//	int a, b;
//
//	cin >> a >> b;
//
//	int c = a * b;
//
//	if (c % 2 == 0)
//	{
//		cout << "Even" << endl;
//	}
//	else
//	{
//		cout << "Odd" << endl;
//	}
//}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int A[100];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) cin >> A[i];
  int h = 10000;
  int ctr = 0;
  rep(i, N-1) {
    if (A[i] == A[i+1]) A[i+1] = h++, ctr++;
  }
  cout << ctr << "\n";
  return 0;
}


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

int main() {
  ll N;
  cin >> N;
  ll sum = 0;
  for (ll i = 1; i <= N; i++) {
    if ((i % 3 == 0) || (i % 5 == 0)) {
      continue;
    }
    else {
      sum += i;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
  // A君の回答を受け取る
  int H,W,h,w;
      cin >> H>>W>>h>>w;
      int ret;

      ret=H*W-h*W-w*H+h*w;


  cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n,y;
    cin >> n >> y;
    rep(i,n+1) {
        rep(j,n+1) {
            int k = n-j-i;
            if (k < 0) break;
            if (10000*i + 5000*j + 1000*k == y) {
                printf("%d %d %d\n", i,j,k);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
typedef struct _data
{
    int node;
    int weight;
}Data;
vector<Data> vec[100005];
int N, M, chk[100005], dist[100005], result, Count, resultChk[100005];

void BFS()
{
    queue<Data> q;
    for(int j = 1; j <= N; j++)
    {
        if(chk[j] == 0)
        {
            if(resultChk[j] == 0)
            {
                resultChk[j] = 1;
                Count++;
            }
            memset(dist, -1, sizeof dist);
            q.push({j, 0});
        }
        while(!q.empty())
        {
            Data temp;
            temp = q.front();
            q.pop();
            for(int i = 0; i < vec[temp.node].size(); i++)
            {
                Data next;
                next.node = vec[temp.node][i].node;
                next.weight = temp.weight + vec[temp.node][i].weight;
                if(dist[next.node] != -1 && dist[next.node] != next.weight)
                {
                    result = -1;
                    return;
                }
                dist[next.node] = next.weight;
                chk[next.node]--;
                if(chk[next.node] == 0)
                {
                    if(resultChk[next.node] == 0)
                    {
                        resultChk[next.node] = 1;
                        Count++;
                    }
                    q.push(next);
                }
            }
        }
    }
}

int main()
{
    scanf("%d %d", &N, &M);
    for(int i = 0; i < M; i++)
    {
        int l, r, d;
        scanf("%d %d %d", &l, &r, &d);
        vec[l].push_back({r, d});
        chk[r]++;
    }
    BFS();
    if(Count != N)
    {
        result = -1;
    }
    result == 0 ? printf("Yes") : printf("No");
}

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

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

    int c[n], a[n];
    for(int i = 0; i < n; i++)  a[i] = 0, cin >> c[i];

    int q;
    cin >> q;

    int t, x, d;
    while(q-- > 0){
        cin >> t >> x >> d;
        x--;
        if(t == 1){
            a[x] += d;
            if(a[x] > c[x]){
                cout << x+1 << endl;
                return 0;
            }
        }else if(t == 2){
            a[x] -= d;
            if(a[x] < 0){
                cout << x+1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3108
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
n = I()
a = LI()
ans = 0
k = a[0]
for i in range(1,n):
    if k*(k+a[i]) >= 0:
        if k < 0:
            ans += abs(1-k-a[i])
            a[i] = 1-k
            k = 1
        else:
            ans += abs(-1-k-a[i])
            a[i] = -1-k
            k = -1
    else:
        k += a[i]
print(ans)
"""

#D
x,y = LI()
if abs(x-y) <= 1:
    print("Brown")
else:
    print("Alice")
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38640
use proconio::input;

#[proconio::fastout]
pub fn main() {
    input! {
    k:isize,
    mut a:[isize],
    }
    a.push(k + a[0]);
    let ans = k - a.windows(2).map(|pair| pair[1] - pair[0]).max().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 5164
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

const ll MOD = INF + 7;



int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    vector<int>plus_num, minus_num, zero_num;
    bool plus = false, minus = false;
    rep(i, n){
        cin >> a[i];
        if(a[i] < 0){
            minus = true;
            minus_num.push_back(a[i]);
        }
        if(a[i] > 0){
            plus = true;
            plus_num.push_back(a[i]);
        }
        if(a[i] == 0)zero_num.push_back(a[i]);
    }


    sort(ALL(a));
    sort(ALL(plus_num));
    sort(ALL(minus_num));




    if(!plus && !minus){
        cout << 0 << endl;
        rep(i, n - 1)cout << 0 << " " << 0 << endl;
    }





    else if(plus && !minus){
        vector<P> p;
        int now = a[0], sum = 0;
        REP(i, 1, n - 2){
            p.emplace_back(now, a[i]);
            sum += now - a[i];
            now = now - a[i];
        }
        p.emplace_back(a[n - 1], now);
        sum = a[n - 1] - now;

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






    else if(!plus && minus){
        vector<P> p;
        reverse(ALL(a));
        int now = a[0], sum = 0;
        REP(i, 1, n - 1){
            p.emplace_back(now, a[i]);
            now = now - a[i];
        }

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






    else {
        int MX = a[n - 1], MN = a[0];
        vector<P> p;
        int sum = 0;
        for(int i = 0; i < plus_num.size() - 1; i++){
            int pn = plus_num[i];
            p.emplace_back(MN, pn);
            MN -= pn;
        }

        for(int i = minus_num.size() - 1; i > 0; i--){
            int mn = minus_num[i];
            p.emplace_back(MX, mn);
            MX -= mn;
        }
        p.emplace_back(MX, MN);
        sum = MX - MN;
        for(int zn : zero_num){
            p.emplace_back(sum, zn);
        }

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


}

Measured memory_bytes: 4592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

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

    int sn =0;
    int j=0;
    for(int i=0;i<10;i++){
      	if(i!=4 && i!=7){
          sn += (s[i]-'0')*pow(10,7-j);
          j++;
        }
        
    } 
	if(sn <=20190430)cout << "Heisei" << endl;
  	else cout << "TBD" <<endl;
    
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    int h, ans = 0;
    for (int i=0; i<n; i++) {
        cin >> h;
        if (h >= k) {
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			long[] t = in.nextLongArray(n);

			long ans = t[0];
			for (int i = 0; i < n-1; i++) {
				ans = MathUtils.lcm(ans, t[i+1]);
			}

			out.println(ans);

		}

	}

	static class MathUtils {
		/**
		 * 最大公約数
		 * */
		public static long gcd(long a, long b) {
			return (b == 0) ? a : gcd(b, a % b);
		}
		/**
		 * 最小公倍数
		 * */
		public static long lcm(long a, long b) {
			return a / gcd(a, b) * b ;
		}

	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}

	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 21460
#include <iostream>
#include <vector>
#include <utility>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int x,y;
    cin >> x >> y;
    if(x%y){
        cout << x << endl;
    }else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
PROGRAM piyo
      IMPLICIT NONE
      integer :: n
      character(50) :: s
      integer :: i, ans=0
      
      read*,n
      read*,s
      
      do i = 1,n-2
        if( s(i:i+2)=='ABC' )then
          ans = ans + 1
        end if
      end do
      
      print*,ans
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 640
# https://atcoder.jp/contests/abc133/tasks/abc133_e
MOD = (10**9) + 7
N, K = gets.split.map(&:to_i)
ab = []
tree = Array.new(N) {Array.new}
already_used = Array.new(N)
ss = []
(N-1).times do
  ab = gets.split.map(&:to_i)
  tree[ab[0]-1] << ab[1]-1
  tree[ab[1]-1] << ab[0]-1
end

# nPr = (n-r+1)..n
def permutate(nnn, rrr)
  ((nnn - rrr + 1)..nnn).reduce(1) { |i, obj| obj = (obj * i)%MOD }
end

tree.map!(&:sort)

ans = 1
# 親ノードの組み合わせ
ans *= (K * permutate(K-1, tree[0].size))%MOD
already_used[0] = true
queue = tree[0].map(&:itself)
while curr_node = queue.shift
  next if already_used[curr_node]
  already_used[curr_node] = true

  valid_node_count = 0
  tree[curr_node].each do |i|
    next if already_used[i]
    queue << i
    valid_node_count += 1
  end
  ans = (ans * permutate(K-2, valid_node_count))%MOD
end

puts ans


Measured memory_bytes: 18280
package main

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

func main() {
	n := getInt()
	as := getIntSlice(n)

	m := make(map[int]int)
	for _, a := range as {
		if n%2 == a%2 {
			fmt.Println(0)
			return
		}
		m[a]++
	}

	ans := 1
	for k, v := range m {
		if (k == 0 && v != 1) || (k != 0 && v != 2) {
			ans = 0
			break
		}

		ans = (ans * v) % 1000000007
	}

	fmt.Println(ans)
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	ans := make([]int, n)
	for i := range ans {
		ans[i] = getInt()
	}
	return ans
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 5120
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n; cin >> n;
	vvl G(n);
	rep(i,n-1){
		ll a,b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vl vv(n,-1);
	vv[0] = 0;
	queue<ll> q;
	q.push(0);
	vl cnt(2,0);
	cnt[0]++;
	while(!q.empty()){
		ll u = q.front(); q.pop();
		for(auto v : G[u]){
			if(vv[v] != -1) continue;
			vv[v] = 1 - vv[u];
			cnt[vv[v]]++;
			q.push(v);
		}
	}
	vl ans(n);
	if(cnt[0] <= n/3){
		ll now = 1;
		ll rev = 1;
		rep(i,n){
			if(vv[i]==0){
				ans[i] = 3 * now;
				now++;
			}else{
				if(rev % 3 == 0 && rev <= cnt[0] * 3) rev++;
				ans[i] = rev;
				rev++;
			}
		}
	}else if(cnt[1] <= n/3){
		ll now = 1;
		ll rev = 1;
		rep(i,n){
			if(vv[i]==1){
				ans[i] = 3 * now;
				now++;
			}else{
				if(rev % 3 == 0 && rev <= cnt[1] * 3) rev++;
				ans[i] = rev;
				rev++;
			}
		}
	}else{
		ll now1 = 0, now2 = 0, now = 1;
		rep(i,n){
			ll t;
			if(vv[i]==0){
				if(n >= 3*now1 + 1){
					t = 3 * now1 + 1;
					now1++;
				}else{
					t = 3 * now;
					now++;
				}
				ans[i] = t;
			}else{
				if(n >= 3*now2 + 2){
					t = 3 * now2 + 2;
					now2++;
				}else{
					t = 3 * now;
					now++;
				}
				ans[i] = t;
			}
		}
	}
	rep(i,n) printf("%lld ",ans[i]);
	printf("\n");
}

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

namespace AC {
#define ll long long
#define PLL pair<ll, ll>
#define PDD pair<double, double>
#define PDPLL pair<double, PLL>
#define PLPLL pair<ll, PLL>
#define pb push_back
#define fi first
#define se second
#define ls rt << 1
#define rs rt << 1 | 1

    const ll N = 1e5 + 66;

    ll BUGS = 1;

    inline ll read(){
        ll x = 0;    bool flag = 1;   char ch = getchar();
        while(ch < '0' || ch > '9') { if(ch == '-') flag = 0; ch = getchar(); }
        while(ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); }
        if(flag) return x;  return (~(x - 1));
    }

    inline void read(ll arr[], ll s, ll e) { for(ll i = s; i <= e; ++i) arr[i] = read(); }

    inline void write(ll x){
        if(x < 0) { x = ~(x - 1); putchar('-'); }
        if(x > 9) write(x / 10); putchar(x % 10 + '0');
    }

    inline void print(ll x) { write(x); puts(""); }

    inline void print(ll arr[], ll s, ll e) {
        for(ll i = s; i <= e - 1; ++i) write(arr[i]), putchar(' ');
        write(arr[e]); puts("");
    }

    inline ll max3(ll a, ll b, ll c) { return max(a, max(b, c)); }

    inline ll min3(ll a, ll b, ll c) { return min(a, min(b, c)); }

    inline void debugNum(ll num, string ss) { cout << "BUGS" << BUGS++ << " : " << ss << " : " << num << endl; }

    inline void debugArr(ll arr[], ll s, ll e, string ss) {
        cout << "BUGS" << BUGS++ << " : " << ss << " : " << endl;
        for(ll i = s; i <= e; ++i) cout << "i : " << i << " val : " << arr[i] << endl;
    }

    inline void IO() {
        //ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
        //cout << setiosflags(ios::fixed) << setprecision(1); //保留小数点后1位
        //cout << setprecision(1); //保留1位有效数字
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
}using namespace AC;

ll n;

inline void solve() {
    ll cur = 7, ans = 1;
    map<ll, bool> MM;
    while(cur < n) cur = cur * 10 + 7, ans++, MM[cur] = true;
    cur %= n;
    if(cur == 0) {
        print(ans);
        return ;
    }
    while(true) {
        cur = cur * 10 + 7;
        cur %= n;
        if(MM[cur] == true) {
            print(-1);
            return ;
        }
        ans++;
        if(cur == 0) {
            print(ans);
            return ;
        }
        MM[cur] = true;
    }
}

int main() {
    //IO();
    while(~scanf("%lld", &n)) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 66172
import math
n = int(input())
towns = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n-1):
    x1, y1 = towns[i]
    for j in range(i+1, n):
        x2, y2 = towns[j]
        ans += math.sqrt((x1-x2)**2 + (y1-y2)**2)*(n-1)*2
print(ans/((n-1)*n))

Measured memory_bytes: 9092
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)


int main() {
	int n;
	cin >> n;
	cout << ((n % 2 == 0) ? (n / 2) : (n / 2) + 1) << endl;

	return 0;
}

Measured memory_bytes: 632
#include <iostream>

using namespace std;

int main (){
	string s;
	cin>>s;
	int tr=0;
	for(int i=0;i<2;i++){
		if(s[i]!=s[i+1]) tr=1;
	}
	if(tr) cout<<"Yes";
	else cout<<"No";





return 0;
}



Measured memory_bytes: 256
package main

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

var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

func nextInts(size int) []int {
	ns := make([]int, size)
	for i := 0; i < size; i++ {
		ns[i] = nextInt()
	}
	return ns
}

func main() {
	nextReader = newScanner()
	N := nextInt()
	Ai := nextInts(N)
	for _, v := range Ai {
		if v%2 == 0 {
			if v%3 != 0 && v%5 != 0 {
				fmt.Println("DENIED")
				return
			}
		}
	}
	fmt.Println("APPROVED")
}


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

int main(void){
 string s;int k=0;
cin>>s;
for(int i=0;i<s.size();i++) k+=s[i]-'0';
cout<<( (stoi(s)%k==0) ? ("Yes") : ("No") )<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int h, w;
const int N = 510;
char C[N][N], A[N][N], B[N][N];
int main()
{
    scanf("%d%d", &h, &w);
    for (int i = 1; i <= h; ++ i)
        scanf("%s", C[i] + 1);
    for (int i = 1; i <= h; ++ i)
        for (int j = 1; j <= w; ++ j)
            A[i][j] = B[i][j] = C[i][j];
    for (int i = 1; i <= h; ++ i) A[i][1] = B[i][w] = '#';
    for (int i = 2; i < h; ++ i)
        for (int j = 2; j < w; ++ j)
            if (i & 1) A[i][j] = '#'; else B[i][j] = '#';
    for (int i = 1; i <= h; ++ i)
        printf("%s\n", A[i] + 1);
    puts("");
    for (int i = 1; i <= h; ++ i)
        printf("%s\n", B[i] + 1);
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    vector<int> A(5);
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
    }
    sort(all(A));

    int ans = 1e9;
    do {
        int now = 0;
        for (int i = 0; i < 5; i++) {
            if (i != 4) now += ((A[i] + 9) / 10) * 10;
            else now += A[i];
        }
        ans = min(ans, now);
    } while(next_permutation(all(A)));
    cout << ans << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;
using std::abs;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

template<typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& vec) {
	os << '[';
	int fst = 1;

	for(auto& elem: vec) {
		if(fst == 0) {
			os << ' ';
		}

		os << elem;
		fst = 0;
	}

	os << ']';
	return os;
}

void solve() {
	int n, x;
	cin >> n >> x;

	int cur = 0;
	int answ = (cur <= x);

	while(n--) {
		int delta;
		cin >> delta;

		cur += delta;
		answ += (cur <= x);
	}

	cout << answ << '\n';
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
bool pan(ll a,ll b){
	ll sum=0,tot=0,x=a;
	while(x) sum+=x%10,x/=10;
	x=b;
	while(x) tot+=x%10,x/=10;
	return a*tot<=b*sum;
}
int main(){
	scanf("%d",&n);
	ll pre=0,sum=0;
	for(ll i=1;n;){
		pre+=i;
		if(pan(pre,pre+i)) printf("%lld\n",pre),n--;
		else pre-=i,i*=10;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int i = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int i = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int i = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    int n; cin >> n;
    long long tmp[3] = {1,1,1};
    ll ans = 0;
    rep(i,n){
        tmp[0] = (tmp[0] * 10) % MOD;
        tmp[1] = (tmp[1] * 9) % MOD;
        tmp[2] = (tmp[2] * 8) % MOD;
    }
    ans = (ans + tmp[0]) % MOD;
    ans = (ans + tmp[2]) % MOD;
    ans = (ans - 2*tmp[1]) % MOD;
    if(ans < 0) ans += MOD;

    cout << ans << endl;

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3652
def inner(a, b):
    s = 0
    for i in range(len(a)):
        s += a[i] * b[i]
    return s

def dot(A, B):
    C = []
    for i in range(len(A)):
        c_i = []
        for j in range(len(B)):
            c_i.append(inner(A[i], B[j]))
        C.append(c_i)
    return C

n, m, l = map(int, input().split())

A = []
for _ in range(n):
    A.append([int(x) for x in input().split()])

B = [[] for _ in range(l)]
for _ in range(m):
    b_t = [int(x) for x in input().split()]
    for i in range(l):
        B[i].append(b_t[i])
        
C = dot(A, B)

for i in range(n):
    for j in range(l):
        print(C[i][j], end="")
        
        if j < l - 1:
            print(" ", end="")
    print()



Measured memory_bytes: 7144
#include <iostream>
#include <stdint.h>

using namespace std;

int main()
{
  int N;

  cin >> N;

  int NN = N;
  int digit_sum = 0;

  while(NN > 10) {
    digit_sum += NN%10;
    NN/=10;
  }

  digit_sum += NN;

  cout << ( (N%digit_sum==0) ? "Yes" : "No") << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
int n,m,ans;
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
int solve(int n,int x)
{
	while(n%x==0)
	{
		n=n/x;
	}
	if(n%x==1)return 1;
	return 0;
}
signed main()
{
	ans=1;
	n=read();
	for(int i=2;i*i<=n;i++)
		if(n%i==0)
		{
			if(solve(n,i))ans++;
			if(i*i==n)continue;
			if(solve(n,n/i))ans++;
		}
	m=n-1;
	if(m>1)ans++;
	for(int i=2;i*i<=m;i++)
		if(m%i==0&&n%i>0)
		{
			ans++;
			if(i*i==m)continue;
			ans++;
		}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a; cin >> a;
  cout << a+a*a+a*a*a << endl;

  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#define int long long 
using namespace std;

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

Measured memory_bytes: 1024
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define int long long
using namespace std;
int a[100005];
signed main()
{
    int x,y,n,i,j,h,f=0,g=0;
    scanf("%lld",&n);
    for(int k=0; k<n; k++)
    {
        scanf("%lld",&a[k]);
    }
    sort(a,a+n);
    for(i=n-1; i>0; i--)
    {
        if(a[i]==a[i-1])
        {
            x=a[i-1];
            f=1;
            h=i-1;
            break;
        }
    }
    if(f==0)
    {
        printf("0\n");
    }
    if(f)
    {
        for(j=h-1; j>0; j--)
        {
            if(a[j]==a[j-1])
            {
                y=a[j];
                g=1;
                printf("%lld\n",x*y);
                //printf("%d×%d rectangle can be formed.\n",y,x);
                break;
            }
        }
        if(f!=0&&g==0)
        {
            printf("0\n");
            //printf("No rectangle can be formed.\n");
        }
    }
    return 0;
}
/***

7
1 1 2 2 3 3 4

8
2 1 2 2 2 3 3 3

6
2 2 2 2 2 2

6
1 2 3 4 5 6

6
1 2 3 4 4 5



***/


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

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

    ll ans = 0;
    ll tmp = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'A' || S[i] == 'G' || S[i] == 'C' || S[i] == 'T') {
            tmp++;
        } else {
            tmp = 0;
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long D;
const int maxn=500005,mod1=1000000007,mod2=1000000009;
int qpow(int x,int y,int mod){
	int ans=1;
	while(y){
		if(y&1)ans=D(ans)*x%mod;
		x=D(x)*x%mod;
		y>>=1;
	}
	return ans;
}
int n;
char s[maxn];
struct H{
	int a,b;
	H():a(0),b(0){}
	H(int _a,int _b):a(_a),b(_b){}
	H operator+(const H &x)const{return H((a+x.a)%mod1,(b+x.b)%mod2);}
	H operator-(const H &x)const{return H((a-x.a+mod1)%mod1,(b-x.b+mod2)%mod2);}
	H operator*(const H &x)const{return H((D)a*x.a%mod1,(D)b*x.b%mod2);}
	bool operator<(const H &x)const{return a!=x.a?a<x.a:b<x.b;}
}b,inv,f[maxn],g[maxn];
map<H,int> mp;
int main(){
	b=H(23,29),inv=H(qpow(23,mod1-2,mod1),qpow(29,mod2-2,mod2));
	scanf("%d%s",&n,s+1);
	g[0]=H(1,1);
	for(int i=1;i<=n;i++){
		f[i]=f[i-1],g[i]=g[i-1];
		if(s[i]=='+')f[i]=f[i]+g[i];
		if(s[i]=='-')f[i]=f[i]-g[i];
		if(s[i]=='<')g[i]=g[i]*inv;
		if(s[i]=='>')g[i]=g[i]*b;
		mp[f[i]]++;
	}
	D ans=0;
	for(int i=1;i<=n;i++){
		ans+=mp[f[i-1]+g[i-1]*f[n]];
		mp[f[i]]--;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 42944
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    ll A;cin>>A;
    long double B;cin>>B;
    ll ans = A*B;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3732
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc=new Scanner(System.in);
       int r=sc.nextInt();
       int c=sc.nextInt();
       int [][]a=new int[r][c];
       int sum=0;
       for(int j=0;j<r;j++){
           for(int k=0;k<c;k++){
               a[j][k]=sc.nextInt();
               System.out.print(a[j][k]+" ");
               sum+=a[j][k];
           }
           System.out.println(sum);
           sum=0;
       }
       
       int sumall=0;
       for(int j=0;j<c;j++){
           for(int k=0;k<r;k++){
               sum+=a[k][j];
           }
           System.out.print(sum+" ");
           sumall+=sum;
           sum=0;
       }
       System.out.println(sumall);
       
    }
}



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

int main()
{
  string n;
  cin >> n; 
  
  for (int i = 0; i < n.size(); i++) {
    if (n.at(i) == '1') 
      cout << '9';
    else if (n.at(i) == '9')
      cout << '1';
    else
      cout << n.at(i);
  }
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  n++;
  cout<<n/2<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

template<class T>
struct BIT {
    int N;
    vector<T> seg;
    BIT(int N) : N(N) {
        seg.resize(N+1);
        fill_n(begin(seg), N+1, 0);
    }
    void add(int i, T x) {
        i++;
        while (i <= N) {
            seg[i] += x;
            i += i & -i;
        }
    }
    T sum(int i) {
        T s{0};
        while (i > 0) {
            s += seg[i];
            i -= i & -i;
        }
        return s;
    }
    T sum(int a, int b) {
        return sum(b) - sum(a);
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int q;
    cin >> q;
    while(q--) {
        int k;
        cin >> k;
        ll d = 0, m = 0, dm = 0, ans = 0;
        rep(i, n) {
            if(i>=k) {
                if(s[i-k] == 'D') d--, dm-=m;
                if(s[i-k] == 'M') m--;
            }
            if(s[i] == 'D') d++;
            if(s[i] == 'M') m++, dm+=d;
            if(s[i] == 'C') ans+=dm;
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 4248
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)  	type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
vi primeFactors(int n) 
{ 
	vi res;
    while (n%2 == 0) 
    { 
        res.push_back(2);
        n = n/2; 
    } 
    for (int i = 3; i <= sqrt(n); i = i+2) 
    { 
        while (n%i == 0) 
        { 
            res.push_back(i);
            n = n/i; 
        } 
    }
    if (n > 2) 
        res.push_back(n);


    sort(all(res));
    return res;
} 

int power(int x, unsigned int y) 
{ 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}

void JH(){
    int d=0,e=0,f=0,g=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n;cin>>n;
    vi v=primeFactors(n);
    map<int,int> m;
    for(auto i: v){
    	m[i]++;
    }
    for(auto i: m){
    	int j=1;
    	while(i.second>0){
    		int p=power(i.first,j);
    		if(n%p==0){
    			ans++;
    			n/=p;
    		}
    		i.second-=j;
    		j++;
    	}
    }
    cout<<ans<<endl;
}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<"Execution time: "<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3856