akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct TopologicalSort{
  Int n;
  vector<set<Int> > G;
  vector<bool> used;
  vector<Int> indeg,p;
  
  TopologicalSort(){}
  TopologicalSort(Int sz):n(sz),G(n),used(n),indeg(n),p(0){}

  void add_edge(Int s,Int t){
    G[s].insert(t);
  }
  
  void bfs(Int s){
    queue<Int> q;
    q.push(s);
    used[s]=1;
    while(!q.empty()){
      Int v=q.front();q.pop();
      p.push_back(v);
      for(Int u:G[v]){
        indeg[u]--;
        if(indeg[u]==0&&!used[u]){
          used[u]=1;
          q.push(u);
        }
      }
    }
  }
  
  vector<Int>  build(){
    fill(used.begin(),used.end(),0);
    fill(indeg.begin(),indeg.end(),0);
    
    for(Int i=0;i<n;i++)
      for(Int v:G[i]) indeg[v]++;
    
    for(Int i=0;i<n;i++)
      if(indeg[i]==0&&!used[i]) bfs(i);
    
    return p;
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  TopologicalSort ts(n);
  vector<vector<Int> > G(n);
  vector<Int> ind(n,0);
  for(Int i=0;i<n-1+m;i++){
    Int a,b;
    cin>>a>>b;
    a--;b--;
    ts.add_edge(a,b);
    G[a].emplace_back(b);
    ind[b]++;
  }
  auto ord=ts.build();
  vector<Int> rev(n),ans(n,-1);
  for(Int i=0;i<n;i++) rev[ord[i]]=i;
  for(Int v:ord){
    for(Int u:G[v]){
      ind[u]--;
      //cout<<v<<" -> "<<u<<endl;
      if(ind[u]==0) ans[u]=v;
    }
  }  
  for(Int x:ans) cout<<x+1<<endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  if ((N / 1000 == (N % 1000) / 100) && ((N % 1000) / 100 == (N % 100) / 10) || ((N % 1000) / 100 == (N % 100) / 10) && ((N % 100) / 10 == N % 10))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    nums = [10]*n
    result = None
    for _ in range(m):
        s, e = map(int, input().split())
        if nums[s-1] == 10:
            nums[s - 1] = e
        else:
            if nums[s - 1] != e:
                result = '-1'
                break

    for i in range(n):
        if i == 0 and nums[i] == 10 and len(nums) > 1:
            nums[i] = 1
        elif nums[i] == 10:
            nums[i] = 0

    if result == '-1':
        print('-1')
    elif nums[0] == 0 and len(nums) > 1:
        print('-1')
    else:
        print(''.join(map(str, nums)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
def main():
    N, T = map(int, input().split())
    t = list(map(int, input().split()))

    ans = 0
    for i in range(1, N):
        if t[i]-t[i-1] >= T:
            ans += T
        else:
            ans += (t[i]-t[i-1])
    ans += T

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 26708
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  ll cnt = 0;
  rep(i,s.size()){
    if(s[i] == '1') cnt++;
  }

  cout<<cnt<<endl;

}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n;
    std::cin>>n;
    struct point{
        int x;
        int y;
        bool flag;
    };
    std::vector<point> r, b;
    for(int i = 0;i < n;i++){
        int x, y;
        std::cin>>x>>y;
        r.push_back({x, y, false});
    }
    for(int i = 0;i < n;i++){
        int x, y;
        std::cin>>x>>y;
        b.push_back({x, y, false});
    }

    std::sort(b.begin(), b.end(),
            [](point& a, point& b) -> bool {
                return a.x < b.x;
            });
    int cnt = 0;
    for(int i = 0;i < n;i++){
        int max = -1;
        for(int j = 0;j < n;j++){
            if(!r[j].flag && r[j].x < b[i].x &&
                    r[j].y < b[i].y){
                if(max == -1 || r[j].y > r[max].y){
                    max = j;
                }
            }
        }
        if(max != -1){
            r[max].flag = true;
            ++cnt;
        }
    }
    std::cout<<cnt<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

const int mod = 1000000007;

struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
bool operator==(const mint& a, const mint& b) { return a.x == b.x;}

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

    int n;
    cin >> n;

    auto dp = make_vec<mint>(n+1, 4, 4, 4);
    dp[0][3][3][3] = 1;
    rep(i, n) rep(c1, 4) rep(c2, 4) rep(c3, 4) {
        rep(c4, 4) {
            if (c2 == 0 && c3 == 2 && c4 == 1) continue;
            if (c2 == 0 && c3 == 1 && c4 == 2) continue;
            if (c2 == 2 && c3 == 0 && c4 == 1) continue;
            if (c1 == 0 && c3 == 2 && c4 == 1) continue;
            if (c1 == 0 && c2 == 2 && c4 == 1) continue;
            dp[i+1][c2][c3][c4] += dp[i][c1][c2][c3];
        }
    }

    mint ans = 0;
    rep(c1, 4) rep(c2, 4) rep(c3, 4) ans += dp[n][c1][c2][c3];
    cout << ans << endl;
}


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

using namespace std;

const int N = 2e5 + 10;
int n, k, a[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    int l = 1, r = 1e9, res = 0;
    while (l <= r) {
        int mid = l + r >> 1;
        long long tot = 0;
        for (int i = 1; i <= n; i++)
            tot += (a[i] + mid - 1) / mid - 1;
        if (tot <= k)
            res = mid, r = mid - 1;
        else
            l = mid + 1;
    }
    cout << res << endl;

    return 0;
}

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

int N;
int L;
int as[114514];

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

  for (int i=1; i<N; i++) {
    if (as[i-1] + as[i] >= L) {
      puts("Possible");
      for (int j=1; j<i; j++) {
        printf("%d\n", j);
      }
      
      for (int j=N-1; j>=i; j--) {
        printf("%d\n", j);
      }
      return 0;
    }
  }

  puts("Impossible");
}


Measured memory_bytes: 1152
n = int(input())
t = {}
for i in range(n):
    s = input()
    if s in t:
        t[s] += 1
    else:
        t[s] = 1
ver = ['AC', 'WA', 'TLE', 'RE']
for v in ver:
    if v in t:
        res = t[v]
    else:
        res = 0
    print(v + ' x ' + str(res))


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

using namespace std;

const int MOD=1000000007;

int arr[102];
long long dp[102][100003];
long long kum[102][100003];

int main () {
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	dp[1][0]=kum[1][0]=1;
	for(int i=1;i<=k;i++){
		if(i<=arr[1]) dp[1][i]=1;
		kum[1][i]=kum[1][i-1]+dp[1][i];
	}
	for(int i=2;i<=n;i++){
		dp[i][0]=kum[i][0]=1;
		for(int j=1;j<=k;j++){
			if(j<=arr[i]) dp[i][j]=kum[i-1][j]%MOD;
			else dp[i][j]=(kum[i-1][j]-kum[i-1][j-arr[i]-1]+MOD)%MOD;
			kum[i][j]=(kum[i][j-1]+dp[i][j])%MOD;
		}
	}
	cout<<dp[n][k]%MOD;


return 0;
}



Measured memory_bytes: 158080
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b_i = list([int(input()) for _ in range(N)])
ans = "No"

for bi in b_i:
    for i in range(3):
        for j in range(3):
            if A[i][j] == bi:
                A[i][j] = "hole"
# 横
for i in range(3):
    if A[i][0] == "hole":
        if A[i][1] == "hole" and A[i][2] == "hole":
            ans = "Yes"

# 縦
for i in range(3):
    if A[0][i] == "hole":
        if A[1][i] == "hole" and A[2][i] == "hole":
            ans = "Yes"

if A[0][0] == "hole" and A[1][1] == "hole" and A[2][2] == "hole":
    ans = "Yes"

if A[0][2] == "hole" and A[1][1] == "hole" and A[2][0] == "hole":
    ans = "Yes"

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int a[7],b[4];
int main()
{
    int k;
    for(int i=0;i<6;i++) scanf("%d",&k),a[k]++;
    for(int i=1;i<=4;i++) b[a[i]]++;
    if(b[1]==2&&b[2]==2) printf("YES\n");
    else printf("NO\n");
}


Measured memory_bytes: 256
/*---> 26 January 2020 <--- > 18:50:44 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e3+5;
int A[N],B[N],n,h;
int dp[N][10*N];
int solve(int ind,int cur){
	if(cur<=0)
		return 0;
	if(ind==n){
		return inf;
	}
	int &ans=dp[ind][cur];
	if(ans!=-1)
		return ans;
	return ans=min(B[ind]+solve(ind,cur-A[ind]),solve(ind+1,cur));
}
int32_t main(){__
	cin>>h>>n;
	memset(dp,-1,sizeof dp);
	for(int i=0;i<n;i++)
		cin>>A[i]>>B[i];
	cout<<solve(0,h)<<"\n";
return 0;
}

Measured memory_bytes: 79744
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    a=a*1;
    b=b*5;
    c=c*10;
    d=d*50;
    e=e*100;
    f=f*500;
    if(a+b+c+d+e+f>999){cout<<1<<endl;}else{cout<<0<<endl;}
}


Measured memory_bytes: 3100
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    auto S = sread();
    DList!char stack;
    foreach (i, c; S)
    {
        if (!stack.empty && stack.back == 'S' && c == 'T')
        {
            stack.removeBack();
        }
        else
        {
            stack.insertBack(c);
        }
    }
    long ans;
    foreach (_; stack)
    {
        ans++;
    }
    writeln(ans);
}


Measured memory_bytes: 10232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
struct edge{int to; ll cost;};
typedef pair<ll,int> P;
const ll INF = 1e17;

void dijkstra(int n, int s, vector<vector<edge>>& g, vector<ll>& d){
  priority_queue<P,vector<P>,greater<P>> que;
  rep(i,n) d[i] = INF;
  d[s] = 0;
  que.push(P(0,s));
  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(auto e : g[v]){
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<edge>> g(n);
  int ans[n];
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(edge{b,1});
    g[b].push_back(edge{a,1});
  }
  vector<ll> d(n);
  dijkstra(n,0,g,d);
  for(int i = 1; i < n; i++) {
    for(auto e : g[i]) {
      if(d[e.to] == d[i]-1) ans[i] = e.to; 
    }
  }
  cout << "Yes" << endl; 
  for(int i = 1; i < n; i++) cout << ans[i]+1 << endl;
  return 0;
}


Measured memory_bytes: 18732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

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

    ll ans = 0;
    for (ll x = 1; x * x < n; x++) {
        if (n % x != 0) continue;
        ll m = (n / x) - 1;
        if (x < m) ans += m;
    }

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

Measured memory_bytes: 256
# AtCoder Beginner Contest 166: B (2020/05/03)
N, K = map(int, input().split())
A = [0 for i in range(N)]
for j in range(K):
    d = int(input())
    l = input().split()
    for i in range(d):
        A[int(l[i])-1] = A[int(l[i])-1] + 1
ans = 0
for i in range(N):
    if A[i] == 0:
        ans = ans + 1
print(ans)

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

int main(){
  ll n,r; cin >> n >> r;
  ll ret = r;
  if(n<10) ret=r+100*(10-n);
  cout << ret;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2100000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

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

ll LCM(ll a, ll b){
	return a/GCD(a,b)*b;
}

vector<ll> fac(MAX), finv(MAX), inv(MAX);

void comInit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(ll 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;
	}
}


ll com(ll n, ll k){
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

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

ll modpow(ll x, ll n, ll mod){
	ll res = 1;
	while(n > 0){
		if(n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

int main(){
	ll n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	vl v(1010101,0);
	map<ll,ll> pr;
	rep(i,n){
		auto pri = prime_factor(a[i]);
		for(auto j : pri){
			chmax(v[j.first],j.second);
		}
	}
	vpl t;
	rep(i,1000001){
		if(v[i]) t.emplace_back(i,v[i]);
	}
	ll lc = 1;
	for(auto i : t){
		lc *= modpow(i.first,i.second,mod);
		lc %= mod;
	}
	comInit();
	ll ans = 0;
	rep(i,n){
		ans += lc*inv[a[i]]%mod;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 57856
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {
		FastScanner scanner = new FastScanner();
		long h=scanner.nextLong();
		long w=scanner.nextLong();
		long tmp1=a(h,w);
		long tmp2=a(w,h);
		long tmp3=b(h,w);
		long tmp4=b(w,h);
		System.out.println(Math.min(Math.min(tmp1, tmp2), Math.min(tmp3, tmp4)));
	}

	private static long b(long h, long w) {
		long min=Long.MAX_VALUE;
		for (int i = 1; i <= h - 1; i++) {
			long[] s = new long[3];
			s[0] = i * w;
			s[1] = (h - i) * (w - (w / 2));
			s[2] = (h - i) * (w / 2);
			Arrays.sort(s);
			min=Math.min(min, s[2]-s[0]);
		}
		return min;
	}

	private static long a(long h, long w) {
		if(h%3==0){
			return 0;
		}else{
			long min=Long.MAX_VALUE;
			for(int i=1;i<h;i++){
				long[] s=new long[3];
				s[0]=i*w;
				s[1]=(h-i)/2*w;
				s[2]=((h-i)-(h-i)/2)*w;
				Arrays.sort(s);
				min=Math.min(min, s[2]-s[0]);
			}
			return min;
		}
	}
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), s1(n+1, 0), s2(n+1, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s1[i+1] = s1[i] + a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        s2[i+1] = s2[i] + b[i];
    }
    
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int s = s1[i] + s2[n] - s2[i-1];
        ans = max(ans, s);
    }
    
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i < 10; ++i)
    for (int j = 1; j < 10; ++j)
      if (i * j == n) {
        cout << "Yes";
        return 0;
      }
  cout << "No";
  return 0;
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)

L = Hash.new
PL = [[0, -1]]

A.each_with_index do |a, i|
  while PL.last[0] > a
    PL.pop
  end

  L[a] = PL.last[1] + 1
  PL << [a, i]
end

R = Hash.new
PR = [[0, -1]]

A.reverse.each_with_index do |a, i|
  while PR.last[0] > a
    PR.pop
  end

  R[a] = PR.last[1] + 1
  PR << [a, i]
end

ans = 0
A.each_with_index do |a, i|
  l = i - L[a] + 1
  r = N - R[a] - i

  ans += a * l * r
end

puts ans


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

using namespace std;

const int mod = 1e9 + 7;

int add(int a, int b) {
  return a + b - mod * (a + b >= mod);
}

int mul(int a, int b) {
  return int(1ll * a * b % mod);
}

int pwr(int a, int x) {
  if (x == 0) {
    return 1;
  }
  return mul(pwr(mul(a, a), x >> 1), (x & 1 ? a : 1));
}

int dvd(int a, int b) {
  return mul(a, pwr(b, mod - 2));
}

int sub(int a, int b) {
  return a - b + mod * (a < b);
}

void inc(int& a, int b) {
  a = add(a, b);
}

void dec(int& a, int b) {
  a = sub(a, b);
}

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

  int n, k;
  cin >> n >> k;
  vector<int> a(n), f(n + 1);
  f[0] = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    f[i + 1] = mul(i + 1, f[i]);
  }
  sort(a.begin(), a.end());
  auto C = [&f](int n, int k) {
    if (k < 0 or k > n) {
      return 0;
    }
    return dvd(f[n], mul(f[n - k], f[k]));
  };
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    inc(a[i], mod);
    inc(ans, mul(a[i], C(i, k - 1)));
    dec(ans, mul(a[i], C(n - i - 1, k - 1)));
  }
  cout << ans;

  return 0;
}

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

#define int long long

main()
{
  int n;
  int pos[200005];
  int ans = 0;
  set < int > st;

  st.insert(-1);
  cin >> n;
  st.insert(n);
  for(int i = 0; i < n; i++) {
    int a;
    cin >> a;
    pos[a] = i;
  }
  
  for(int i = 1; i <= n; i++) {
    int g;
    st.insert(pos[i]);
    set < int >::iterator it = st.find(pos[i]);
    
    it--;
    g = (pos[i] - *it);
    it++, it++;
    g *= (*it - pos[i]);
    ans += g * i;
  }

  cout << ans << endl;

  return (0);
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define INF 2500
typedef pair<int, int> P;
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
int main() {
  int h, w;
  cin >> h >> w;
  string maze[h];
  int d[h][w], cnt = 0;
  rep(i,h)
  {
    cin >> maze[i];
    rep(j,w)
      cnt += (maze[i][j] == '#');
  }
  fill(d[0], d[h], INF);
  queue<P> que;
  que.push(P(0, 0));
  d[0][0] = 1;
  while (!que.empty()) {
    P p = que.front();
    que.pop();
    if (p.first == h - 1 && p.second == w - 1)
      break;
    rep(i,4)
    {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if (0 <= nx && nx < h && 0 <= ny && ny < w && maze[nx][ny] != '#'
          && d[p.first][p.second] + 1 < d[nx][ny]) {
        que.push(P(nx, ny));
        d[nx][ny] = d[p.first][p.second] + 1;
      }
    }
  }
  if (d[h - 1][w - 1] != INF)
    cout << h * w - cnt - d[h - 1][w - 1];
  else
    cout << -1;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string t,s;
  	int nt,ns,i,j;
  	cin>>s>>t;
  	ns=s.length(),nt=t.length();
  	int ans=100000,cnt;
  	for(i=0;i<ns-nt+1;i++)
  	{
  	    cnt=0;
  	    for(j=0;j<nt;j++)
  	    {
  	        if(s[i+j]!=t[j])cnt++;
  	    }
  	    ans=min(ans,cnt);
  	}
  	cout<<ans<<"\n";
  	return 0;
}


Measured memory_bytes: 3628
import sys
e=sys.stdin.readline
for _ in[0]*int(e()):
 X,z=e(),[]
 for y in e():
  s=i=0
  for k in z:
   t=X.find(y,s)+1
   if t<1:break
   if t<k:z[i]=t
   s=k;i+=1
  else:
   t=X.find(y,s)+1
   if t:z+=[t]
 print(len(z)-1)


Measured memory_bytes: 5620
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;
use std::io::Write;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = readn(n);

    let mut ans = 0;
    for i in 0..n {
        ans += a[i] / 2;
        a[i] %= 2;
        if i+1 < n && a[i] >= 1 && a[i+1] >= 1 {
            ans += 1;
            a[i+1] -= 1;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

long long cnt;
int l, a[1000000], n;
vector<int> G;

void insertion_sort(int a[], int n, int g)
{
	for(int i = g; i < n; i++)
	{
		int v = a[i];
		int j = i - g;
		while(j >= 0 && a[j] > v)
		{
			a[j + g] = a[j];
			j -= g;
			cnt++;
		}
		a[j + g] = v;
	}
}

void shell_sort(int a[], int n)
{
	for(int h = 1; ; )
	{
		if(h > n)
		{
			break;
		}
		G.push_back(h);
		h = 3 * h + 1;
	}
	for(int i = G.size()-1; i >= 0; i--)
	{
		insertion_sort(a,n,G[i]);
	}
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	cnt = 0;
	shell_sort(a,n);
	cout << G.size() << endl;
	for(int i = G.size() - 1; i >= 0; i--)
	{
		printf("%d", G[i]);
		if(i)
		{
			printf(" ");
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i = 0; i < n; i++)
	{
		cout << a[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 7196
#include <iostream>
#include <vector>
#include <cmath>
#include <utility>

template<typename F>
constexpr decltype(auto) fix(F&& f) {
	return[f = std::forward<F>(f)](auto&&... args) {
		return f(f, std::forward<decltype(args)>(args)...);
	};
}

int msbval(int x) {
	x = (x & 0xffff0000) ? (x & 0xffff0000) : x;
	x = (x & 0xff00ff00) ? (x & 0xff00ff00) : x;
	x = (x & 0xf0f0f0f0) ? (x & 0xf0f0f0f0) : x;
	x = (x & 0xcccccccc) ? (x & 0xcccccccc) : x;

	return (x & 0xaaaaaaaa) ? (x & 0xaaaaaaaa) : x;
}

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

	std::vector<int> vec(n);

	char prev;
	std::cin >> prev;
	bool hasOne = false;
	for (int i = 0; i < n - 1; ++i) {
		char c;
		std::cin >> c;

		vec[i] = std::abs(c - prev);
		if (vec[i] == 1)
			hasOne = true;

		prev = c;
	}

	if (hasOne) {
		for (auto&& e : vec)
			e = e % 2;
	}
	else
		for (auto&& e : vec)
			e = e / 2;

	int ans = fix([&](auto f, int i, int height) -> int {
		if (height == 0)
			return vec[i];

		int x = msbval(height);
		return f(f, i, height - x) ^ f(f, i + x, height - x);
	})(0, n - 2);

	std::cout << (hasOne ? ans : ans * 2) << std::endl;
}

Measured memory_bytes: 4096
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next();
  var a = nextm(n,2);
  a.sort((a,b) => a[0]-b[0]);
  var m = n >> 1;
  if(n & 1){
    var ans = -a[m][0];
    a.sort((a,b)=>a[1]-b[1]);
    ans += a[m][1]+1;
  }else{
    var ans = a[m][0]+a[m-1][0];
    a.sort((a,b)=>a[1]-b[1]);
    ans -= a[m][1]+a[m-1][1];
    ans = -ans+1;
  }
  return ans;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  string s; std::cin >> s;
  int q; std::cin >> q;
  vector<set<int>> cnt(26);
  rep(i, n) {
    cnt[s[i]-'a'].insert(i);
  }
  rep(i, 26) {
    cnt[i].insert(n);
  }
  rep(i, q) {
    int t; std::cin >> t;
    if (t == 1) {
      int i; std::cin >> i; --i;
      char c; std::cin >> c;
      if (s[i] == c) continue;
      cnt[s[i]-'a'].erase(i);
      cnt[c-'a'].insert(i);
      s[i] = c;
    } else {
      int l, r; std::cin >> l >> r; --l, --r;
      int sum = 0;
      rep(i, 26) {
        int pos = *cnt[i].lower_bound(l);
        if (pos <= r) sum++;
      }
      std::cout << sum << "\n";
    }
  }
}


Measured memory_bytes: 24348
#include <iostream>
using namespace std;
int k[256] = {0};
bool ok() {
  if(k[1] % 2 == 0) return false;
  if(k[2] % 2 == 0) return false;
  for(int i=3; i<256; i++) {
    if(k[i] % 2 == 1) return false;
  }
  return true;
}
int main() {
  int a, b;
  while (cin >> a >> b) {
    k[a]++;
    k[b]++;
    if (a == 0) {
      if (ok()) cout << "OK" << endl;
      else cout << "NG" << endl;
      for (int i=0; i<256; i++) k[i] = 0;
    }
  }
}

Measured memory_bytes: 1156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

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

            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).OrderByDescending(x => x).ToArray();
            
            Console.WriteLine(input[0] < input.Skip(1).Sum()? "Yes":"No");
        }
    }
}

Measured memory_bytes: 13396
def main():
    H, W, h, w = map(int, input().split())
    p = 4000
    q = h*w-1
    a = [[p]*W for _ in [0]*H]
    for i in range(H//h):
        for j in range(W//w):
            a[(i+1)*h-1][(j+1)*w-1] = -p*q-1
    if sum([sum(i) for i in a]) <= 0:
        print("No")
    else:
        print("Yes")
        for i in a:
            print(*i)


main()

Measured memory_bytes: 10640
//専用ライブラリ
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int cmp(P a,P b){
        if(a.fi!=b.fi)
        return a.fi>b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------
struct unionfind{
    vector<int> rank,parent,size;
    unionfind(int n){
        for(int i=0;i<n;i++){
            rank.push_back(1);//树的高度
            parent.push_back(i);//根
            size.push_back(1);//树大小
        }
    }
    int getroot(int x){
        if(parent[x]==x)
            return x;
        return parent[x]=getroot(parent[x]);//押平路径加速以后的查找
    }
    bool issame(int a,int b){
        return getroot(a)==getroot(b);
    }
    void unite(int a,int b){
        a=getroot(a);
        b=getroot(b);
        if(a==b)
            return;
        else if(rank[a]>rank[b]){ //合并到高的树下
            parent[b]=a;
            size[a]+=size[b];
        }
        else if(rank[a]==rank[b]){
            parent[b]=a;
            rank[a]++;
            size[a]+=size[b];
        }
        else{
            parent[a]=b;
            size[b]+=size[a];
        }
    }
};
int n,m;
vector<vector<int> >M;
//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    cin>>n>>m;
    M.resize(m);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int a;
            cin>>a;
            a--;
            M[a].push_back(i);
        }
    }
    unionfind uf(n);
    for(int i=0;i<m;i++){
        if(M[i].size()>1){
            for(int j=1;j<M[i].size();j++){
                if(!uf.issame(M[i][0],M[i][j]))
                    uf.unite(M[i][0],M[i][j]);
            }
        }
    }
    int ans=-1;
    for(int i=0;i<n;i++)
        ans=std::max(ans,uf.size[uf.getroot(i)]);
    if(ans==n)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

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

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 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; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 




int main() {
int N;
cin >> N;
int ge = 200 * (N / 15);

int ans = N * 800 - ge;

print(ans);

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define int long long
const int mod=1e9+7;
int dp[65][2][2][2];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
int solve(int l,int r,int len,int lim1,int lim2,int zero)
{
	if(len<0)return 1;
	int &ans=dp[len][lim1][lim2][zero];
	if(ans!=-1)return ans;
	ans=0;
	int up2=lim2?((r>>len)&1):1;
	int up1=lim1?((l>>len)&1):0;
	for(int i=up1;i<=1;i++)
		for(int j=0;j<=up2;j++)
		{
			if (i>j)continue;
			if(zero&&i!=j)continue;
			(ans+=solve(l,r,len-1,lim1&&i==up1,lim2&&j==up2,zero&&j==0))%=mod;
		}
	return ans;	
}
signed main()
{
	memset(dp,-1,sizeof(dp));
	int L=read(),R=read();
	cout<<solve(L,R,60,1,1,1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	
	int a,b,c,d,a1,b1,c1,d1;
    long long r=0,n;
	cin>>a>>b>>c>>d>>n;
	a1=a;
  	b1=min(a*2,b);
	c1=min(a*4,min(b*2,c));
	d1=min(a*8,min(b*4,min(c*2,d)));
	n*=4;
	for(;n>=8;){
		n-=8;
		r+=d1;
	}
	for(;n>=4;){
		n-=4;
		r+=c1;
	}
	for(;n>=2;){
		n-=2;
		r+=b1;
	}
	for(;n>=1;){
		n-=1;
		r+=a1;
	}
	cout<<r<<endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <stdio.h>

int isPrime(int);

int main()
{
  int n,x,i,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(isPrime(x)) count++;
  }
  printf("%d\n",count);
  
  return 0;
} 
int isPrime(int x)
{
  int i;
  if(x<2) return 0;
  if(x==2) return 1;
  if(x%2==0) return 0;
  for(i=3;i*i<=x;i+=2){
  if(x%i==0) return 0;
  }
  return 1;
}
  

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fori(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
const int ma=1e5+5;
int n,id[ma],ce=0;
struct oo {int x,y,t;};
oo a[ma],e[2*ma];
bool ssx(oo a,oo b) {return a.x<b.x;}
bool ssy(oo a,oo b) {return a.y<b.y;}
bool ss(oo a,oo b) {return a.t<b.t;}
int _set(int u) {return id[u]<0?u:(id[u]=_set(id[u]));}
void _union(int u,int v)
{
    u=_set(u),v=_set(v);
    if(id[u]>id[v]) swap(u,v);
    id[u]+=id[v];
    id[v]=u;
}
main()
{
    //freopen("dbuilt.inp","r",stdin);
    cin>>n;
    fori(i,1,n)
    {
        cin>>a[i].x>>a[i].y;
        a[i].t=i;
    }
    sort(a+1,a+n+1,ssx);
    fori(i,1,n-1)
    {
        e[++ce]={a[i].t,a[i+1].t,a[i+1].x-a[i].x};
    }
    sort(a+1,a+n+1,ssy);
    fori(i,1,n-1)
    {
        e[++ce]={a[i].t,a[i+1].t,a[i+1].y-a[i].y};
    }
    sort(e+1,e+ce+1,ss);
    memset(id,-1,sizeof(id));
    int kq=0;
    fori(i,1,ce)
    {
        if(_set(e[i].x)!=_set(e[i].y))
        {
            _union(e[i].x,e[i].y);
            kq+=e[i].t;
        }
    }
    cout<<kq;

}


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

int main() {
  int N, T, c, t; cin >> N >> T;
  int minc = 1100;
  bool flag = false;
  for(int i = 0; i < N; i++) {
    cin >> c >> t;
    if(t <= T) {
      minc = min(minc, c);
      flag = true;
    }
  }
  if(flag) cout << minc << endl;
  else cout << "TLE" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,b,c,k,i,n;
    scanf("%d%d%d",&a,&b,&k);
    n=0;
    if(a>b)
        c=a;
    else 
        c=b;
        
    for(i=c;i>=1 ;i--){
       if (a%i == 0 && b%i == 0)
        n++;
        if(n == k){
            printf("%d",i);
            return 0;             
       }
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << endl; exit(0);}

int main()
{
  ll N;
  cin >> N;
  string S;
  cin >> S;
  string ans = "";
  for (ll i = 0; i < N; i++)
  {
    ans += ' ';
  }

  vector<string> sw = {"SS", "SW", "WS", "WW"};
  for (ll q = 0; q < 4; q++)
  {
    ans.at(0) = sw.at(q).at(0);
    ans.at(1) = sw.at(q).at(1);
    for (ll i = 1; i < N - 1; i++)
    {
      bool b = (S.at(i) == 'o') ^ (ans.at(i - 1) == 'S') ^ (ans.at(i) == 'S');
      ans.at(i + 1) = b ? 'S' : 'W';
    }

    if (((S.at(N - 1) == 'o') ^ (ans.at(N - 1) == 'S')) != ((ans.at(N - 2) == 'S') ^ (ans.at(0) == 'S')))
      continue;
    if (((S.at(0) == 'o') ^ (ans.at(0) == 'S')) != ((ans.at(N - 1) == 'S') ^ (ans.at(1) == 'S')))
      continue;

    FINALANS(ans);
  }

  FINALANS(-1);
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
const int maxn = 50;
char a[maxn];
int main()
{
	cin>>a;
	for(int i = 0; i < strlen(a); i++)
	{
		if(a[i] == 'A' && a[i+1] == 'C')
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a,b,n,ans;
signed main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	ans=n/(a+b)*a,n%=a+b,ans+=min(a,n);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <time.h>
#include <ctype.h>

int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; }
int max(int a, int b) { return a >= b ? a : b; }
int min(int a, int b) { return a <= b ? a : b; }
int dsum(int x) { int r=0; while(x){ r+=(x%10); x/=10; } return r;}
void swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp; return; }

int main(void) {
  int F;
  scanf("%d",&F);
  printf("%d\n",(F-30)/2);
  return 0;
}


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

struct point
{
    long long x,y;
    double z;
};

bool compare(point p,point q)
{
    if(p.z!=q.z) return p.z>q.z;
    else return p.y<q.y;
}

long long dp[10001][1001];

long long solve(point a[],long long n,long long h,long long i)
{
    if(i==n) return 1000000000000;
    if(h==0) return 0;
    if(dp[h][i]!=0) return dp[h][i];
    if(a[i].x<=h)
    {
        long long ans=0;
        ans+=min(solve(a,n,h,i+1),a[i].y+solve(a,n,h-a[i].x,i));
        dp[h][i]=ans;
        return ans;
    }
    else if(a[i].x>h)
    {
        long long ans=0;
        ans=min(solve(a,n,h,i+1),a[i].y);
        dp[h][i]=ans;
        return ans;
    }
}

int main()
{
    long long h,n,ans;
    cin>>h>>n;
    point a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i].x>>a[i].y;
        a[i].z=((double(a[i].x))/(double(a[i].y)));
    }
    memset(dp,0,sizeof(dp));
    sort(a,a+n,compare);
    cout<<solve(a,n,h,0)<<endl;
    return 0;
}


Measured memory_bytes: 79104
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
int main() {
    int a; int b;
    cin >> a >> b;
    if (a == b ) { cout << "Yes" <<endl; }
    else 
    {
        cout << "No" << endl;
    }
    
	return 0;
}

  

Measured memory_bytes: 256