akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  map<int,int> mp;
  int MAX = 0;
  int MIN = 1e9;
  for(int i=0; i<N; i++){
    int x;
    cin >> x;
    mp[x]++;
    MAX = max(MAX,x);
    MIN = min(MIN,x);
  }
  
  bool flag = true;
  
  int now = MIN-1;
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    int x = itr->first;
    int y = itr->second;
    if(x != now+1){
      flag = false;
    }
    if(x == MIN){
      if(MAX %2 == 1){
        if(y != 2){
          flag = false;
        }
      }
      else{
        if(y != 1){
          flag = false;
        }
      }
    }
    if(x == MAX){
      if(y == 1){
        flag = false;
      }
    }
    now = x;
  }
  
  if(flag){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}
    
    

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





ll a, b;

bool check(ll x) {
    if (x * x < a * b) return 1;
    return 0;
}

void solve(ll ok) {
    if (ok * (ok + 1) < a * b) {
        cout << (ok - 1) + ok << endl;
    } else {
        cout << (ok - 1) * 2 << endl;
    }
}

template<typename T>
void binary_search(T ok, T ng) {
    while (abs(ng - ok) > 1) {
        T mid = (ng + ok) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    // cout << "ok " << ok << endl;
    solve(ok);
}





int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int q;
    cin >> q;
    rep(i, q) {
        cin >> a >> b;
        if (a > b) swap(a, b);
        if (a == b) { cout << 2 * a - 2 << endl; continue; }
        binary_search(0LL, a + b + 1);
    }
    
    
    
}


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

int main() {
	long long k;cin>>k;
	long long div=k/50;
	long long mod=k%50;
	cout<<50<<endl;
	long long num=49+div;
	for(int i=0;i<mod;i++){
		cout<<num+50-mod+1<<' ';
	}
	for(int i=mod;i<50;i++){
		cout<<num-mod<<' ';
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  CIN(a,b,c);
  S s;
  s.insert(a);s.insert(b);s.insert(c);
  COUT(s.size());
  
  

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> void vdebug(vector<T> v){ cout << "vdebug" << endl; for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ cout << "adebug" << endl; reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
template<typename T1, typename T2> void mdebug(map<T1, T2> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mldebug(multimap<T1, T2> mp){ cout << "mldebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mdebugr(map<T1, T2, greater<T1>> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mldebugr(multimap<T1, T2, greater<T1>> mp){ cout << "mldebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    double n;
    double x[10], y[10];
    cin >> n;
    rep(i, n){
        cin >> x[i] >> y[i];
    }

    double sum = 0.0;
    reps(i, 0, n-2){
        reps(j, i+1, n-1){
            double num = sqrt( (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
            //cout << num << endl;
            sum += num;
            //cout << i sp j << endl;
            //cout << x[i] sp y[i] sp x[j] sp y[j] sp sum << endl;
        }
    }

    double nn = 1.0;
    reps(i, 1, n){
        nn *= i;
    }

    //cout << sum <<endl;
    sum *= nn/n*2;

    printf("%.10lf", sum/nn);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

struct LRPair
{
    ll from = -1;
    ll to = -1;
    ll centerR = -1;
    ll centerL = -1;
    bool close = false;
};
int main()
{
    // 整数の入力
    ll N;
    string S;
    vector<LRPair> pairs;
    cin >> S;
    vector<ll> counts(S.size(),0);
    LRPair p;
    p.from = 0;
    for (int i = 1; i < S.size(); i++)
    {
        if (S[i-1] == 'R')
        {
            if (S[i] == 'R')
            {

            }
            else
            {
                p.centerL = i;
                p.centerR = i - 1;
            }
        }
        else
        {
            if (S[i] == 'R')
            {
                p.to = i -1;
                pairs.push_back(p);
                LRPair new_p;
                p = new_p;
                p.from = i;
            }
            else
            {
            }
        }
    }
    p.to = S.size() - 1;
    pairs.push_back(p);

    // for(auto p:pairs){
    //     cout << p.from << p.centerR << p.centerL << p.to << endl;
    // }

    ll pair_index = 0;
    for (int i = 0;i<S.size();i++){
        if (pairs[pair_index].to < i){
            pair_index++;
        }
        LRPair &p = pairs[pair_index];
        if (abs(p.centerR - i) % 2 == 0){
            counts[p.centerR]++;
        }else{
            counts[p.centerL]++;
        }
    }

    for(int i = 0;i< S.size();i++){
        if (i == 0){
            cout << counts[i];
        }else
        {
            cout << " " << counts[i];
        }

    }
    cout << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int n, d, a;
	scanf("%d %d %d", &n, &d, &a);

	vector<pair<int, int>> vec(n);
	for(auto &p : vec) scanf("%d %d", &p.first, &p.second);

	sort(vec.begin(), vec.end());

	d = 2 * d;

	vector<int> rig(n);

	for(int i = 0, j = 0; i < n; i++) {
		while(j + 1 < n and vec[j + 1].first - vec[i].first <= d) j++;
		rig[i] = j;
	}

	vector<ll> ft(n + 1);
	auto addp = [&](int x, int val) {
		x++;
		for(; x <= n; x += x & -x) ft[x] += val;
	};
	auto add = [&](int l, int r, int val) {
		addp(l, val);
		addp(r + 1, -val);
	};
	auto get = [&](int x) {
		x++;
		ll ans = 0;
		for(; x > 0; x -= x & -x) ans += ft[x];
		return ans;
	};

	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ll now = vec[i].second - 1LL * a * get(i);
		if(now <= 0) continue;
		int cnt = int((now + a - 1) / a);
		ans += cnt;
		add(i, rig[i], cnt);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 7116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll M;
double t;
ll ret = 0;
priority_queue<double> q;

void input() {
  IN(N);
  IN(M);
  REP(i, N) {
    IN(t);
    q.push(t);
  }
}

void solve() {
  REP(i, M) {
    double M = q.top();
    q.pop();
    q.push(M/2.0);
  }
  REP(i, N) {
    double M = q.top();
    q.pop();
    ret += (ll)(floor(M));
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


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

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

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

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

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

class RMQ {
    int n;
    vector<int> dat;
    
public:
    RMQ(int _n) {init(_n);}
    RMQ(){}
    
    void init(int _n) {
        n=1;
        while (n<_n) n*=2;
        dat.resize(2*n-1, INT_MAX);
    }
    
    void update(int k, int a) {
        k += n-1;
        dat[k] = a;
        while (k>0) {
            k = (k-1)/2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
        }
    }
    
    int size() {
        return n;
    }
    
    int query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return INT_MAX;
        if (a <= l && r <= b) return dat[k];
        else {
            int vl = query(a, b, k*2+1, l, (l+r)/2);
            int vr = query(a, b, k*2+2, (l+r)/2, r);
            return min(vl, vr);
        }
    }

    int query(int l, int r)
    {
        return query(l, r, 0, 0, n);
    }
};
// RMQ R;

int main()
{
    int N, Q;
    cin >> N >> Q;
    // R.init(N);
    RMQ R(N);
    while (Q--) {
        int C, X, Y;
        cin >> C >> X >> Y;

        if (C == 0) {
            R.update(X, Y);
        } else {
            cout << R.query(X, Y+1) << endl;
        }
    }
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
const int MOD=1e9 + 7;
const ll MAX = 510000;
long long 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;
    }
}
 
long long 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;
}
 
ll Pow(ll a,ll b){
    ll res=1ll;
    a%=MOD;
    while(b){
        if (b & 1)
            res = (1ll*res * a) % (1ll*MOD);
        a = (1ll*a * a) % (1ll*MOD);
        b >>= 1ll;
    }
    return 1ll*res%MOD;
}

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

int main(){
    ll N,M;cin>>N>>M;
    COMinit();
    ll ans = PEM(M, N) * PEM(M, N) % MOD;
    for(int i=1;i<=N;++i){
        if(i%2==1) ans -= COM(N, i) * PEM(M-i, N-i) % MOD * PEM(M-i, N-i) % MOD * PEM(M, i) % MOD;
        else ans += COM(N, i) * PEM(M-i, N-i) % MOD * PEM(M-i, N-i) % MOD * PEM(M, i) % MOD;
        ans = (ans + MOD) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15568
#include<stdio.h>
#include<math.h>

int main()
{
	int n,x;
	double xa,ya,ra,xb,yb,rb,d;

	scanf("%d",&n);
	for(x=0;x<n;x++)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);

		d=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));

		if(ra+rb<d)
		{
			printf("0\n");
		}
		else if(ra<rb&&d<rb-ra)
		{
			printf("-2\n");
		}
		else if(rb<ra&&d<ra-rb)
		{
			printf("2\n");
		}
		else
		{
			printf("1\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1048
import java.util.Scanner;

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

        int w = sc.nextInt();
        int n = sc.nextInt();

        int[] num = new int[w];

        for(int i = 0; i < w; i++)
            num[i] = i + 1;

        for(int i = 0; i < n; i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            int tmp = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = tmp;
        }

        for(int i = 0; i < n; i++)
            System.out.println(num[i]);

        sc.close();
    }
}



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

const int MOD = 1000000007;

//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)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
string S;
cin >> S;
int N = S.size();
vector<int>ans(N);
int cnt = 0;
REP(j, 2){
REP(i, N) {
  if(S.at(i) == 'R') cnt++;
  else{
    ans.at(i) += cnt / 2;
    ans.at(i - 1) += (cnt + 1) / 2;
    cnt = 0;
}
}
 reverse(all(ans));
 reverse(all(S));

 REP(i, N){
   if(S.at(i) == 'L') S.at(i) = 'R';
   else S.at(i) = 'L';
 }
 }

REP(i, N) cout << ans.at(i) << ' ';
 }

Measured memory_bytes: 1024
MOD = 10**9 + 7
n = int(input())
s = input()

t = []
for i in range(2*n):
    if i % 2 == 0:
        t.append(0 if s[i] == 'B' else 1)
    else:
        t.append(0 if s[i] == 'W' else 1)

# print(t)
ans = 1
l = r = 0
for i in range(2*n):
    if t[i] == 1:
        ans *= max(l - r, 0)
        ans %= MOD

    if t[i] == 0:
        l += 1
    else:
        r += 1

if l == n:
    for i in range(1, n+1):
        ans *= i
        ans %= MOD
else:
    ans = 0

print(ans)


Measured memory_bytes: 5096
q,h,s,d=map(int,input().split())
n=int(input())
q*=4
h*=2
if n%2==0:
    print(min(min(q,h,s)*n,d*n//2))
else:
    print(min(min(q,h,s)*n,d*(n//2)+min(q,h,s)))

Measured memory_bytes: 8924
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    int d[110];
    cin >> n;
    
    for(int i=0;i<n;i++)cin >> d[i];
    sort(d,d+n,greater<int>());
    
    int ans = 1;
    
    for(int i=0;i<n-1;i++){
        if(d[i]>d[i+1]) ans++;
    }
    
    cout << ans;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
  int K, X;
  cin >> K >> X;

  vector<int> ans;

  int ptmp=X;
  int mtmp=X;
  ans.push_back(X);
  for(int i=0; i<K-1; i++)
    {
      ptmp++;
      mtmp--;
      ans.push_back(ptmp);
      ans.push_back(mtmp);
    }

  sort(ans.begin(), ans.end());

  for(int i=0; i<ans.size(); i++)
    cout << ans[i] << " ";
  cout << endl;


  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
  string s;
  cin>>s;
  s[3] = '8';
  cout<<s<<endl;
  return 0;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    map<string, int> m;

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

    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl; 
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
using namespace std; 
int a[250000];

int main(){
	int n=0;
	int t=0;
	int i=0;
	int ii=0;
	int z=0;
	int x=0;
	
	cin>>n;
	cin>>t;
	for(i=0;i<n;i++){
		cin>>a[i];		
	}
	
	for(i=1;i<n;i++){
		if(a[i]<a[i-1]+t){
			x=a[i]-a[i-1];
			z=z+x;
		}else{
			z=z+t;
		}
	}
	cout<<z+t;
	
}
	

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

int main(){

    double H;
    cin >> H;

    long long int count = 0;
    count = pow(2,floor(log2(H))+1)-1;

    cout << count << endl;

    return 0;
}

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

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

vector<int> prime;
void eratos(int N)
{
    vector<bool> isprime(N, true);
    isprime[0] = isprime[1] = false;
    
    reps(i, 2, N){
        if(isprime[i]){
            for(int j=i*2; j<N; j+=i)
                isprime[j] = false;
        }
    }
    
    rep(i, N){
        if(isprime[i])
            prime.push_back(i);
    }
}

int main()
{
    eratos(200000);
    
    int n, p;
    while(scanf("%d%d", &n, &p), n!=-1){
        vector<int> ans;
        int idx = upper_bound(prime.begin(), prime.end(), n) - prime.begin();
        
        rep(i, 200) reps(j, i, 200){
            ans.push_back(prime[i+idx] + prime[j+idx]);
        }
        
        sort(ans.begin(), ans.end());
        printf("%d\n", ans[p-1]);
    }
    
    return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <iomanip>
using std::cin;
using std::cout;
using std::endl;
using std::fixed;
using std::setprecision;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << a/b << " " << a%b << " ";
	cout << fixed << setprecision(5) << (double) a/b << endl;
	return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
//#define int long long int
#define mod 1000000007

char solve(char a)
{
    int n = int(a);
    if(n>=65 && n<=90)
        return 'A';
    else
        return 'a';
}

int32_t main()
 {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t,n,w,k,x,i;
    //cin>>t;
    t=1;
    while(t--)
    {
        char a;
        cin>>a;
        cout<<solve(a)<<endl;
    }

	return 0;
}


Measured memory_bytes: 3648
n = gets.to_i
h = gets.split.map(&:to_i)

ans = "Yes"
(n-1).downto(1).each do |i|
  if h[i-1] > h[i] + 1
    ans = "No"
    break
  elsif h[i-1] > h[i]
    h[i-1] -= 1
  end
end
puts ans

Measured memory_bytes: 8580
#include <stdio.h>
int main(void){
    // Your code here!
    int m[2],d[2];
    for(int i=0;i<2;i++)scanf("%d %d",&m[i],&d[i]);
    if(d[1]==1)printf("1\n");
    else printf("0\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



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


int main()
{
  int n ;
  cin >> n ;
  string s ;
  cin >> s ;
  int ans = 0 ;
  
  REP(i,10){
    REP(j,10){
      vector<int> cnt(10,0) ;
      int k = 0;
      bool flag1 = true ;
      bool flag2 = false ;
      while(k<n){
        
        if(flag2 && s.at(k)-'0'==j){
          
          for(int l=k+1;l<n;l++){
            cnt.at(s.at(l)-'0')++ ;
          }
          
          REP(l,10){
            if(cnt.at(l)!=0){
              ans++ ;
            }
          }
          
          break ;
        }
        
        if(flag1 && s.at(k)-'0'==i){
          flag2 = true ;
        }
        k++ ;
      }     
    }
  }

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

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    i32 n,m;
    cin >> n >> m;
    vector<i32> c(m);
    rep(i,m)cin >> c[i];
    sort(all(c));
   vector<i32> dp(n + 1,1e9);
   dp[n] = 0;
   for(i32 i = n - 1; 0 <= i; i--){
       for(i32 j = 0; j < m; j++){
           if(i + c[j] <= n){
               dp[i] = min(dp[i + c[j]] + 1, dp[i]);
           }
       }
   }
   cout << dp[0] << endl;
}


Measured memory_bytes: 3408
def bubble_sort(lst):
    cnt = 0
    flag = True
    while flag:
        flag = False
        for i in range(len(lst)-1):
            if lst[i] > lst[i+1]:
                lst[i], lst[i+1] = lst[i+1], lst[i]
                flag = True
                cnt += 1
    return cnt

n = int(input())
lst = list(map(int, input().split()))
cnt = bubble_sort(lst)
print(*lst)
print(cnt)


Measured memory_bytes: 5608
H, W = map(int,input().split())
board = []
for h in range(H):
    board.append(input())

dp=[[1000 for i in range(W+1)] for j in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for h in range(H):
    for w in range(W):
        dp[h+1][w+1] = min(dp[h][w+1] + (board[h][w]=='#' and (h==0 or board[h-1][w]=='.')), dp[h+1][w] + (board[h][w]=='#' and (w==0 or board[h][w-1]=='.')))
 
            

print (dp[-1][-1])



Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        double B = sc.nextDouble();
        long b = (long)((B*100.0)+0.5);
        final long ans = A*b;
        String ansstr = String.valueOf(ans);
        if(ansstr.length() <= 2){
            System.out.println("0");
        }else {
            System.out.println(ansstr.substring(0, ansstr.length() - 2));
        }
    }
}


Measured memory_bytes: 36904
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, q;
	string s;
	cin >> n >> q >> s;
	
	vector<int> sum(n + 1, 0);
	int cnt = 0;
	for(int i = 0; i < n - 1; ++i) {
		sum[i + 1] = sum[i] + (s.substr(i, 2) == "AC");
	}
	
	vector<int> x(q);
	for(int i = 0; i < q; ++i) {
		int l, r;
		cin >> l >> r;
		l--;
		r--;
		
		x[i] = sum[r] - sum[l];
	}
	
	for(auto ans : x) {
		cout << ans << endl;
	}		
	
	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//????¨????
		int sum = 0;
		//n????????????
		int n = sc.nextInt();
		//???????????????
		int m = sc.nextInt();
		//A??????????????£?¨? ???????????? ?¨???????m
		int [][] A = new int [n][m];
		//B??????????????£?¨? ?¨???????m
		int [] B = new int[m];
		//A???????´?
		for(int i = 0; i< n; i++){
			for(int j =0; j<m;j++){
				A [i][j] = sc.nextInt();
			}
		}
		//B???????´?
		for(int i = 0; i < m; i++){
			B[i] = sc.nextInt();
		}
		//??¨???
		for(int i = 0; i< n; i++){
			//??????????????????
			sum =0;
			for(int j =0; j<m;j++){
				//????¨?????¨???? ?¨???????????¨???? ??????A??¨B????????????????????????????¶?????????????
				sum +=A[i][j] * B[j];
			}
			System.out.println(sum);
		}
	}
}

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

int main() {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;

    if ((0 <= x - r && x + r <= w) && (0 <= y - r && y + r <= h)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3104
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)

// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
} 

int main() {
	// 入力
	ll H, W;
	cin >> H >> W;
	ll a[H][W];
	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			cin >> a[i][j];
		}
	}
 
	// 解法
	// 操作前
	// for (int i = 0; i < H; ++i){
	// 	for (int j = 0; j < W; ++j){
	// 		printf("%lld ", a[i][j]);
	// 	}
	// 	printf("\n");
	// }
	// printf("-------------\n");
	
	ll count = 0;
	ll b[H][W];
	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			b[i][j] = a[i][j];
		}
	}
	
	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			if (i!=H-1 && b[i][j]%2==1){ // 最終行でない, 奇数
				count++;
				b[i][j]--;
				b[i+1][j]++;
			}
			else if (i==H-1 && j!=W-1 && b[i][j]%2==1){
				count++;
				b[i][j]--;
				b[i][j+1]++;
			}
		}
	}
		
	
	printf("%lld\n", count);
	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			if (i!=H-1 && a[i][j]%2==1){ // 最終行でない, 奇数
				printf("%d %d %d %d\n", i+1,j+1,i+2,j+1); // 下に流す
				a[i][j]--;
				a[i+1][j]++;
			}
			else if (i==H-1 && j!=W-1 && a[i][j]%2==1){ // 最終行, 最終列でない, 奇数
				printf("%d %d %d %d\n", i+1,j+1,i+1,j+2);
				a[i][j]--;
				a[i][j+1]++;
			}
		}
	}

	// printf("-------------\n");
	// for (int i = 0; i < H; ++i){
	// 	for (int j = 0; j < W; ++j){
	// 		printf("%lld ", a[i][j]);
	// 	}
	// 	printf("\n");
	// }
}
 


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

using ll = long long;
using namespace std;

int main() {
    ll n, k;
    ll h[100010];
    ll dp[100010];

    cin >> n >> k;

    REP(i, n){
        dp[i] = 1000000000;
        cin >> h[i];
    }

    dp[0] = 0;
    FOR(i, 1, n){
        FOR(j, max(0LL, i-k), i){
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }

    cout << setprecision(20) << dp[n-1] << endl;

    return 0;
}

Measured memory_bytes: 1792
// Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

inline void ckmin(int &a, int b) {
  if (a > b) a = b;
}
inline void ckmax(int &a, int b) {
  if (a < b) a = b;
}

int ans;
int x;

int main() {
  cin >> x;
  ans += 1000 * (x / 500);
  x %= 500;
  ans += 5 * (x / 5);
  x %= 5;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void quicksort(int a[], int first, int last) {

	int i, j;
	int x, t;

	x = a[(first + last) / 2];
	i = first; 
	j = last;
	for (;;) {
		while (a[i] < x)i++;
		while (x < a[j])j--;
		if (i >= j)break;
		t = a[i];
		a[i] = a[j];
		a[j] = t;
		i++;
		j--;
	}
	if (first < i - 1)quicksort(a, first, i - 1);
	if (j + 1 < last)quicksort(a, j + 1, last);
}

int main(void) {

	int i;
	int n, m;
	int x[100000];
	int dis[100000] = {};
	int ans = 0;

	scanf("%d %d", &n, &m);

	for (i = 0; i < m; i++) {
		scanf("%d", &x[i]);
	}

	if (n >= m) {
		printf("0\n");
		return 0;
	}

	quicksort(x, 0, m - 1);

	for (i = 0; i < m - 1; i++) {
		dis[i] = x[i + 1] - x[i];
	}

	quicksort(dis, 0, m - 2);

	for (i = m - 2; i > (m - 2 - n) + 1; i--) {
		ans += dis[i];
	}

	ans = (x[m - 1] - x[0]) - ans;

	printf("%d\n", ans);

	return 0;
}

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

int c[26];
int main(){
    int n;
    char ci,ans;
    while(cin>>n,n){
        int mx=0,cur=0;
        memset(c,0,sizeof(c));
        rep(i,n){
            cin>>ci;
            ++c[ci-'A'];
            if(mx<c[ci-'A']){
                mx=c[ci-'A'];
                ans=ci;   
            }
            int mx2=0;
            rep(j,26)if((ans-'A')!=j) mx2=max(mx2,c[j]);
            if(n-1-i+mx2<mx&&cur==0) cur=i+1;
        }
        if(cur==0) cout<<"TIE"<<endl;
        else cout<<ans<<" "<<cur<<endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
const int inf=1e5+5;
typedef long long ll;
int n,m;
bool vis[100005];
vector<int> v[100005];
int main()
{
    cin>>n;
    int a[n+1];
    for(int i=0;i<n;i++) cin>>a[i];
    int ans=0;
    int k=0;
    for(int i=1;i<n;i++){
        if(a[i]>a[i-1]){
           k=i;
        }
        ans=max(ans,i-k);
    }
    cout<<ans;
}


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

int main()
{
    string s;
    cin >> s;
    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}


Measured memory_bytes: 3592
n = int(input())

ans = set()

def check(k):
    global ans, n
    if k <= 1 or k > n:
        return
    c = n
    while c % k == 0 and c >= k:
        c //= k
    c %= k
    if c == 1:
        ans.add(k)

for i in range(1, n):
    if i ** 2 > n:
        break
    if i ** 2 == n:
        check(i)
    elif n % i == 0:
        check(i)
        check(n // i)

m = n - 1
for i in range(1, m):
    if i ** 2 > m:
        break
    if i ** 2 == m:
        check(i)
    elif m % i == 0:
        check(i)
        check(m // i)

print(len(ans))

Measured memory_bytes: 40812
#include<bits/stdc++.h>
#define f first
#define se second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define emp emplace
#define ins insert
#define sz(s) (int)s.size()
#define rep(i,a,b) for( int i=a;i<b;i++)
#define repr(i,a,b) for( int i=a;i>=b;i--)
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(n,m) memset(n,m,sizeof(n))
#define ii pair<int,int>
#define iii tuple<int, int, int>
#define si set<int>
#define vi vector<int>
#define vii vector<ii>
#define mi map<int,int>
#define lb lower_bound
#define ub upper_bound
#define present(s,x) (s.find(x) != s.end())
#define ford(container, it) for(auto it:container)
#define fors(container, it, a, b) for(auto it = a; it != b; it++)
#define Anurag_Gupta ios_base::sync_with_stdio(0);
#define IIIT_ALLD cin.tie(0);cout.tie(0);
#define mod 987654319
#define EPSILON 1e-9
#define PI acos(-1)
#define inf 1e17
#define int long long
#define debug(a) cerr<<#a<<": ";for(auto i:a)cerr<<i<<" ";cerr<<'\n';
#define trace(a) cerr<<#a<<": "<<a<<"\n"
#define gcd(a,b) __gcd(a,b)
using namespace std;
int add(int a, int b, int c){int res=a+b;return(res>=c?res-c:res);}
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
int mul(int a, int b, int c){int res=(int)a*b;return(res>=c?res%c:res);}
template<typename T>T power(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
template<typename T>T mdpower(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
/*------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
    Anurag_Gupta
    IIIT_ALLD
 
 
    
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        if(i%3!=0 and i%5!=0)
        sum+=i;
    }
    cout<<sum<<"\n";
 






 
#ifndef LOCAL_DEFINE
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 3748
using static System.Math;
using System;

public class hello
{
	public static void Main()
	{
		var a = new decimal[31];
		a[30] = (decimal)Pow(2, 23);
		for (int i = 29; i >= 0; i--)
			a[i] = a[i + 1] / 2m;
		var n = int.Parse(Console.ReadLine().Trim());
		for (int i = 0; i < n; i++)
		{
			var s = Console.ReadLine().Trim();
			var t = Convert.ToInt32(s, 16);
			Console.WriteLine(getAns(a, t));
		}
	}
	static string Format(string s)
	{
		var dp = s.IndexOf('.');
		var s1 = s.Substring(dp + 1).ToCharArray();
		var f = true;
		var wans = "";
		for (int i = s1.Length -1; i >= 0 ; i--)
		{
			if (f && s1[i] == '0') continue;
			else if (f && s1[i] != '0') { f = false; wans += s1[i]; }
			else wans += s1[i];
		}
		if (wans == "") wans = "0";
		var s2 = wans.ToCharArray();
		Array.Reverse(s2);
		return s.Substring(0, dp + 1) + new string(s2);
	}
	static string getAns(decimal[] a, int t)
	{
		var w = 0m;
		for (int i = 0; i < 31; i++)
			w += ((t >> i) & 1) * a[i];
		var ans = Format(w.ToString());
		if (((t >> 31) & 1) == 1) ans = "-" + ans;
		return ans;
	}
}



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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,n) for(int i=(int)(n-1);i>=0;--i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x)*(x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int N;
    cin >> N;
    REP(ii, N) {
        vector<unsigned int> val(8);
        unsigned int checksum;
        REP(i, 8) cin >> hex >> val[i];
        cin >> hex >> checksum;

        unsigned int key = 0;
        REP(bit, 32) {
            unsigned int sum = 0;
            REP(i, 8) {
                sum += val[i] ^ key;
            }
            if (BIT(sum, bit) == BIT(checksum, bit)) {
            } else {
                key |= (1 << bit);
            }
        }
        cout << hex << key << endl;
    }
}

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

import sys
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class BipartiteMatching:
    """
    XとYの二部グラフの最大マッチング X={0,1,2,...|X|-1} Y={0,1,2,...,|Y|-1}
    edges[x]: xとつながるYの頂点のset
    match1[x]: xとマッチングされたYの頂点
    match2[y]: yとマッチングされたXの頂点
    """

    def __init__(self, n, m):
        self.n = n
        self.m = m
        self.edges = [set() for _ in range(n)]
        self.match1 = [-1] * n
        self.match2 = [-1] * m
 
    def dfs(self, v, visited):
        """
        :param v: X側の未マッチングの頂点の1つ
        :param visited: 空のsetを渡す（外部からの呼び出し時）
        :return: 増大路が見つかればTrue
        """
        for u in self.edges[v]:
            if u in visited:
                continue
            visited.add(u)
            if self.match2[u] == -1 or self.dfs(self.match2[u], visited):
                self.match2[u] = v
                self.match1[v] = u
                return True
        return False
    
    def add(self, a, b):
        self.edges[a].add(b)

    def whois1(self, a):
        """ :param: グループ1の頂点 :return: ペアになるグループ2の頂点 """
        return self.match1[a]

    def whois2(self, a):
        """ :param: グループ2の頂点 :return: ペアになるグループ1の頂点 """
        return self.match2[a]

    def solve(self):
        # 増大路発見に成功したらTrue(=1)。合計することでマッチング数となる
        return sum(self.dfs(i, set()) for i in range(self.n))

while True:
    N, M = MAP()
    if N == M == 0:
        break
    A = []
    B = []
    for _ in range(ceil(N, 10)):
        A += LIST()
    for _ in range(ceil(M, 10)):
        B += LIST()

    bm = BipartiteMatching(N, M)
    for i, a in enumerate(A):
        for j, b in enumerate(B):
            if gcd(a, b) != 1:
                bm.add(i, j)
    ans = bm.solve()
    print(ans)



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

int main(){
  int n, r=0, w=0, ct1=0, ct2=0;
  cin >> n;
  char c[n];
  for(int i=0; i<n; i++){
    cin >> c[i];
    if(c[i]=='R') r++;
    else w++;
  }
  for(int i=0; i<r; i++){
    if(c[i]=='W') ct1++;
  }
  for(int i=0; i<w; i++){
    if(c[n-1-i]=='R') ct2++;
  }
  cout << max(ct1, ct2);
  return 0;
}

Measured memory_bytes: 3808
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>

//     MLE,TLE魔
//↓↓↓↓↓↓↓↓↓↓↓↓
#define int long long
//↑↑↑↑↑↑↑↑↑↑↑↑
//     MLE,TLE魔
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 5000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
map<int, int>factor(int x) {
	map<int, int>res;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1)res[x]++;
	return res;
}
/*--------Library Zone!--------*/

int n, m, cnt[35];
signed main() {
	cin >> n >> m;
	rep(i, n) {
		int k;
		cin >> k;
		rep(j, k) {
			int a;
			cin >> a;
			cnt[a]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= m; i++) {
		if (cnt[i] == n)ans++;
	}
	cout << ans << endl;
	endre;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
   int N;
   cin >> N;
   int ans;
   int NN = N;
   while(NN>=1){
      int a = NN%10;
      NN =NN/10;
      ans = ans+a;
   }
   if(N%ans==0){
   cout << "Yes" << endl;
   }
   else{
   cout <<"No"<< endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int N,kake2=2;
int main(void){
	cin>>N;
	while(N>=kake2*2){
		kake2*=2;
	}
	cout<<kake2<<endl;
	return 0;
}


Measured memory_bytes: 3092
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

#define PB push_back
#define MP make_pair

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<double> VD;
typedef long long LL;
typedef pair<int,int> PII;

const int N = 303;
const LL inf = (LL) 1<<40;
#define mod 1000000007
//437001103351396 10int
int main()
{
    int n,m;
    cin>>n>>m;
    if (abs(n-m)>=2)
    {
        cout<<0<<endl;
        return 0;
    }

    long long ans =1;
    for (int i=1;i<=n;i++) ans=ans*i%mod;

    for (int i=1;i<=m;i++) ans=ans*i%mod;

    if (n==m)
        ans = ans*2 %mod;

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


Measured memory_bytes: 256