akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc173
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_abc173C();
            Console.Out.Flush();
        }

        public static void solve_abc173C()
        {
            int[] hwk = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int h = hwk[0];
            int w = hwk[1];
            int k = hwk[2];
            int[,] mtx = new int[11, 11];
            for (int i = 0; i < h; i++)
            {
                string row = Console.ReadLine();
                for (int j = 0; j < w; j++)
                {
                    mtx[i, j] = row[j];
                }
            }
            int ans = 0;
            for (int a = 0; a < (1 << h); a++)
            {
                for (int b = 0; b < (1 << w); b++)
                {
                    int cnt = 0;
                    for (int i =  0; i < h; i++)
                    {
                        if (!Convert.ToBoolean((a & (1 << i))))
                        {
                            for (int j = 0; j < w; j++)
                            {
                                if (!Convert.ToBoolean((b & (1 << j))))
                                {
                                    if (mtx[i, j] == '#')
                                    {
                                        cnt++;
                                    }
                                }
                            }
                        }
                    }
                    if (cnt == k)
                    {
                        ans++;
                    }
                }
            }
            Console.WriteLine(ans);
        }

        public static void solve_abc173B()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            Dictionary<string, int> cnt = new Dictionary<string, int>();
            for (int tt = 0; tt < t; tt++)
            {
                string v = Console.ReadLine();
                if (cnt.ContainsKey(v))
                {
                    cnt[v]++;
                }
                else
                {
                    cnt.Add(v, 1);
                }
            }
            Console.WriteLine("AC x {0}", cnt.ContainsKey("AC") ? cnt["AC"] : 0);
            Console.WriteLine("WA x {0}", cnt.ContainsKey("WA") ? cnt["WA"] : 0);
            Console.WriteLine("TLE x {0}", cnt.ContainsKey("TLE") ?  cnt["TLE"] : 0);
            Console.WriteLine("RE x {0}", cnt.ContainsKey("RE") ? cnt["RE"] : 0);
        }

        public static void solve_abc173A()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            Console.Write(n % 1000 == 0 ? 0 : 1000 - (n % 1000));
        }
    }
}

Measured memory_bytes: 28516
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int MAXN = 10000001;
#define ll long long 

class TaskD {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n;
		cin >> n;
		vector<int> a(n);
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		sort(a.rbegin(), a.rend());
		ll ans = a[0];
		n-=2;
		int pos = 1;
		while(n > 0){
			n--;
			ans += a[pos];
			if(n > 0){
				n--;
				ans += a[pos];
			}
			pos++;
		}
		cout << ans << endl;

	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskD solver;
	solver.solve();
	return 0;
}


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

int main(){
    int a[201];
    int n,i;
    int count=0;

    cin>> n;

    for(i=0; i<n; i++){
        cin>> a[i];
    }

    while(1){
        bool odd=false;
        for(i=0; i<n; i++){
            if(a[i]%2!=0) odd=true;
        }

        if(odd) break;

        for(i=0; i<n; i++){
            a[i]=a[i]/2;
        }
        count++;

    }
    cout<< count << endl;
}

Measured memory_bytes: 3656
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    A = list(map(int, rl().split()))
    A.sort()
    
    ope = [[] for _ in range(N - 1)]
    for i in range(N - 2):
        if 0 <= A[i + 1]:
            ope[i] = [A[0], A[i + 1]]
            A[0] -= A[i + 1]
        else:
            ope[i] = [A[-1], A[i + 1]]
            A[-1] -= A[i + 1]
    ope[N - 2] = [A[-1], A[0]]
    
    ans = A[-1] - A[0]
    print(ans)
    for x, y in ope:
        print(x, y)


if __name__ == '__main__':
    solve()


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

int main() {
	
	int a, b, c; cin >> a >> b >> c;
	vector<int> num(8, 0);
	num[a]++;
	num[b]++;
	num[c]++;
	if (num[5] == 2 && num[7] == 1) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<=(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  int r;
  cin >> r;
  cout << r * r * 3 << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

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

	ll N, M;
	ll ans = 0;

	cin >> N >> M;

	vector<ll> a(N+1,1);
	ll tmp;
	rep(i, M) {
		cin >> tmp;
		a[tmp] = 0;
	}

	vector<ll> dp(N + 1, 0);
	dp[0] = 1;
	if (a[1] == 1) dp[1] = 1;
	rep2(i, 2, N+1) {
		dp[i] = a[i] * (dp[i - 1] + dp[i - 2]) % MOD;
	}

	ans = dp[N] % MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var r string
	sc.Scan()
	x := sc.Text()
	for i := 0; i < len(x); i++ {
		c := string(x[i])
		switch c {
		case "0", "1":
			r += c
		case "B":
			if r != "" {
				r = r[0 : len(r) - 1]
			}
		}
	}
	fmt.Println(r)
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(3*n);
    for(int i=0; i<3*n; i++){
        cin >> a.at(i);
    }

    sort(a.begin(),a.end(),greater<>());

    long long int ans=0;
    for(int i=0; i<n; i++){
        ans+=a.at(1+2*i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4244
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let a = scan.readn::<i64>(n);
    let div = ui(n * (n + 1) / 2);
    let sum = a.iter().cloned().sum::<i64>();
    let mut is_ok = sum % div == 0;
    let opcnt = sum / div;
    for i in 0..n {
        let v = a[i] - a[(i+1)%n] + opcnt;
        is_ok &= v >= 0 && v % ui(n) == 0;
    }
    println!("{}", if is_ok {"YES"} else {"NO"});
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
n, Y = [int(s) for s in input().split(' ')]
 
max_x = int(Y/10000)
for x in range(n, -1, -1):
    if Y < x * 10000 or n < x:
        continue
    
    max_y = int((Y-x*10000)/5000)
    for y in range(n-x, -1, -1):
        if Y < x*10000+y*5000 or n < x+y:
            continue
            
        z = int((Y-x*10000-y*5000)/1000)
        if (Y-x*10000-y*5000) % 1000 == 0 and n == x+y+z:
            print('{} {} {}'.format(x, y, z))
            exit()
            
print('-1 -1 -1')

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

int main() {
  char c;
  cin >> c;

  if (c == 'a') { cout << "vowel" << endl;}
  else if (c == 'i') { cout << "vowel" << endl;}
  else if (c == 'u') { cout << "vowel" << endl;}
  else if (c == 'e') { cout << "vowel" << endl;}
  else if (c == 'o') { cout << "vowel" << endl;}
  else { cout << "consonant" << endl;}

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[3000100],b[3000100],fa[3000100],js[3000100];
map<int,int> mp;
int getf(int s){if (fa[s]==s) return s;return fa[s]=getf(fa[s]);}
int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);mp[a[i]]++;
		a[n+1]^=a[i];
	}
	mp[a[n+1]]++;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);mp[b[i]]--;
		b[n+1]^=b[i];
	}
	mp[b[n+1]]--;
	for (map<int,int>::iterator it=mp.begin();it!=mp.end();it++) if (it->second!=0) {cout<<-1<<endl;return 0;}
	int ans=0;
	for (int i=1;i<=n;i++) if (a[i]!=b[i]) ans++;
	if (ans==0) {cout<<ans<<endl;return 0;}
	mp.clear();for (int i=1;i<=n+1;i++) if ((a[i]!=b[i])||(i==n+1)) mp[a[i]]=mp[b[i]]=0;
	int tp=0;for (map<int,int>::iterator it=mp.begin();it!=mp.end();it++) it->second=++tp;
	for (int i=1;i<=tp;i++) fa[i]=i;
	for (int i=1;i<=n+1;i++) if (a[i]!=b[i]) fa[getf(mp[a[i]])]=getf(mp[b[i]]);
	for (int i=1;i<=tp;i++) ans+=(getf(i)==i);
	cout<<ans-1<<endl;
}

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

int main() 
{
    char X, Y;
    cin >> X >> Y;
    if (X - 'Z' < Y - 'Z') {
        cout << "<" << endl; 
    }else if (X - 'Z' > Y - 'Z') {
        cout << ">" << endl;
    }else{
        cout << "=" << endl;
    }
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int n, l; cin >> n >> l;
    vector<int> a(n), b(n);
    REP(i,0,n){
        a[i] = l+i;
        b[i] = abs(l+i);
    }
    sort(b.begin(), b.end());
    a.erase(remove(a.begin(), a.end(), b[0]), a.end());
    int sum = 0;
    REP(i,0,n-1){
        sum = sum + a[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
xy=[list(map(int, input().split())) for _ in range(n)]

l=[]
for i in range(n):
    l.append(i)

from itertools import permutations
import math

lst=list(permutations(l))

ans_l=[]
len_l=len(lst)

for l_i in lst:
    tmp_dist=0
    for i in range(n-1):
        tmp_dist+=math.sqrt((xy[l_i[i]][0]-xy[l_i[i+1]][0])**2+(xy[l_i[i]][1]-xy[l_i[i+1]][1])**2)
    ans_l.append(tmp_dist)

print(sum(ans_l)/len_l)


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

class ITP1_10C
{
    static void Main()
    {
        int[] x = new int[8];
        char[] y = new char[100];
        string str = Console.ReadLine();
        for (int i = 0; i < 6; i++)
        {
            x[i+1] = int.Parse(str.Split()[i]);
        }
        y = Console.ReadLine().ToCharArray();
        for (int i = 0; i < y.Length; i++)
        {
            if (y[i] == 'S')
            {
                x[0] = x[1]; x[1] = x[5];
                x[5] = x[6]; x[6] = x[2]; x[2] = x[0];
            }
            else if (y[i] == 'N')
            {
                x[0] = x[1]; x[1] = x[2];
                x[2] = x[6]; x[6] = x[5]; x[5] = x[0];
            }
            else if (y[i] == 'E')
            {
                x[0] = x[1]; x[1] = x[4];
                x[4] = x[6]; x[6] = x[3]; x[3] = x[0];
            }
            else if (y[i] == 'W')
            {
                x[0] = x[1]; x[1] = x[3];
                x[3] = x[6]; x[6] = x[4]; x[4] = x[0];
            }
        }

        Console.WriteLine(x[1]);
    }
}

Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin >>N;
  int A[N],B[N-1];
  int ans=0;
  for(int i=0;i<N-1;++i) {
    cin >>B[i];
    if(i==0) ans+=B[i];
    if(i>=1) {
      if(B[i]<B[i-1]) ans+=B[i];
      if(B[i]>=B[i-1]) ans+=B[i-1];
    }
    if(i==N-2) ans+=B[i];
  }
  cout <<ans;
}


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

ans = N
# b, w
right = [S.count('#')]
right.append(N-right[0])
left = [0, 0]

for s in S:
    ans = min(ans, left[0]+right[1])
    if s == '#':
        left[0] += 1
        right[0] -= 1
    else:
        left[1] += 1
        right[1] -= 1
print(min(ans, left[0]+right[1]))

Measured memory_bytes: 3500
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

ll lcm(ll a, ll b) { //最小公倍数
  return a * b / gcd(a, b);
}

ll digit_sum(ll a){ //10進桁和
  ll ans=0;
  while(a>0){
    ans+=a%10;
    a/=10;
  }
  return ans;
}



int main()
{
  ll n,a,b;
  cin>>n;
  if(n==1){
    cout<<"Hello World"<<endl;
    return 0;
  }
  cin>>a>>b;
  cout<<a+b<<endl;

  return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

int n,k,x,mod=1e9+7;
vector<ll> pos;
vector<ll> zero;
vector<ll> neg;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
    for (int i=0;i<n;++i)
    {
        cin>>x;
        if (x>0)
            pos.push_back(x);
        else if (x<0)
            neg.push_back(x);
        else
            zero.push_back(x);
    }
    bool ok=0;
    for (int i=k;i>=0;i-=2)
    {
        if (sz(pos)>=i)
            if (sz(neg)>=k-i)
                ok=1;
    }
    ll ans=1;
    sort(pos.begin(), pos.end());
    sort(neg.rbegin(), neg.rend());
    if (ok)
    {
        while (k>0)
        {
            if (k==1)
            {
                ans*=pos.back();
                pos.pop_back();
                ans%=mod;
                --k;
            }
            else if (sz(pos)>1&&sz(neg)>1&&k>1)
            {
                if (pos.back()*pos[sz(pos)-2]>neg.back()*neg[sz(neg)-2])
                {
                    ans*=pos.back();
                    pos.pop_back();
                    ans%=mod;
                    ans*=pos.back();
                    pos.pop_back();
                    ans%=mod;
                }
                else
                {
                    ans*=neg.back();
                    neg.pop_back();
                    ans%=mod;
                    ans*=neg.back();
                    neg.pop_back();
                    ans%=mod;
                }
                k-=2;
            }
            else if (sz(neg)>1)
            {
                ans*=neg.back();
                neg.pop_back();
                ans%=mod;
                ans*=neg.back();
                neg.pop_back();
                ans%=mod;
                k-=2;
            }
            else
            {
                ans*=pos.back();
                pos.pop_back();
                ans%=mod;
                --k;
            }
        }
        cout<<ans<<"\n";
        return 0;
    }
    if (sz(zero))
    {
        cout<<0<<"\n";
        return 0;
    }
    sort(pos.rbegin(), pos.rend());
    sort(neg.begin(), neg.end());
    while (k>0)
    {
        if (sz(pos)&&sz(neg))
        {
            if (pos.back()<abs(neg.back()))
            {
                ans*=pos.back();
                pos.pop_back();
            }
            else
            {
                ans*=neg.back();
                neg.pop_back();
            }
        }
        else if (sz(pos))
        {
            ans*=pos.back();
            pos.pop_back();
        }
        else
        {
            ans*=neg.back();
            neg.pop_back();
        }
        ans%=mod;
        --k;
    }
    while (ans<0)
        ans+=mod;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 5556
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
//typedef LL int;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    map<int, int> m;

    REP(i, 3){
        int x;
        cin >> x;
        m[x] = 1;
    }

    cout << m.size() << endl;

    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);




int main()
{
    int q=1;

    while(q--)
    {
       ll n;  cin>>n;
        if(n%1000==0)
            cout<<0;
        else
            cout<<1000-n%1000;
    }


    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <string>

using namespace std;

void solve();

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

void solve() {
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        a[i]--;
    }
    int count = 0;
    for(int i = 0; i < N; i++) {
        if(a[i] < i) continue;
        if(a[a[i]] == i) count++;
    }
    cout << count << endl;



    
}

Measured memory_bytes: 640
#include <iostream>

inline bool is_right_triangle(u_int a, u_int b, u_int c) {
    return (a*a == b*b + c*c || b*b == c*c + a*a || c*c == a*a + b*b);
}

int main(void) {
    u_int n, a, b, c;

    std::cin >> n;
    for (u_int i = 0; i < n; ++i) {
        std::cin >> a >> b >> c;
        if (is_right_triangle(a, b, c)) {
            std::cout << "YES" << std::endl;
        } else {
            std::cout << "NO" << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1148
#include <iostream>

using namespace std;

int main()
{
	int N, b1 = 0, b2 = 0, b4 = 0;
	long long int a[100000];

	cin >> N;

	for (int n = 0; n < N; n++)
		scanf("%d", &a[n]);

	for (int n = 0; n < N; n++) {
		if (a[n] % 2 == 0) {
			if (a[n] / 2 % 2 == 0) {
				b4++;
				continue;
			}
			b2++;
			continue;
		}
		b1++;
	}

	if ((b1 <= (b4 + 1) && b2 == 0) || ((b1 <= b4) && b2 > 0))cout << "Yes";
	else cout << "No";

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  long long N;
  string S;
  cin >> N >> S;
  for (int i=0;i<S.size();i++) {
    char a=S.at(i);
	a+=N;
    if (a>'Z') {a-=26;}
	cout << a;
  }
  
}


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

int main() {
	int N;
	cin>>N;
	map<string,int> mp;
	int max=-1;
	for(int i=0; i<N; i++){
		string s; cin>>s;
		if(mp.count(s)) mp[s]++;
		else            mp[s]=1;
		if(mp[s]>=max){
			max=mp[s];
		}
	}
	for(auto itr=mp.begin(); itr!=mp.end(); itr++){
		if(itr->second==max) cout<<itr->first<<endl;
	}
}

Measured memory_bytes: 25216
#include<iostream>
using namespace std;
int main()
{
    int m,n;
    cin>>m>>n;
    int a[n],i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        m=m-a[i];
    }
    if(m<1)
        cout<< "Yes"<<endl;
    else
        cout<< "No"<<endl;
    return 0;
}


Measured memory_bytes: 640
# スイッチのon/offの状態による全探索を実行する。
n, m = map(int, input().split(" "))
relation = []
for _ in range(m):
    relation.append(list(map(int, input().split(" "))))
P = list(map(int, input().split(" ")))

count = 0
for i in range(2**n):
    flag = True
    for j in range(m):
        switch_set = relation[j]
        on_count = 0
        for k in range(1, len(switch_set)):
            tmp = i
            shifted = tmp >> (switch_set[k]-1)
            if shifted & 1:
                on_count += 1
        if on_count % 2 != P[j]:
            # このパターンにおいてこの電球がついていない場合
            flag = False
            break
    if flag:
        count += 1

print(count)


Measured memory_bytes: 3188
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846264338327950L

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, Q, i, j, k, l, tmp, ans;

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

    vector<ll> A(N, 0), B(M, 0);
    vector<ll> a(1, 0), b(1, 0);
    REP(i, N){
        scanf("%d", &A.at(i));
    }
    REP(i, M){
        scanf("%d", &B.at(i));
    }
    REP(i, N){
        a.push_back(a[i] + A[i]);
    }
    REP(i, M){
        b.push_back(b[i] + B[i]);
    }
    j = M;
    REP(i, N + 1){
        if (a[i] > K){
            break;
        }
        while(b[j] > K - a[i]){
            j -= 1;
        }
        ans = max(ans, i + j);
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 11104
N,K = map(int,input().split())
p = 10**9+7
ans = ((((N+1)**2)*(N+2))//2)%p
ans = (ans-((N+1)*(N+2)*(2*N+3))//6+N+1)%p
ans = (ans-((N+1)*(K-1)*K)//2)%p
ans = (ans+((K-1)*K*(2*K-1))//6-K+1)%p
print(ans)

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

int main() {
  vector<char>alphabet(26);
  alphabet={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  string s;
  cin >> s;
  int L=s.size();
  for(int i=0;i<26;i++){
    bool a=false;
    for(int j=0;j<L;j++){
      if(s.at(j)==alphabet.at(i)) a=true;
    }
    if(!a){
      cout << alphabet.at(i) << endl;
      return 0;
    }
  }
  
  cout << "None" << endl;
}


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

using namespace std;

#define ll long long int

#define DEBUG (0)
int main()
{
    int K = 0;
    string S;
    string dot = "...\0";

    cin >> K;
    cin >> S;

    if(S.length() > K ){
        S.erase(K);
        S.insert(K,dot);
        cout << S << "\n";
    }else{
        cout << S << "\n";
    }
}


Measured memory_bytes: 3624
n, a, b = map(int, input().split())
h = [int(input()) for _ in range(n)]

l = 0
r = max(h) // b + 1
while r - l > 1:
    m = (l + r) // 2
    count = 0
    for x in h:
        x = x - m * b
        if x > 0:
            count += (x + a - b - 1) // (a - b)
    if count <= m:
        r = m
    else:
        l = m
print(r)

Measured memory_bytes: 7112
#include <bits/stdc++.h>
#define isFile 0
#define NAME "taskA"
#define scan 1
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;

#define mp make_pair
#define pb push_back
#define fr first
#define sc second

#define ins insert
#define all(v) v.begin(), v.end()
#define rep(i,a,n) for (int i=a;i<n;i++)
#define bit(n, i) (n >> i) & 1
#define bpc(x) __builtin_popcountll(x)
#define rev(a) reverse(all(a))
#define skip continue
#define read(a) for(auto &i : a) cin >> i
#define print(a) for(auto i : a) cout << i << ' '
#define unique(a) sort(all(a));    a.resize(unique(all(a)) - a.begin())

//                D  R  U   L
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void faster() {
    if (isFile) {
        freopen(NAME".in", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }
    if (scan) {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    }
}

const ll  INF = 1e18;
const int inf = 2e9;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ld  PI = acos(-1);
const ld  EPS = 3E-16;
const int ALPHA = 27;
const int N = (int)1e2 + 5;
const int M = 123;

int n, w;
ll W[N], V[N];
ll dp[111111];
// dp[i] - the total minimum weight with value i

void solve() {
    cin >> n >> w;
    ll sum_values = 0;
    for(int i = 0; i < n; i++) {
        cin >> W[i] >> V[i];
        sum_values += V[i];
    }

    for(int i = 0; i <= sum_values; i++)
        dp[i] = INF;

    dp[0] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = sum_values - V[i]; j >= 0; j--) {
            if (dp[j] != INF)
                dp[j + V[i]] = min(dp[j + V[i]], dp[j] + W[i]);
        }
    }

    ll ans = -1;
    for(int i = sum_values; i >= 0; i--) {
        if (dp[i] != -INF && dp[i] <= w)
//            cout << i << ' ' << dp[i] << '\n';
            ans = max(ans, (ll) i);
    }

    cout << ans << endl;
}

int main() {
    faster();
    int t = 1;
//    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 1024
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

struct RSQRAQ {
  int n;
  vector<ll> dat, lazy;

  RSQRAQ(){}
  RSQRAQ(int n_) {
    n = 1; while(n < n_) n *= 2;
    dat.assign(n*2, 0);
    lazy.assign(n*2, 0);
  }

  void eval(int len, int k) {
    if(lazy[k] == 0) return;
    if(k*2+1 < n*2-1) {
      lazy[2*k+1] += lazy[k];
      lazy[2*k+2] += lazy[k];
    }
    dat[k] += lazy[k]*len;
    lazy[k] = 0;
  }

  // [a, b)
  ll update(int a, int b, ll x, int k, int l, int r) {
    eval(r-l, k);
    if(b <= l || r <= a) return dat[k];
    if(a <= l && r <= b) {
      lazy[k] += x;
      return dat[k] + lazy[k]*(r-l);
    }
    return dat[k] = update(a, b, x, 2*k+1, l, (l+r)/2) + update(a, b, x, 2*k+2, (l+r)/2, r);
  }
  ll update(int a, int b, ll x) { return update(a, b, x, 0, 0, n); }

  // [a, b)
  ll query(int a, int b, int k, int l, int r) {
    eval(r-l, k);
    if(b <= l || r <= a) return 0;
    if(a <= l && r <= b) return dat[k];
    ll vl = query(a, b, 2*k+1, l, (l+r)/2);
    ll vr = query(a, b, 2*k+2, (l+r)/2, r);
    return vl + vr;
  }
  ll query(int a, int b) { return query(a, b, 0, 0, n); }
};

signed main(void)
{
  int n, q;
  cin >> n >> q;
  RSQRAQ seg(n);
  REP(i, q) {
    int type;
    cin >> type;
    if(type == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      s--;
      seg.update(s, t, x);
      // REP(i, n) {
      //   cout << seg.query(i, i+1) << " ";
      // }
      // cout << endl;
    } else {
      int s, t;
      cin >> s >> t;
      s--;
      cout << seg.query(s, t) << endl;
    }
  }

  return 0;
}



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

int main(){
    int N; cin >> N;
    using pi = pair<int, int>;
    vector<vector<pi>>input(N + 1);
    for(int i = 1; i <= N;++i){
        int Q; cin >> Q;
        for(int j = 0; j < Q; ++j){
            int a,b; cin >> a >> b;
            input[i].emplace_back(a,b);
        }
    }
    auto check = [](int bit, int i){
        return (bit & (1 << (i - 1)));
    };
    int ans = 0;
    for(int bit = 0; bit < (1 << N); ++bit){
        bool valid = true;
        vector<bool>res(N + 1,true);
        for(int i = 1; i <= N; ++i) res[i] = check(bit,i);
        for(int i = 1; i <= N; ++i){
            if(check(bit,i) == 0){
                continue;
            }
            for(auto p : input[i]){
                bool crt = p.second;
                int trg = p.first;
                if( res[trg]!= crt){
                    valid = false;
                }
            }
        }
        if(not valid) continue;
        ans = max(ans, accumulate(res.begin() + 1, res.end(), 0));
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
s = [dict(Counter(list(input()))) for _ in range(n)]
st = []
kouho = s[0]
moji = sorted(kouho)
for i in moji: #１つめの辞書から１つ１つ取り出す
    mn = kouho[i]
    for j in s: #すべての辞書において確認
        if i in j: #もし辞書に入っているのであれば取る値の小さいほうをmnに格納
            mn = min(mn,j[i])
        else:
            mn = 0
    st.append(i*mn)

print(''.join(st))

Measured memory_bytes: 39152
import sys
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
  L = []
  n, m, k = map(int, input().split())
  uf = UnionFind(n+1)
  F = [[] for _ in range(n+1)]
  for _ in range(m):
    a, b = map(int, input().split())
    F[a].append(b)
    F[b].append(a)
    uf.unite(a, b)
  G = [set() for _ in range(n+1)]
  for _ in range(k):
    c, d = map(int, input().split())
    G[c].add(d)
    G[d].add(c)
  for i in range(1, n+1):
    temp = uf.size(i)
    temp -= len(F[i])
    for v in G[i]:
      if uf.same(i, v):
        temp -= 1
    L.append(temp-1)
  print(*L)
    
if __name__ == "__main__":
  main()

Measured memory_bytes: 121912
import java.io.*;
import java.util.*;

public class Main{
  public static void main(String[] args){
    try {
      Scanner sc = new Scanner(System.in);
      int n;
      n=Integer.parseInt(sc.next());
      String[] w=new String[n];
      for(int i=0; i<n; i++){
        w[i]=sc.next();
      }

      boolean ans=true;
      out: for(int i=1; i<n; i++){
        if(w[i].charAt(0)!=w[i-1].charAt(w[i-1].length()-1)){
          ans=false;
          break out;
        }
        for(int j=0; j<i; j++){
          if(w[i].equals(w[j])){
            ans=false;
            break out;
          }
        }
      }

      if(ans==true){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      

      }catch (Exception e) {
      System.out.println("out");
    }
  }
}


Measured memory_bytes: 22996
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int i,j;
    int n;
    cin >> n;
    ll sum=0;
    rep(i,n){
        int a;
        cin >> a;
        sum+=a-1;
    }
    cout << sum << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int>r(N);
  vector<int>l(N);
  for(int i=0;i<N;i++){
    cin >> r.at(i) >> l.at(i);
  }
  int number =0;
  
  for(int i=0;i<N;i++){
    number += l.at(i)-r.at(i)+1;
  }
    cout << number << endl;
}

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

int main(){
    int x,y,l,s;
    
    scanf("%d %d",&x,&y);
    s=x*y;
    l=2*x+2*y;
    
    cout<<s<<" "<<l<<endl;
    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int n,k;
    cin>>n>>k;
    int *arr=new int[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    long long int a[n]={0};
    for(int i=1;i<n;i++)
    a[i]=INT_MAX;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=(i+k)&&j<n;j++)
        {
            a[j]=min(a[j],a[i]+abs(arr[j]-arr[i]));
        }
    }
    /*for(int i=0;i<n;i++)
    cout<<a[i]<<" ";
    cout<<endl;*/
    cout<<a[n-1]<<endl;
}

Measured memory_bytes: 1408
//https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/all/DPL_1_E
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define REP(i,n) for(int i=0;i<(n);i++)

int Levenshtein(string s1,string s2){
    int dp[s1.size()+1][s2.size()+1];
    REP(i,s1.size()+1)dp[i][0]=i;
    REP(i,s2.size()+1)dp[0][i]=i;
    rep(i,1,s1.size()+1)rep(j,1,s2.size()+1)
        dp[i][j]=min({dp[i-1][j]+1,dp[i][j-1]+1,dp[i-1][j-1]+(s1[i-1]==s2[j-1]?0:1)});
    return dp[s1.size()][s2.size()];
}

int main()
{
   string s1,s2;cin>>s1>>s2;
   cout<<Levenshtein(s1,s2)<<endl;
}



Measured memory_bytes: 7096
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<complex>
#include<algorithm>
#include<vector>

int main()
{
	int n;
	long long a[100000], sum{};
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%lld", a + i);
	}

	std::sort(a, a + n);

	if (n & 1)
	{
		int les = std::min(a[n / 2] - a[n / 2 - 1], a[n / 2 + 1] - a[n / 2]);
		for (int i = 0; i < n; ++i)
		{
			sum += std::abs(a[i] - a[n / 2]) * 2;
		}
		sum -= les;
	}
	else
	{
		for (int i = 0; i < n; ++i)
		{
			sum += std::abs(a[i] - a[n / 2]) * 2;
		}
		sum -= a[n / 2] - a[n / 2 - 1];
	}

	printf("%lld\n", sum);

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>

#define NumPlusIter(start,end) for(int start = 0; start < end; start++)
#define LL long long

using namespace std;

int main() {
        int N;
	cin >> N;
	vector<LL> currentPos;
	map<LL, LL> correctPos;
	NumPlusIter(a, N) {
		LL temp;
		cin >> temp;
		currentPos.push_back(temp);
		correctPos[temp] = 0;
	}
	int count = 0;
	for (auto a = correctPos.begin(); a != correctPos.end(); a++) {
		a->second = count++;
	}
	int result = 0;
	NumPlusIter(a, N) {
		if (a%2 != correctPos[currentPos[a]]%2) {
			result++;
		}
	}
	cout << result / 2 << endl;
        return 0;
}

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

def calculate(n):

    indexes = [0]
    for i in range(n):
        indexes.append(0)


    for index in range(1,n+1):
        pow6 = 6
        pow9 = 9
        pows = []
        if index == 6:
            indexes[index] = 1
            continue
        elif index == 9:
            indexes[index] = 1
            continue
        elif index < 9:
            indexes[index] = index
            continue
        else:
            while pow6 <= index:
                pows.append(indexes[index - pow6] + 1)
                pow6 = pow6 * 6
            while pow9 <= index:
                pows.append(indexes[index - pow9] + 1)
                pow9 = pow9 * 9

            pows.append(indexes[index - 1] + 1)

            indexes[index] = min(pows)



    print(indexes[n])
calculate(N)

Measured memory_bytes: 3884
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vector<P> p(n);
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        p[i] = make_pair(b, a);
    }
    sort(all(p));

    ll t = 0;
    rep(i, n) {
        t += p[i].second;
        if(t > p[i].first) {
            out("No");
            re0;
        }
    }

    out("Yes");
    re0;
}

Measured memory_bytes: 3328
N = int(input())
MOD = 10 ** 9 + 7


def factfact(n):
    res = []
    prime = [0] * (n + 1)
    for i in range(2, n + 1):
        prime[i] = 1

    for i in range(2, n + 1):
        if prime[i]:
            j = i * 2
            while j <= n:
                prime[j] = 0
                j += i

    for i in range(2, n + 1):
        if prime[i]:
            prime[i] = 0
            j = i
            while j <= n:
                prime[i] += n // j
                j *= i
            # print(i, prime[i])
            res.append([i, prime[i]])
    return res


prime_list = factfact(N)
ans = 1
# print(prime_list, len(prime_list))
for i in range(len(prime_list)):
    ans *= (prime_list[i][1] + 1) % MOD
print(ans % MOD)


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

int main() {
    string s;
    int a, b, c, d;
    cin >> s;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';

    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            for (int k = 0; k < 2; ++k) {
                int sum = a;
                if (i) sum += b;
                else sum -= b;
                if (j) sum += c;
                else sum -= c;
                if (k) sum += d;
                else sum -= d;

                if (sum == 7) {
                    cout << a;
                    if (i) cout << "+";
                    else  cout << "-";
                    cout << b;
                    if (j)  cout << "+";
                    else  cout << "-";
                    cout << c;
                    if (k)  cout << "+";
                    else  cout << "-";
                    cout << d << "=7" << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x,k,d;
    cin>>x>>k>>d;
    if(x<0)x=-x;
    int n=x/d;
    int z=k-n;
    int m=x%d;
    if(z>0&&z%2==0){
        cout<<abs(m);
    }
    if(z>0&&z%2==1){
        cout<<abs(m-d);
    }
    if(z<=0){
        cout<<abs(x-(k*d));
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int in() {int x; cin>>x; return x;}
ll lin() {ll x; cin>>x; return x;}
string sin() {string x;cin>>x;return x;}
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

int main(){
    int K, N;
    cin>>K>>N;
    int a[N];
    rep(i, N){
        cin>>a[i];
    }
    int m=0;
    rep(i, N-1){
        m=max(m, a[i+1]-a[i]);
    }
    m=max(m, K+a[0]-a[N-1]);
    cout<<K-m<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int x, t;
  cin >> x >> t;
  int ans = max(0, x - t);
  cout << ans << endl;
}


Measured memory_bytes: 256
use std::io::BufRead;

pub struct StdinReader<R: BufRead> {
    pub buf_reader: R,
    pub buf: String,
}
impl<R: BufRead> StdinReader<R> {
    pub fn new(r: R) -> Self {
        StdinReader {
            buf_reader: r,
            buf: String::with_capacity(10000),
        }
    }
}

#[macro_export]
macro_rules! input {
    ($reader : expr, $t : ty) => { // one variable
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: $t = reader.buf.trim().parse().unwrap(); 
                reader.buf.clear();
                tmp_var
            },
        }
    };
    ($reader : expr, $t0 : ty, $t1 : ty) => { // 2 tuple
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: Vec<$t0> = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                (tmp_var[0], tmp_var[1])
            }
        }
    };
    ($reader : expr, $t0 : ty, $t1 : ty, $t2 : ty) => { // 3 tuple
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: Vec<$t0> = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                (tmp_var[0], tmp_var[1], tmp_var[2])
            }
        }
    };
    ($reader : expr, $t : ty; $size : expr) => { // Vector
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: $t = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                tmp_var
            }
        }
    };
}

fn main() {
    let handle = std::io::stdin();
    let mut r = StdinReader::new(handle.lock());
    let (t, x) = input!(r, f64, f64);

    
    println!("{}", t/x);
}


Measured memory_bytes: 4352
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())

def make_prime_list(lower:int, upper:int) -> list:
    
    # 素数リストの初期化    
    isPrime = [True]*upper
    primeList = []
    
    # 区間内の数字が0,1のみならここで終了
    if upper <= 2:
        return primeList
    
    # 区間内の数字に2以上のものがあるとき
    isPrime[0] = False
    isPrime[1] = False
    
    # エラトステネスの篩の処理
    n = 2
    while n**2 <= upper:
        if isPrime[n]:
            res=2*n
            while res<upper:
                isPrime[res] = False
                res += n
                
        n += 1
    
    # 区間内の素数を抽出
    for n in range(lower,upper):
        if isPrime[n]:
            primeList.append(n)
        
    return primeList

n = ni()
prime_list = make_prime_list(1,55555+1)

ans = []

for p in prime_list:
    if p%5 == 1:
        ans.append(p)
        
    if len(ans) == n:
        break
    
print(*ans)

Measured memory_bytes: 3700