akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 100005
#define NIL -1
 
struct Node{ int p, l, r,key;};
struct Node T[MAX];
 
int n, S[MAX],DG[MAX],H[MAX], D[MAX];
 
int getDepth(int u){
  int d = 0,n = u;
  while(1){
    n = T[n].p;
    if(n == NIL)break;
    d++;
  }
  return d;
}
 
 
int getHeight(int u){
  int L=0,R=0;
  if (T[u].r == NIL && T[u].l == NIL) return 0;
    if (T[u].l != NIL){
      L =  getHeight(T[u].l)+1;
    }
    if(T[u].r != NIL){
      R =  getHeight(T[u].r)+1;
    }
    if(L > R) return L; 
     
    else return R; 
}
 
 
int getDegree(int u){
  int n = u;
  if(T[n].l != NIL && T[n].r != NIL)return 2;
  else if(T[n].l != NIL || T[n].r != NIL)return 1;
  else return 0;
}
 
int getSibling(int u, int n){
  int i;
  for(i = 0; i < n; i++ ){
    if(T[u].p == T[i].p && i != u)return i; 
  }
  return NIL;
}
 
void print(int u){
  int n = u;
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d,",u,T[u].p,S[u],DG[u],D[u],H[u]);
  n = T[n].l;
 
  if(T[u].p == NIL)printf(" root\n");
  else if(DG[u]>= 1 && DG[u] <= 2)printf(" internal node\n");
  else printf(" leaf\n");
  
}
int main(){
  int i,v,l,r;
 
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = NIL;
  }
 
  for ( i = 0; i < n; i++ ){
    scanf("%d %d %d", &v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL)T[l].p = v;
    if(r != NIL)T[r].p = v;
  }
  
  for(i = 0; i < n; i++){
    S[i] = getSibling(i,n);
  }
 
  for(i = 0; i < n; i++){
    DG[i] = getDegree(i);
    }
  for ( i = 0; i < n; i++ ){
     D[i] = getDepth(i);
  }
  
  for (i = 0; i < n; i++ ){
    H[i] = getHeight(i);
  } 
 
  for ( i = 0; i < n; i++ ) print(i);
  return 0;
   
}



Measured memory_bytes: 2104
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        long k = Long.parseLong(sc.next());
        long[] sumA = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            sumA[i] = sumA[i - 1] + Long.parseLong(sc.next());
        }
        long[] sumB = new long[m + 1];
        for (int i = 1; i <= m; i++) {
            sumB[i] = sumB[i - 1] + Long.parseLong(sc.next());
        }
        sc.close();

        // 主処理
        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
        int index = sumB.length - 1;
        for (int i = 0; i < sumA.length; i++) {
            long remain = k - sumA[i];
            for (int j = index; 0 <= j; j--) {
                if (sumB[j] <= remain) {
                    pq.add(i + j);
                    index = j;
                    break;
                }
            }
        }
        int result = pq.poll();

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 64572
#include <iostream>

using namespace std;

int main()
{
   string str;cin>>str;
   bool c1=true,c2=true;
   for(int i=0;i<str.size();i++)
   {
       if(i%2==0)//ODD
       {
            if(str[i]!='R'&& str[i]!='U'&& str[i]!='D')
            {
                c1=false;
                break;
            }
       }
       else if(i%2==1)
       {
            if(str[i]!='L'&& str[i]!='U'&&str[i]!='D')
            {
                c1=false;
                break;
            }
       }
   }
   if(c1==true && c2==true)
   {
       cout<<"Yes\n";
   }
   else cout<<"No\n";
   
   return 0;
}

Measured memory_bytes: 3620
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    ll ans = 0;
    REP1(i, N)
    {
        for (ll j = i; j <= N; j += i)
        {
            ans += j;
        }
    }
    OUT(ans);
}

Measured memory_bytes: 3624
n=int(input())
l=[0,0,0,0,0]
for _ in range(n):
    s=input()
    if s[0]=='M':l[0]+=1
    if s[0] == 'A': l[1] += 1
    if s[0] == 'R': l[2] += 1
    if s[0] == 'C': l[3] += 1
    if s[0] == 'H': l[4] += 1

ans=0
for i in range(0,5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans+=l[i]*l[j]*l[k]
print(ans)

Measured memory_bytes: 9156
import java.util.*;
import java.math.BigInteger;
// warm-up
public class Main {

	// GCD of two numbers
	// Euclid's algorithm
	static BigInteger GCD(BigInteger a, BigInteger b) {
		if (b.equals(BigInteger.ZERO)) return a;
		return GCD(b, a.mod(b));
	}

	// LCM of two numbers
	static BigInteger LCM(BigInteger a, BigInteger b) {
		return b.multiply(a).divide(GCD(a, b));
	}


	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (n>1) {
			BigInteger[] a = {sc.nextBigInteger(),sc.nextBigInteger()};
			BigInteger b = a[1];
			a[1] = LCM(a[0], a[1]);
			a[0] = b;
			n-=2;
			while (n-->0) {
				b = a[1];
				a[1] = LCM(a[1], sc.nextBigInteger());
				a[0] = b;
			}
			System.out.println(a[1]);
		} 
		else System.out.println(sc.next());
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 36320
#include <iostream>
using namespace std;
int main(){
	long long N, A, B;
	cin >> N >> A >> B;
	long long arr[N]={};
	long long crr[N];
	for (int i=0; i<N; i++){
		cin>>arr[i];
	}
	long long start = 0;
	long long end = 1000000001;
	while (start<end){
		long long m = (start+end)/2;
		//cout << "m " << m << ' ';
		for (int i=0; i<N; i++){
			crr[i]=max( (long long int) (0),arr[i]-B*m);
		}
		long long cnt = 0;
		for (int i=0; i<N; i++){
			if (crr[i]){ 
				cnt += ((crr[i]-1)/(A-B)+1);
				//cout << "cnt " << cnt << endl;
			}
		}
		if (cnt==m){ 
			cout << m << endl; 
			return 0;
		}
		else if (cnt>m) start = m+1;
		else end = m;		
	}
	cout << end << '\n';
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,n) for(ll i=n-1;i>=0;i--)
#define rloop(i,a,b) for(ll i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define mem(x,p) memset(x,p,sizeof(x))
#define w(t) ll t;cin>>t;while(t--)
#define kk "\n"
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  ll n;
  cin>>n;
  ll a[n];
  map <ll,ll> mp;
  ll s=0;
  fo(i,n)
  {
  	cin>>a[i];
  	mp[a[i]]++;
  	s+=a[i];
  }
  ll q;
  cin>>q;
  while(q--)
  {
  	ll a,b;
  	cin>>a>>b;
  	if(mp[a]>0)
  	{
  		s=s-(a*mp[a])+(b*mp[a]);
  		mp[b]+=mp[a];
  		mp[a]=0;
  	}
  	cout<<s<<kk;
  }
  return 0;
}

Measured memory_bytes: 10164
n = int(input())
s = []
for i in range(n):
    s.append(input())
m = int(input())
t = []
for i in range(m):
    t.append(input())

words = list(set(s))
max = 0
for word in words:
    count = s.count(word) - t.count(word)
    if count > max:
        max = count

print(max)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) { 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
const int N = 2e5 + 55;
long double arr[N];
int n, k;
void solve() {
	cin >> n >> k;
	arr[0] = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> arr[i];
		arr[i] = 0.5 * (arr[i] + 1);
	}
	long double lol = 0;
	for (int i = 1; i <= k - 1; ++i) {
		lol += arr[i];
	}
	long double mx = 0;
	for (int i = k; i <= n; ++i) {
		lol += arr[i];
		lol -= arr[i - k];
		mx = max(mx, lol);
	}
	cout << mx;
}   

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

int main(){
  vector<string> c(3);
  for(int i = 0 ; i < 3 ; i++){
    cin >> c[i];
  }
  printf("%c%c%c\n",c[0][0],c[1][1],c[2][2]);
}


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

// マクロ
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) x * x

// 型エイリアス
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

int main() {

	int N;
	int s;

	cin >> N;
	cin >> s;

	if (N == s)y();
	else n();
}

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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e5) + 17;

int n, W;
int w[MAXN], v[MAXN];
ll dp[101][MAXN];

bool read() {
    if (!(cin >> n >> W))
        return false;

    forn (i, n)
        cin >> w[i + 1] >> v[i + 1];

    return true;
}

void solve() {
    for (int i = 0; i <= n; ++i)
        for (int j = 0; j < MAXN; ++j)
            dp[i][j] = INF * INF;

    dp[0][0] = 0;
    ll res = 0;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < MAXN; ++j) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);

            if (j + v[i + 1] < MAXN)
                dp[i + 1][j + v[i + 1]] = min(dp[i + 1][j + v[i + 1]], dp[i][j] + w[i + 1]);
        }
    }

    for (int i = 0; i < MAXN; ++i)
        if (dp[n][i] <= W)
            res = i;

    cout << res << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 79232
import sys, math
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    X = ii()
    s = 0
    i = 1
    while s < X:
        s += i
        i += 1
    print(i-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 65736
import sys
from collections import deque
input = sys.stdin.readline

def main():
    H, W = map(int, input().split())
    bo = [list(map(int, input().split())) for i in range(H)]
    route = []
    for i in range(H):
        if i&1 == 0:
            for j in range(W):
                route.append((i, j))
        else:
            for j in range(W-1, -1, -1):
                route.append((i, j))
    # print(route)
    len_ = len(route)
    ans = []
    for i in range(len_):
        y, x = route[i]
        if bo[y][x]&1 == 1 and i != len_ - 1:
            ny, nx = route[i+1]
            bo[y][x] -= 1
            bo[ny][nx] += 1
            ans.append((y+1, x+1, ny+1, nx+1))

    print(len(ans))
    for a, b, c, d in ans:
        print(a, b, c, d)
    # for t in bo:
    #     print(t)

if __name__ == "__main__":
    main()


Measured memory_bytes: 48732
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 


ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}







int main()
{
     int n;
     cin>>n;
     int a[n+1];
     for(int i=1;i<=n;i++)cin>>a[i];
     int c[3]={0};
     ll res=1LL;
     for(int i=1;i<=n;i++)
     {
          int ct=0,idx=-1;
          if(c[0]==a[i]){ct++;idx=0;}
          if(c[1]==a[i]){ct++;idx=1;}
          if(c[2]==a[i]){ct++;idx=2;}
          if(idx==-1){cout<<0;return 0;}
          res=(res*ct)%mod;
          c[idx]++;
     }
     cout<<res;

}











 














 
 

















Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> cnt(1001, 0);
  for (int i = 1; i <= 1000; i++){
    int sum = i;
    for (int j = i + 1; j <= 1000; j++){
      sum += j;
      if (sum <= 1000){
        cnt[sum]++;
      } else {
        break;
      }
    }
  }
  while (1){
    int N;
    cin >> N;
    if (N == 0){
      break;
    } else {
      cout << cnt[N] << endl;
    }
  }
}


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

#define vi vector<int>
#define pb push_back

typedef long long ll;
using namespace std;

double price[101][101] = {};

int main(){
    rep(y,101) rep(x,101){
        price[y][x] = sqrt((double)(pow(y,2) + pow(x,2)));
    }
    int d,e;
    while(cin >> d >> e,d) {
        double mn = 1000;
        rep(y,d){
            int x = d - y;
            mn = min(mn,abs(e - price[y][x]));
        }
        cout << mn << endl;
    }
    return 0;
}



Measured memory_bytes: 3280
#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int N;
    string s;
    cin >> N;
    cin >> s;

    set<char> cSet;
    REP(i, N) {
        cSet.insert(s[i]);
    }

    int result = 0;
    REP(i, N - 2) {
        string sf = s;
        sf.erase(i + 1);
        string sb = s.substr(i + 1);
        debug(s, sb, sf);
        int count = 0;
        set<char> cSet;
        REP(j, SIZE(sf)) {
            if (cSet.count(sf[j])) {
                continue;
            }
            if ((sb.find(sf[j]) != string::npos)) {
                count++;
                cSet.insert(sf[j]);
            }
        }
        debug(result, count);
        chmax(result, count);
    }
    cout << result;
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 3592
n=int(input())
a=list(map(int,input().split()))
cnt=n-1
i=n
arg=[0]*n
while(cnt>=0):
     arg[n-i]=cnt
     cnt-=1
     if cnt<0:
          break
     arg[i-1]=cnt
     cnt-=1
     i-=1
b=[]
for idx in arg:
     b.append(str(a[idx]))
print(' '.join(b))

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;


int32_t main()
{
	GO;
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		if (a % 2 == 1 && i % 2 == 0)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

//!

Measured memory_bytes: 3636
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    AIN(ll, A, N);
    ll x = 1000;
    ll s = 0;
    REP(i, N - 1)
    {
        if (s == 0 and A[i] < A[i + 1])
        {
            s += x / A[i];
            x %= A[i];
        }
        else if (s > 0 and A[i] > A[i + 1])
        {
            x += s * A[i];
            s = 0;
        }
    }
    if (s > 0)
    {
        x += s * A[N - 1];
    }
    OUT(x);
}

Measured memory_bytes: 3644
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)] 
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main() {
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int T = 1;
	 for(int t = 1; t <= T; t++) {
		 int n;
		 cin >> n;
		 for(int i = 1; i <= 9; i++){
			 for(int j = 1; j <= 9; j++){
				 if(i * j == n){
					 cout << "Yes\n";
					 return 0;
				 }
			 }
		 }
		 cout << "No\n";
	 }
}


Measured memory_bytes: 3652
import java.io.PrintWriter
import java.util.*

fun main(args:Array<String>){
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()
    if(2*k-1<=n){
        println("YES")   
    }
    else{
        println("NO")
    }
    return
}

Measured memory_bytes: 29476
#include <stdio.h>

int main()
{
	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);
	if (A + B > C + D) printf("Left\n");
	else if (A + B < C + D) printf("Right\n");
	else printf("Balanced\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1640
date=input().rstrip().split(" ")
X=int(date[0])
N=int(date[1])
if N==0:
    print(X)
else:
    date0=list(map(int, input().split(" ")))
    date0=sorted(date0)
    if date0.count(X)==0:
        print(X)
    else:
        for i in range(1,51):
            C=date0.count(X-i)
            D=date0.count(X+i)
            if C==0:
                print(X-i)
                break
            elif D==0:
                print(X+i)
                break

Measured memory_bytes: 9208
def _main():
  n_book, n_algo, target = map(int, input().split())

  book_infos = []
  for _ in range(n_book):
    book_infos.append(list(map(int, input().split())))

  ans = float('inf')
  def dp(cost, current_levels, current_book):
    if min(current_levels) >= target:
      nonlocal ans
      ans = min(ans, cost)
      return
    for index, book_info in enumerate(book_infos[current_book+1:], current_book+1):
      next_levels = [cur + up for cur, up in zip(current_levels, book_info[1:])]
      dp(cost+book_info[0], next_levels, index)

  dp(0, [0 for _ in range(n_algo)], -1)
  print(ans if ans < float('inf') else -1)
  
_main()

Measured memory_bytes: 9220
#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,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		40010

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//




//
int main(){
	int N ; cin >> N;
	// V V(N);
	// REP(i,N)cin>>V[i];

	vector<pair<int,int>> m1(100010,P(0,0)),m2(100010,P(0,0));
	REP(i,100000)m1[i].second=m2[i].second=i;
	REP(i,N){
		int t; cin>>t;
		if(i%2==0)m1[t].first++;
		else m2[t].first++;
	}

	sort(ALL(m1),[&](P x,P y){return x.first>y.first;});
	sort(ALL(m2),[&](P x,P y){return x.first>y.first;});

	int ans = 0;
	// printf("%d:%d\n",m1[0].first,m1[0].second);
	// printf("%d:%d\n",m1[1].first,m1[1].second);
	// printf("%d:%d\n",m2[0].first,m2[0].second);
	// printf("%d:%d\n",m2[1].first,m2[1].second);

	if(m1[0].second == m2[0].second){
		if(m1[0].first > m2[0].first){
			ans += N/2 - m1[0].first;
			ans += N/2 - m2[1].first;
		}else if(m1[0].first < m2[0].first){
			ans += N/2 - m1[1].first;
			ans += N/2 - m2[0].first;
		}else{
			ans += N/2 - m1[0].first;
			ans += N/2 - max(m1[1].first , m2[1].first);
		}
	}else{
		ans += N/2 - m1[0].first;
		ans += N/2 - m2[0].first;
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 1792
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-02-16 23:50:05
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int n; cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; ++i) {
    string s; cin >> s;
    ++mp[s];
  }

  debug(mp);

  int mx = -1;

  for (auto x : mp) {
    mx = max(mx, x.second);
  }

  debug(mx);


  for (auto x : mp) {
    if (x.second == mx) {
      cout << x.first << '\n';
    }
  }

  return 0;
}

Measured memory_bytes: 23808
using System;
using System.Collections.Generic;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {
        static void Main(string[] args)
        {

            int N = int.Parse(Console.ReadLine());

            //var A = Console.ReadLine().Split(' ')
            //.Select(x => long.Parse(x)).ToList();
            Console.WriteLine(3.1416 * N * 2);
            


        }
       

    }
}


Measured memory_bytes: 18592
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define ba 47
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,a[100005],cnt[2];
vector<pii > ans;
int64 res = 0;
void Solve() {
    read(N);
    
    for(int i = 1 ; i <= N ; ++i) {
	read(a[i]);
	if(a[i] < 0) cnt[0]++;
	else cnt[1]++;
    }
    if(cnt[0] && cnt[1]) {
	int s,t;
	for(int i = 1 ; i <= N ; ++i) res += abs(a[i]);
	for(int i = 1 ; i <= N ; ++i) {
	    if(a[i] >= 0) s = i;
	    if(a[i] < 0) t = i;
	}
	for(int i = 1 ; i <= N ; ++i) {
	    if(a[i] >= 0 && i != s) {
		ans.pb(mp(a[t],a[i]));
		a[t] -= a[i];
	    }
	}
	for(int i = 1 ; i <= N ; ++i) {
	    if(a[i] < 0) {
		ans.pb(mp(a[s],a[i]));
		a[s] -= a[i];
	    }
	}
    }
    else if(cnt[0]) {
	int p = 1;
	for(int i = 2 ; i <= N ; ++i) {
	    if(a[i] > a[p]) p = i;
	}
	res += a[p];
	for(int i = 1 ; i <= N ; ++i) {
	    if(i != p) res += abs(a[i]);
	}
	for(int i = 1 ; i <= N ; ++i) {
	    if(i != p) {
		ans.pb(mp(a[p],a[i]));
		a[p] -= a[i];
	    }
	}
    }
    else {
	int p = 1,q;
	for(int i = 2 ; i <= N ; ++i) {
	    if(a[i] < a[p]) p = i;
	}
	res -= a[p];
	for(int i = 1 ; i <= N ; ++i) {
	    if(i != p) res += a[i];
	}
	if(p == 1) q = 2;
	else q = 1;
	for(int i = 1 ; i <= N ; ++i) {
	    if(i != p && i != q) {
		ans.pb(mp(a[p],a[i]));
		a[p] -= a[i];
	    }
	}
	ans.pb(mp(a[q],a[p]));
    }
    out(res);enter;
    for(auto t : ans) {
	out(t.fi);space;out(t.se);enter;
    }
}
int main(){
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		int n,x;
		int max = -1000000;
		int min = 1000000;
		long sum = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		sc.hasNext();

		for(int i=0;i<n;i++){
			x = sc.nextInt();
			if(min > x){
				min = x;
			}
			if(x > max){
				max = x;
			}
			sum += x;
		}

		System.out.println(min +" "+ max +" "+ sum);
		sc.close();
	}

}

Measured memory_bytes: 41504
#include<iostream>
#include<cmath>

using namespace std;
int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if((a==b&&c==d)||(a==c&&b==d)||(a==d&&b==c)){
        cout << "yes" << endl;
    }else{
        cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
from collections import deque

n, m, q = map(int,input().split())
q_list = []
point_list = []

for i in range(q):
    temp_list = list(map(int,input().split()))
    q_list.append(temp_list)

que = deque()
que.append([1,[]])
ans = 0
temp_list = []

while len(que) != 0:
    temp = que.pop()
    if len(temp[1]) != n:
        temp_list = []
        for i in range(temp[0], m+1):
            for j in temp[1]:
                temp_list.append(j)
            temp_list.append(i)
            que.append([i, temp_list])
            temp_list = []
    else:
        point = 0
        for q in q_list:
            if temp[1][q[1]-1] - temp[1][q[0]-1] == q[2]:
                point += q[3]
        if ans < point:
            ans = point

print(ans)


Measured memory_bytes: 9484
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#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 VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e18 + 7LL;
constexpr ll MOD = 1e9 + 7;

template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
    for (int i = 0; i < v.size(); ++i)
    {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    for (int i = 0; i < v.size() - 1; ++i)
    {
        os << v[i] << " ";
    }
    if (v.size() > 0)
    {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main()
{
    int n;
    cin >> n;
    vint l(n);
    cin >> l;
    sort(l.begin(), l.end());
    ll ans = 0;
    REP(i, n)
    {
        REP(j,n){
            if (i < j){
                int a = l[i], b = l[j];
                auto ite = upper_bound(l.begin(), l.end(), b - a);
                if (ite == l.end())
                {
                    continue;
                }
                auto ite2 = lower_bound(l.begin(), l.end(), a + b);
                int now;
                if (ite - l.begin() < j + 1)
                {
                    now = ite2 - (l.begin() + j + 1);
                }else{
                    now = ite2 - ite;
                }
                if (now > 0) ans += now;
            }
        }
    }
    cout << ans << endl;
}

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

#define int long long

using namespace std;

//int a[100001];
//int b[100001];
string s;

int get (char x) {
	int res = 0;
	string t = s;
	while (1) {
		bool ok = 0;
		for (int i = 0;i < t.size () - 1;i ++) {
			if (t[i] != t[i + 1]) ok = 1; 
		}
		if (!ok) break;
		string tt = "";
		for (int i = 0;i < t.size () - 1;i ++) {
			if (t[i] == x || t[i + 1] == x) tt += x;
			else tt += t[i];
		}
		t = tt;
		res ++;
	}
	return res;
}
		
 main () {
    cin >> s;
    int ans = s.size ();
    for (char x = 'a';x <= 'z';x ++) {
    	ans = min (ans, get (x));
    }
    cout << ans;
    return 0;           		
}

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

const int maxn = 1e5 + 5;
const int inf = 1e9 + 7;
int a[maxn],b[maxn],c[maxn];
long long sum = 0,n,x,y,l,r,mid;


long long slove1(int i){
	l = 1,r = n,mid;
	while(l <= r){
		mid = (l + r) / 2;
		if(b[i] <= a[mid]){
			if(b[i] > a[mid - 1]){
				l = mid - 1;
				break;
			}
			r = mid - 1;
		}
		else l = mid + 1;
	}
	if(l == n + 1) l = n;
	return l;
}

long long slove2(int i){
	l = 1,r = n + 1;
	while(l <= r){
		mid = (l + r) / 2;
		if(b[i] < c[mid]){
			if(b[i] >= c[mid - 1]){
				l = mid;
				break;
			}
			r = mid - 1;
		}
		else l = mid + 1;
	}
	if(l == n + 1) l = 0;
	else l = n - l + 1;
	return l;
}

int main(){
	scanf("%lld",&n);
	for(int i = 1;i <= n;i++) scanf("%d",&a[i]);
	for(int i = 1;i <= n;i++) scanf("%d",&b[i]);
	for(int i = 1;i <= n;i++) scanf("%d",&c[i]);
	sort(a + 1,a + 1 + n);
	sort(b + 1,b + 1 + n);
	sort(c + 1,c + 1 + n);
	a[n + 1] = inf;
	c[n + 1] = inf;
	for(int i = 1;i <= n;i++){
		x = slove1(i);//找出在a数组中,小于b[i]的元素个数。
		y = slove2(i);//找出在c数组中,大于b[i]的元素个数。
		sum += x * y;
	}
	printf("%lld",sum);
}

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L.at(i);
  }
  sort(L.begin(),L.end());
  int sum = 0;
  for (int i = 0; i < N-1; i++) {
    sum += L.at(i);
  }
  if (sum > L.at(N-1)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<ll, ll>> p(n);
    ll money = 0;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        p[i] = make_pair(x,y);
    }

    ll c = 0;

    sort_1(p);

    rep(i,n){
        money += min(m-c, p[i].second)*p[i].first;
        c += p[i].second;
        if(m < c) break;
    }
    cout << money << endl;
}

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

#define all(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int n ;
  cin >> n ;
  vector<int> vec(n) ;
  int count = 0 ;
  rep(i,n){
    cin >> vec.at(i) ;
  }
  rep(i, n-2){
    if(vec.at(i)<vec.at(i+1) && vec.at(i+1)<vec.at(i+2)){
      count++ ;
    }
    else if(vec.at(i)>vec.at(i+1) && vec.at(i+1)>vec.at(i+2)){
      count++ ;
    }
  }
  
  cout << count <<endl ;
  
    
    return 0 ;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

vector<int> to[100005];
pint tree[100005];
int fen = 0, snu = 0, n;

void dfs(int now,int par, int cnt, int p) {
    if(tree[now].first!=INF) {
        if(cnt>=tree[now].first) return;
    }
    tree[now].first = cnt;
    tree[now].second = p;
    rep(i,to[now].size()) {
        if(to[now][i]==par) continue;
        dfs(to[now][i], now, cnt+1, p);
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    rep(i,n) tree[i].first = INF;
    rep(i,n-1) {
        int a, b; cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    dfs(0, -1, 0, 0);
    dfs(n-1, -1, 0, 1);
    rep(i,n) {
        if(tree[i].second==0) fen++;
        else snu++;
    }
    if(snu>=fen) cout << "Snuke" << endl;
    else cout << "Fennec" << endl;


    return 0;
}

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

int main() {
    long long n, x, ans=1;
    cin >> n;
    map<int, int> cnt;
    for(int i=2; i<=n; i++) {
        x=i;
        for(int j=2; j<=i*i; j++) {
            while(x%j==0) {
                if(cnt.count(j)) cnt[j]++;
                else cnt[j]=1;
                x /=j;
            }
            if(x==1) break;
        }
        if(x!=1) cnt[x]=1;
    }
    for(int i=2; i<=n; i++) {
        if(cnt.count(i)) {
            ans*=(cnt[i]+1);
        }
        ans%=1000000007;
    }
    cout << ans;
}

Measured memory_bytes: 256
// need to be reviwed
  
#include<bits/stdc++.h>

using namespace std;

int sum[100100]; bool arr[100100];


void eratosthenes(){
  for(int i = 0; i < 100100; i++){
    arr[i] = true;}
  
  arr[0] = false; arr[1] = false;
  
  for(int i = 2; i < 100100; i++){
    if( arr[i]){
      for(int j = 2; i* j < 100100; j++){
        arr[i * j] = false;}}}
}

void Sumtable(){
  //100010以下の2017に似た数を検索
  
  for(int i = 0; i < 100010; i++){
    if( arr[i] && arr[( i + 1) / 2] && i % 2 == 1){
      sum[i+1] = sum[i] + 1;}
    else{ 
      sum[i+1] = sum[i];}}
}

int main(){
  int Q; cin >> Q;
  
  eratosthenes();
  
  for(int i = 0; i < 100100; i++){
    sum[i] = 0;}
  
  Sumtable();
  
  for(int i = 0; i < Q; i++){
    int l,r;cin >> l >> r;
    cout << sum[r+1] - sum[l] << endl;}
  
  return 0;}

Measured memory_bytes: 1152
#include <stdio.h>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    map<int, int> pt, rank;
    vector<int> ps;
    for (;;) {
        int x, y;
        scanf("%d,%d", &x, &y);
        if (x == 0 && y == 0) break;
        pt[x] = y;
        ps.push_back(y);
    }
    sort(ps.begin(), ps.end());
    ps.erase(unique(ps.begin(), ps.end()), ps.end());
    rep (i, ps.size()) rank[ps[i]] = ps.size()-i;
    int k;
    while (scanf("%d", &k) != EOF) printf("%d\n", rank[pt[k]]);
    return 0;
}

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

ll N,T,t[200010],ans;

int main() {
  cin >> N >> T;
  rep(i,N){
    cin >> t[i];
  }
  ans=0;
  rep(i,N-1){
    if (t[i+1]-t[i]<T){
      ans+=t[i+1]-t[i];
    }
    else{
      ans+=T;
    }
  }
  ans+=T;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
import std.functional,
       std.algorithm,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.math;

T read_num(T)() { return readln.chomp.to!T; }

T min(T)(T a, T b) { return a < b ? a : b; }

void main() {
  long N = read_num!long;
  long A = read_num!long;
  long B = read_num!long;
  long C = read_num!long;
  long D = read_num!long;
  long E = read_num!long;
  long x = min(A, min(B, min(C, min(D, E))));

  long ans = 4 + N / x;
  ans += !!(N % x);

  writeln(ans);
}

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

int main(){
  int k;
  cin >> k;
  int a, b;
  cin >> a >>b;
  for(int i = a; i<=b;i++){
    if(i%k==0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int> p(n);
  for(int i = 0; i < n; i++)
    cin >> p.at(i);
  
  sort(p.begin(), p.end());
  int sum = 0;
  for(int i = 0;i < n; i++){
    if(i == n -1)
      sum+=p.at(i) / 2;
    else
      sum += p.at(i);
  }
  cout << sum;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"

using namespace std;

int V, E, o;
int dis[16][16], dp[16][1<<16];

int solve(int s, int state)
{
	if (~dp[s][state])
	{
		return dp[s][state];
	}
	if (state == (1<<V)-1)
	{
		return dp[s][state] = dis[s][o];
	}
	int res = INT_MAX;
	for (int i = 0; i < V; i++)
	{
		if (state >> i & 1) continue;
		res = min(res, solve(i, state | 1 << i) + dis[s][i]);
	}
	return dp[s][state] = res;
}

int main()
{
	cin >> V >> E;
	memset(dis, -1, sizeof(dis));
	while(E--)
	{
		int s, t, w;
		cin >> s >> t >> w;
		dis[s][t] = w;
	}
	for (int s = 0; s < V; s++)
	{
		for (int t = 0; t < V; t++)
		{
			if (dis[s][t] == -1)
			{
				dis[s][t] = 1000000;
			}
		}
	}
	int ans = INT_MAX;
	for (int s = 0; s < V; s++)
	{
		o = s;
		memset(dp, -1, sizeof(dp));
		ans = min(ans, solve(s, 1<<s));
	}
	if (ans > 1000000)
	{
		ans = -1;
	}
	cout << ans << endl;
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



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

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  for (int i = 0; i < 3; ++i){
    string s;
    cin >> s;
    char c = s[i];
    cout << c;
  }
  cout << endl;
}

Measured memory_bytes: 256
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<bits/stdc++.h>
#define inf  1000000000
const long long int N = 6999999;
#define all(x) begin(x),end(x)
#define ll long long int
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
using namespace std;

int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll a,b,x,y;
  cin >> a >> b >> x >> y;
  if (a == x+x && b == y+y)
  {
    printf("%.10f 1\n",(a*b)/2.0);
  }
  else
  {   
    printf("%.10f 0\n",(a*b)/2.0);
  }
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int n ,a;
    cin >> n >> a;
    
    int tmp = n % 500;
    cout << (tmp <= a ? "Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long
#define ld                  long double
#define pb                  push_back
#define mkp                 make_pair
#define f(i,l,h)            for(ll i=l;i<h;i++)
#define fr(i,h,l)           for(ll i=h;i>=l;i--)
#define mem(a,val)          memset(a,val,sizeof(a))
#define all(v)              (v).begin(),(v).end()
#define ff                  first
#define ss                  second
#define spc(x)              cout<<fixed<<setprecision((x));
#define deb(x)              cout<<#x<<" "<<x<<endl;
#define deba(x)             cout<<#x<<": "; for(auto u:x) cout<<u<<" ";  cout<<endl;
#define check               cout<<"hello"<<endl;
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
const ld pi=3.141592653589793;
const ll mod=998244353;
const ll INF=(ll)(1e9+7);
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

ll power(ll a,ll b){
    ll res=1;
	while(b){
	    if(b&1) res=(res*a);
	    a=(a*a);
	    b>>=1;
	}
	return res;
}

int main()
{
    //cout << "Hello world!" << endl;
    string s,t;
    cin>>s>>t;
    ll n=s.length(),m=t.length();
    ll dp[n+1][m+1];

    f(i,0,n+1){
        f(j,0,m+1){
            if(i==0 || j==0){
                dp[i][j]=0;
                continue;
            }
            if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    ll i=n,j=m;
    string ans="";
    while(i!=0 && j!=0){
        if(s[i-1]==t[j-1]){
            ans+=s[i-1];
            i--;j--;
        }else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }else{
            j--;
        }
    }
    reverse(all(ans));
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 73988