akhauriyash/Code-Regression huggingface dataset:
n=int(input())

#Sはn以上になる
#単純グラフのため、末端は一つとしか接続しない点がでてくる
#つまりsはn以下
#Sはnとしてよい

tree=[[] for _ in range(n)]

for i in range(n):
    for j in range(n):
        if i!=j:
            tree[i].append(j)

ans=[]
if n%2==0:
    for i in range(n):
        for item in tree[i]:
            if item+1!=n-i:
                if i>item:
                    ans.append([i+1,item+1])

else:
    for i in range(n):
        if i==n-1:
            for item in tree[i]:
                if i>item:
                    ans.append([i+1,item+1])
        else:
            for item in tree[i]:
                if item+1!=n-(i+1):
                    if i>item:
                        ans.append([i+1,item+1])

print(len(ans))
for item in ans:
    print(item[0],item[1])






Measured memory_bytes: 9516
# import sys
# input = sys.stdin.readline
import itertools

# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n, k = input_list()
    a = input_list()
    d = {1: 0}
    pre = 1
    loop_start = 0
    loop_end = 0
    loop_pos = 0
    for i in range(1, n+1):
        new = a[pre-1]
        if d.get(new):
            loop_start = d[new]
            loop_end = i
            loop_pos = new
            break
        if i == k:
            print(new)
            exit()
        d[new] = i
        pre = new

    k -= loop_start
    k %= loop_end - loop_start
    pre = loop_pos
    for i in range(k):
        pre = a[pre-1]
    print(pre)

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


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


if __name__ == "__main__":
    main()


Measured memory_bytes: 110648
N = int(input())
A = list(map(int,input().split()))
tasizann = 0
for i in range (N):
 tasizann = tasizann + A[i]
nijou = tasizann**2
nijouwa = 0
for i in range (N):
 nijouwa =nijouwa + A[i]**2
ans = (nijou - nijouwa)//2
ans = ans % (10**9+7)
print (ans)

Measured memory_bytes: 31624
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int	dfs(const Graph &graph,
		vector<int> &d_vec, vector<int> &f_vec, int u, int cur_time)
{
	d_vec.at(u) = ++cur_time;
	for (int v : graph.at(u)) {
		if (d_vec.at(v) != -1)
			continue;
		cur_time = dfs(graph, d_vec, f_vec, v, cur_time);
	}
	f_vec.at(u) = ++cur_time;
	return cur_time;
}	
		
int	main()
{
	int	n;
	cin >> n;
	Graph graph(n);
	vector<int>	d_vec(n, -1);
	vector<int>	f_vec(n, -1);
	int	k;
	int	u, v;
	for (int i = 0; i < n; ++i) {
		cin >> u >> k;
		--u;
		for (int j = 0; j < k; ++j) {
			cin >> v;
			--v;
			graph.at(u).push_back(v);
		}
	}
	int cur_time = 0;
	for (int i = 0; i < n; ++i) {
		if (d_vec.at(i) != -1)
			continue;
		cur_time = dfs(graph, d_vec, f_vec, i, cur_time);
	}
	for (int i = 0; i < n; ++i) {
		cout << i + 1 << " " << d_vec.at(i) << " " << f_vec.at(i) << endl;
	}
}



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

int main(){
  int n,x,ans,dis;
  dis = 0;
  ans = 1;
  cin >> n >> x;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin >> l.at(i);}
  for(int i=0;i<n;i++){
    dis += l.at(i);
    if(dis <= x){
      ans++;}
    else {break;}
  }
  cout << ans << endl;
  return 0;
}
    
  
  
    
    
  


Measured memory_bytes: 256
import sys
s = input()
n = len(s)

ans = 7

for bit in range(2**(n-1)):
    tmp = s[0]
    for i in range(n-1):
        if (1<<i)&bit:
            tmp += '+'
        else:
            tmp += '-'
        tmp += s[i+1]
    total = eval(tmp)
    if total == ans:
        print(tmp + '=7')
        sys.exit()


Measured memory_bytes: 3060
N = int(input())
A = list(map(int,input().split()))
multiplier_list = []

for i in range(N):
    number = A[i]
    multiplier = 0
    while True:
        if number % 2 == 0:
            multiplier += 1
            number /= 2
        else:
            break
    multiplier_list.append(multiplier)
print(min(multiplier_list))


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());

		int[] l = new int[N];
		int[] r = new int[N];
		for(int i = 0; i < N; i++) {
			l[i] = Integer.parseInt(sc.next());
			r[i] = Integer.parseInt(sc.next());
		}

		int count = 0;
		for(int i = 0; i < N; i++) {
			count += r[i] - l[i] + 1;
		}

		System.out.println(count);

		sc.close();
	}

}


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

int main(){
	char s[5];
	scanf("%s",s);
	int flag=0;
	for(int i=0;i<3;i++)if(s[i]==s[i+1])
		flag=1;
	if(flag)puts("Bad");
	else puts("Good");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define fin for(i=0;i<n;i++)
#define vec vector<ll>
#define pb push_back
#define vecit vector<ll>::iterator
#define vecp vector<pair<ll,ll> >
#define vecpit vector<pair<ll,ll> >::iterator
#define mapp map<ll,ll>
#define mapr map<ll,pair<ll,ll> >
#define maprit map<ll,pair<ll,ll> >::iterator
#define mapit map<ll,ll>::iterator
#define mod1 1000000007
#define INF 10000000000
using namespace std;
int main()
{
    ll h,w;
    cin>>h>>w;
    ll i,j , k,l;
    ll a[h][w];
    for(i=0;i<h;i++)
    {
        string x;
        cin>>x;
        for(j=0;j<w;j++)
            {
                if(x[j]=='.')
                    a[i][j]=1;
                else
                    a[i][j]=0;
            }
    }

    ll n=h,m=w;
    i=0;j=0;
    l=0;
    vector<vec > dp(h,vec (w));
    dp[0][0]=1;
    for(i=1;i<n;i++)
    {
        if(a[i][0]==0)
        {
            dp[i][0]=0;
        }
        else
            dp[i][0]=dp[i-1][0];
    }
    for(i=1;i<m;i++)
    {
        if(a[0][i]==0)
        {
            dp[0][i]=0;
        }
        else
            dp[0][i]=dp[0][i-1];
    }
    for(i=1;i<n;i++)
    {
        for(j=1;j<m;j++)
        {
            if(a[i][j]==0)
                dp[i][j]=0;
            else
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod1;
        }
    }

    l=dp[n-1][m-1];
   cout<<l<<"\n";
}


Measured memory_bytes: 18720
#include <stdio.h>
#include <stack>
#include <vector>
using namespace std;

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> relations[n];
  int index1, index2;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &index1, &index2);
    relations[index1].push_back(index2);
    relations[index2].push_back(index1);
  }
  int color[n], id;
  for (int i = 0; i < n; i++) {
    color[i] = -1;
  }
  id = 0;
  for (int i = 0; i < n; i++) {
    if (color[i] == -1) {
      id++;
      stack<int> S;
      S.push(i);
      while (!S.empty()) {
        int v = S.top(); S.pop();
        color[v] = id;
        for (int j = 0; j < relations[v].size(); j++) {
          int nv = relations[v][j];
          if (color[nv] == -1) {
            S.push(nv);
          }
        }
      }
    }
  }
  scanf("%d", &m);
  int u1, u2;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u1, &u2);
    if (color[u1] == color[u2]) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}



Measured memory_bytes: 8512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

int n,x;
int main()
{
 //freopen("in.txt","r",stdin);
 //freopen("out.txt","w",stdout);
cin>>n;
x=1;
for(;;)
{
	if(x>n)
	{
		break;
	}
	x*=2;
}
cout<<x/2<<endl;
 return 0;
}

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

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
using ll = long long;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
ll A,B,C,K,N,X,Y,cnt;

int main(){
  cin >> N >> S;
  rep(i,1000){
    int idx=0;
    vector<int> tgt = {i/100,(i/10)%10,i%10};
    rep(j,N){
      if(S.at(j)==('0' + tgt.at(idx))){
        idx++;
        if(idx==3){
          break;
        }
      }
    }
    if(idx==3) cnt++;
  }
  print(cnt);
}


Measured memory_bytes: 3672
struct Rin{}
impl Rin{
    fn input(&self)->String{
        let mut x=String::new();
        std::io::stdin().read_line(&mut x).ok();
        x
    }
    fn inputs(&self)->String{
        let s=self.input().trim().to_string();
        s
    }
    fn inputn(&self)->i32{
        let n:i32=self.input().trim().parse().unwrap();
        n
    }
    fn inputvs(&self)->Vec<String>{
        let vs=self.input().trim().split(' ').map(|x|x.to_string()).collect();
        vs
    }
    fn inputvn(&self)->Vec<i32>{
        let vn=self.input().trim().split(' ').map(|x|x.to_string().parse().unwrap()).collect();
        vn
    }
}

fn main(){
    let rin=Rin{};
    let r=rin.inputn() as f64;
    println!("{}",2.0*r*std::f64::consts::PI);
}

Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n;
int main() {
    scanf("%d", &n);
    int ban = n + (~n & 1);
    vector<pii> ans;
    for (int i = 1; i <= n; ++i) 
        for (int j = i + 1; j <= n; ++j)
            if (i + j != ban) 
                ans.push_back(pii(i, j));
    printf("%d\n", (int)ans.size());
    for (auto x: ans) printf("%d %d\n", x.first, x.second);
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
int main(void){
    int x,y,a,count,count2;
    count = count2 = 0;
    scanf("%d %d %d\n",&x, &y, &a);
    while(a > 0){
        a = a - 1;
        count++;
        if (count == x){
            count = 0;
            count2 = count2 + y;
        }
    }
    
 
    printf("%d",count2);
    return 0;
}

Measured memory_bytes: 128
S_list = list(input())

N = len(S_list)

is_strong = False

if list(reversed(S_list)) == S_list:
    first_half = S_list[:int((N-1)/2)]
    if list(reversed(first_half)) == first_half:
        is_strong = True

if is_strong:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys


def solve(P: int, Q: int, R: int):
    print(min(P + Q, Q + R, R + P))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    P = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(P, Q, R)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
	int N, K;
	int ans = 1;

	cin >> N >> K;

	for (int i = 0; i < N; i++)
	{
		if (ans < K)
			ans *= 2;
		else
			ans += K;
	}

	cout << ans << endl;

	return 0;
}


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

int main(void){
int h1,h2,k1,k2,a,b,c,d;
int h=0,k=0;
string s[]={"hiroshi","kenjiro","even"};

cin>>h1>>h2;
cin>>k1>>k2;
cin>>a>>b>>c>>d;

h=a*h1+b*h2+ (a*h1)/10*c + (b*h2)/20*d;
k=a*k1+b*k2+ (a*k1)/10*c + (b*k2)/20*d;

if(h==k){cout<<s[2]<<endl;}
else if(h>k){cout<<s[0]<<endl;}
else {cout<<s[1]<<endl;}
return 0;

}



Measured memory_bytes: 3216
n = int(input())

taro = 0
hanako = 0

for ni in range(n):
    t, h = input().split()
    
    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)

Measured memory_bytes: 7612
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace D_ABC166
{
    class MainClass
    {

        static long[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            long[] a = new long[1001];
            long[] b = new long[1001];

            for(int i = 0;i<=1000;i++){
                long tmp = (long)Pow(i,5);
                a[i] = tmp;
                b[i] = -tmp;
            }

            for(int i = 0;i<=1000;i++){
                for(int j = 0;j<=1000;j++){
                    long tmp = a[i] + b[j];
                    long tmp2 = a[i] - b[j];
                    if(tmp ==s[0]){
                        WriteLine("{0} {1}",i,j);
                        return;
                    }else if(tmp2==s[0]){
                        WriteLine("{0} {1}",i,-(j));
                        return;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 28372
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
  int n;cin>>n;
  int sum=0;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int diff=INF;
  for(int i=-100;i<=100;i++){
    int tmp=0;
    for(int j=0;j<n;j++){
      tmp+=pow(int(i-a[j]), 2);	
    }
    diff=min(diff, tmp);
  }
  cout << diff << endl;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))

if n<=2:
    print(1)
else:
    status="U"
    for i in range(n):
        if a[i+1]-a[i]<0:
            status="D"
            break
        elif a[i+1]-a[i]>0:
            status="U"
            break

    cnt=1
    reset_flag=False
    for i in range(n-1):
        if reset_flag:
            if a[i+1]-a[i]>0:
                status="U"
                reset_flag=False
            elif a[i+1]-a[i]<0:
                status="D"
                reset_flag=False
            else:
                continue
        elif status=="D" and a[i+1]-a[i]>0:
            cnt+=1
            reset_flag=True
        elif status=="U" and a[i+1]-a[i]<0:
            cnt+=1
            reset_flag=True
    print(cnt)



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

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,M;
  cin >> N >> M;

  int ans=100*(N-M) + 1900*M;
  rep(i,M)  ans*=2;
  cout << ans << endl;

  return 0;
}

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

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}

int main()
{
	FASTIO;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ll n;
	cin>>n;

	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		ll x;
		 cin>>x;

		 if(x%2!=0 and i%2!=0)
		 	ans++;

	}

	cout<<ans<<"\n";

	
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  if (N>=2 && M>=2) {
    cout << (N-2)*(M-2) << endl;
  }
  else if (N==1 && M>=2) {
    cout << M-2 << endl;
  }
  else if (N>=2 && M==1) {
    cout << N-2 << endl;
  }
  else {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
class Main{
 
    int a;
    int b;
 
    public Main(){
        Scanner scan = new Scanner(System.in);
        a = scan.nextInt();
        b = scan.nextInt();
 
        int x = a / b;
        int y = a % b;
        double z = (double)a/b;
 
        System.out.printf("%d %d %.5f", x, y, z);
    }
    public static void main(String[] args){
        new Main();
    }
}

Measured memory_bytes: 26428
import sys

def f1(s): return "".join([d0[c] for c in s])

d0={"M":"10010","N":"10011"}
a="ABCD";
for i in range(4): d0[a[i]]=format(i,"02b")
a="EFGHIJKL"
for i in range(8): d0[a[i]]=format(i,"03b")
L0="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
L1=" ',-.?"+L0
L2=L0+" .,-'?"

dc={}
a="J,EE,EH,MF,GF,EF,IJ,NG,BB,AB,K,BF,NH,GE,BD,NE,BC,"\
  "AI,NF,NK,AJ,L,NL,CA,AK,AL,NI,NJ,EG,MG,MH,ME".split(",")
for i,e in enumerate(a): dc[f1(e)]=L1[i]
ec={}
for i in range(32): ec[L2[i]]=format(i,"05b")
for s0 in sys.stdin:
  s1="".join([ec[c] for c in s0.strip("\n")])
  s=""
  x=""
  for c in s1:
    s+=c
    if s in dc: x+=dc[s]; s=""
  print x

Measured memory_bytes: 4284
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

x = ni()

if x == 1:
    print(1)
    
else:
    ans = 0
    for b in range(2,40):
        for p in range(2,11):
            if ans < b**p <= x:
                ans = b**p
                
            if b**p > x:
                break
            
    print(ans)

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

 
int main() {
    int n,k;
    cin>>n>>k;
    map<int,int> A;

    rep(i,n){
        int a;
        cin>>a;
        A[a]++;
    }

    priority_queue<int, vector<int>, greater<int> > que;//小さい順priority_queue記憶しておく
    for(auto p:A){
        que.push(p.second);
    }

    int ans=0;
    rep(i,A.size()-k){
        ans+=que.top();
        que.pop();
    }

    cout<<ans<<endl;
}

//mapをvalueでソートするには？

Measured memory_bytes: 10748
use whiteread::parse_line;

fn main() {
    // eprintln!("{:?}", 1);
    let (n, k): (usize, usize) = parse_line().unwrap();
    let xs: Vec<usize> = parse_line().unwrap();
    let mut l = 0;
    let mut r = 1_000_000_000;
    while r - l > 1 {
        let m = (l + r) / 2;
        let ok = |y, xs| {
            let mut now = 0;
            for &x in xs {
                now += (x - 1) / y;
            }
            now <= k
        };
        if ok(m, &xs) {
            r = m
        } else {
            l = m
        }
    }
    println!("{}", r);
}


Measured memory_bytes: 5668
#include <iostream>
using namespace std;
 
int main(){
  int A,B;
  cin >> A >> B;
  
  if (A != 1 && B != 1) {
    cout << "1" << endl;
  }
  else if (A != 2 && B != 2) {
    cout << "2" << endl;
  }
  else if (A != 3 && B != 3) {
    cout << "3" << endl;
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
        

fast();
//ll t;cin>>t;while(t--)
{
    ll n,x,t;
    cin>>n>>x>>t;
    ll ans=(ceil(n/float(x)))*t;
    cout<<ans<<endl;
}
return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>

long long N,r[100006];
long long sum=1;

int main(){
	scanf("%lld",&N);
	for(int i=0;i<N;i++){
		scanf("%lld",&r[i]);
	}
	
	int j=0;
	for(int i=0;i<N;i++){
		for(j;j<N&&2*(j-i)<r[j];j++);
		if(j<N)j++;
		sum*=(j-i);
		sum%=1000000007;
	}
	printf("%lld",sum);
	
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int dp[20000];

int main()
{
long long n,m;
cin>>n>>m;
m/=1000;
for(int i=0;i<=n;i++)
{
    for(int j=0;j<=n;j++)
    {
       if(i*10 + j*5 + (n-i-j)*1==m && (n-i-j)>=0)
       {
           
       
        cout << i << " " << j << " " << n-i-j<<endl;
       return 0;
       }

    }
}
cout <<"-1 -1 -1"<<endl;
}


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

#define rep(i, a, b) for(int i=(a); i<(b); i++)

int main(){
  string S;
  cin >> S;
  int red=0, blue=0;
  rep(i, 0, S.size()){
    if(S[i]=='0') red++;
    else blue++;
  }

  cout<<min(red,blue)*2<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/*Coding Space*/
int main(){
  int a,b,c; cin >> a >> b >> c;
  if(b < c) swap(b,c);
  if(a < b) swap(a,b);
  cout << max(10*a+ b + c, a + 10*b + c) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("03")
#include <bits/stdc++.h>
typedef long long ll;
const int inf=INT_MAX;
using namespace std;
int n,m,x;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(int i=0;i<2;i++)
        {
            x=n%10;
            if(x==9) {cout<<"Yes"<<endl; break;} else if(i==1) {cout<<"No"<<endl;}
            n/=10;
        }
    return 0;
}


Measured memory_bytes: 256
use strict;
use utf8;
use warnings;

my $inp = <STDIN>;
chomp($inp);
my @segments = split(" ", $inp);
my $tail = pop(@segments);
my $ op  = pop(@segments);
my $head = pop(@segments);
my $ans;
if ($op eq "+"){
    $ans = $head + $tail;
}else{
    $ans = $head - $tail;
}
print "$ans\n";

Measured memory_bytes: 768
#include <stdio.h>
int main(void) {
    int n, i, pm, pe, pj;
  scanf("%d",&n);
    while(n) {
        for(i=0;i<n;i++){
            scanf("%d%d%d",&pm,&pe,&pj);
            if(pe == 100 || pm == 100 || pj == 100|| (pm+pe)/2 >= 90 || (pe+pm+pj)/3 >= 80) {
                puts("A");
            } else if( (pm+pj+pe)/3 >= 70 || ((pm+pe+pj)/3 >= 50 && (pm >= 80|| pe >= 80))) {
                puts("B");
            } else {
                puts("C");
            }
        }
        scanf("%d",&n); 
    }
    return(0);
}

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

using namespace std;

const int mod = 1e9 + 7;

int bp(int a, int n) {
    int ret = 1;
    while (n) {
        if (n & 1) {
            ret = (ret *1ll* a) % mod;
        }
        a = (a * 1ll * a) % mod;
        n >>= 1;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    long long ans;
    cin >> n;
    ans = bp(10, n);
    ans = (ans - bp(9, n) + mod) % mod;
    ans = (ans - bp(9, n) + mod) % mod;
    ans = (ans + bp(8, n) + mod) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
/*ll gcd(ll a, ll b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll LCM(ll a,ll b)
{
    return (a*b)/gcd(a, b);
}*/
 
 
int main()
{
    string s;
    cin>>s;
    int c=0;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R')
       cout<<"3"<<endl;
    else if((s[0]=='R' && s[1]=='R')||(s[1]=='R' && s[2]=='R'))
        cout<<"2";
    else if(s[0]=='S' && s[1]=='S' && s[2]=='S')
        cout<<"0";
    else
        cout<<"1";
  return 0;
}

Measured memory_bytes: 3620
n=int(input())
s=input()

L,R=0,0
l,r=0,0
for i in s:
    if i=="(":
        l +=1
    else:
        l -=1
        L=min(L,l)

for i in s[::-1]:
    if i==")":
        r +=1
    else:
        r -=1
        R=min(R,r)

print("("*-L+s+")"*-R)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1L<<32;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n,k;cin>>n>>k;
  vll a(n);
  rep(i,0,n){
    cin>>a[i];
  }
  rep(i,0,min(41LL,k)){
    vll b(n,0);
    rep(j,0,n){
      ll l=max(0LL,j-a[j]),r=min(n-1,j+a[j]);
      b[l]++;
      if(r+1<n)b[r+1]--;
    }
    rep(j,0,n-1){b[j+1]+=b[j];}
    a=b;
  }
  rep(i,0,n){
    cout<<a[i]<<' ';
  }
  cout<<endl;
}





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

int main()
{
    int n; cin >> n;
    int m; cin >> m;
    vector< pair<int, int> > ab;
    for(int i = 0; i < n; ++i){
        int a; cin >> a;
        int b; cin >> b;
        pair<int, int> tmp = make_pair(a, b);
        ab.push_back(tmp);
    }
    sort(ab.begin(), ab.end());
    
    int count = 0;
    long long answer = 0;
    for (int i = 0; i < n; ++i){
      for (int j=0; j < ab[i].second; ++j){
        ++count;
        answer += ab[i].first;
        if(count == m){
          cout << answer << endl; 
          return 0;
        }
      }
    }
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <fstream>
#include <string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


typedef  long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;


#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
const int N=2e6+5;
int mod=1e9+7;
ll mul (ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
ll add (ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a+b+mod)%mod;
}
ll fastpow(ll b, ll p)
{
    if(p==0)
        return 1;
    ll ans=fastpow(b,p/2);
    ans=mul(ans,ans);
    if(p%2)ans=mul(ans,b);
    return ans;
}
int n,q;
int inter(int mx,pair<int ,int>p,pair<int ,int>f)
{
    pair<int,int>ans;
    ans.first=min(max(mx+1,p.first),p.second+1);
    ans.second=max(min(p.second,f.first-1),p.first-1);

    return max(0,((ans.second-ans.first)+1));
}
int xxx=0;
vector<int>build(vector<pair<int,int>>v)
{
    vector<vector<int>>add(n+2),rem(n+2);
    vector<int>t;
    t.resize(v.size(),0);
  set<int>st;
    for(int i=0; i<v.size(); i++)
    {
        add[v[i].first].push_back(i);
        rem[v[i].second+1].push_back(i);
    }
    for(int i=1;i<=n;i++)
    {
        while(add[i].size())
        {
            st.insert(add[i].back());
            add[i].pop_back();
        }
        while(rem[i].size())
        {
            st.erase(rem[i].back());
            rem[i].pop_back();
        }
        if(st.size()==0)
            xxx++;
        else if(st.size()==1)
        {
            t[*(st.begin())]++;
        }
    }

    return t;
}

int solve2(vector<pair<int,int>>v)
{
    vector<int>t=build(v);
    int mn=1e9,mx=0;
    for(int i=0; i<v.size(); i++)
    {
        mn=min(mn,t[i]);
    }
    return mn;
}

int solve(vector<pair<int,int>>v)
{
    vector<int>t=build(v);
    int mn=1e9;
    for(int i=0; i<v.size(); i++)
    {
        mn=min(mn,t[i]);

    }

    int ans=1e9;
    for(int i=v.size()-1; t.size(); i--)
    {
        if(t.back()==mn)
        {
            pair<int,int>tmp=v[i];
            v.erase((v.begin()+i));
            ans=min(ans,solve2(v));
            //   cout<<"Try==> "<<tmp.first<<"  "<<tmp.second<<" t = "<<t.back()<<" ans = "<<ans<<endl;
            v.insert((v.begin()+i),tmp);


        }
        t.pop_back();


    }
    return ans+mn;
}

int main()
{
    FIO
ll n,p,ans=0;
cin>>n>>p;
mod=p;
string s;
cin>>s;
if(p==2||p==5)
{
    for(int i=0;i<n;i++)
    {
     if((s[i]-'0')%p==0)
        ans+=(i+1);

    }

}
else
{
    ll po=1;
    ll sum=0;
    map<ll,ll>mp;
    mp[0]=1;

    for(int i=n-1;i>=0;i--)
    {
        sum=add(mul(s[i]-'0',po),sum);
        po=mul(po,10);
        ans+=mp[sum]++;




    }

}
cout<<ans;

}



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

int main(){
  int N,M,C;
  cin >> N >> M >> C;
  int sum,cou=0;
  vector<int> B(M);
  for(int i=0;i<M;i++)
    cin >> B.at(i);
  for(int i=0;i<N;i++){
    sum=C;
    for(int j=0;j<M;j++){
      int a; cin >> a;
      sum += a*B.at(j);
    }
    if(sum>0)
      cou++;
  }
  cout << cou;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <string>
#define ll long long
#define ms(a) memset(a,0,sizeof(a))
#define pi acos(-1.0)
#define INF 0x3f3f3f3f
const double E=exp(1);
const int maxn=1e6+10;
using namespace std;
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	if(n%k)
		cout<<1<<endl;
	else
		cout<<0<<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<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x; cin>>x;
    cout<<1-x<<endl;
    return 0;
}

Measured memory_bytes: 3648
using System;

class MyClass
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');

        if (str.Length == 2)
        {
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);

            if (a < b)
                Console.WriteLine("a < b");
            else if (a > b)
                Console.WriteLine("a > b");
            else if (a == b)
                Console.WriteLine("a == b");
        }
    }
}

Measured memory_bytes: 8884
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>


int main() {
	int k, n; std::cin >> k >> n;
	std::vector<int> a(n);
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	int s = a[0] + k - a[n - 1], ma = s;
	for (int i = 0; i < n - 1; i++) {
		s += a[i + 1] - a[i];
		ma = std::max(ma, a[i + 1] - a[i]);
	}
	std::cout << s - ma << std::endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define inf 1000000000
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define yoi cout<<"yo"<<endl;
#define debug(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
const int mod=1e9+7;
int main(){
IOS;
int n;
cin>>n;
string s;
map<string,lli> m;
for(int i=0;i<n;i++){
    cin>>s;
    sort(all(s));
    m[s]++;
}
lli ans=0;
for(auto it: m){
    ans+=(it.second*(it.second-1))/2;
}
cout<<ans<<endl;
}


Measured memory_bytes: 11264
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  input.shift();
  var X = input.map(i => i.split(" ").map(i => parseInt(i)));
  X.splice(N,X.length-N);
  X.sort(function(a,b){
    if (a[1] < b[1]) return -1;
    if (a[1] > b[1]) return 1;
    return 0;
  });
  var ans = "Yes";
  var sum =0;
  for(var i=0;i<N;i++){
    sum+=X[i][0];
    if(sum>X[i][1]){
      ans="No";
      break;
    }
  }


  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 64612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,r;cin>>n>>r;
  const ll ans=r+max(0ll,100*(10-n));
  print(ans);
  return 0;
}

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

int main() {
    string S;
    cin >> S;
    int N = (int)S.size();

    vector<int> res(N);
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            cnt++;
        } else {
            res[i] += cnt / 2;
            res[i - 1] += (cnt + 1) / 2;
            cnt = 0;
        }
    }
    for (int i = N - 1; i >= 0; i--) {
        if (S[i] == 'L') {
            cnt++;
        } else {
            res[i + 1] += (cnt + 1) / 2;
            res[i] += cnt / 2;
            cnt = 0;
        }
    }

    for (int i = 0; i < N; i++)
        cout << res[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x)end()
#define sz(x) (int)(x).size
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const int INF = 2000000000;
const int maxn = 0;

ll gcd(ll a,ll b) {
    if (b == 0) return a;
    return gcd(b,a % b);
}

int main ()
{
    int n;
    scanf("%d",&n);
    ll t;
    scanf("%lld",&t);
    ll ans = t;
    rep(i,1,n) {
        scanf("%lld",&t);
        ans = t / gcd(ans,t) * ans;
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        s: chars,
    }

    let mut ans = 0;
    let mut prev = ' ';

    for i in 0..n {
        if s[i] != prev {
            prev = s[i];
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10**6#float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()

ans = pow(10, N, mod)
tmp1 = pow(9, N, mod)
tmp2 = pow(8, N, mod)

print((ans-2*tmp1+tmp2)%mod)

Measured memory_bytes: 10044
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>  // min, max
#include <fstream>  // ifstream
#include <iomanip>  // setprecision
using namespace std;
typedef long long ll;

int main(void)
{
#ifdef FILE_DEBUG
    ifstream inputFile("data/input.txt");
    cin.rdbuf(inputFile.rdbuf());
#endif
    // これより下にコードを書く

    string S;
    cin >> S;

    ll sum = 0, number = 0;
    for (int i = 0; (i < S.size()); ++i) {
        sum += S[i] - 0x30;
        number += (S[i] - 0x30) * pow(10, S.size() - i - 1);
    }

    if (number % sum == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define line cout << endl
using namespace std;
int a, b, k;
int main() {
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			cout << "OK";
			line;
			return 0;
		}
	}
	cout << "NG";
	line;
	return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	int n,m;
	cin >> n >> m;
	n--;
	m--;
	cout <<n*m <<"\n";	
	return 0;
}

Measured memory_bytes: 256
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
//using
using namespace std;
/*using vi = vector<int>;
using vs = vector<string>;
using vc = vector<char>;*/
//define
#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
//グローバル変数宣言
int a=0,b=0,c=0,d=0,e=0;

//int sa(int n,int p){if(n>=p)return n-p;else return p-n;}

signed main(){
    cin>>a;
    vector<int>x(a);
    rep(i,a){cin>>x[i]; b+=x[i];}
    c=b/a;
    rep(i,a)d+=(c-x[i])*(c-x[i]);
    rep(i,a)e+=(1+c-x[i])*(1+c-x[i]);
    cout<<min(d,e)<<endl;
}

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

int main() {
  int N;
  cin >> N;
 
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
 
  int C = 0;
  vector<int> count(N,0);
  for (int i = 0; i < N-1; i++) {
      if (S.at(i) == S.at(i+1)){
        C++;
      }
      if (S.at(i) != S.at(i+1) || i == N-2){
        count.at(i+1-C) += C;
        C = 0;
      }
  }
  
  vector<int> countt(N);
  for (int i = 0; i < N; i++) {
    countt.at(i) = count.at(i);
  }
  sort(countt.begin(), countt.end());
  
  int M = countt.at(N-1);
  
  for (int i = 0; i < N; i++) {
    if (count.at(i) == M){
      cout << S.at(i) << endl;
    }
  }
}



Measured memory_bytes: 11164
#include <iostream>
 using namespace std;
 long long N, A[87], CM = 1000;

 int main() {
   
 	cin >> N;
 	for (int i = 1; i <= N; i++) cin >> A[i];
   
 	for (int i = 1; i <= N - 1; i++) {
 		long long St = 0;
 		if (A[i] < A[i + 1]) St = CM / A[i];
 		CM += (A[i + 1] - A[i]) * St;
 	}
 	cout << CM << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
    int n; cin >> n;
    vector<int> h(n);
    rep(i,n)cin >> h[i];
    int maxh=0,res=0;
    rep(i,n){
        if(h[i]>=maxh)res++;
        maxh=max(maxh,h[i]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::HashMap;
use std::cmp::*;
use itertools::Itertools;


//素因数分解
pub fn prime_factor(mut n: i64) -> HashMap<i64, i64> {
    let mut res: HashMap<i64, i64> = HashMap::new();
    let mut i = 2;
    while i * i <= n {
      while n % i == 0 {
        let v = match res.get(&i) {
          Some(v) => *v + 1,
          None => 1,
        };
        res.insert(i, v);
        n /= i;
      }
      i += 1;
    }
    if n != 1 {
      res.insert(n, 1);
    }
    res
  }

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: i64,
    }

    let s = prime_factor(n);

    let mut cnt = 0;
    for (k,v) in s {
        let mut vv = v;
        let mut b = 1;
        while b <= vv {
            vv -=b;
            b += 1;
            cnt += 1;
        }
    }

     println!("{}", cnt);
}


Measured memory_bytes: 2200
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//-----------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#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 FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	int n, a, b;
	int c1 = 0, c2 = 0, c3 = 0;
	cin >> n >> a >> b;
	REP(i, n) {
		int t;
		scanf("%d", &t);
		if (t <= a)c1++;
		else if (t <= b)c2++;
		else c3++;
	}
	printf("%d\n", min(c1, min(c2, c3)));
	return 0;
}

Measured memory_bytes: 256