akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 200001
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1;
    while(test--)
    {
        double n,m,x,y; cin>>n>>m;
        vector<double> v(n);
        double tot=0;
        for(int i=0;i<n;i++)
        {
            cin>>v[i];
            tot+=v[i];
        }
        double check = (tot/(double)4)/m;
        double ans=0;
        for(int i=0;i<n;i++)
        {
            if(v[i]>=check)
            ans++;
        }
        if(ans>=m)
        cout<<"Yes";
        else
        cout<<"No";
    }
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
 
using namespace std;
 
#define endl "\n"
typedef long long int ll;
#define f first
#define s second
 
#define SEND_HELP ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
inline void setPrecision(int n){cout.precision(n);}
 
//DEBUG
#define BR cerr<<endl
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
 
ll INF = 1e10;
ll MOD = 1e9+7;

int main(){
	#ifndef ONLINE_JUDGE
        freopen("inputf.in", "r", stdin);
    #endif
    SEND_HELP

    ll n;
    cin >> n;



    ll ans = 1;
    ll sum = 1;
    ll ans2 = 1;
    while(n --){
    	sum *= 10;
    	ans *= 9;
    	ans2 *= 8;
    	if(ans > MOD)
    		ans %= MOD;
    	if(ans2 > MOD)
    		ans2 %= MOD;
    	if(sum > MOD)
    		sum %= MOD;
    }
    ans *= 2;
    if(ans > MOD)
    	ans %= MOD;
    sum -= (ans - ans2);
    while(sum < 0)
    	sum += MOD;
    cout << sum;
    return 0;
}

/*

*/

Measured memory_bytes: 3644
n = int(input())
ans_list = [2, 1]
if n == 0:
    print(ans_list[0])
elif n == 1:
    print(ans_list[1])
else:
    for i in range(2, n+1):
        num = ans_list[i-1] + ans_list[i-2]
        ans_list.append(num)
    print(ans_list[n])

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

int main() {

    int N, M;
    cin >> N >> M;
    vector<pair<int,int>> V;
    for(int i = 0; i < N; i++){
        int A, B;
        cin >> A  >> B;
        V.push_back(make_pair(A, B));
    }

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

    int num = 0;
    long long ans = 0;
    for(auto v:V){
        for(int i = 0; i < v.second; ++i){
            ans += v.first ;
            num++;
            if(num == M){
                cout << ans << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4320
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long

int main()
{
    ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
//cin>>t;
while(t--){
ull int a,b,c,d;
cin>>a>>b>>c>>d;
ull int start1;
if(a%c==0){
    start1=a/c;
}
else{start1=(a/c)+1;}
ull int start2;
if(a%d==0){start2=a/d;}
else{start2=(a/d)+1;}
ull int start3;
ull int kya=(c*d)/__gcd(c,d);
if(a%kya==0){
    start3=a/kya;
}
else{start3=(a/kya)+1;}
cout<<b-a+1-((b/c)-start1+1)-((b/d)-start2+1)+((b/kya)-start3+1)<<endl;
}}


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

#define NIL -1

//木の左子右兄弟表現。pは親、lは1番左の子、rは右隣の兄弟を表す。
struct Node{ int p, l, r; };

Node tree[100005];
int n, D[100005];

void print(int id){
    cout << "node " << id << ": ";
    cout << "parent = " << tree[id].p << ", ";
    cout << "depth = " << D[id] << ", ";

    if(tree[id].p == NIL) cout << "root, [";
    else if(tree[id].l == NIL) cout << "leaf, [";
    else cout << "internal node, [";

    int c;
    for(int i=0, c=tree[id].l;  c!=NIL;  i++, c=tree[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

void calcDepth(int id, int depth){
    D[id] = depth;
    //右隣の兄弟が存在する場合->右へ行く
    if(tree[id].r != NIL) calcDepth(tree[id].r, depth);
    //(一番左の)子が存在する場合->一番左から子の段を調べる。
    if(tree[id].l != NIL) calcDepth(tree[id].l, depth+1);
}

int main(){
    int id, k, c, l_tmp, root;
    cin >> n;
    //まず、木をNILで初期化。
    for(int i=0; i<n; i++){
        tree[i].p = tree[i].l = tree[i].r = NIL;
    }

    for(int i=0; i<n; i++){
        cin >> id >> k;
        //子の処理。
        for(int j=0; j<k; j++){
            cin >> c;
            //親を代入。
            tree[c].p = id;
            if(j == 0){
                //1番左の子はlに代入。
                tree[id].l = c;
            }else{
                //今指している子の、右隣の兄弟にlを代入
                tree[l_tmp].r = c;
            }
            l_tmp = c;
        }
    }

    //親がいない接点は根である。
    for(int i=0; i<n; i++){
        if(tree[i].p == NIL) root = i;
    }

    calcDepth(root, 0);

    for(int i=0; i<n; i++){
        print(i);
    }

    return 0;
}


Measured memory_bytes: 7772
#include <stdio.h>
#include <math.h>

int main(){
    int n,T,ans=10000;
    scanf("%d%d",&n,&T);
    for(int i = 0;i < n;i ++){
        int c,t;
        scanf("%d%d",&c,&t);
        ans = t<=T&&c<ans?c:ans;
    }
    if(ans==10000) printf("TLE\n");
    else printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
ans = 0
vstd = [0]*n
def jungkeng(x):
  global ans
  if x=='r':
    ans += p
  elif x=='s':
    ans += r
  else:
    ans += s
  return ans
  
for i in range(k):
  ans = jungkeng(t[i])
  vstd[i]=1
for i in range(k,n):
  if t[i]==t[i-k] and vstd[i-k]:
    continue
  ans = jungkeng(t[i])
  vstd[i] = 1
print(ans)

Measured memory_bytes: 9908
#include<iostream>
using namespace std;
int main() {
	int date[55],ne[55],n,ans,kazu[55];
	n = 0;
	ans = 1;
	for (int i = 1; i <= 44; i++) {
		kazu[i] = 0;
	}
	for (int i = 1; i <= 12; i++) {
		cin >> date[i];
		for (int z = 1; z <= n; z++) {
			if (ne[z] == date[i]) {
				kazu[z] = kazu[z] + 1;
				goto a;
			}
		}
		n = n + 1;
		ne[n] = date[i];
		kazu[n] = 1;
	a:;
	}
	if (n <= 3) {
		for (int i = 1; i <= n; i++) {
			if (kazu[i] % 4 != 0) {
				goto b;
			}
		}
	}
	else {
	b:;
		ans = 0;
	}
	if (ans) {
		cout << "yes"<<endl;
	}
	else {
		cout << "no" << endl;
	}
}


Measured memory_bytes: 3136
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });            var N = Sarray()[0];
            var x = Sarray()[0];

            var ans = x / 11 * 2;
            if (x % 11 == 0) { }
            else if (x % 11 <= 6) ans += 1;
            else ans += 2;
            WriteLine(ans);

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include <numeric>
#include <functional>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> adj[n];
    for (int i = 1; i < n; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    function<long long(int, int)> dp = [&](int i, int p) {
        vector<long long> v;
        for (int j : adj[i]) {
            if (j != p) v.push_back(dp(j, i));
        }
        if (v.empty()) return (long long)a[i];
        sort(v.begin(), v.end());
        long long s = accumulate(v.begin(), v.end(), 0LL);
        long long x = s - a[i];
        if (0 <= x && x <= s / 2 && x <= s - v.back()) return 2 * a[i] - s;
        else throw exception();
    };
    try {
        long long r = dp(0, -1);
        cout << (r == 0 || adj[0].size() == 1 ? "YES\n" : "NO\n");
    } catch (exception &e) {
        cout << "NO\n";
    }
}


Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int calc(int n){
  int ans = 0;
  while(ans<n){
    ans+=10;
  }
  return  ans;
}
int main() {
  cout << fixed << setprecision(10);
  int n = 5;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  sort(ALL(a));
  int ans = INF;
  do {
    int sum = 0;
    rep(i,n-1){
      sum+=calc(a.at(i));
    }
    sum+=a.at(n-1);
    ans = min(sum,ans);
  } while(next_permutation(ALL(a)));

  cout << ans << endl;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int a, b;
    cin >> a >> b;
    --a;
    --b;

    string bl(2500, '#');
    string wh(2500, '.');

    rep(i, a)
    {
        bl[i * 2] = '.';
    }
    rep(i, b)
    {
        wh[i * 2] = '#';
    }

    vstr ans(100);
    rep(i, 100)
    {
        if (i < 50)
        {
            if (i % 2 == 0)
            {
                rep(j, 100)
                {
                    ans[i].pb('#');
                }
            }
            else
            {
                ans[i] = string(bl.begin() + (100 * (i / 2)), bl.begin() + (100 * (i / 2 + 1)));
            }
        }
        else
        {
            if (i % 2 == 0)
            {
                rep(j, 100)
                {
                    ans[i].pb('.');
                }
            }
            else
            {
                ans[i] = string(wh.begin() + (100 * ((i - 50) / 2)), wh.begin() + (100 * ((i - 50) / 2 + 1)));
            }
        }
    }
    cout << 100 << " " << 100 << endl;
    rep(i, ans.size())
    {
        cout << ans[i] << endl;
    }
}

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


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
N = int(input())
S = input()
 
dp = [[0] * 5005 for _ in range(5005)]
 
for i in range(N-1, -1, -1):
  for j in range(N-1, -1, -1):
    if S[i] != S[j]:
      dp[i][j] = 0
    else:
      dp[i][j] = dp[i+1][j+1] + 1
      
ans = 0
for i in range(N):
  for j in range(N):
    if i >= j:
      continue
    now = min(dp[i][j], j-i)
    ans = max(ans, now)
    
print(ans)

Measured memory_bytes: 231944
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int N,C; cin>>N>>C;
  int s[100001]={};
  int t[100001]={};
  int c[100001]={};
  int e[100001]={};
  int a[100001]={};
  for(int i=1; i<=N; i++) {
    cin>>s[i]>>t[i]>>c[i];
  }

  for(int i=1; i<=C; i++) {
    // eはCに対応する列なので、初期化する必要がある。
    for(int i=0; i<=100000; i++) e[i]=0;
    for(int j=1; j<=N; j++) {
      if(c[j]==i) {
        // ここでチャンネル同じ、連続した番組を一本の番組にする
        e[s[j]]++;
        e[t[j]]--;
      }
    }
    for(int i=1;i<=100000;i++){
      // 累積和とることで録画してるとき1にする
      e[i]+=e[i-1];
    }
    for(int i=1; i<=100000; i++) {
      if(e[i]==1)a[i]++;
      // -1と1で相殺されちゃう部分をカバーする
      if(e[i]==0 && e[i-1]==1)a[i]++;
    }
  }
  int mx=0;
  for(int i=1;i<=100000;i++)if(mx<a[i])mx=a[i];
  P(mx);
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
//long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll N, X, Y;
    cin >> N >> X >>Y;
    vector<vector<ll>> v(N);
    rep(i,N-1){
        v[i].push_back(i+1);
        v[i+1].push_back(i);
    }
    v[--X].push_back(--Y);
    v[Y].push_back(X);
    vector<vector<ll>> memo(N,vector<ll>(N,1e10));
    //cout <<"AAA"<<endl;
    rep(i,N){
        queue<pair<ll,ll>> que;
        vector<ll> dist(N,1e10);
        que.push(make_pair(i,0));
        while(!que.empty()){
            ll u = que.front().first;
            ll d = que.front().second;
            que.pop();
            if(dist[u] != 1e10)continue;
           // cout <<"huhuh"<<endl;
            dist[u] = d;
            memo[i][u] = d;
            rep(j,v[u].size()){
                que.push(make_pair(v[u][j], d+1));
            }
        }
    }
    //cout << "B" <<endl;
    vector<ll> num(N+1,0);
    rep(i,N){
        rep(j,N){
            if(memo[i][j] == 1e10)continue;
            num[memo[i][j]] += 1;
            //cout << memo[i][j] << "a"<<endl;
        }
    }

    rep(i,N-1){
        cout << (num[i+1]/2) << endl;
    }
}


Measured memory_bytes: 31744
from typing import List

# id
# k 子の数
# 子のID


class Node:
    node_id = -999
    child = []
    parent = -1
    depth = -999
    node_type = 'Not set'

    def __init__(self, id: int, child: List[int]):
        self.node_id = id
        self.child = child

    def show(self):
        out = f'node {self.node_id}: '
        out += f'parent = {self.parent}, depth = {self.depth}, '
        out += f'{self.node_type}, '
        tmp = ', '.join(map(str, self.child))
        out += f'[{tmp}]'
        print(out)

    def get_value(self):
        return self.node_id


def show(node_list: List[Node]):
    for n in node_list:
        n.show()


def get_parent(node_id: int) -> int:
    return node_list[node_id].parent


def set_depth(node_id: int, depth: int):
    node_list[node_id].depth = depth
    for ch in node_list[node_id].child:
        set_depth(ch, depth + 1)


def set_node_info(node_list: List[Node]):

    # depthを設定する。
    for target in node_list:
        if target.parent == -1:
            set_depth(target.node_id, 0)
            break

    # typeを設定する。
    for target in node_list:
        if target.depth == 0:
            target.node_type = 'root'
        elif target.depth > 0:
            target.node_type = \
                'leaf' if len(target.child) == 0 else 'internal node'
        else:
            raise ValueError()


n = int(input())
node_list = []
for _i in range(n):
    node_list.append(Node(_i, []))

for _i in range(n):
    line = [int(i) for i in input().split()]
    node_id = line[0]
    num = line[1]

    # 親子関係を設定する。
    for i in range(num):
        child_id = line[2 + i]
        node_list[node_id].child.append(child_id)
        node_list[child_id].parent = node_id

set_node_info(node_list)
show(node_list)




Measured memory_bytes: 45572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int a,b;
  scanf("%d%d", &a,&b);
  int ans = 0;

  FOR(i,11,b){
    int c,d;
    c = i%10;
    d = i/10;
    if(d*c<=a && d*c>0 && d>1 && c>1) {
      ++ans;
      // cout << d << c << endl;
    }
  }

  cout << ans << endl;
  

}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int BN = sc.nextInt() - 1;
		int[] B = new int[BN];
		for(int i=0;i<BN;i++) {
			B[i] = sc.nextInt();
		}
		
		int total = B[0];
		for(int i=1;i<BN;i++) {
			total += Math.min(B[i], B[i-1]);
		}
		total += B[BN-1];
		System.out.println(total);
		
		sc.close();
	}
}

Measured memory_bytes: 21716
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long K = sc.nextLong();
		if(K%2 == 0) {
			System.out.println(A - B);
		} else {
			System.out.println(B - A);
		}
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");


//fk u gfg
int n;
int v[10001];

#define F first 
#define S second 
#define MAX 10000003
typedef long long ll; 
const int mod = 1000000007; 
  
int prime[MAX]; 
unordered_map<int, int> max_map; 

int power(int a, int n) 
{ 
    if (n == 0) 
        return 1; 
    int p = power(a, n / 2) % mod; 
    p = (p * p) % mod; 
    if (n & 1) 
        p = (p * a) % mod; 
    return p; 
} 

void sieve() 
{ 
    prime[0] = prime[1] = 1; 
    for (int i = 2; i < MAX; i++) { 
        if (prime[i] == 0) { 
            for (int j = i * 2; j < MAX; j += i) { 
                if (prime[j] == 0) { 
                    prime[j] = i; 
                } 
            } 
            prime[i] = i; 
        } 
    } 
} 

ll lcmModuloM(const int* ar, int n) 
{ 
  
    for (int i = 0; i < n; i++) { 
        int num = ar[i]; 
        unordered_map<int, int> temp; 

        while (num > 1) { 
  
            int factor = prime[num]; 
  
            temp[factor]++; 

            num /= factor; 
        } 
  
        for (auto it : temp) { 
            max_map[it.first] = max(max_map[it.first], it.second); 
        } 
    } 
  
    ll ans = 1; 
  
    for (auto it : max_map) {
        ans = (ans * power(it.F, it.S)) % mod; 
    } 
  
    return ans; 
}

signed main(){
    FASTER;
    sieve();
    cin>>n;
    for(int i=0;i<n;i++)cin>>v[i];
    int lc=lcmModuloM(v,n);
    int ans=0;
    for(int i=0;i<n;i++){
        ans=(lc*power(v[i],MOD-2)%MOD+ans)%MOD;
    }
    cout<<ans;
}

Measured memory_bytes: 78848
#include <stdio.h>

int main()
{
	unsigned long long k, a, b;

	scanf("%llu %llu %llu", &a, &b, &k);

	if (a > k)
		a -= k;
	else
	{
		k -= a;
		a = 0;

		if (b > k)
			b -= k;
		else
			b = 0;
	}

	printf("%llu %llu\n", a, b);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	int A,B,C,X;
	cin>>A>>B>>C>>X;
	int ans=0;
	rep(i,A+1){
		rep(j,B+1){
			rep(k,C+1){
				if(i*500+j*100+k*50==X) ans++;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: i64 = read();
    let k: i64 = read();
    let po = n / k;
    println!(
        "{}",
        po.pow(3) + if k % 2 == 0 && n >= k / 2 {
            ((n - k / 2) / k + 1).pow(3)
        } else {
            0
        }
    );
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      
        while(true){
            String strArr[] = br.readLine().split(" ");
            int x = Integer.parseInt(strArr[0]);
            int y = Integer.parseInt(strArr[1]);
            //int  x = br.nextInt();
            //int  y = br.nextInt();
            if ( x == 0 && y == 0 ) break;
            
            if(x > y) {
                System.out.println(y + " " + x);
            } else {
                System.out.println(x + " " + y);
            }
        }
	}
}


Measured memory_bytes: 26972
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

int n, c, k;
int t[120000];

int main() {
	cin >> n >> c >> k;
	for (int i = 0; i < n; ++i)
		cin >> t[i];
	sort(t, t + n);
	int ans = 0;
	int now = 0;
	for (int i = 0; i < n; ++i) {
		while (t[now] + k < t[i]) {
			++ans;
			now = min(now + c, i);
		}
	}
	while (now < n) {
		++ans;
		now = min(now + c, n);
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        int[] input = GetInputsInt();

        int k = 1;
        int count = 0;

        while(k < input[1])
        {
            k += input[0] - 1;
            count++;
        }

        Console.Write(count);

        Console.ReadKey();
    }


    public static int GetInputInt()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] GetInputsInt()
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }
    public static List<int> GetInputsIntList()
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToList();
    }
    public static List<float> GetInputsFloatList()
    {
        return Console.ReadLine().Split(' ').Select(float.Parse).ToList();
    }

    public static long GetInputLong()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] GetInputsLong()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }

}


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

const double pi = acos(-1.0);

double f (double m, double a, double b) {
	if (a * sin(m) <= b * cos(m))
		return a * ((a * (2.0 * b - (a * sin(m) / cos(m)))) / 2.0);
	return a * (b * cos(m) / sin(m)) * b / 2.0;
}

signed main () {
	double a, b, x;
	cin >> a >> b >> x;
	double l = 1e-10, r = (pi / 2.0) - 1e-10, eps = 1e-11;
	while (r - l > eps) {
		double m = (l + r) / 2.0;
		if (x > f(m, a, b))
			r = m;
		else
			l = m;
	}
	double ans = (l * 180.0 / pi);
	cout << fixed << setprecision(20) << ans << '\n';
}


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

int main(){
    int d,t,s;
    cin >> d >> t >> s ;
    long long y;
    if(t*s>=d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;
using vb=vector<bool>;using vs=vector<string>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<typename T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){o<<'('<<p.fst<<", "<<p.snd<<')';return o;}

#define P first
#define X P.first
#define Y P.second
#define R second

using pll=pair<ll,ll>;

template<class T>
double dist(const pair<T, T> &p1, const pair<T, T> &p2) {
  T dx = p1.first - p2.first;
  T dy = p1.second - p2.second;
  return sqrt(dx * dx + dy * dy);
}

void Main() {
  pll s, t;
  s.fst = read<int>();
  s.snd = read<int>();
  t.fst = read<int>();
  t.snd = read<int>();
  int n = read<int>();
  vector<pair<pll, int>> C(n);
  rep(i, n) {
    C[i].X = read<int>();
    C[i].Y = read<int>();
    C[i].R = read<int>();
  }

  vvd E(n, vd(n));
  rep(i, n) rep(j, i+1, n) {
    double d = max(0.0, dist(C[i].P, C[j].P) - C[i].R - C[j].R);
    E[i][j] = E[j][i] = d;
  }

  vd D(n);
  priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>> > q;

  rep(i, n) {
    double d = max(0.0, dist(C[i].P, s) - C[i].R);
    D[i] = d;
    q.emplace(d, i);
  }

  while (!q.empty()) {
    double c = q.top().fst;
    int v = q.top().snd;
    q.pop();

    if (D[v] < c) continue;

    rep(i, n) if (i != v) {
      double nc = c + E[v][i];
      if (D[i] > nc) {
        D[i] = nc;
        q.emplace(nc, i);
      }
    }
  }

  double ans = dist(s, t);
  rep(i, n) {
    double d = max(0.0, dist(C[i].P, t) - C[i].R);
    ans = min(ans, D[i] + d);
  }

  _p("%.10f\n", ans);

}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 12404
import java.io.*;

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str;
		str = br.readLine().split(" ");
		int N = Integer.parseInt(str[0]);
		int W = Integer.parseInt(str[1]);
		long[][] items = new long[N][2];
		int sum_value = 0;
		for(int i=0; i<N; i++) {
			str = br.readLine().split(" ");
			items[i][0] = Long.parseLong(str[0]);
			items[i][1] = Long.parseLong(str[1]);
			sum_value += items[i][1];
		}
		long[] dp = new long[sum_value+1];
		for(int i=0; i<=sum_value; i++) dp[i] = (long)1e18;
		dp[0]=0;
		for(int item=0; item<N; item++) {
			long val = items[item][1];
			for(int already_value = sum_value-(int)val; already_value>=0; already_value--) {
				dp[(int)val+already_value] = Math.min(dp[(int)val+already_value], 
												dp[already_value]+items[item][0]);
			}
		}
		long ans = -1;
		for(int i=0; i<=sum_value; i++) {
			//System.out.print(dp[i]+" ");
			if(dp[i]<=W) ans = i;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;


int main(){
    ll n; cin>>n;
    ll x = (log(n)/log(2))+1;
    //cout<<x<<endl;
    ll y = 1;
    rep(i,1,x+1)y*=2;
    cout<<y-1<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <cassert>

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

int main()
{
	int A,B,C;
	scanf("%d %d %d",&A,&B,&C);
	if(A==B&&B==C) puts("Yes");
	else puts("No");
	return 0;
}


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

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

  int prevT = 0;
  int prevX = 0;
  int prevY = 0;
  bool can = true;

  for (int i = 0; i < N; i++) {
    int t, x, y;
    cin >> t >> x >> y;

    int diffTime = t - prevT;
    int dist = abs(x - prevX) + abs(y - prevY); // 2点間の移動距離

    if (diffTime < dist || (diffTime % 2) != (dist % 2)) {
      can = false;
      break;
    }
  }

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


Measured memory_bytes: 256
import math

MOD = 10 ** 9 + 7

def comb(n, r):
    if n - r < 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(1, k+1):
    c = comb(n-k+1, i) % MOD
    d = comb(k-1, i-1) % MOD
    print((c * d) % MOD )


Measured memory_bytes: 3316
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	x := getNextInt(scanner)

	if x == 1 {
		fmt.Fprintln(writer, "No")
		return
	}
	if x == n*2-1 {
		fmt.Fprintln(writer, "No")
		return
	}
	fmt.Fprintln(writer, "Yes")
	ans := make([]int, n*2-1)
	ans[n-2] = n*2 - 1
	ans[n-1] = x
	ans[n] = 1
	a := 1
	b := n*2 - 1
	l := n - 3
	r := n + 1

	for l >= 0 {
		a++
		if a == x {
			a++
		}
		ans[l] = a
		l--
	}
	for r < n*2-1 {
		b--
		if b == x {
			b--
		}
		ans[r] = b
		r++
	}
	for i := 0; i < n*2-1; i++ {
		fmt.Fprintln(writer, ans[i])
	}
}


Measured memory_bytes: 5120
#include <stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b){
        printf("a > b\n");
    }else if(a<b){
        printf("a < b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
h,w=map(int,input().split())
s=[input() for _ in range(h)]


a="Yes"

for i in range(h):
    if a=="No":
        break
    for j in range(w):
        a="No"
        if s[i][j]==".":
            a="Yes"
        else:
            if i-1>=0 and s[i-1][j]=="#":
                a="Yes"
            elif j-1>=0 and s[i][j-1]=="#":
                a="Yes"
            elif j+1<w and s[i][j+1]=="#":
                a="Yes"
            elif i+1<h and s[i+1][j]=="#":
                a="Yes"
        if a=="No":
            break


print(a)



Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import numpy as np

def fnSolv0(iNum, l, lFact):
  iRet = 1
  lNums= list(range(1,1+iNum))
  for iDigt, i in enumerate(l):
    i0 = lNums.index(i)
    lNums.remove(i)
    iRet += i0 * lFact[len(lNums)]
  return iRet
  

def fnSolv():
  iNum = int(input())
  lP = list(map(int, input().split()))
  lQ = list(map(int, input().split()))
  lFact = [1]
  for i in range(iNum):
    lFact.append(lFact[i]*(i+1))
  #print(lFact)
  iP = fnSolv0(iNum, lP,lFact)
  iQ = fnSolv0(iNum, lQ,lFact)
  print(abs(iP - iQ))

if __name__ == '__main__':
  fnSolv()


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

int ans;
long long n;

int main() {
    cin >> n;
    for (int i = 2; i <= sqrt(n); i++){
        if (n % i == 0){
            int cnt = 0;
            while (n % i == 0){
                n /= i;
                cnt++;
            }
            int tmp = 1;
            while (cnt >= tmp){
                cnt -= tmp;
                ans++;
                tmp++;
            }
        }
    }
    if (n != 1) ans++;
    cout << ans << "\n";
}


Measured memory_bytes: 3680
#include <iostream>

using namespace std;

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

  int n = 0;
  for (int i = 0; i <= A; ++i) {
    for (int j = 0; j <= B; ++j) {
      for (int k = 0; k <= C; ++k) {
        const int s = 500 * i + 100 * j + 50 * k;
        if (s == X)
          n++;
      }
    }
  }
  cout << n << endl;

  return 0;
}

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

int main(){
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	vector<int> g(h);
	vector<int> r(w);
	rep(i, h) cin >> s.at(i);
	rep(i, h){
		int f = 0;
		rep(j, w) if(s.at(i).at(j) == '#') f = 1;
		if(f == 0) g.at(i) = 1;
	}
	rep(i, w){
		int f = 0;
		rep(j, h) if(s.at(j).at(i) == '#') f = 1;
		if(f == 0) r.at(i) = 1;
	}
	rep(i, h){
		if(g.at(i) == 0){
			rep(j, w) if(r.at(j) == 0) cout << s.at(i).at(j);
			cout << endl;
		}
	}
	return 0;
}

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

int main()
{
	while (true) {
		string str;

		cin >> str;

		if (str == "#") {
			break;
		}

		vector<int> vec;

		while (!str.empty()) {
			if (str.substr(0, 4) == "west") {
				str = str.substr(4);
				vec.push_back(90);
			}
			else if (str.substr(0, 5) == "north") {
				str = str.substr(5);
				vec.push_back(0);
			}
		}

		reverse(vec.begin(), vec.end());

		int bunsi = vec[0];
		int bunbo = 1;

		for (int i = 1; i < vec.size(); i++) {
			if (vec[i] == 0) {
				bunsi = bunsi * 2 - 90;
				bunbo *= 2;
			}
			else {
				bunsi = bunsi * 2 + 90;
				bunbo *= 2;
			}
		}

		while (bunsi % 2 == 0 && bunbo % 2 == 0) {
			bunsi /= 2;
			bunbo /= 2;
		}

		if (bunbo != 1) {
			cout << bunsi << "/" << bunbo << endl;
		}
		else {
			cout << bunsi << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3124
macro_rules! inputln {
    ($t:ty) => {{
        let mut l = String::new();
        std::io::stdin().read_line(&mut l).unwrap();
        l.trim().parse::<$t>().unwrap()
    }};
    ($($t:ty),*) => {{
        let mut l = String::new();
        std::io::stdin().read_line(&mut l).unwrap();
        let mut it = l.split_whitespace();
        ($(it.next().unwrap().parse::<$t>().unwrap(),)*)
    }};
    /*
    ($t:ty,$n:expr) => {{
        let mut l = String::new();
        std::io::stdin().read_line(&mut l).unwrap();
        let mut it = l.split_whitespace();
       vec![$(it.next().unwrap().parse::<$t>().unwrap(),)*]
    }};
    */
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let s = inputln!(String);
    let result = match s.as_str() {
        "SUN" => 7,
        "MON" =>6,
        "TUE"=>5,
        "WED"=>4,
        "THU"=>3,
        "FRI"=>2,
        "SAT"=>1,
        _=>0
    };
    println!("{}",result);
}


Measured memory_bytes: 4352
import java.util.*;

class Main {
    // ABC152D
    static final long MOD = 1_000_000_007;
    // 10^9+7
    //static final int MAX = 2_147_483_646;
    static final int MAX = 10_000_000;
    // intの最大値
    static final int INF = 1_000_000_000;
    // 10^9

  
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        int an = a.length();
        for(int i = 0;i < an;i++){
            System.out.print("x");
        }
    }
    
}




Measured memory_bytes: 22996
#include<stdio.h>
#define max 1000000
int main()
{
	char furui[max];
	int n=2,i,end,ans;
	
	for(i=0;i<max;i++)
	{
		furui[i]=1;
	}
	furui[0]=0;
	while(n<=max)
	{
		if(furui[n-1]==1)
		{
			for(i=n*2;i<=max;i+=n)
			{
				furui[i-1]=0;
			}
		}
		n++;
	}
		
	while(scanf("%d",&end)!=EOF)
	{
		ans=0;
		for(i=0;i<end;i++)
		{
			if(furui[i]==1)
			{
				ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1384
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){

    int n;cin>>n;
    
    double m=ceil(n/2.0);
    float a=(float)m/n;

    cout<<a<<endl;

}

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

int main (void) {
    int N, M;
    cin >> N >> M;

    int sum = 0;
    int tmp = 0;
    for (int i = 0; i < M; ++i) {
        cin >> tmp;
        sum += tmp;
    }

    if ((N - sum) >= 0) {
        cout << to_string(N - sum) << endl;
    } else {
        cout << "-1" << endl;
    }


}

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

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

    ll ans=0;
    ll i=0, j=s.size()-1;
    while(i<j){
        while(s[i]=='R'){i++;}
        while(s[j]=='W'){j--;}
        if(i<j){
            ans++;
            i++;
            j--;
        }
        else{
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
	int a, b, c;
	int k;
	int n;

	scanf("%d%d%d", &a, &b, &c);
	n = 0;
	for (k = a; k <= b; k++) {
		if (c % k == 0) n++;
	}
	printf("%d\n", n);
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#define pb push_back
#define int long long 
using namespace std;
typedef pair<int,int> pii;

class UnionFind {
private:
  vector<int> data;  
public:
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


signed main(){
  int n,m;
  cin>>n>>m;
  
  vector<pii> hasi;
  int a,b;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    hasi.pb(pii(a,b));
  }
  reverse(hasi.begin(),hasi.end());

  vector<int> res;
  UnionFind uf(n+1);
  int tmp=n*(n-1)/2;

  for(auto x : hasi){
    res.pb(tmp);
    //printf("%lld %lld %lld\n",x.first,x.second,tmp);
    if(!uf.findSet(x.first,x.second)){
      //printf(": %lld %lld\n",uf.size(x.first),uf.size(x.second));
      tmp-=uf.size(x.first)*uf.size(x.second);
    }
    uf.unionSet(x.first,x.second);
  }
  
  reverse(res.begin(),res.end());
  for(auto x : res){
    cout<<x<<endl;
  }
  return 0;
}


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

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

  int cnt4 = 0;
  int cnt2 = 0;
  int odd = 0;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if (A.at(i) % 4 == 0)
      cnt4++;
    else if (A.at(i) % 2 == 0) {
      cnt2 = 1;
    } else
      odd++;
  }

  if (cnt2 == 0) {
    if (cnt4 >= odd - 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  } else {
    if (cnt4 >= odd)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

LLONG times[50][2501];

int main()
{
    int N, M; cin >> N >> M;
    map<int, map<int, int>> pref2yearIDMap;
    for (int i = 0; i < M; ++i)
    {
        int pi, yi; cin >> pi >> yi;
        pref2yearIDMap[pi].insert({ yi, i });
    }
    vector<string> strIDs(M);
    for (const auto &kvp : pref2yearIDMap)
    {
        string strPref;
        for (int i = to_string(kvp.first).length(); i < 6; ++i)
        {
            strPref += '0';
        }
        strPref += to_string(kvp.first);
        int x = 1;
        for (const auto &yip : kvp.second)
        {
            string strX;
            for (int i = to_string(x).length(); i < 6; ++i)
            {
                strX += '0';
            }
            strX += to_string(x);
            strIDs[yip.second] = strPref + strX;
            ++x;
        }
    }
    for (const auto &strID : strIDs)
    {
        cout << strID << endl;
    }
}

Measured memory_bytes: 20992
def main():
  n = int(input())
  a = list(map(int, input().split()))
  v = [0] * n

  for i in range(n - 1, -1, -1):
    x = sum(v[i::i + 1]) % 2

    if x != a[i]:
      v[i] = 1

  idx = [str(i + 1) for i, x in enumerate(v) if x == 1]

  print(len(idx))

  if len(idx) != 0:
    print(' '.join(idx))


if __name__ == '__main__':
  main()


Measured memory_bytes: 74332
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int v[3][3];
    rep(i,0,3)rep(j,0,3)cin>>v[i][j];
    if(v[0][0]+v[1][1]+v[2][2]==v[0][1]+v[1][2]+v[2][0]&&v[0][1]+v[1][2]+v[2][0]==v[0][2]+v[1][0]+v[2][1]){
        cout<<"Yes"<<endl;
        
    }else cout<<"No"<<endl;
    return 0;
}


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

ll  INF=101010101010;

//nを超えない最大の6の累乗を返す関数
int max6(int n){
    int count=0;
    while(1){
        n/=6;
        if(n==0)break;
        count++;
    }
    return pow(6,count);
}

//同様に9
int max9(int n){
    int count=0;
    while(1){
        n/=9;
        if(n==0)break;
        count++;
    }
    return pow(9,count);
}

//配るDPで実装

int main(){
    int n;
    cin>>n;
    vector<ll> dp(10101010);
    rep(i,n+1)dp[i]=INF;
    dp[0]=0;
    for(int i=0;i<=n;i++){
        dp[i+1]=min(dp[i+1],dp[i]+1);
        dp[i+max6(n-i)]=min(dp[i+max6(n-i)],dp[i]+1);
        dp[i+max9(n-i)]=min(dp[i+max9(n-i)],dp[i]+1);
    }

    cout<<dp[n]<<endl;

}

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

int main(){
	int purchase, capa;
	std::cin >> purchase >> capa; //input
	
	while(purchase > 0 && capa > 0){
		std::vector<int> vegetable_price;
		vegetable_price.resize(purchase);
		
		//input
		for(int i=0; i<purchase; ++i){
			std::cin >> vegetable_price[i];
		}
		
		std::sort(vegetable_price.begin(), vegetable_price.end(), std::greater<int>());
		
		// 
		for(size_t i=capa-1; i<vegetable_price.size(); i += capa-1){
			vegetable_price.erase(vegetable_price.begin() + i);
		}
		
		int sum_price = 0;
		for(size_t i=0; i<vegetable_price.size(); ++i){
			sum_price += vegetable_price[i];
		}
		
		//show
		std::cout << sum_price << std::endl;
		
		//input
		std::cin >> purchase >> capa;
	}
	
	return 0;
}

Measured memory_bytes: 1220