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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
    
    
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    int ans=1000;
    rep(i,n-1){
        int kau=a[i];
        for(int j=i+1;j<n;j++){
            if(a[j]<kau) break;
            if(kau<a[j]){
                int cnt=ans/kau;
                ans-=cnt*kau;
                ans+=cnt*a[j];
                i=j-1;
                break;
            }
        }
    }
    cout<<ans<<endl;
    
    
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 7780
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  string S;
  cin >> S;
  string S1 = S.substr(0, N);
  string S2 = S.substr(N, N);
  lint ans = 0;
  REP(k, 1<<N) {
    string a = "";
    string b = "";
    REP(i, N) {
      if((k>>i&1) == 1) {
        a = S1[i] + a;
      } else {
        b = S1[i] + b;
      }
    }
    vector<vector<lint>> dp(N+1, vector<lint>(a.size()+1));
    dp[0][0] = 1;
    REP(i, N) {
      REP(j, a.size()+1) {
        if(j != a.size() && S2[i] == a[j]) {
          dp[i+1][j+1] += dp[i][j];
        }
        if(S2[i] == b[i-j]) {
          dp[i+1][j] += dp[i][j];
        }
      }
    }
    ans += dp[N][a.size()];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define NUM ((long long)1000000007)
#define int long long

using namespace std;

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(c - a) <= d)
    {
        cout << "Yes" << endl;
        return 0;
    }

    if (abs(b - a) <= d && abs(c - b) <= d)
    {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc122_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

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

  int ans = 0;
  int tmp = 0;
  rep(i, N) {
    if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
      tmp++;
    } else {
      ans = max(ans, tmp);
      tmp = 0;
    }
  }
  if (tmp > 0) {
    ans = max(ans, tmp);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

int main(void) {
    ll X;
    cin >> X;

    ll cur = 100;
    int year = 0;
    while (cur < X) {
        cur = cur / 100 + cur;
        year++;
    }
    cout << year << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}



typedef vector<ll> Row;
typedef vector<Row> Matrix;

Matrix G;
Matrix mul(const Matrix& A, const Matrix& B) {
    Matrix res(A.size(), Row(B[0].size(), 0));
    REP(i, A.size()) REP(j, B[0].size()) REP(k, B.size()) {
        if ( A[i][k] && B[k][j] ) res[i][j] = !res[i][j];
    }
    return res;
}
Matrix E(const int n) {
    Matrix res(n, Row(n, 0));
    REP(i, n) res[i][i] = 1;
    return res;
}
Matrix power(const Matrix& A, const ll n) {
    Matrix x = A;
    Matrix res = E(A.size());
    for (ll i = 1; i <= n; i <<= 1) {
        if (i & n) {
            res = mul(res, x);
        }
        x = mul(x, x);
    }
    return res;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n; cin >> n;
    Matrix G(n, Row(n)); cin >> G;
    vector<ll> b(n); cin >> b;
    ll T; cin >> T;
    vector<bool> used(n, false);
    G = power(G, T);
    REP(i, n) {
        int pos = -1;
        REP(j, n) {
            if (used[j]) continue;
            if (G[j][i]) {
                pos = j;
            }
        }
        if (pos < 0) continue;
        REP(j, n) {
            if (j == pos) continue;
            if (G[j][i] == 0) continue;
            REP(k, n) {
                G[j][k] = (G[j][k] + G[pos][k]) & 1;
            }
            b[j] = (b[j] + b[pos]) & 1;
        }
        used[pos] = true;
    }
    int flag = 0;
    REP(i, n) {
        bool f = false;
        REP(j, n) {
            if ( G[i][j] ) {
                f = true;
            }
        }
        if (!f) {
            if ( b[i] == 0 ) {
                flag = max(flag, 1);
            }
            else {
                flag = 2;
            }
        }
    }
    if (flag == 2) {
        cout << "none" << endl;
    }
    else if (flag == 1) {
        cout << "ambiguous" << endl;
    }
    else {
        vector<int> ans(G.size());
        REP(i, b.size()) {
            REP(j, G.size()) {
                if ( G[i][j] ) {
                    ans[j] = b[i];
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 5808
# -*- coding: utf-8 -*-

s_list = list(input())
t_list = list(input())

# 昇順ソート
s_list.sort()
# 降順ソート
t_list.sort(reverse=True)

res_list = []
res_list.append("".join(s_list))
res_list.append("".join(t_list))
res_list.sort()

# 比較対象が同一文字列の場合はNoにする(s<=tではなくs<tだから)
if "".join(s_list) == "".join(t_list):
    print("No")
# ソート後の先頭と文字列sの一致を確認
elif res_list[0] == "".join(s_list):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 5;
int a[N];

int main()
{
	int n;
	cin >> n;
	vector<int> sub(n + 1, 0);
	for (int i = 2; i <= n; ++i) {
		cin >> a[i];
		sub[a[i]]++;
	}
	for (int i = 1; i <= n; ++i)
		cout << sub[i] << "\n";
	

}




Measured memory_bytes: 4840
// Author: Sayantanu
#include <bits/stdc++.h>

using namespace std;

#define ll long long int
const int mod = 1e9 + 7;


int main() {
    //code
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i = 0;i<n;i++){
        cin>>arr[i];
    }
    vector<int> dp(n);
    dp[0] = 0;
    for(int i = 1;i<n;i++){
        dp[i] = min(abs(arr[i] - arr[i-1]) + dp[i-1],abs(arr[i] - arr[max(0,i-2)]) + dp[max(0,i-2)]);
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
template<long long Mod = mod>
constexpr long long MOD(long long in) {
    return in % Mod;
}

int n;
ll a[100005];
ll dp[100005];
int main()
{
    std::cin >> n;
    for (int i = 0; i < n; ++i)
        std::cin >> a[i];

    std::fill(dp, dp + n + 1, inf);
    std::reverse(a, a + n);
    for (int i = 0; i < n; ++i) {
        *std::upper_bound(dp, dp + n, a[i]) = a[i];
    }

    std::cout << std::lower_bound(dp, dp + n, inf) - dp << std::endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int d[200000],a[200000],sum[200000];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		scanf("%1d",&d[i+1]);
	}
	for(int i=1;i<=n;i++)
	{
		a[i]=(d[i]^d[i-1]);
	}
	for(int i=1;i<=n;i++)
	{
		sum[i]=sum[i-1]+a[i];
	}
	int b=0,ans=0;
	for(int i=1;i<=n;i++)
	{
		b^=a[i];
		int x=upper_bound(sum,sum+n+1,k*2-(!b)+sum[i])-sum;
		ans=max(ans,x-i);
	}
	cout<<ans<<endl;
	return 0;
}

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

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

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

    ll N; cin >> N;
    ll ans = 0;

    map<P,int> cnt;

    for (int i = 1;i <= N;i++){
        string s = to_string(i);
        cnt[P(s[0]-'0',s[s.size()-1]-'0')]++;
    }

    for (auto&& i:cnt){
        ans += i.second*cnt[P(i.first.second,i.first.first)];
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007



              
int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
      
    int t;
    t=1;
     //  cin>>t;
    while(t--){
        	string s,t;
        	cin>>s>>t;
        	ll c=0;
        	REP(i,0,s.length()-1){
        		if(s[i]!=t[i]) c++;
        	}  
        	cout<<c;
       


             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
#define boost std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
constexpr int MAXN = 3e5 + 5;
constexpr int LOG = 25;
constexpr int BIT = 24;
using namespace std;
template <typename T> inline void read(T &x) {
    int f = 1; x = 0;
    char ch = getchar();
    while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}
vector <pair <int, int> > G[MAXN];
int main() {
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 7296
'''input
3
1 2 2
2 3 1
'''
import sys
sys.setrecursionlimit(100100)
N = int(input())

edges = [[] for i in range(N)]

for i in range(N-1):
	a, b, w = [int(x) for x in input().split()]
	a -= 1
	b -= 1
	edges[a].append((b, w))
	edges[b].append((a, w))


color = [None]*N

color[0] = 0

def dfs(curr, prev):
	for i in edges[curr]:
		if i[0] == prev: continue

		if i[1] % 2 == 0: color[i[0]] = color[curr]
		else: color[i[0]] = 1 - color[curr]

		dfs(i[0], curr)

dfs(0, -1)

for i in color:
	print(i)

Measured memory_bytes: 157344
#!/usr/bin/env ruby
require 'set'

def main
    n,k = gets.chomp.split(" ").map(&:to_i)
    as = gets.chomp.split(" ").map(&:to_i)
    if (n-1) % (k-1) == 0
        puts (n-1)/(k-1)
    else
        puts (n-1)/(k-1) + 1
    end
end

main

# s[0,6] # 0番目から6文字
# s[0..6] # 0番目から6番目まで
# s[5..-1] # 5番目から最後まで
# until s.empty? do

Measured memory_bytes: 9116
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    String s = sc.next();
    StringBuilder sb = new StringBuilder();
    for(int i = 0; i < s.length(); i += 2){
      char c = s.charAt(i);
      sb.append(c);
    } 
    System.out.println(sb);
  }
}

Measured memory_bytes: 26156
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
#include<cstdio>

int v[1500001];
char s[1500001],t[500002];
void Zalgorithm(int N){
  int i=1,j=0,k=0;
  while(i<N){
    while(i+j<N&&s[i+j]==s[j])++j;
    if(!(v[i]=j)){
      ++i;
      continue;
    }
    k=1;
    while(v[k]+k<j){
      v[i+k]=v[k];
      ++k;
    }
    i+=k;
    j-=k;
  }
}
int i,j,K,que[500001],bf,ans,size;
int main(){
  int N,ng=500001,mid;
  std::fgets(t,1000000,stdin);
  std::fgets(s,1000000,stdin);
  while(ng-K>1){
    mid=(ng+K)>>1;
    (s[mid]?K:ng)=mid;
  }
  while(t[i]!='\n'){
    s[K+i]=t[i];++i;
  }
  N=i;
  i+=K;
  int M=N+(K<<1);
  while(i<M){
    s[i++]=t[j++];
    j*=j<N;
  }
  Zalgorithm(M);
  M=K%N;
  for(i=0;i<N;++i){
    if(v[i+M]=v[i+K]<K)que[size++]=(i+M)-(i+M>=N)*N;
  }
  for(i=0;i<N;++i){
    if(i==size){
      puts("-1");
      return 0;
    }
    if(!v[que[i]+=M]){
      que[size++]=que[i]-(que[i]>=N)*N;
      if(bf<=i){
        bf=size-1;
        ++ans;
      }
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 9984
A = int(input())
ans = ''
for i in range(1, 99):
	if A <= 26 ** i:
		A -= 1
		for j in range(i):
			ans += chr(ord('a') + A % 26)
			A //= 26
		break
	else:
		A -= 26 ** i
print(ans[::-1])

Measured memory_bytes: 9100
def main():
    n,m = map(int, input().split())
    h = list(map(int, input().split()))
    ab = {}
    for _ in range(m):
        a,b = map(int, input().split())
        ab[a] = ab.get(a, set())
        ab[a].add(b)
        
        ab[b] = ab.get(b, set())
        ab[b].add(a)

    ans = set()
    for num, val in enumerate(h,1):
        if (tenbodai := ab.get(num, [])):
            is_top = True
            for i in tenbodai:
                if val <= h[i-1]:
                    is_top = False
            if is_top:
                ans.add(num)
        else:
            ans.add(num)
    print(len(ans))
if __name__ == "__main__":
    main()

Measured memory_bytes: 48464
#include <iostream>
#include<vector>

using namespace std;

long long knapSack(int W, vector<int> wt, vector<int> val, int n) 
{ 
   int i, w; 
   long long K[n+1][W+1]; 
  
   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
  
   return K[n][W]; 
} 

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,W;
    cin >> n >> W;
    vector<int> w(n);
    vector<int> v(n);
    for(int i = 0; i < n;i++)
         cin >> w[i] >> v[i];

    cout << knapSack(W,w,v,n) << endl;
    
    return 0;
}


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



int main() {
    int n;
    cin >> n;
    
    vector<int> v(n), c(n);
    rep(i,n) cin >> v[i];
    rep(i,n) cin >> c[i];
    
    int ans = 0;
    rep(i,n) {
        if(v[i] - c[i] > 0)
            ans += v[i] - c[i];
    }
    
    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 3628
n = int(input())
Red = [list(map(int,input().split())) for i in range(n)]
Blue = [list(map(int,input().split())) for i in range(n)]
Red.sort(key=lambda x:x[1], reverse=True)
Blue.sort()
cnt = 0
for b in Blue:
	for r in Red:
		if b[0] > r[0] and b[1] > r[1] :
			cnt += 1
			r[0] = 10**9
			r[1] = 10**9
			break
print(cnt) 

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main(){
    string s;
    int K;
    cin >> s;
    cin >> K;
    int l = s.length();

    vector<string> substring;
    for(int i=1; i<=K; i++){
        for(int j=0; j<l-i+1; j++){
            substring.push_back(s.substr(j, i));
        }
    }
   sort(substring.begin(), substring.end());
   substring.erase(unique(substring.begin(), substring.end()), substring.end());
   cout << substring[K-1] << endl;

   return 0;
}

Measured memory_bytes: 1660
#include<iostream>
using namespace std;
int a, b, c, d;
int main(){
  cin >> a >> b >> c >> d;
  if(a + b > c + d){
    cout << "Left" << endl;
    }else if(a + b < c + d){
    cout << "Right" << endl;
    }else{
    cout << "Balanced" << endl;
    }
  return 0;
  }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>
#include <cmath>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

typedef struct {
	float x;
	float y;
} point;

void print_point(point p)
{
	printf("%.6f %.6f\n", p.x, p.y);
}

void KochCurve(point p1, point p2, int depth, int limit)
{
	point s, t, u;

	depth++;

	s.x = p1.x + (p2.x - p1.x) / 3;
	s.y = p1.y + (p2.y - p1.y) / 3;

	t.x = p1.x + (p2.x - p1.x) * 2 / 3;
	t.y = p1.y + (p2.y - p1.y) * 2 / 3;

	u.x = s.x + (t.x - s.x) / 2 - (t.y - s.y) * sqrtf(3) / 2;
	u.y = s.y + (t.x - s.x) * sqrtf(3) / 2 + (t.y - s.y) / 2;

	if (depth <= limit) {
		KochCurve(p1, s, depth, limit);
		KochCurve(s, u, depth, limit);
		KochCurve(u, t, depth, limit);
		KochCurve(t, p2, depth, limit);
	}
	else print_point(p2);
}

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

	point p1 = { 0, 0 };
	point p2 = { 100, 0 };

	print_point(p1);
	KochCurve(p1, p2, 0, n);

	return 0;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define VL vector < ll >
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
#define cu cout<<
#define en endl
#define sp " "
#include<cstdio>
#include<cstring>
void bug()
{
    cout << "here\n";
}
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 10000009
bool prime[N];
vector<ll> prm;
void seive ()
{
    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {

        if (prime[i] == true)
        {
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
    for (ll i=2; i<=N; i++)
    {
        if(prime[i]) prm.pb(i);
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
bool isprime(ll n)
{
    if(n<2) return 0;
    if(n==2) return 1;
    else
    {
        for(int i=2; i*i<=n; i++)
            if(n%i==0) return 0;
    }
    return 1;

}
ll countSum(ll x)
{
    ll res = 0;
    while (x != 0)
    {
        res += (x % 10);
        x /= 10;
    }
    return res;
}
ll power(ll a,ll b)
{
    if(b==0) return 1;
    if(b==1) return a;
    else
    {
        ll  res = power(a,b/2);
        if(b%2)
            return res * a*res;
        else
            return res*res;
    }
}
ll suff[1000005],pre[1000005];
int main()
{
    fast;
    ll x;
  cin >> x;
  cout << (!x)<<endl;
}






Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
int main(){
    ll n;cin >> n;
    vector<ll> a(n);
    vector<ll> m(n);
    for(int i=0; i<n; i++) cin >> a[i];
    ll v=0;
    for(int i=1; i<=n-2; i++){
        if(i%2!=0) v+=a[i];
        else v-=a[i];
    }
    ll aa=(a[0]+a[n-1]-v)/2;
    for(int i=0; i<n; i++){
        m[i]=2*aa;
        aa=a[i]-aa;
    }
    for(int i=0; i<n; i++) cout << m[i] << endl;
    return 0;
}

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

const long long MOD=1000000007;

int main(){
  string ss; cin >> ss;
  char S[4];
  for(int i=0; i<4; i++) S[i]=ss[i];
  sort(S,S+4);
  if(S[0]==S[1]&&S[1]!=S[2]&&S[2]==S[3]) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 256
n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
    if a[i] != b[i] and b[i] != c[i] and c[i] != a[i]:
        ans += 2
    elif a[i] != b[i] or b[i]!=c[i] or c[i]!=a[i]:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}
int dfs(int v, ll N, bool visited[nmax])
{
    bool all_visited = true;

    for (int i = 0; i < N; i++)
    {
        if (!visited[i])
        {
            all_visited = false;
        }
    }

    if (all_visited)
    {
        return 1;
    }
    int ret = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (!graph[v][i])
        {
            continue;
        }
        if (visited[i])
        {
            continue;
        }

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}
const string YES = "Yes";
const string NO = "No";

void solve(std::string w)
{
    for (char c = 'a'; c <= 'z'; c++)
    {
        if (count(w.cbegin(), w.cend(), c) % 2 != 0)
        {
            cout << NO << endl;
            return;
        }
    }

    cout << YES << endl;
}

int main()
{
    std::string w;
    std::cin >> w;
    solve(w);
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
for(int x,y,i=0;  ; i++){
cin >> x >> y;
if(x==0 && y==0)break;
if(x>y) cout << y << " " << x <<endl;
else cout << x << " " << y <<endl;
}
return 0;
}


Measured memory_bytes: 2984
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define vii vector<ll> 
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int MOD = 1e9 + 7, N = 1e4 + 3;

int main(){
    fast;
    ll n; cin >> n;
    ll a[n], sum = 0;
    for(int i = 0; i < n; ++i){ 
        cin >> a[i];
        sum += a[i];
    }
    sort(a, a+n);
    sum -= a[n - 1];
    if(a[n - 1] < sum) cout << "Yes\n";
    else cout << "No\n";
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

Measured memory_bytes: 3776
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

// 約数の列挙
vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) {
                res.push_back(n / i);
            }
        }
    }
    return res;
}

int main(){
  ll N,K;cin>>N>>K;
  vector<ll> v(N);
  rep(i,N) cin>>v[i];

  ll sum = 0;
  rep(i,N) sum+= v[i];

  //約数vectorを作成
  vector<ll> a;
  a = divisor(sum);
  a.pb(1); a.pb(sum);
  SORT(a);

  ll d = a.size();
  for(ll i = d-1; i >= 0; i--){
    vector<ll> cnt(N);
    ll re=0;
    rep(j,N){
      cnt[j] = v[j]%a[i];
      re += cnt[j];
    }

    SORT(cnt);
    //cはそこからひく場所
    ll c = re/a[i];
    ll check = 0;
    rep(j,N-c){
      check += cnt[j];
    }
    if(check<=K){
      cout<<a[i]<<endl;
      return 0;
    }
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;
	ll ans = 0;
	repl(i, 1, n + 1) ans += (i + n / i * i) * (n / i) / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3568
#include<iostream>
using namespace std;
 
int main(){
  int n;
  while(cin>>n){
    if(n==0) break;
    int a[n+1];
    for(int i=0; i<n; i++) cin >> a[i];
    int Max = a[0];
 
    for(int i=0; i<n; i++){
      int sum=0;
      for(int j=i; j<n; j++){
    sum+=a[j];
    if(Max < sum) Max = sum;
      }
    }
    cout << Max << endl;
  }
  return 0;
}

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

int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    if(s.size()==2)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true) {
            int n = stdIn.nextInt();
            if(n == 0) break;
            int[] s = new int[n];
            int sum = 0;
            for(int i = 0; i < n; i++) {
                s[i] = stdIn.nextInt();
                sum += s[i];
            }
            double m = sum/(double)n;
            double a = 0.0;
            for(int i = 0; i < n; i++) {
                a += (s[i] - m)*(s[i] - m);
            }
            a= a/(double)n;
             
            System.out.println(Math.sqrt(a));
             
        }
    }
}


Measured memory_bytes: 31472
K, N = map(int, input().split())
A = list(map(int, input().split()))
A.append(A[0])

Big = 0
for i in range(1,N):
    Big = max(Big,abs(A[i] - A[i-1]))

ans = min(K-Big, max(A)-min(A))
print(ans)

Measured memory_bytes: 26420
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long

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

	int N;
	vector<int> X;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> tmp;
		X.push_back(tmp);
	}

	sort(X.begin(), X.end());
	int sum = 0;
	int max;
	for (int i = 0; i < N; i++)
	{
		sum += X[i];
	}
	sum -= X[N - 1];
	max = X[N - 1];

	if (max < sum) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin, (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
	  fac[i] = fac[i-1] * i % MOD;
	  inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
	  finv[i] = finv[i-1] * inv[i] % MOD;
	}
}
//組み合わせ
long long COM (int n, int k) {
	if(n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
void solve() {
	long long n; cin >> n;
	long long ans = INFL;
	for (long long i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		long long j = n / i;
		ans = min(ans, i + j - 2);
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k;
  cin >> n >> k;
  if(k == 1) cout << 0;
  else cout << n-k;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define int long long
using namespace std;
const int N=100005;
int n,k,ans,a[N],b[N],L[N],R[N],sum[N],f[N],h[N*2],val[N*8];
void pushdown(int o){
	if(val[o]){
		val[o*2]=val[o*2+1]=val[o];
		val[o]=0;
	}
}
void update(int o,int l,int r,int L,int R,int v){
	if(L>R){
		return;
	}
	if(L<=l&&R>=r){
		val[o]=v;
		return;
	}
	pushdown(o);
	int mid=(l+r)/2;
	if(L<=mid){
		update(o*2,l,mid,L,R,v);
	}
	if(R>mid){
		update(o*2+1,mid+1,r,L,R,v);
	}
}
int query(int o,int l,int r,int k){
	if(l==r){
		return val[o];
	}
	pushdown(o);
	int mid=(l+r)/2;
	if(k<=mid){
		return query(o*2,l,mid,k);
	}else{
		return query(o*2+1,mid+1,r,k);
	}
}
int get(int x){
	int res=query(1,1,h[0],x);
	if(!res){
		return 0;
	}
	return f[res]+(h[L[res]]-h[x]+k)%k;
}
signed main(){
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&a[i],&b[i]);
		sum[i]=sum[i-1]+a[i];
		if(b[i]==1){
			L[i]=sum[i-1]%k*(k-2)%k;
			R[i]=sum[i]%k*(k-2)%k;
			if(a[i]*2>k){
				return puts("-1"),0;
			}
		}else{
			L[i]=0;
			R[i]=k-1;
		}
		h[++h[0]]=L[i];
		h[++h[0]]=R[i];
	}
	sort(h+1,h+h[0]+1);
	h[0]=unique(h+1,h+h[0]+1)-h-1;
	for(int i=n;i>=1;i--){
		L[i]=lower_bound(h+1,h+h[0]+1,L[i])-h;
		R[i]=lower_bound(h+1,h+h[0]+1,R[i])-h;
		f[i]=get(L[i]);
		if(L[i]>R[i]){
			update(1,1,h[0],R[i]+1,L[i]-1,i);
		}else{
			update(1,1,h[0],1,L[i]-1,i);
			update(1,1,h[0],R[i]+1,h[0],i);
		}
	}
	ans=f[1];
	for(int i=1;i<=h[0];i++){
		ans=min(ans,get(i));
	}
	printf("%lld\n",ans+2*sum[n]);
	return 0;
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(void){
    int a, b;
    cin >> a >> b;
    if((a+b)%2 == 1){
        cout << "IMPOSSIBLE" << endl;
    }else{
        cout << (a+b)/2 << endl;
    }
    return 0;
}


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

int main() {
  int N, K, temp, ans;
  cin >> N >> K;
  
  
  for(int i = 0; i < N; i++){
    cin >> temp;
    if(temp >= K){
      ans++;
    }
  }
  
  cout << ans << endl;

  return 0;
}


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

int main(){
    int K, A, B;
    cin >> K;
    cin >> A >> B;
    if (A % K == 0){
        cout << "OK" << endl;
    } else if (A + K - (A % K) > B){
        cout << "NG" << endl;
    } else{
        cout << "OK" << endl;
    }
    return 0;
}


Measured memory_bytes: 3596
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split(' ');
            int b = int.Parse(a[0]);
            int c = int.Parse(a[1]);


            Console.WriteLine(b * c - b - c + 1);
               


        }

    }
}


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

int main(void){
  int N,M;
  cin>>N>>M;
  vector<int>A(M);
  for(int i=0;i<M;i++){
    cin>>A[i];
  }
  int sum=0;
  for(int i=0;i<M;i++){
    sum+=A[i];
  }
  int result=N-sum;
  if(result>=0) cout<<result<<endl;
  else cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 3628
W,H,N=map(int,input().split())
values=[[0],[W],[0],[H]]
for i in range(N):
  x,y,a=(map(int,input().split()))
  if a<=2:
    values[a-1].append(x)
  elif a>=3:
    values[a-1].append(y)
print(max(0,min(values[1])-max(values[0]))*max(0,min(values[3])-max(values[2])))

Measured memory_bytes: 9144
def main():

    N = input()
    D = list(map(int,input().split()))
    M = max(D)
    countlist=[0] * (M + 1)
    ans=1

    for i in D:
        countlist[i]+=1

    if countlist[0]!=1 :
        ans = 0
    else :
        if D[0]!=0 :
            ans = 0
        else:
            for i in range(2,M+1):
                ans *= (countlist[i-1]**countlist[i])

    print(ans % 998244353) 

if __name__ == "__main__":
    main()

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

vector<int> sieve(int n) {
  vector<int> p(n);
  for(int i=2; i<n; i++) p[i]=i;
  for(int i=2; i*i<n; i++) {
    if(p[i]) {
      for(int j=i*i; j<n; j+=i) p[j]=0;
    }
  }
  return p;
}

int main() {
  vector<int> prime=sieve(1000001);
  int n,m;
  while(cin >> n >> m && (n||m)) {
    bool dp[m+1];
    memset(dp,false,sizeof(dp));
    dp[0]=true;
    int ans=-1;
    rep(i,n) {
      int x;
      cin >> x;
      rep(j,m) {
	if(dp[j] && j+x<=m) {
	  dp[j+x]=true;
	  if(prime[j+x]) ans=max(ans,j+x);
	}
      }
    }
    if(ans==-1) pr("NA");
    else pr(ans);
  }
  return 0;
}


Measured memory_bytes: 5956
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#define print(n) std::cout << n << std::endl
using namespace std;


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

    vector<double> a(n);
    double sum = 0;

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

    for (int i = 0; i < n; ++i) sum += 1 / a[i];
    
    double ans = 1 / sum;
    
    print(ans);
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main(){
    lli n,k,d,a;
    lli i,j;
    cin>>n>>k;
    vector<lli> vec(n,0);
    rep(i,0,k){
        cin>>d;
        rep(j,0,d){
            cin>>a;
            vec[a-1]=1;
        }
    }
    lli cnt=0;
    rep(i,0,n){
        if(vec[i]==0){
            cnt++;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3636
X, Y = map(int, input().split(" " ))
Z=[0,300000, 200000, 100000]
if (X>3): 
    X=0
if (Y>3):
    Y=0
sum = 0
if X==1 and Y==1:
    sum = 400000
print (Z[X]+ Z[Y]+sum)
    

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
using namespace std;

typedef long long ll;

map<int,int> res;

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

int main() {
  int N; cin >> N;
  ll ans = 1;

  if ( N == 1 ) ans = 1;
  else {
    for ( int i = 2; i <= N; i++ ) {
      prime_factor(i);
    }
    map<int,int>::iterator ite;
    for ( auto ite = res.begin(); ite != res.end(); ite++ ) {
      //cout << ite->first << " " << ite->second << endl;
      ans *= ite->second+1;
      ans %= 1000000007;
	
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------


int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int R, G;
	cin >> R >> G;

	// (R+out)/2=G
	// R+out=2G
	// out=2G-R;

	cout << (2 * G) - R << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include"atcoder/all"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using namespace atcoder;
typedef long long ll;
int main(){
  int N,Q,i,t,u,v;scanf("%d%d",&N,&Q);
  dsu d(N);
  for(i=0;i<Q;i++){
    scanf("%d%d%d",&t,&u,&v);
    if(t == 0) d.merge(u,v);
    else printf(d.same(u,v) ? "1\n":"0\n");
  }
}

Measured memory_bytes: 4048
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String before = sc.next();

        for (int i = 0; i < 12; i++) {
            System.out.print(before.charAt(i));
            if (i == 3) {
                System.out.print(' ');
            }
        }
        
        System.out.println();
    }
}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
typedef pair<int,int> pii;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define MAX_V 100000

vector<int> G[MAX_V];
vector<int> depth,vs;
int id[MAX_V]={};

template<class T>
class segtree{
private:
    vector<T> dat;
    int _size;
    T _init;
    
public:
    segtree(int __size=0 , T init=numeric_limits<T>::max() ):_size(__size) , _init(init) , dat(4*__size,init){
        if(__size==0)return ;
        int x=1;
        while(x<_size)x*=2;
        _size = x;
    }
    
    int size(){
        return _size;
    }
    
    void update(int m,T x){
        int i = m+_size;
        dat[i] = x;
        while(i!=1){
            dat[i/2] = min(dat[i],dat[i^1]);
            i/=2;
        }
    }
    
    // call find(s,t)
    T find(int s,int t,int num=1,int a=0,int b=-1){
        if(b==-1)b=_size-1; //I couldn't "int b=_size".
        if(b<s||t<a)return _init;
        if(s<=a&&b<=t)return dat[num];
        return min( find(s,t,num*2,a,(a+b)/2) , find(s,t,num*2+1,(a+b)/2+1,b) );
    }
};


void dfs(int d,int num){
    depth.pb(d);
    vs.pb(num);
    rep(i,G[num].size()){
        dfs(d+1,G[num][i]);
        depth.pb(d);
        vs.pb(num);
    }
    return ;
}


void init(){
    dfs(1,0);
    rep(i,vs.size()){
        if(id[ vs[i] ]==0)id[ vs[i] ]=i;
    }
}


int main(){
    int n;
    cin>>n;
    rep(i,n){
        int k;
        cin>>k;
        rep(j,k){
            int a;
            cin>>a;
            G[i].pb(a);
        }
    }
    
    init();
    segtree<pii> st(depth.size(),pii((1<<31)-1,(1<<31)-1));
    rep(i,depth.size()){
        st.update(i,pii(depth[i],vs[i]));
    }
    int q;
    cin>>q;
    rep(i,q){
        int a,b;
        cin>>a>>b;
        cout<<st.find(min(id[a],id[b]),max(id[a],id[b])).second<<endl;
    }
}

Measured memory_bytes: 19604
import java.util.*; 

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long s = sc.nextLong();
        long c = sc.nextLong();
        
        
        long count = 0;
        
        if (s*2 == c) {
            System.out.println(s);
        } else if (s*2 < c) {
            count += s;
            c -= s * 2;
            s = 0;
            count += (c / 4);
            System.out.println(count);
        } else {
            System.out.println(c/2);
        }
    }
}

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

int main(void){
int H, W;
    while(true){
    cin >> H >> W;
    if(H == 0 && W == 0) break;
        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++ ){
                if(1<=i && 1<=j && i<(H-1) && j<(W-1)){
                    cout << ".";
                }
                else{
                cout << "#";
                }
            }
        cout << endl;
        }
    cout << endl;
    }
}


Measured memory_bytes: 3060
n,m,x,y=map(int,input().strip().split(" "))
ar1=[int(i) for i in input().strip().split(" ")]
ar2=[int(i) for i in input().strip().split(" ")]
ar1.append(x)
ar2.append(y)
m1=max(ar1)
m2=min(ar2)
if m2>m1:
    print("No War")
else:
    print("War")

Measured memory_bytes: 61920
# Author: cr4zjh0bp
# Created: Mon Mar 23 19:34:20 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

h, w = na()
a = nsn(h)

for i in range(w + 2):
    print("#", end="")
print()

for i in range(h):
    print("#", end="")
    for j in range(w):
        print(a[i][j], end="")
    print("#")

for i in range(w + 2):
    print("#", end="")
print()

Measured memory_bytes: 4468
s = input()
k = int(input())
lst = []
m = min(5,len(s))
while True:
    if m<=0:
        break
    for i in range(len(s)-m+1):
        q = s[i:i+m]
        if not q in lst:
            lst.append(q)
    m -= 1

lst.sort()
print(lst[k-1])

Measured memory_bytes: 41824