akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

long long n,x,ans;

void dfs(long long n,long long x)
{
	ans+=2LL*x*(n/x);
	if(n%x==0) { ans-=x; return; }
	dfs(x,n%x);
}

int main()
{
	scanf("%lld%lld",&n,&x);
	ans=n;dfs(max(x,n-x),min(x,n-x));
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define INF 1<<30
#define mp make_pair

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

int n;
vector<string> s;

int dfs(int &i, int dep) {
	string t = s[i];
	char c = t[t.size()-1];

	i++;
	int ret;

	if(c == '*') {
		ret = 1;
		while(i < n) {
			string u = s[i];
			int depth = u.size()-1;
			char c2 = u[u.size()-1];

			if(dep + 1 == depth) {
				ret *= dfs(i, depth);
			} else break;
		}
	} else if(c == '+') {
		ret = 0;

		while(i < n) {
			string u = s[i];
			int depth = u.size()-1;
			char c2 = u[u.size()-1];

			if(dep + 1 == depth) {
				ret += dfs(i, depth);
			} else break;
		}
	} else {
		return int(c - '0');
	}

	return ret;
}

int main() {
	while(cin >> n && n) {
		s.clear(); s.resize(n);
		rep(i, n) cin >> s[i];

		int i = 0;
		cout << dfs(i, 0) << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int n = Integer.parseInt(sc.next());
			int i, j, max = 0, tmp = 0;
			int[] num = new int[5001];
			if(n == 0) {
				break;
			}
			for(i = 0; i < n; i++) {
				num[i] = Integer.parseInt(sc.next());
			}
			max =  num[0];
			for(i = 0; i < n; i++) {
				for(j = i; j < n; j++) {
					tmp += num[j];
					if(max < tmp) {
						max = tmp;
					}
				}
				tmp = 0;
			}
			System.out.println(max);

		}
		sc.close();


	}

}



Measured memory_bytes: 37452
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>

using namespace std;
int main() {
  int n, m, p, a[100010] = {}, flag[100010] = {}, ans = 0, cnt = 0;
  char s[10];
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%s", &p, s);
    if (strcmp(s, "AC") == 0) {
      if (flag[p] == 0) {
        cnt++;
        ans += a[p];
      }
      flag[p] = 1;
    } else if (flag[p] == 0) {
      a[p]++;
    }
  }
  printf("%d %d\n", cnt, ans);
}

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

int main(){
	int N, M;
	cin >> N;
	vector<string> blues(N);
	vector<int> clist(N);
	
	for(int i = 0;i<N;i++){
		cin >> blues.at(i);
	}
	
	cin >> M;
	vector<string> reds(M);
	
	for(int j = 0;j<M;j++){
		cin >> reds.at(j);
	}
	
	int Mgain = 0;
	
	for(int k = 0;k<N;k++){
		if(clist.at(k) >0)
			continue;
		
		string bc = blues.at(k);
		int cnt = 1;
		
		for(int l = k+1;l<N;l++){
			if(bc == blues.at(l)){
				cnt++;
				clist.at(l)++;
			}
		}
		
		for(int m = 0;m<M;m++){
			if(bc == reds.at(m)){
				cnt--;
			}
		}
		
		clist.at(k)++;
		if(Mgain<cnt)
			Mgain = cnt;
	}
	
	cout << Mgain << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i,j,wk;	
	int data[10];
	
	for(i=0;i<10;i++){
		scanf("%d",&data[i]);
	}
	for(i=0;i<9;i++){
		for(j=i+1;j<10;j++){
			if(data[i]<data[j]){
				wk=data[i];
				data[i]=data[j];
				data[j]=wk;
			}
		}
	}
	printf("%d\n",data[0]);
	printf("%d\n",data[1]);
	printf("%d\n",data[2]);

	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
const int MAXN=200010;
int n,q,x,y,cnt,eg,dfn[MAXN],ed[MAXN],b[MAXN],hd[MAXN],ver[2*MAXN],nx[2*MAXN];
int query (int x) {
	int res=0;
	for (int i=x;i;i-=(i&(-i))) {res+=b[i];}
	return res;
}
void modify (int x,int v) {
	for (int i=x;i<=n+1;i+=(i&(-i))) {b[i]+=v;}
	return;
}
void add_edge (int x,int y) {
	ver[++eg]=y;
	nx[eg]=hd[x];
	hd[x]=eg;
	return;
}
void dfs (int x,int fa) {
	dfn[x]=ed[x]=++cnt;
	for (int i=hd[x];i;i=nx[i]) {
		if (ver[i]==fa) {continue;}
		dfs(ver[i],x);
		ed[x]=ed[ver[i]];
	}
	return;
}
int main () {
	scanf("%d%d",&n,&q);
	for (int i=1;i<=n-1;i++) {
		scanf("%d%d",&x,&y);
		add_edge(x,y),add_edge(y,x);
	}
	dfs(1,0);
	for (int i=1;i<=q;i++) {
		scanf("%d%d",&x,&y);
		modify(dfn[x],y),modify(ed[x]+1,-y);
	}
	for (int i=1;i<=n;i++) {printf("%d ",query(dfn[i]));}
	return 0;
}

Measured memory_bytes: 18048
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n, m;
    map<string, int> card;
    cin >> n;
    for(int i = 0; i < n; i++){
        string key;
        cin >> key;
        card[key]++;
    }
    cin >> m;
    for(int i = 0; i < m; i++){
        string key;
        cin >> key;
        card[key]--;
    }
    int ans = 0;
    for(auto x : card){
        ans = max(ans, x.second);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define N 3
 
struct Puzzle {
  int f[N*N];
  int space;
  string path;
 
  bool operator < ( const Puzzle &p ) const {
    for(int i=0;i < N*N; i++){
      if(f[i]==p.f[i]) continue;
      return f[i]>p.f[i];
    }
    return false;
  }
};
 
static const int dx[4]={-1,0,1,0};
static const int dy[4]={0,-1,0,1};
static const char dir[4]={'u','l','d','r'};
 
bool isTarget(Puzzle p){
  for(int i=0;i<N*N;i++)
    if(p.f[i]!=(i+1)) return false;
  return true;
}
 
string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle,bool> V;
  Puzzle u,v;
  s.path="";
  Q.push(s);
  V[s]=true;
 
  while(!Q.empty()){
    u=Q.front(); Q.pop();
    if(isTarget(u)) return u.path;
    int sx=u.space/N;
    int sy=u.space%N;
    for(int r=0;r<4;r++){
      int tx=sx+dx[r];
      int ty=sy+dy[r];
      if(tx<0||ty<0||tx>=N||ty>=N) continue;
      v=u;
      swap(v.f[u.space],v.f[tx*N+ty]);
      v.space=tx*N+ty;
      if(!V[v]){
    V[v]=true;
    v.path+=dir[r];
    Q.push(v);
      }
    }
  }
  return "unsolvable";
}
 
int main()
{
  Puzzle in;
 
  for(int i=0;i<N*N;i++){
    cin>>in.f[i];
    if(in.f[i]==0){
      in.f[i]=N*N;
      in.space=i;
    }
  }
  string ans=bfs(in);
  cout<<ans.size()<<endl;
 
  return 0;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int sgn(int x) { return (x > 0) - (x < 0); }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int L, R, d;
    cin >> L >> R >> d;
    cout << R / d - (L - 1) / d << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
using lint = int_least64_t;
using namespace std;

int main()
{
	int N;
	pair<lint, lint> jobs[200010] = {};

	cin >> N;
	for(int i = 0; i < N; i++)
		cin >> jobs[i].second >> jobs[i].first;
	
	sort(jobs, jobs + N);

	lint sum = 0;
	string ans = "Yes";
	for(int i = 0; i < N; i++)
	{
		sum += jobs[i].second;
		if(sum > jobs[i].first)
		{
			ans = "No";
			break;
		}
	}

	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3328
a=int(input())
b=int(input())
c=int(input())
x=int(input())
sum=[]

for i in range (0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            sum.append(500*i+100*j+50*k)
print(sum.count(x))

Measured memory_bytes: 8276
#![allow(non_snake_case)]

use std::cmp::max;
use std::io::Read;

fn rec(a: i64, b: i64) -> i64 {
    if a < b {
        rec(b, a)
    } else if a % b == 0 {
        ((a / b) * 2 - 1) * b
    } else {
        rec(a % b, b) + (a / b) * 2 * b
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: i64 = iter.next().unwrap().parse().unwrap();
    let x: i64 = iter.next().unwrap().parse().unwrap();
    println!("{}", n + rec(x, n - x));
}


Measured memory_bytes: 4352
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


x, a = Is()
if x < a:
    print(0)
else:
    print(10)

Measured memory_bytes: 63340
A,B,N = map(int, input().split())
if B == 1 or A == 1:
  floor = 0
else:
  if N < B:
    floor = int(A*N/B) - A*int(N/B)
  elif N == B:
    floor = int(A*(N-1)/B) - A*int((N-1)/B)
  else:
    floor = max([(int(A*(x-1)/B) - A*int((x-1)/B)) for x in range(B,N,B)])
    
print(floor)

Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define v vector<long long>
using namespace std;
using ll = long long;

// ----本問について----
// 問題：Vacation
// 問題文URL：https://atcoder.jp/contests/dp/tasks/dp_c
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

const ll N_MAX = pow(10, 5) + 10;
const ll H_MAX = pow(10, 4) + 10;

// グローバル変数（入力）
ll N, h[N_MAX][3], dp[N_MAX][3];

ll solve(ll i, ll j) {                     // メモ化再帰（？）
  if (dp[i][j] != -1) { return dp[i][j]; } // 計算済みならその値を返す

  if (i == 1) {
    dp[i][j] = h[i][j];
  } else {
    if (j == 0) {
      dp[i][j] = max(solve(i - 1, 1), solve(i - 1, 2)) + h[i][j];
    } else if (j == 1) {
      dp[i][j] = max(solve(i - 1, 0), solve(i - 1, 2)) + h[i][j];
    } else {
      dp[i][j] = max(solve(i - 1, 0), solve(i - 1, 1)) + h[i][j];
    }
  }

  return dp[i][j];
}

int main() {
  // cout << fixed << setprecision(10);
  cin >> N;
  for (ll i = 1; i <= N; i++) {
    cin >> h[i][0] >> h[i][1] >> h[i][2];
  }
  rep(i, N_MAX) {
    rep(j, 3) {
      dp[i][j] = -1; // dpを全部未計算(-1)に初期化
    }
  }
  cout << max(solve(N, 0), max(solve(N, 1), solve(N, 2))) << endl;

  return 0;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

const ll MOD = 1000000007;
ll dp[53][4][4];

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<string> S(2);
    rep(i, 2) cin >> S[i];

    if (S[0][0] == S[1][0]) {
        rep(c, 3) dp[0][c][c] = 1;
    } else {
        rep(c1, 3) rep(c2, 3) {
            if (c1 != c2) {
                dp[0][c1][c2] = 1;
            }
        }
    }

    for (int x=0; x<N-1; x++) {
        if (S[0][x+1] == S[1][x+1]) {
            // 縦
            rep(c1, 3) rep(c2, 3) rep(nc, 3) {
                if (c1 != nc && c2 != nc) {
                    (dp[x+1][nc][nc] += dp[x][c1][c2]) %= MOD;
                }
            }
            /*
            rep(c1, 3) rep(c2, 3) {
                if (c1 == c2) {
                    rep(nc, 3) {
                        if (c1 == nc) continue;
                        dp[x+1][nc][nc] = dp[x][c1][c2] * 2 % MOD;
                    }
                } else {
                    rep(nc, 3) {
                        if (c1 == nc || c2 == nc) continue;
                        dp[x+1][nc][nc] = dp[x][c1][c2];
                    }
                }
            }
            */
        } else {
            // 横
            if (x%2 == 0) {
                rep(c1, 3) rep(c2, 3) dp[x+1][c1][c2] += dp[x][c1][c2];
            } else {
                rep(c1, 3) rep(c2, 3) rep(nc1, 3) rep(nc2, 3) {
                    if (c1 != nc1 && c2 != nc2 && nc1 != nc2) {
                        (dp[x+1][nc1][nc2] += dp[x][c1][c2]) %= MOD;
                    }
                }
            }
        }
    }

    /*
    rep(j, N+1) rep(c1, 3) rep(c2, 3) {
        cerr << "j, c1, c2 = " << j << ", " << c1 << ", " << c2 << endl;
        cerr << dp[j][c1][c2] << endl;
    }
    */

    ll ans = 0;
    rep(c1, 3) rep(c2, 3) (ans += dp[N-1][c1][c2]) %= MOD;
    cout << ans << endl;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, x);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

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

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(void) {
  string a;
  string b;
  string c;
  string ans = "";
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace _123A
{
    class Program
    {
        static int OUTChecker(int p, int o, int k)
        {
            if (Math.Abs(p - o) > k)
                return 1;
            else
                return 0;
        }



        static void Main(string[] args)
        {
            int[] Antena = new int[6];
            int k;
            int check = 0;

            for (int a = 0; a < 5; a++)
            {
                Antena[a] = int.Parse(Console.ReadLine());
            }
            k = int.Parse(Console.ReadLine());

            for (int a = 0; a < 5; a++)
            {
                for (int b = 0; b < 5; b++)
                {
                    check += OUTChecker(Antena[a], Antena[b], k);
                }
            }

            if (check == 0)
                Console.WriteLine("Yay!");
            else
                Console.WriteLine(":(");
        }
    }
}


Measured memory_bytes: 11092
n,k=map(int,input().split())
def replace(m):
  if m=="A":
    return "a"
  elif m=="B":
    return "b"
  else:
    return "c"
  
abc_str=list(input())
abc_str[k-1]=replace(abc_str[k-1])
abc_str="".join(abc_str)
print(abc_str)

Measured memory_bytes: 9080
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,k;
    int q,w,s,r,t,y,u,m,n,v;
    cin>>a>>b>>c>>d>>e>>k;
    q=b-a; w=c-a; s=d-a; r=e-a; t=c-b;
    y=d-b; u=e-b; m=d-c; n=e-c; v=e-d;
    if(q>k||w>k||s>k||r>k||t>k||y>k||u>k||m>k||n>k||v>k)
    {
        cout<<":(";
    }
    else 
    {
        cout<<"Yay!";
    }
    return 0;
}
 
 

Measured memory_bytes: 256
#import<atcoder/all>
#define f(i)std::cout<<i<<' ';
#define g(x)f(size(x))for(auto i:x)
int u,v;main(){std::cin>>u>>v;atcoder::scc_graph G(u);for(;std::cin>>u>>v;)G.add_edge(u,v);g(G.scc()){g(i)f(i)}}

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

const int MOD=1000000007;

long long MPOWten(long long n){  //n^10を返す
    long long ans=1;
    for(int i=1; i<=10; i++){
        ans = ans * n % MOD;
    }
    
    return ans;
}

long long MPOW (long long n){  //n^(MOD-2)を返す
    long long Five=n;
    for(int i=1; i<5; i++){
        Five = Five * n % MOD;
    }
    
    long long Ten=n;
    for (int i=1; i<=9; i++){
        Ten = MPOWten (Ten) % MOD;
    }
    
    long long ans=1;
    ans = Five * Ten % MOD;
    
    return ans;
}

long long fact(long long n){
    long long ans=1;
    for (int i=1; i<=n; i++){
        ans = ans * i % MOD;
    }
    
    return ans;
}

long long comb(long long n, long long k){
    long long N=fact(n), K=fact(k), NK=fact(n-k);
    
    long long ans=1;
    ans = ans * N % MOD;
    ans = ans * MPOW(K) % MOD;
    ans = ans * MPOW(NK) % MOD;
    
    return ans;
}



int main(void){
    // Your code here!
    long long S;
    cin >> S;
    
    long long Max=S/3, K=0;
    long long ans=0;
    for (long long i=1; i<=Max; i++){
        K=S-3*i;
        ans = ans + comb(i+K-1, i-1) % MOD;
    }
    
    ans = ans % MOD;
    
    cout << ans << endl;
    
    
    return 0;
}

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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

using namespace std;

int n, k;

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}

int sc(int k) {
	int ans = 0;
	while(k) {
		ans += (k % 10);
		k /= 10;
	}
	return ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n;

	int ans = 1000;
	for(int a = 1; a <= n / 2; a++) {
		ans = min(ans, sc(a) + sc(n - a));
	}
	cout << ans << '\n';
}	

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

map<int, int> prime_factor(int n) {
    map<int, int> ret;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

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

    map <int, int> mp;
    for (int i = 2; i <= n; i++) {
        auto mp2 = prime_factor(i);
        for (auto &itr : mp2) {
            mp[itr.first] += itr.second;
        }
    }

    ll ans = 1;
    for (auto &itr : mp) {
        if (itr.first == 1) continue;
        ans = ans * (itr.second + 1) % MOD;
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3620
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

vector<int> retErase(vector<int> &r) {
  if (r[0] == r[1] && r[1] == r[2] && r[2] == r[3] && r[3] == r[4] && r[2] != 0) return {1, 1, 1, 1, 1};
  if (r[1] == r[2] && r[2] == r[3] && r[3] == r[4] && r[2] != 0) return {0, 1, 1, 1, 1};
  if (r[0] == r[1] && r[1] == r[2] && r[2] == r[3] && r[2] != 0) return {1, 1, 1, 1, 0};
  if (r[0] == r[1] && r[1] == r[2] && r[2] != 0) return {1, 1, 1, 0, 0};
  if (r[1] == r[2] && r[2] == r[3] && r[2] != 0) return {0, 1, 1, 1, 0};
  if (r[2] == r[3] && r[3] == r[4] && r[2] != 0) return {0, 0, 1, 1, 1};
  return {0, 0, 0, 0, 0};
}

int solve(vector<vector<int>> &M) {
  int H = M.size();
  bool cont = true;
  int score = 0;
  while(cont) {
    cont = false;
    vector<vector<int>> E(H, vector<int>(5));
    for (int i = 0; i < H; i++) {
      vector<int> e = retErase(M[i]);
      for (int j = 0; j < 5; j++) {
        if (e[j] == 1) {
          cont = true;
          E[i][j] = 1;
          score += M[i][j];
        }
      }
    }
    for (int j = 0; j < 5; j++) {
      vector<pii> newM(H);
      for (int i = 0; i < H; i++) {
        newM[i].first = M[i][j];
        newM[i].second = E[i][j];
      }
      newM.erase(remove_if(newM.begin(), newM.end(), [](pii a){return a.second == 1;}), newM.end());
      int z = H - newM.size();
      for (int i = 0; i < H; i++) {
        if (i < z) {
          M[i][j] = 0;
        } else {
          M[i][j] = newM[i - z].first;
        }
      }
    }
  }
  return score;
}

int main() {
  int H;
  while(cin >> H, H) {
    vector<vector<int>> M(H, vector<int>(5));
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < 5; j++) {
        cin >> M[i][j];
      }
    }
    cout << solve(M) << endl;
  }
  return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define sp " "
#define cs "Case "
#define fi first
#define sn second

/* STL */
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxi(v) distance(v.begin(),max_element(v.begin(),v.end()))
#define mxa(a) *max_element(a, a.size())
#define r(a)   reverse(a.begin(),a.end())
/* loops */
#define fa(i, a, b) for (auto (i) = (a); (i) < (b); ++(i))
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n) i=1;i<=(n);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(something)  cerr<<#something<<" - "<<something<<"\n";

int main()
{

   Ezio
   ll t,m,n,x,a,b;
   string s,r;

   cin>>s;
   for(auto c:s){
    if(c=='B'){
        if(!r.empty()){
            r.pop_back();
        }
    }
    else r.pb(c);
   }

   cout<<r<<endl;

   return 0;
}


Measured memory_bytes: 3556
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
using namespace std;
typedef pair<int, int> pii;
typedef double lf;
typedef long long ll;
const int inf=0x3f3f3f3f, mod=1000000007;
struct node{int to, nxt;}edge[200200];
int deg[100100], val[100100], head[100100], cnt=0;

inline int read()
{
    int x=0,f=1; char ch=getchar();
    for (; ch<'0' || ch>'9'; ch=getchar()) if (ch=='-') f=-1;
    for (; ch>='0' && ch<='9'; ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
    return x*f;
}

void add(int u, int v)
{
    edge[++cnt]=(node){v, head[u]};
    head[u]=cnt;
}

int dfs(int u, int fa)
{
    if (deg[u]==1) return val[u];
    int res=val[u]<<1;
    for (int i=head[u]; i; i=edge[i].nxt)
    {
        int v=edge[i].to;
        if (v==fa) continue;
        int tmp=dfs(v, u); if (tmp>val[u]) {puts("NO"); exit(0);}
        res-=tmp;
    }
    if (res<0 || res>val[u]) {puts("NO"); exit(0);}
    return res;
}       

int main()
{
    int n=read(), rt;
    for (int i=1; i<=n; i++) val[i]=read();
    for (int i=1; i<n; i++)
    {
        int u=read(), v=read();
        add(u, v); add(v, u);
        deg[u]++; deg[v]++;
        if (deg[u]>1) rt=u; if (deg[v]>1) rt=v;
    }
    if (n==2) 
    {
        if (val[1]==val[2]) puts("YES");
            else puts("NO");
        return 0;
    }
    if (dfs(rt, 0)) puts("NO");
        else puts("YES");
    return 0;
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define N 200005
using namespace std;
vector<int> G[N];

int n, m, d[N], rt[N], cnt, f[N];
int tot = 0, fir[N], nxt[N << 1], to[N << 1];

inline void addEdge(int u, int v) {
    nxt[++tot] = fir[u], fir[u] = tot, to[tot] = v;
}

inline void topsort() {
    queue<int> q;
    while (!q.empty()) q.pop();
    for (int i = 1; i <= n; ++i)
        if (d[i] == 0) q.push(i);
    while (!q.empty()) {
        int u = q.front(); q.pop();
        rt[++cnt] = u;
        for (int i = fir[u], v; i; i = nxt[i]) {
            v = to[i], d[v]--;
            if (d[v] == 0)
                q.push(v);
        }
    }
}

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    cin >> n >> m;
    for (int i = 1, u, v; i <= m; ++i)
        scanf("%d%d", &u, &v),
        addEdge(u, v), d[v]++, G[v].push_back(u);
    topsort();
    for (int k = 1; k <= cnt; ++k) {
        int u = rt[k];
        for (int i = 0, v, sz = G[u].size(); i < sz; ++i) {
            v = G[u][i];
            f[u] = max(f[u], f[v] + 1);
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        ans = max(ans, f[i]);
    cout << ans << endl;
    return 0;
}


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

cnt = 1
cp = s[0]
for i in range(1, n):
  if s[i] != cp:
#    print ('CNT INC at ' + str(s[i]))
    cnt += 1
  cp = s[i]
#  print ('CP=' + str(cp))

print (cnt)


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

int main(){
  int N;
  cin>>N;
  int a[N];
  ll int m,ans=0;
  int cou=1,mx=0;
  ll int r,tmp,b,c,x;

  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)ans+=a[i]-1;
  cout<<ans<<endl;
}

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

const string YES = "Yes";
const string NO = "No";
int main(){
  int H, N; cin >> H >> N;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
  }
  
  rep(i, N) {
    H -= A[i];
  }

  if(H<=0) cout << YES << endl;
  else cout << NO << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

using namespace std;
using LL = long long;

class Solution {
public:
	/* time: O(1), space: O(1) */
	LL countBalls(LL n, LL a, LL b) {
		if (a == 0 && b == 0)
			return 0;

		LL k = n / (a + b);
		LL rest = n % (a + b);
		return a * k + min(rest, a);
	}
};

int main() {
	LL n, a, b;
	cin >> n >> a >> b;

	Solution sol;
	const LL ans = sol.countBalls(n, a, b);
	cout << ans << endl;
	return 0;
}


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

int main() {
	
	int a, b;
	cin >> a >> b;
	int ans = 0;
	if(a > b){
		ans += a;
		a--;
	}else{
		ans += b;
		b--;
	}
	if(a > b){
		ans += a;
		a--;
	}else{
		ans += b;
		b--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9;

int a[3];
string s;

int main() {
    cin>>s;
    REP(i,0,s.size()){
        if(s[i]=='a') a[0]++;
        else if(s[i]=='b') a[1]++;
        else a[2]++;
    }
    sort(a,a+3);
    if(a[2]-a[0]<=1){
        p("YES");
    }else p("NO");
	return 0;
}


Measured memory_bytes: 512
# coding: utf-8
# Your code here!
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))

A = list(map(lambda x: x*(-1), A)) #各要素を-1倍
heapq.heapify(A)

for i in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A,int(tmp_min / 2))
    
print(-sum(A))

Measured memory_bytes: 73196
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
    --y;
  }

  return sum;
}

/*考えを書くスペース
  AtCoder Grand Contest 019-A


*/
//main.cpp----------------------------
#define max_n 200000

void solve();

ll n;
string s;

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

  solve();

  return 0;
}

void solve() {
  ll all_e = 0;
  rep(i, n) if(s[i]=='E') ++all_e;

  ll w = 0, e = 0;
  ll min = inf;
  rep(i, n) {
    if(s[i]=='E') {
      ++e;
      chmin(min, w+(all_e-e));
    }else {
      chmin(min, w+(all_e-e));
      ++w;
    }
  }

  cout << min << endl;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll r, g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
num_list = list(map(int, input().split()))
if 0 in num_list:
  print(0)
  exit()

res = num_list[0]
for i in range(1,n):
  res *= num_list[i]
  if res > 10**18:
    print(-1)
    exit()
print(res)

Measured memory_bytes: 21796
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, M): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };
    let (K, L): (Vec<usize>, Vec<Vec<usize>>) = {
        let mut K = vec![];
        let mut L = vec![];
        for _ in 0..N {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            K.push(iter.next().unwrap().parse().unwrap());
            L.push(iter.map(|x| x.parse().unwrap()).collect());
        }
        (K, L)
    };

    struct UnionFindTree {
        parent: Vec<usize>,
        size: Vec<i64>,
    }

    impl UnionFindTree {
        fn new(n: usize) -> UnionFindTree {
            UnionFindTree {
                parent: (0..(n + 1)).collect(),
                size: vec![1; n + 1],
            }
        }
        fn find(&mut self, x: usize) -> usize {
            if self.parent[x] != x {
                let parent_x = self.parent[x];
                self.parent[x] = self.find(parent_x);
            }
            self.parent[x]
        }
        fn same(&mut self, x: usize, y: usize) -> bool {
            self.find(x) == self.find(y)
        }
        fn size(&mut self, x: usize) -> i64 {
            let i = self.find(x);
            self.size[i]
        }
        fn union(&mut self, x: usize, y: usize) {
            let parent_x = self.find(x);
            let parent_y = self.find(y);
            if !self.same(x, y) {
                if self.size[parent_x] < self.size[parent_y] {
                    self.size[parent_y] += self.size[parent_x];
                    self.parent[parent_x] = parent_y;
                } else {
                    self.size[parent_x] += self.size[parent_y];
                    self.parent[parent_y] = parent_x;
                }
            }
        }
    }

    let mut uft = UnionFindTree::new(N + M + 2);
    for i in 0..N {
        for &l in &L[i] {
            uft.union(i, l + N);
        }
    }
    let ans = if (1..N).all(|i| uft.find(i) == uft.find(0)) {
        "YES"
    } else {
        "NO"
    };

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


Measured memory_bytes: 14588
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long K = sc.nextLong(), A = sc.nextLong(), B = sc.nextLong();
		if(A + 2 >= B) System.out.println(K + 1);
		else {
			/* make A cookies */
			if(K <= A) {
				System.out.println(K + 1);
			}else {
				K -= (A + 1);
				long ans = B;
				ans += (B - A) * (K / 2);
				System.out.println(ans + ((K % 2 == 1) ? 1 : 0));
			}
		}
	}
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define Graph vector<vector<int>>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

const string YES = "Yes";
const string NO = "No";

bool kaibun(string s) {
  string r = s;
  reverse(r.begin(), r.end());
  if(r==s){
    return true;
  }

  else{
    return false;
  }
}

int main() {
  // cout << fixed << setprecision(5);

  string S, T, U;
  int N;
  cin >> S;
  N = S.size();
  T = S.substr(0, (N - 1) / 2);
  U = S.substr((N + 1) / 2, (N - 1) / 2);

  if (kaibun(S) && kaibun(T) && kaibun(U)) {
      cout << "Yes" << endl;
  }

  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;

public class OfficialHouse
{
    //4?£?????????¬???????????\?±?????????±?????\????????????
    static void Main(string[] args)
    {
        /*---??£?¨???¨---*/
        int[] countNM = new int[2];
        string[] countBuffer;
        string[] arrayBuffer;
        int highAIndex;
        int widthAIndex;
        int bIndex;
        int sum;
        /*---??£?¨???¨---*/

        /*??\???????????°??????????????????????????????*/
        countBuffer = Console.ReadLine().Split();
        //countNM = countBuffer.Select(s => int.Parse(s)).ToArray();
        countNM[0] = int.Parse(countBuffer[0]);
        countNM[1] = int.Parse(countBuffer[1]);

        int[,] aMatrix = new int[countNM[0],countNM[1]];
        int[] bMatrix = new int[countNM[1]];

        /*??\????????????[A]???????´??????????*/
        for (highAIndex = 0; highAIndex < countNM[0]; highAIndex++)
        {
            arrayBuffer = Console.ReadLine().Split();
            for (widthAIndex = 0; widthAIndex < countNM[1]; widthAIndex++)
            {
                aMatrix[highAIndex, widthAIndex] = int.Parse(arrayBuffer[widthAIndex]);
            }
        }

        /*??\????????????[b]???????´??????????*/
        for (bIndex = 0; bIndex < countNM[1]; bIndex++)
        {
            arrayBuffer = Console.ReadLine().Split();
            bMatrix[bIndex] = int.Parse(arrayBuffer[0]);
        }

        /*?¨????+??????*/
        for (highAIndex = 0; highAIndex < countNM[0]; highAIndex++) 
        {
            sum = 0;
            for (widthAIndex = 0; widthAIndex < countNM[1]; widthAIndex++)
            {
                sum += aMatrix[highAIndex, widthAIndex] * bMatrix[widthAIndex];
            }
            Console.WriteLine(sum);
        }
    }
}

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

using namespace std;

const int M=26;

int arr[404];
int n;
int c[26];
int s[404][26];
int las[26];

long long calc()
{
	for(int i=0;i<M;i++) las[i]=0;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		las[arr[i]-1]=i+1;
		ans+=s[i][arr[i]-1];
		for(int j=0;j<M;j++)
			ans-=c[j]*(i+1-las[j]);
		//cout << ans << endl;
	}
	return ans;
}

long long calcs(vector<int> v,int st)
{
	vector<int> lass;
	for(int i=0;i<M;i++)
		lass.push_back(las[i]);
	long long res=0;
	for(int i=0;i<v.size();i++)
	{
		lass[v[i]]=st+i;
		res+=s[st+i-1][v[i]];
		for(int j=0;j<M;j++)
			res-=c[j]*(st+i-lass[j]);
	}
	return res;
}

int main()
{
	//auto start = std::chrono::system_clock::now();
	mt19937 rng(12342);
	cin >> n;
	for(int i=0;i<M;i++) cin >> c[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<M;j++) cin >> s[i][j];
	}
	for(int i=0;i<n;i+=3)
	{
		vector<int> v={0,0,0};
		long long best=calcs(v,1+i);
		arr[i]=1; arr[i+1]=1; arr[i+2]=1;
		for(int x=0;x<26;x++)
		{
			for(int y=0;y<26;y++)
			{
				for(int z=0;z<26;z++)
				{
					v[0]=x;
					v[1]=y;
					v[2]=z;
					long curs=calcs(v,1+i);
					if(curs>best)
					{
						best=curs;
						arr[i]=v[0]+1; arr[i+1]=v[1]+1; arr[i+2]=v[2]+1;
					}
				}
			}
		}
		for(int j=0;j<v.size();j++)
		{
			las[v[j]]=i+j+1;
		}
	}
	//std::chrono::duration<double> elp=std::chrono::system_clock::now()-start;
	int t=1000;
	long long curs=calc();
	while(t--)
	{
		int x=uniform_int_distribution<int>(0, n-1)(rng);
		int y=uniform_int_distribution<int>(0, M-1)(rng);
		int oldx=arr[x];
		arr[x]=y+1;
		if(calc()<curs)
		{
			arr[x]=oldx;
		}
	}
	for(int i=0;i<n;i++)
		cout << arr[i] << endl;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	set<int> st={3,5,7};
	int x; cin>>x;
	cout << (st.find(x)==st.end() ? "NO" : "YES") << endl;
	return 0;
}


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

#define INFTY (1<<21)
#define MAX_N 100

int m[MAX_N + 1][MAX_N + 1], p[MAX_N + 1];
int n;

void matrixChainMultiplication(){
	for( int i = 1; i <= n; i++ ){
		m[i][i] = 0;
	}

	for( int l = 2; l <= n; l++ ){
		for( int i = 1; i <= n - l + 1; i++ ){
			int j = i + l - 1;
			m[i][j] = INFTY;
			for( int k = i; k < j; k++ ){
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}
}

int main(void){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> p[i - 1] >> p[i];
	}

	matrixChainMultiplication();

	cout << m[1][n] << endl;

	return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define vs vector<str>
#define pq priority_queue
#define ordered_set_of(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define nub(x) x.resize(unique(all(x)) - x.begin())
#define TWO class T1, class T2
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
using namespace __gnu_pbds;
char _$ = ' ';
struct sep {sep(char c) {_$ = c;}};
ostream& operator<<(ostream& o, sep s) {return o;}
template<TWO> ostream& operator<<(ostream& o, pair<T1, T2> x) {return o << x.fi << ' ' << x.se;}
template<TWO> istream& operator>>(istream& i, pair<T1, T2>& x) {return i >> x.fi >> x.se;}
template<class T> ostream& operator<<(ostream& o, vector<T> x) {for (auto it : x) o << it << _$; return o;}
template<class T> istream& operator>>(istream& i, vector<T>& x) {for (auto& it : x) i >> it; return i;}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vi a(n), b(n);
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    sort(all(a)), sort(all(b));
    if (n % 2)
        cout << b[n / 2] - a[n / 2] + 1 << endl;
    else
        cout << b[n / 2] + b[n / 2 - 1] - a[n / 2] - a[n / 2 - 1] + 1 << endl;
    GAME_OVER;
}

Measured memory_bytes: 6352
package main

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

func main() {
	sc := NewScanner()
	_, _ = sc.NextInt(), sc.NextInt()

	x := sc.NextIntArray()
	y := sc.NextIntArray()

	s := 0
	for k := 0; k < len(x); k++ {
		s += k*x[k] - (len(x)-k-1)*x[k]
		s %= 1e9 + 7
	}

	t := 0
	for k := 0; k < len(y); k++ {
		t += k*y[k] - (len(y)-k-1)*y[k]
		t %= 1e9 + 7
	}

	p := s * t
	p %= 1e9 + 7
	fmt.Println(p)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 8704
//xenowitz -- Jai Shree Ram
#include<bits/stdc++.h>
using namespace std;

#define fori(i,a,b) for (long int i = a; i <= b ; ++i)
#define ford(i,a,b) for(long int i = a;i >= b ; --i)
#define mk make_pair
#define mod 1000000007
#define pb push_back
#define eb emplace_back
#define vec vector<long long int>
#define ll long long
#define rnd mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count())
#define pi pair<long long int,long long int>
#define sc second
#define fs first
#define stf shrink_to_fit

ll binpow(ll a, ll b) {
    ll m = 1e9+7;
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res%m;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  // 10^n -2*9^n + 8^n

  ll n;
  cin >> n;

  ll ans = (binpow(10,n) - binpow(9,n) + mod)%mod;
  ans = (ans - binpow(9,n) + mod)%mod;
  ans = (ans + binpow(8,n))%mod;

  cout << ans << endl;
  return 0;
}


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


using namespace std;

int n;
int f[101][10];
int p[101][11];
int ans = -(1<<30);

int main() {

    scanf("%d", &n);
    
    
    for (int i = 0; i < n; i++)
        for (int j = 0; j < 10; j++)
            scanf("%d", &f[i][j]);
    
    for (int i = 0; i < n; i++)
        for (int j = 0; j < 11; j++)
            scanf("%d", &p[i][j]);
    
    
    for (int i = 1; i < (1<<10); i++) {
        
        //i is Joisino
        int sum = 0;
        for (int j =0; j < n; j++) {
            
            int pos = 0;
            for (int k =0; k < 10; k++) {
                if ((i >> k & 1) && f[j][k]) {
                    pos++;
                }
            }
            sum += p[j][pos];
            
        }
        if (sum > ans) {
            ans = sum;
        }
    }
    printf("%d\n", ans);
    

    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>
string a,b;
int main() {
    cin >> a >> b;
    int x=a.size(),z=0;
    for (int i = 0; i <x ; ++i) {
        if(a[i]==b[i])
            continue;
        else
            z++;

    }cout<<z;
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int N,a[MAXN];
int tobe[MAXN];
bool has[MAXN];
ll K;
vector<int> v,ans;
int main()
{
    scanf("%d%lld",&N,&K);
    for(int i=1;i<=N;i++) scanf("%d",&a[i]);
    for(int i=1;i<=200000;i++) tobe[i]=i;
    for(int i=1;i<=N;i++) swap(tobe[0],tobe[a[i]]);
    int now=0,tot=0;
    do
    {
        now=tobe[now];
        v.push_back(now);
        tot++;
    }while(now!=0);
    reverse(v.begin(),v.end());
    K=K%(int)v.size();
    int x=v[K];
    if(x==0) return 0;
    memset(has,false,sizeof(has));
    for(int i=N;i>=1;i--)
    {
        if(a[i]==x)
        {
            for(int j=i;j<=N;j++)
            {
                if(has[a[j]])
                {
                    while(ans.back()!=a[j]) has[ans.back()]=false,ans.pop_back();
                    ans.pop_back();
                    has[a[j]]=false;
                    continue;
                }
                ans.push_back(a[j]);
                has[a[j]]=true;
            }
            for(auto x:ans) printf("%d ",x);
            return 0;
        }
    }
}


Measured memory_bytes: 4980
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf);
    let mut iter = buf.split_whitespace();
    let x:i32 = iter.next().unwrap().parse().unwrap();
    let y:i32 = iter.next().unwrap().parse().unwrap();
    let ans: Vec<String> = (y-x+1..y+x).into_iter().map(|x| {x.to_string()}).collect();
    println!("{}", ans.join(" "));
}


Measured memory_bytes: 4352