akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n;
string s, t;
LL MOD = 1e9 + 7;

LL d[3][2] = { { 2, 2 }, { 1, 3 }, { 3, 6 } };

int main() {
	cin >> n >> s >> t;
	
	LL ans = 1;
	int a = 2;
	inc(i, n) {
		int b = (s[i] == t[i] ? 0 : 1);
		(ans *= d[a][b]) %= MOD;
		a = b;
		if(b == 1) { i++; }
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
 
n, q = map(int, input().split())
connect = [set() for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)
 
counter = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    counter[p-1] += x
 
ans = [0] * n
 
def dfs(count, v, parent):
    count += counter[v]
    ans[v] = count
    for child in connect[v]:
        if child != parent:
            dfs(count, child, v)
 
dfs(0, 0, -1)
 
print(*ans)

Measured memory_bytes: 266200
n, k, q = map(int, input().split())
p = [k]*n
for i in range(q):
    a = int(input())
    p[a-1] += 1
for j in range(n):
    p[j] -= q
    if p[j] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 12884
#include <stdio.h>
#define N 50

void dfs(int, int);

int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
int input[N][N],w,h,count;
main() {
  int i, j;

  while(1) {
    scanf("%d %d", &w, &h);
    if(w==0 && h==0) break; 
    for(i=0 ; i<h ; i++) {
      for(j=0 ; j<w ; j++) {
	scanf("%d", &input[i][j]);
      }
    }
  
    for(i=0 ; i<h ; i++) {
      for(j=0 ; j<w ; j++) {
	if(input[i][j] == 0) continue;
	dfs(j,i);
	count++;
      }
    }
    printf("%d\n", count);
    count=0;
  }

  return 0;
}

void dfs(int x, int y) {
  int i, nx, ny;
  
  input[y][x] = 0;
  for(i=0 ; i<8 ; i++) {
    nx = x + dx[i];
    ny = y + dy[i];
    if(input[ny][nx]==0 || nx<0 || ny<0 || nx>=w ||  ny>=h) continue;
    dfs(nx,ny);
  }
  
  return;
}

Measured memory_bytes: 680
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;


int main()
{
char x,y;
cin>>x>>y;

if(x==y)
    cout<<"="<<endl;
else if(x>y)
    cout<<">"<<endl;
else
    cout<<"<"<<endl;



 return 0;
}


Measured memory_bytes: 3624
import java.lang.Math.max

fun main(args: Array<String>) {
    val (n) = readLine()!!.split(' ').map(String::toInt)
    val a1 = readLine()!!.split(' ').map(String::toInt)
    val a2 = readLine()!!.split(' ').map(String::toInt)
    var sum = a1[0] + a2.sum()
    var current = sum
    for(i in 1 until n){
        current += a1[i] - a2[i-1]
        sum = max(sum, current)
    }
    print(sum)
}

Measured memory_bytes: 37996
H, W = gets.split(' ').map(&:to_i)
grid = []
bl = 0
H.times do
  s = gets.chomp
  bl += s.count('#')
  grid.push(s)
end

step = Array.new(H){[-1] * W}
now = [[0, 0]]
nxt = []
1.upto(H * W) do |i|
  now.each do |x, y|
    step[x][y] = i
    [[0, 1], [0, -1], [1, 0], [-1, 0]].each do |s, t|
      z = x + s
      w = y + t
      next if z < 0 || z > H - 1 || w < 0 || w > W - 1
      if grid[z][w] == '.' && step[z][w] == -1
        nxt.push([z, w])
      end
    end
  end
  break if nxt.empty?
  break if step[H - 1][W - 1] > 0
  now = nxt.uniq
  nxt = []
end

if step[H - 1][W - 1] > 0
  puts H * W - step[H - 1][W - 1] - bl
else
  puts '-1'
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P=pair<ll,ll>;
int main(){
  int n; cin>>n;
  vector<P> lr(n);
  ll maxl=0,minr=1000000010;
  for(int i=0;i<n;i++){
    ll x,y; cin>>x>>y;
    y++; //半開区間にしたほうが
    lr[i]=P(x,y);
    if(maxl<x) maxl=x;//最も大きなl
    if(minr>y) minr=y;//最も小さなr
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    ans=max(ans,max(0ll,minr-maxl)+lr[i].second-lr[i].first);
    //場合分け一、最大のlと最小のrが同一のグループ
  }
  //以下同一でないグループに所属した場合
  vector<P> lrre(n),lrre2(n);
  for(int i=0;i<n;i++){
    ll x=max(0ll,minr-lr[i].first);
    //最小のrが所属するグループに所属させたとき
    ll y=max(0ll,lr[i].second-maxl);
    //最大のlが所属するグループに所属させたとき
    lrre[i]=P(y,x);
  }
  sort(lrre.begin(),lrre.end());
  ll w=1000000010;
  for(int i=0;i<n;i++){
    if(i){//i=0以外の時
      ans=max(ans,lrre[i].first+w);
      //昇順なので、i番目以降が同一のグループに所属するとき
      //lrre[i].firstが最も小さい範囲になるのでi-1番目までの
      //最小範囲別途、記録すればよい
    }
    if(w>lrre[i].second) w=lrre[i].second;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4992
#include<cstdio>
using namespace std;
const long long MOD = 1000000000 + 7;
long long dp[100000][110];
int main() {

    int n, k;
    scanf("%d %d", &n, &k);

    int last = n;
    int tmp = 0, ss = 0;
    for(int i = 1 ; i*i <= n ; i++) {
        dp[i][0] = last - n/(i+1), last = n/(i+1);
        tmp=i;
        ss += dp[i][0];
    }
    while(n - ss > 0) {
        dp[++tmp][0] = 1;
        ss++;
    }

    // for(int i = 1 ; i <= tmp ; i++) {
    //     printf("%d\n", dp[i][0]);
    // }

    for(int j = 1 ; j < k ; j++) {
        long long sum = 0;
        for(int i = 1 ; i <= tmp ; i++) {
            sum += dp[tmp-i+1][j-1];
            sum %= MOD;
            dp[i][j] = sum * dp[i][0] % MOD;
        }
    }
    long long ans = 0;
    for(int i = 1 ; i <= tmp ; i++){
        ans += dp[i][k-1] % MOD;
    }
    printf("%lld\n", ans % MOD);

    return 0;
}

Measured memory_bytes: 55424
# 区間が出る問題は累積和を疑おう
N, M, Q = map(int, input().split())

# l から rまで行く鉄道の数
lr = [[0 for i in range(N + 1)] for j in range(N + 1)]
# l から r以前のどこかまで行く鉄道の数
imos = [[0 for i in range(N + 1)] for j in range(N + 1)]

for i in range(M):
    l, r = map(int, input().split())
    lr[l][r] += 1

for i in range(1, N + 1):
    for j in range(1, N + 1):
        imos[i][j] = imos[i][j-1] + lr[i][j]
res = []
for i in range(Q):
    ans = 0
    p, q = map(int, input().split())
    for i in range(p, q + 1):
        ans += imos[i][q]
    res.append(ans)

for row in res:
    print(row)

Measured memory_bytes: 66136
// https://atcoder.jp/contests/abc077/tasks/arc084_a

#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 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, t, l, m, cnt;
vector<int> A, B, C;

int main()
{
  cin >> N;
  REP(i, N)
  {
    cin >> t;
    A.push_back(t);
  }
  REP(i, N)
  {
    cin >> t;
    B.push_back(t);
  }
  REP(i, N)
  {
    cin >> t;
    C.push_back(t);
  }
  sort(ALL(A));
  sort(ALL(B));
  sort(ALL(C));

  cnt = 0;
  l = m = 0;
  REP(i, N)
  {
    while (l < N && A[l] < B[i])
      l++;
    while (m < N && C[m] <= B[i])
      m++;
    cnt += l * (N - m);
  }

  cout << cnt << '\n';

  return 0;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(a) (int)a.size()
#define rep(i, a, b) for(int i=(a); i<(b); i++)
//-----
const int N=200010;
int n;
ll hea[N];
ll sum[N];
ll ans=1e18;
int main() {
	scanf("%d", &n);
	rep(i, 1, n+1)scanf("%lld", hea+i), sum[i]=sum[i-1]+hea[i];
	rep(i, 1, n)ans=min(ans, abs(sum[i] - sum[n]+sum[i]));;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main()
{
    int N;
    double X;
    scanf("%d %lf", &N, &X);
    double *L = (double *)malloc(sizeof(double)*N);
    double now = 0;
    int hane = 0;

    for(int i = 0; i < N; i++)
    {
        scanf("%lf", &L[i]);
    }

    if(X == 0) hane = 1;
    else
    {
        for(int i = 0; now <= X && i <= N; i++)
        {
            hane++;
            if(i != N) now += L[i];
            //printf("%d %d\n", hane, now);
        }
    }
    
    printf("%d\n", hane);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);cout.tie(NULL);
 long double w,h,x,y;
 cin>>w>>h>>x>>y;
 cout<<(long double)((w*h)/2)<<" ";
 if(x==(w/2) && y==(h/2))
 cout<<1;
 else
 cout<<0;
 return 0;
}

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

int main()
{
	long long n, a, b;
	cin >> n >> a >> b;
	cout << n / (a + b) * a+ min(a,n % (a + b)) << endl;
	
}

Measured memory_bytes: 256
N,M,X,Y = map(int,input().split())
XList = list(map(int,input().split()))
YList = list(map(int,input().split()))
if max(XList) >= max(YList):
  print('War')
  exit()
elif X >=Y:
  print('War')
  exit()
for item in range(X+1,Y+1):
  if max(XList) < item <= min(YList):
    print('No War')
    exit()
print('War')

Measured memory_bytes: 9156
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;

int main(){
    int r,ans;
    cin >> r;
    ans = 3 * r * r;
    cout << ans << endl;
}

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

tmp = []

s_len = len(S)
for i in range(s_len):
    for j in range(i,i+min(K,s_len-i)):
        #print(i, j)
        #print(S[i:j+1])
        tmp.append(S[i:j+1])

str_set = set(tmp)

for i,s in enumerate(sorted(str_set)):
    if i == K-1:
        print(s)
        break

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

int main(){
    int n,p; cin>>n>>p;
    string s; cin>>s;
    ll ans = 0;
    if(p==2||p==5){
        rep(i,n){
            if((s[i]-'0')%p==0) ans+=i+1;
        }
        cout << ans << endl;
        return 0;
    }

    vector<int> sum(n+1);
    int ten = 1;
    for(int i=n-1;i>=0;i--){
        int a = (s[i]-'0')*ten%p;
        sum[i] = (sum[i+1]+a)%p;
        ten *= 10; ten %= p;
    }
    vector<int> cnt(p);
    for(int i=n;i>=0;i--){
        ans += cnt[sum[i]];
        cnt[sum[i]]++;
    }
    cout << ans << endl;
}

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

typedef long long int ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

void solve() {

    string s;
    cin >> s;
    ll ans = 0;
    ll cnt = 0;
    for(int i = 0;i < 3;i++){
        if(s[i] == 'R'){
            cnt = 1;
            ans = max(cnt,ans);
            for(int j = i+1;j < 3;j++){
                if(s[j] == 'R'){
                    cnt++;
                    ans = max(cnt,ans);
                }else{
                    break;
                }
            }
        }
    }
    cout << ans;

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


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

int main()
{
	int a[] = { 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
	int x, y;
	cin >> x >> y;
	if (a[x - 1] == a[y - 1]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

ll N, M;

ll MODpow(ll n, ll m, ll MOD = M) {
    ll result = 1;
    n %= MOD;
    while (m) {
        if (m % 2 == 1) {
            result *= n;
            result %= MOD;
        }

        m /= 2;
        n *= n;
        n %= MOD;
    }

    return result;
}

class Combination {
public:
    Combination(ll max_num, ll mod) {
        fact_.resize(max_num + 1, 1);
        inv_fact_.resize(max_num + 1, 1);
        mod_ = mod;
        for (ll i = 2; i <= max_num; i++) {
            fact_[i] = i * fact_[i - 1] % mod_;
            inv_fact_[i] = MODpow(fact_[i], mod_ - 2);
            assert(fact_[i] * inv_fact_[i] % mod_ == 1);
        }
    }
    ll operator()(ll n, ll m) const {
        if (m < 0 || m > n) return 0;
        return fact_[n] * inv_fact_[n - m] % mod_ * inv_fact_[m] % mod_;
    }
private:
    vector<ll> fact_, inv_fact_;
    ll mod_;
};

vector<vector<ll>> dp;
vector<ll> pow2;
ll ways(ll i) {
    ll result = 0;
    for (ll j = 0; j <= i; j++) {
        (result += dp[i][j] * pow2[(N - i) * j] % M) %= M;
    }
    return result * MODpow(2, MODpow(2, N - i, M - 1)) % M;
}

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

    dp.resize(N + 2, vector<ll>(N + 2, 0));
    dp[0][0] = 1;
    for (ll i = 1; i <= N; i++) {
        for (ll j = 0; j <= N; j++) {
            if (j > 0) {
                (dp[i][j] += dp[i - 1][j - 1]) %= M;
            }
            (dp[i][j] += dp[i - 1][j] * (j + 1)) %= M;
        }
    }

    pow2.resize(N * N);
    pow2[0] = 1;
    for (ll i = 1; i < N * N; i++) {
        pow2[i] = pow2[i - 1] * 2 % M;
    }

    Combination comb(N + 1, M);
    ll ans = 0;
    //包除原理
    for (ll i = 0; i <= N; i++) {
        (ans += (i % 2 ? -1 : 1) * comb(N, i) * ways(i) % M + M) %= M;
    }
    cout << ans << endl;
}

Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair;
#define pb push_back;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,L;
  cin >> N >> L;
  int sum=0;
  rep1(i,N){
    sum += L + i -1;
  }

  if(L <= 0 && L+N-1>=0){
    cout << sum << endl;
  }
  else if(L+N-1 <0){
    cout << (sum -(L+N-1)) << endl;
  }
  else {
    cout << sum -L << endl;
  }

  return 0;
    

}


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

ll const limit = 1e18;

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

    for (int i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        if (a == 0)
        {
            cout << 0 << endl;
            return 0;
        }
        A.push_back(a);
    }

    ll ans = 1;
    for (ll a : A)
    {
        if (limit / ans >= a)
        {
            ans *= a;
        }
        else
        {
            cout << -1 << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 4228
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    S = str(input().strip())

    if N % 2 == 1:
        return 'No'
    
    if S[:N//2] == S[N//2:]:
        return 'Yes'

    return 'No'

if __name__ == '__main__':
    print(main())

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    string s;
    cin >> s;
    bool flag = true;
    for (int i = 0; i < s.size(); ++i) {
        if (i % 2 == 1 && s[i] == 'R') flag = false;
        if (i % 2 == 0 && s[i] == 'L') flag = false;
    }
    cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n,w;
	cin>>n>>w;
	
	int wt[n],v[n];
	for(int i=0;i<n;i++) {
		cin>>wt[i]>>v[i];
	}
	
	ll dp[n+1][w+1];
	memset(dp,0,sizeof(dp));
	
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=w;j++) {
			if(wt[i-1]>j) {
				dp[i][j] = dp[i-1][j];
			}
			else {
				dp[i][j] = max(dp[i-1][j],v[i-1]+dp[i-1][j-wt[i-1]]);
			}
		}
	}
	
	cout<<dp[n][w];
	
	return 0;
}


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

  const int MOD = 1000000007;
  const double PI = acos(-1); 

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }



// // 二分探索(最小値を出す問題は疑う)
// bool C(ll x){
//     ll res = 0;
//     for(int i = 0; i < N; ++i){
// 		res += max(0ll, A[i]-x/F[i]);
//     }
//     return res <= K;
// }

//   ll binary_search(ll ok, ll ng){
//     while(abs(ok - ng) > 1){
//       ll mid = (ok + ng) / 2;
//       if(C(mid)) ok = mid;
//       else ng = mid;
//     }
//     return ok;
//   }



int main() {
string S;
cin >> S;
int w;
cin >> w;
string ans;
int i = 0;
while(i < S.size()){
  ans += S.at(i);
  i += w;
}
print(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
  int A, B, C, d;
  cin >> A >> B >> C;
  if (A%B == 0){
    d = A/B;
  }
  else{
    d = A/B + 1;
  }
  cout << d*C << endl;
  return 0;
}

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

int main()
{
int n,k,total=0;
cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++){
    cin>>arr[i];
}
sort(arr,arr+n);
for(int j=0;j<k;j++){
    total+=arr[j];
}
cout<<total;

    return 0;
}


Measured memory_bytes: 3620
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    string[] ss;
    for (int i = 0; i < n; i++) {
        ss ~= read!string;
    }

    char[] ans;
    foreach (c; 'a'..'z'+1) {
        int cnt = int.max;
        foreach (s; ss) {
            cnt = min(cnt, s.count(c));
            if (cnt == 0) break;
        }

        if (cnt > 0) {
            ans ~= repeat(cast(char) c, cnt).array;
        }
    }
    writeln(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    sort(d.begin(), d.end());
    int ans =  d[n/2] - d[n/2-1];
    cout << ans << endl;
    return 0;
}

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

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

constexpr auto inf = 1e9;

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

using ll = long long;

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

	return 0;
}

Measured memory_bytes: 256
S = gets.chomp
K = gets.to_i

L = []
def add_list(s)
  if L.size < K then
    L << s
    L.sort!
    true
  else
    if L[-1] < s then
      false
    else
      L << s
      L.sort!.uniq!
      L.pop if L.size > K
      true
    end
  end
end

(0...S.size).each{|i|
  (i...S.size).each{|j|
    break if not add_list(S[i..j])
  }
}

puts L[-1]


Measured memory_bytes: 1788
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
  int h, w;
  string s;
  cin >> h >> w;
  for(int i=0; i<h+2; i++) {
    for(int j=0; j<w+2; j++) {
      if(i==0) {
        cout << "#";
        if(j==w+1) cout << endl;
      }
      else if(i==h+1) {
        cout << "#";
        if(j==w+1) cout << endl;
      }
      else {
        cin >> s;
        cout << "#" << s << "#" << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;

int main(void) {
  int a; cin >> a;
  pl(a == 1 ? 0 : 1);
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <set>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 100000007

#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong gcd(llong a, llong b) {
    return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> a(n,0);
    REP(i,n) cin>>a[i];
    
    int cnt=0;
    REP(i,n-1)
    {
        if(a[i]==a[i+1])
        {
        ++cnt;
        i++;
        }
    }
    cout<<cnt<<endl;
    return  0;
}


Measured memory_bytes: 256
use std::cmp::max;
use std::cmp::min;
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut itr = s.split_whitespace().map(|e| e.parse().unwrap());
    let n: i64 = itr.next().unwrap();
    let x: i64 = itr.next().unwrap();
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut a: Vec<i64> = s.split_whitespace().map(|e| e.parse().unwrap()).collect();
    let mut ans = 0;

    for e in &mut a {
        let t = min(*e, x);
        ans += *e - t;
        *e = t;
    }

    for i in 1..a.len() {
        let mut t = max(0, a[i] + a[i - 1] - x);
        ans += t;
        a[i] = max(0, a[i] - t);
    }

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


Measured memory_bytes: 8444
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <climits> 
#include <map>
using namespace std;

const int MAX_V = 1000; 
const int INF = 100000; 
int v; 
int g[MAX_V][MAX_V]; 
int g2[MAX_V][MAX_V];
int d[MAX_V]; 
bool used[MAX_V]; 


void dijkstra(int s)
{
  fill(d, d + v, INF);
  fill(used, used + v, false);
  d[s] = 0;
  for(;;){
    int i = -1;
    for(int j = 0; j < v; ++j)
      if(!used[j] && (i == -1 || d[i] > d[j]))
	i = j;
    if(i == -1)break; 
    used[i] = true;
    for(int j = 0; j < v; ++j)
      d[j] = min(d[j], d[i] + g[i][j]);
  }
}

void dijkstra2(int s)
{
  fill(d, d + v, INF);
  fill(used, used + v, false);
  d[s] = 0;
  for(;;){
    int i = -1;
    for(int j = 0; j < v; ++j)
      if(!used[j] && (i == -1 || d[i] > d[j]))
	i = j;
    if(i == -1)break; 
    used[i] = true;
    for(int j = 0; j < v; ++j)
      d[j] = min(d[j], d[i] + g2[i][j]);
  }
}


int main()
{
  for(;;){
    int gv, ge;
    
    cin >> ge >> gv;
    if(ge==0){return 0;}

    fill(&g[0][0], &g[MAX_V][0], 100000);
    fill(&g2[0][0], &g2[MAX_V][0], 100000);


    for(int i = 0; i < ge; ++i){
      int gs, gt, gd,gd2;
      cin >> gs >> gt >> gd >> gd2;
      g[gs-1][gt-1]=gd;
      g[gt-1][gs-1]=gd;
      g2[gs-1][gt-1]=gd2;
      g2[gt-1][gs-1]=gd2;
    }
    v = gv;

    //for(int i=0;i<v;i++){for(int j=0;j<v;j++){cout << g[i][j] << " ";}cout << endl;}

    //for(int i=0;i<v;i++){for(int j=0;j<v;j++){cout << g2[i][j] << " ";}cout << endl;}


    
    int k;
    cin >> k;
    for(int i=0;i<k;i++){
      int p,q,r;
      cin >> p >> q >> r;
      if(r==0){
	dijkstra(p-1);
	//for(int j=1;j<=gv;j++)
	  cout << d[q-1] << endl;
      }else{
	dijkstra2(p-1);
	//for(int j=0;j<=gv;j++)
	  cout << d[q-1] << endl;
      }
    }
  }
  return 0;
}

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

#define ll long long int
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vl>
#define vvi vector<vi>
#define pb push_back
#define P pair<ll,ll>
#define mp make_pair
#define F first
#define S second
#define rep(i,n) for(ll i=0; i<n; i++)
#define Sort(v) sort(v.begin(), v.end())
#define all(v) v.begin(),v.end()

ll mo = 1000000007;
ll MO = 998244353;

ll modpower(ll a, ll b, ll mod){
	ll ans = 1;
	if(b == 0){
		return 1;
	}
	if(b%2 == 1){
		ans = a;
	}
	ll x = modpower(a,b/2,mod)%mod;
	ans *= (x*x)%mod;
	ans %= mod;
	return ans;
}

void pri(vl a){
	for(auto i:a)
		cout<<i<<" ";
	cout<<endl;
}

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

void solve(){
	ll n,d;
	cin>>n>>d;
	ll ans = 0;
	rep(i,n){
		ll x,y;
		cin>>x>>y;
		if(x*x + y*y <= d*d) ans++;
	}
	cout<<ans<<endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	int nt = 1;
	// cin>>nt;
	while(nt--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(18);

	string str;
    cin >> str;
    rep(i, 3){
        cout << str.at(i);
    }

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define F(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define D(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
int rd() {
	char c; do { c = getchar(); } while (!isdigit(c));
	int x = 0; do { x = x*10+c-'0', c = getchar(); } while (isdigit(c)); return x;
}

const int N = 200005;
const int S = 600000;
const int INF = -1u>>2;

int n, m, ans, tag[S], Mx[S];
struct I {
	int l, r;
	friend int operator < (I a, I b) { return a.r < b.r; }
}it[N];

#define Lc (x << 1)
#define Rc (x << 1 | 1)
#define M (L+R >> 1)
void Pro(int x, int L, int R) {
	Mx[x] = -L;
	if (L != R) {
		Pro(Lc, L, M);
		Pro(Rc, M+1, R);
	}
}
void Dw(int x, int t) { tag[x] += t, Mx[x] += t; }
void CLR(int x) {
	int &t = tag[x];
	if (t) {
		Dw(Lc, t);
		Dw(Rc, t), t = 0;
	}
}
void Mo(int x, int L, int R, int l, int r) {
	if (l <= L && R <= r) return Dw(x, +1), void();
	CLR(x);
	if (l <= M) Mo(Lc, L, M, l, r);
	if (M < r) Mo(Rc, M+1, R, l, r);
	Mx[x] = max(Mx[Lc], Mx[Rc]);
}
int Max(int x, int L, int R, int l, int r) {
	if (l <= L && R <= r) return Mx[x];
	CLR(x);
	int ans = -INF;
	if (l <= M) ans = max(ans, Max(Lc, L, M, l, r));
	if (M < r) ans = max(ans, Max(Rc, M+1, R, l, r));
	return ans;
}

int main() {	
	n = rd(), m = rd();
	F(i, 1, n) {
		int l = rd(), r = rd();
		it[i] = (I){l, r};
	}
	sort(it+1, it+n+1);
	Pro(1, 0, m+1);
	
	ans = max(ans, n-m);
	D(i, n, 1) {
		int l = it[i].l, r = it[i].r;
		Mo(1, 0, m+1, l, r);
		ans = max(ans, Max(1, 0, m+1, 0, r) - (m-r+1));
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y;
	cin>>x>>y;
	for(int i=0;i<=y/2;i++){
		if(i*2+(x-i)*4==y){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 3632
#include <iostream>


void bubbleSort(int *array, int size) {
  size -= 1;
  int temp = 0;

  for (int i = 0; i < size; i ++)
    for (int j = 0; j < size; j ++)
      if (array[j] < array[j + 1]) {
        temp = array[j];
        array[j] = array[j + 1];
        array[j + 1] = temp;
      }
}

int main() {
  int heights[10];
  int size = 0;
  for (int i = 0; i < 10; i ++)
    std::cin >> heights[i];
  size = sizeof(heights) / sizeof(*heights);

  bubbleSort(heights, size);

  for (int i = 0; i < 3; i ++)
    std::cout << heights[i] << std::endl;

  return 0;
}

Measured memory_bytes: 3072
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){
    int q = readln().chomp().to!int;
    for(int i=0;i<q;i++){
	int c,a,n;
	int[] s = readln().split().to!(int[]);
	c = s[0];
	a = s[1];
	n = s[2];
	int res;
	if(n>0){
	    res = min(c,min(a,n));
	    int temp =  min(c,min(a,n));
	    c -= temp;
	    a -= temp;
	}
	if(a>0){
	    res += min(to!int(floor(to!real(c)/2.0)),a);
	    c -= 2*min(to!int(floor(to!real(c)/2.0)),a);
	}
	if(c>0)
	    res += to!int(floor(to!real(c)/3.0));
	writeln(res);
    }
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> a(N);
    rep (i, N) {
        cin >> a[i];
    }

    ll ans = 0;
    ll cnt = 0;
    rep (i, N-1) {
        if (a[i] == a[i+1]) {
            cnt++;
        } else {
            ans += (cnt+1)/2;
            cnt = 0;
        }
        if (i == N-2) {
            ans += (cnt+1)/2;
        }
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
unsigned long long int t[101],n,mx,g,i;
int main()
{
	using namespace std;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%ld",&t[i]);
	}
	sort(t,t+n);
	/*for(i=0;i<n;i++){
		printf("%ld\n",t[i]);
	}*/
	
	mx=t[n-1];
	
	for(i=0;i<n;i++){
		if((mx%t[i])!=0){
			g=mx;
			while(1){
				if((g%t[i])==0)break;
				g+=mx;
			}
			mx=g;
		}
	}
	
	printf("%ld\n",mx);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if (e-a<=k){
        cout << "Yay!" << endl;
    }
    else {
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
N = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, N - 1):
	if p[i - 1] < p[i] and p[i] < p[i + 1]:
		ans += 1
	elif p[i - 1] > p[i] and p[i] > p[i + 1]:
		ans += 1
print(ans)


Measured memory_bytes: 9120
sd = input()
t = input()

anss = []
for tpos in range(len(sd) - len(t) + 1):
    check = True
    for i in range(len(t)):
        if t[i] != sd[(i + tpos)] and sd[(i + tpos)] != '?':
            check = False
            break
    if check == True:
        cand = sd[:tpos] + t + sd[(tpos + len(t)):]
        anss.append(cand.replace('?', 'a'))

if len(anss) == 0:
    print('UNRESTORABLE')
else:
    print(sorted(anss)[0])


Measured memory_bytes: 9056
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
class Main {
	public static void main (String[] args) {
	    Scanner sc=new Scanner(System.in);
		String s=sc.next();
		long yy=compu(s,0,s.length()-1);
		System.out.println(yy);
	}
	public static long compu(String s,int i,int j)
	{
	    if(i>j||i>=s.length())
	    return 0;
	    if(i==j)
	    return s.charAt(i)-'0';
	    else
	    {
	        long sd=0;
	        for(int x=i;x<=j;x++)
	        {
	            if(j>x)
	            sd=sd+((int)Math.pow(2,j-x-1))*(Long.parseLong(s.substring(i,x+1)))+compu(s,x+1,j);
	            else
	            sd+=Long.parseLong(s.substring(i,x+1));
	        }
	        return sd;
	    }
	}
}

Measured memory_bytes: 22996
n,m = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
lis.sort()
to = 0
nu = 0
for i in lis:
    for n in range(i[1]):
        to += i[0]
        nu += 1
        if nu == m:
            print(to)
            exit()

Measured memory_bytes: 27756
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef map<ll, ll> MAP;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111

MAP mp;
void factor(ll x) {
  for (ll i = 2;i*i <= x;i++) {
	while (x%i == 0) {
	  mp[i]++;
	  x /= i;
	}
  }
  if (x != 1)mp[x]++;
}

int main(void) {
  cin >> n;
  FOR(i, 1, n + 1) factor(i);
  ans = 1;
  for (auto it : mp) {
	tmp = it.second + 1;
	(ans *= tmp) %= MOD;
  }

  cout << ans << endl;

  return 0;
}

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

const int MAX_N = 10000;
int Par[MAX_N];
int Rank[MAX_N];

void init_union_find(int n){
	for(int i=0; i<n; ++i){
		Par[i] = i;
		Rank[i] = 0;
	}
}

int find(int x){
	if(Par[x] == x){
		return x;
	}else {
		return Par[x] = find(Par[x]);
	}
}

void unite(int x, int y){
	x = find(x);
	y = find(y);

	if(x == y)
		return ;

	if(Rank[x] < Rank[y]){
		Par[x] = y;
	} else{
		Par[y] = x;
		if(Rank[x] == Rank[y]){
			++Rank[x];
		}
	}
}

bool same(int x, int y){
	return find(x) == find(y);
}

struct edge {
	int from,
		to,
		cost;
};

bool comp(const edge& e1, const edge& e2){
	return e1.cost < e2.cost;
}

const int MAX_E = 10000;
edge es[MAX_E];
int V, E;

int kruskal(void){
	sort(es, es + E, comp);
	init_union_find(V);

	int res = 0;
	for(int i=0; i<E; ++i){
		edge e = es[i];
		if(!same(e.from, e.to)){
			unite(e.from, e.to);
			res += e.cost / 100 - 1;
		}
	}

	return res;
}

int main(void){
	while(true){
		cin >> V;
		if(V == 0)
			break;
		cin >> E;

		char d;
		for(int i=0; i<E; i++){
			cin >> es[i].from >> d >> es[i].to >> d >> es[i].cost;
		}

		cout << kruskal() << endl;
	}
}

Measured memory_bytes: 1252
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

#にぶたんサーチ
def search(arr, num):
    l = 0
    r = len(arr) - 1
    while r - l > 1:
        c = (r + l) // 2
        if arr[c] > num:
            r = c
        elif arr[c] < num:
            l = c
        else:
            r = c
            l = c
    if arr[l] == num:
        return l
    elif arr[r] == num:
        return r
    else:
        return -1

n = INT()
x = LIST()
arr1 = sorted(list(set(x)))
arr2 = Counter(x)
arr3 = [-1 for _ in range(len(arr1))]
for i in range(len(arr1)):
    arr3[i] = arr2[arr1[i]]
    arr3[i] += arr3[i - 1] if i > 0 else 0
med = n // 2 - 1
y = sorted(x)
mdx_mn = y[med]
mdx_mx = y[med + 1]

for xx in x:
    idx = search(arr1, xx)
    if idx == 0:
        print(mdx_mx)
        continue
    mn = arr3[idx - 1]
    mx = arr3[idx]
    if med < mn:
        print(mdx_mn)
    else:
        print(mdx_mx)


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

int main() {
	int A, B, C, D, W;
	cin >> A >> B >> C >> D;
	
	W = A + B - C - D;
	if (W > 0) {
		cout << "Left" << endl;
	}
	else if (W == 0) {
		cout << "Balanced" << endl;
	}
	else {
		cout << "Right" << endl;		
	}
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>                          
using namespace std; 
int x,t[1000005],j;                                            
int main(){	
    cin>>x;
	for(int i=2;i<=2*x;i++)
	{
		bool f=1;
		for(j=2;j<=sqrt(i);j++)
		    if(i%j==0) {f=0;break;}
		if(f==1) t[i]=1;
	}
	while(t[x]==0)
		x++;
	cout<<x;
	return 0;
}    

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

ll n;
ll a[500039];

void INP(){
    cin>>n;
    for(ll i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
}

void solve(){
    for(ll i=1;i<n;i++)
        if(a[i]==a[i+1])
        {
            cout<<"NO";
            return;
        }
    cout<<"YES";
}

int main(){
    INP();
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void) {
  int i;
  char str1[1200],str2[1200];

  fgets(str2, sizeof(str2), stdin);

  for(i = 0; i < 1200; i++){
    str1[i] = tolower(str2[i]);
  }

  for(i = 0; i < 1200; i++){
    if(islower(str2[i]) != 0){
      str1[i] = toupper(str2[i]);
    }
  }

  int len = strlen(str2);
  for(i = 0; i < len; i++){
    printf("%c",str1[i]);
  }
  return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
int main(){
  long N;
  cin>>N;
  vector<string>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  sort(A.begin(),A.end());
  vector<pair<int,string>>P(N);
  for(int i=0;i++;i<N)P[i].first=2000000;
  P[0].second=A[0];
  for(int i=1;i<N;i++){
    P[i].second=A[i];
    if(A[i-1]==A[i])P[i].first=P[i-1].first-1;
  }
  sort(P.begin(),P.end());
  
  int n=P[0].first;
  for(int i=0;i<N;i++){
	if(P[i].first==n)cout<<P[i].second<<endl;
  }
}
  
  
  

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

int cnt[1000];
char s[1000];

int main(){
	scanf("%s", s);
	int n = strlen(s);
	for (int i = 0; i < n; ++ i){
		++ cnt[s[i]];
	}
	if ((cnt['N'] > 0) + (cnt['S'] > 0) == 1 || (cnt['W'] > 0) + (cnt['E'] > 0) == 1){
		puts("No");
	}
	else{
		puts("Yes");
	}
	return 0;
}

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

int A, B, H, M;
const double pi = 3.14159265358979311600;

int main(void) {
  cin >> A >> B >> H >> M;
  int m = 60*H + M;
  double thetaA = pi / 360 * (double)m;
  double thetaB = pi / 30 * (double)m;
  while (thetaA >= 2 * pi) {
    thetaA -= 2*pi;
  }
  while (thetaB >= 2 * pi) {
    thetaB -= 2*pi;
  }
  double theta = abs(thetaA - thetaB);
  double ans = sqrt((double)A*(double)A + (double)B*(double)B - 2 * (double)A*(double)B*cos(theta));
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}


Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int x[100010];
bool bo[100010];
signed main(){
	int a,b,sum1=0,sum2=0;
	cin>>a>>b;
	f(i,b){
		int a;
		string s;
		cin>>a>>s;
		if(s=="AC"&&!bo[a]){
			bo[a]=true;
			sum1++;
			sum2+=x[a];
		}
		else x[a]++;
	}
	cout<<sum1<<" "<<sum2<<endl;
}


Measured memory_bytes: 1152
#include<iostream>
using namespace std;
 int main()
 {
     long long int A,B,C,D,m,n,o,p,q,r,gcd,lcm;
     cin>>A>>B>>C>>D;
     n=C;
     o=D;
     while(D != 0)
     {
         m=D;
         D=C%D;
         C=m;
     }
     gcd=C;
     lcm=n*o/gcd;
     if(A%n==0)
     {
         p=B/n-A/n+1;
     }
     else{
        p=B/n-A/n;
     }
     if(A%o==0)
     {
         q=B/o-A/o+1;
     }
     else{
        q=B/o-A/o;
     }
     if(A%lcm==0)
     {
         r=B/lcm-A/lcm+1;
     }
     else{
        r=B/lcm-A/lcm;
     }
      cout<<B-A+1-p-q+r<<endl;
 }


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX=100000;
int main()
{
  int n,a,b,l,r,c,t,i;
  int h[N_MAX];
  cin >> n >> a >> b;
  for(i=0;i<n;i++)
    cin >> h[i];
  sort(h,h+n,greater<int>());
  l=(h[0]+a-1)/a;
  r=(h[0]+b-1)/b;
  while(l<r){
    c=(l+r)/2;
    t=0;
    for(i=0;i<n;i++){
      t+=max(0,(h[i]-b*c+a-b-1)/(a-b));
      if(t>c)
        break;
    }
    if(t<=c)
      r=c;
    else
      l=c+1;
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 3992
from collections import deque

def main():
    H, W = map(int, input().split())
    S = tuple(input() for _ in [0] * H)

    maze = ['#' * (W + 2)] * (H + 2)
    dot = 0
    for i, s in enumerate(S):
        dot += s.count('.')
        maze[i+1] = '#' + s + '#'

    before = deque([(1, 1)])
    step = [[None for i in range(W+2)] for j in range(H+2)]
    step[1][1] = 0
    while len(before) > 0:
        x, y = before.popleft()
        if (x, y) == (W, H):
            print(dot - (step[y][x] + 1))
            break
        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            if '.' in maze[y+j][x+i] and step[y+j][x+i] == None:
                before.append((x+i, y+j))
                step[y+j][x+i] = step[y][x] + 1
    else:
        print(-1)

main()


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

#define ll long long int
int main() 
{

ll i,j,n,m;
string a;
cin>>a;
n=a.size();
m=(n-1)/2;
int k=(n+3)/2;
int f=0;
for(i=0;i<n/2;i++)
{
	if(a[i]!=a[n-1-i])
	{
		f=1;break;
	}
}
for(i=0;i<m;i++)
{

	if(a[i]!=a[m-1-i])
	{
		f=1;break;
	}
}
for(i=k-1;i<n;i++)
{

	if(a[i]!=a[n-1-i])
	{
		f=1;break;
	}
}
if(f==0)
	cout<<"Yes"<<endl;
else
	cout<<"No"<<endl;
}

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

int main(){
  int N,M,L;
  cin >> N >> M >> L;
  if(N+M-L >= 0) cout << M+L << endl;
  else if(N+M-L < 0) cout << M+L-(L-N-M)+1 << endl;
  return 0;
}

Measured memory_bytes: 256