akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")



void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
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;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll aa , bb;} fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->aa - ((fr*)q)->aa;}

/*ai<xとなる最大のi*/
ll lower_bound(ll n, ll a[n], ll l, ll r, ll x){
    while(r-l>1){
        ll p=(l+r)/2;
        if(a[p]<x) l=p;
        else r=p;
    }
    return a[r]<x?r:a[l]<x?l:-1;
}
ll alp[100000][26]={};

ll lb( ll l, ll r, ll x , ll ch ){
    while(r-l>1){
        ll p=(l+r)/2;
        if(alp[p][ch]<x) r=p;
        else l=p;
    }
    return alp[l][ch] <x ? l : r;
}

int main(void){
    char s[100005],t[100005];
    ll ls,lt;
    scanf("%s%s",s,t);
    ls=strlen(s);
    lt=strlen(t);

    ll falp[26];
    rep(i,0,26) falp[i]=INF;
    rep(i,0,ls) falp[s[i]-'a']=min2(falp[s[i]-'a'],i);

    rrep(i,ls-2,0){
        rep(j,0,26){
            alp[i][j]=alp[i+1][j];
        }
        alp[i][s[i+1]-'a']++;
    }
    
    ll j=falp[t[0]-'a'],k;
    if(j==INF){
        printf("-1\n");
        return 0;
    }
    ll ans= j+1;
    rep(i,1,lt){
        if( alp[j][ t[i]-'a' ] > 0 ){
            // k=falp[ t[i]-'a' ];
            k = lb( j+1 , ls-1 , alp[j][t[i]-'a'] , t[i]-'a' );
            // printf("K%lld ",k);
            ans+=k-j;
            j=k;
        }else{
            ans+=ls-1-j;
            j = falp[ t[i]-'a' ];
            if(j==INF){
                printf("-1\n");
                return 0;
            }
            ans+=j+1;
        }
        // printf("%lld ",ans);
    }
    // rep(i,0,26){
    //     printf("%lld ",falp[i]);
    // }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 20736
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
#include <chrono>
#include<unordered_map>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

int main()
{
	int X, Y;
	scanf("%d%d", &X, &Y);

	REP(i,X+1)
		if (2 * i + 4 * (X - i) == Y)
		{
			printf("Yes\n");
			return 0;
		}

	printf("No\n");
	return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3+5;
char S[maxn];
char T[maxn];
int main(){
	scanf("%s%s",S,T);
	int ans = maxn;
	int ls =  strlen(S);
	int lt = strlen(T);
	for(int i=0;i<(ls-lt+1);i++){
		int tmp=0;
		for(int j=0;j<lt;j++){
			if(T[j]!=S[i+j]){
				tmp++;
			}
		}
		ans=min(ans,tmp);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...)
#define endl '\n'
#else
#include "../../tr.h"
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = (int)1e5 + 10;

int n, a[N];

struct UnionFind
{
   vector<int> A, S;

   UnionFind(int n){
      A.resize(n+1);
      S.resize(n+1);
      for (int i = 1; i <= n; ++i)
      {
         A[i] = i;
         S[i] = 1;         
      }
   }

   int find(int x){
      while(x != A[x]){
         A[x] = A[A[x]];
         x = A[x];
      }
      return x;
   }

   bool unite(int x, int y){
      x = find(x), y = find(y);
      if(x == y)
         return false;
      if(S[x] < S[y])swap(x, y);
      S[x] += S[y];
      A[y] = x;
      return true;
   } 
};

int m;
vector<P> queries;

int32_t main(){_

   cin>>n>>m;
   UnionFind S(n);

   for (int i = 0; i < m; ++i)
   {
      int x, y;
      cin>>x>>y;
      queries.pb({x, y});
   }

   int ans = n*(n-1) / 2;
   reverse(queries.begin(), queries.end());

   vector<int> store;
   store.pb(ans);

   for(auto it: queries){
      int x = it.F, y = it.S;
      x = S.find(x), y = S.find(y);
      if(x == y){
         store.pb(ans);
         continue;
      }

      int S1 = S.S[x], S2 = S.S[y];

      int A = ((S1 + S2)*((S1 + S2 - 1))) / 2;
      int B = (S1*(S1-1))/2 + (S2*(S2-1))/2;

      ans -= (A-B);
      S.unite(x, y);
      store.pb(ans);
   }

   store.pop_back();
   reverse(store.begin(), store.end());

   for(auto it: store)
      cout<<it<<'\n';

   #warning make sure N size is correct!
   return 0;
}

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

#define LL long long
#define pii pair<int,int>
using namespace std;
const int inf = 2147483647;

int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x * f;
}
void put(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

bool sp;
int h1, h2;

void pt(int x, int y) {
	if(sp) swap(x, y);
	put(x * h1), putchar(' '), put(y * h2), puts("");
}

int main() {
	int K = read(), X = read(), Y = read();
	h1 = X < 0 ? -1 : 1, h2 = Y < 0 ? -1 : 1;
	X = abs(X), Y = abs(Y);
	if(X < Y) swap(X, Y), sp = 1;
	if(!(K & 1) && (X + Y) & 1) {puts("-1"); return 0;}
	int ans = 1; while(K * ans < X + Y || ((K * ans - X - Y) & 1) || ((K * ans - X - Y) && ans == 1)) ans++;
	put(ans), puts("");
	int gg = (K * ans - X - Y) / 2;
	int x = 0, y = 0;
	while(gg >= K) x -= K, gg -= K, pt(x, y);
	if(gg > 0) x += K - gg, y -= gg, pt(x, y);
	while(X - x >= K) x += K, pt(x, y);
	while(X - x) y += K - (X - x), x = X, pt(x, y);
	while(y < Y) y += K, pt(x, y);
	return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358

int main(void){
    double a, b, hour, min, radh, radm, rad, ans;
    scanf("%lf %lf %lf %lf", &a, &b, &hour, &min);
    radh = 2*PI * (hour + min / 60) / 12;
    radm = 2*PI * min / 60;
    rad = (radh - radm < PI) ? radh - radm : radm - radh;
    
    ans = sqrt(a*a + b*b - 2*a*b*cos(rad));
    printf("%.10lf", ans);
    return 0;
}


Measured memory_bytes: 2532
//#include "pch.h"
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	double r;
	cin >> r;

	r *= 2;

	cout << fixed << PI * r << endl;


	return 0;
}

Measured memory_bytes: 3768
k, n = map(int, input().split())
li = input().split()
dis_li = []
for i in range(len(li)-1):
    dis_li.append(int(li[i+1])- int(li[i]))
dis_li.append(k-int(li[n-1])+int(li[0]))
print(k-max(dis_li))

Measured memory_bytes: 20148
// May this submission get accepted
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    string c = inp1;

    cout << (char)(c[0] + 1) << endl;

}

Measured memory_bytes: 256
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7

def cmb(n, k):
    if k < 0 or k > n: return 0 
    return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD

def cumprod(arr, MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv

U = 10 ** 6  # 階乗テーブルの上限
fact, fact_inv = make_fact(U, MOD)

# 最終形が白一色、逆再生、leftとrightで別に考える
N = ir()
S = sr()
cur = 'W'  # 左端に白があるとする
left = 0
right = 0
dic = {'W': 'B', 'B': 'W'}
answer = fact[N]
X = []
for s in S:
    if s == cur:
        right += 1
        cur = dic[s]
    else:
        left += 1
        remain = N - right
        X.append(remain)
        cur = s
    if right > left:
        print(0); exit()

if right != left:
    print(0); exit()

for i, x in enumerate(X[::-1]):
    answer *= (x - i)
    answer %= MOD

print(answer % MOD)
# 07

Measured memory_bytes: 51772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

unsigned GetDigit(unsigned num){
    return std::to_string(num).length();
}

int main(){
    queue<ll> q;
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    ll n; cin >> n;
    q.push(3); pq.push(3);
    q.push(5); pq.push(5);
    q.push(7); pq.push(7);
    ll x;
    while(x < n){
        x = q.front();
        q.push(pow(10, GetDigit(x)) * 3 + x);
        pq.push(pow(10, GetDigit(x)) * 3 + x);
        q.push(pow(10, GetDigit(x)) * 5 + x);
        pq.push(pow(10, GetDigit(x)) * 5 + x);
        q.push(pow(10, GetDigit(x)) * 7 + x);
        pq.push(pow(10, GetDigit(x)) * 7 + x);
        q.pop();
    }
    int ans = 0;
    while(!pq.empty()){
        bool include_three = false, include_five = false, include_seven = false;
        ll current_num = pq.top();
        if(current_num > n) break;
        ll tmp = current_num;
        for(int div = GetDigit(current_num); div >= 0; div--){
            ll current_digit = (ll)pow(10, div);
            if(tmp / current_digit == 3) include_three = true;
            else if(tmp / current_digit == 5) include_five = true;
            else if(tmp / current_digit == 7) include_seven = true;
            tmp %= current_digit;
        }
        if(include_three && include_five && include_seven) ans += 1;
        pq.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1624
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

// find_by_order(k) returns the iterator to the kth largest element (start from 0)
// order_of_key(k) returns the number of elements in the set which are strictly less than the value k

using namespace std;
using namespace __gnu_pbds;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define rightmostbit(x) __builtin_ffsll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout << fixed; cout << setprecision(x); cout << y;
#define pi              3.141592653589793238
#define mk(a,n)         int n;cin>>n;vi a(n);for(int i=0;i<n;i++) cin>>a[i]
#define w(x)            int x; cin>>x; while(x--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

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

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void g_b()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
int32_t main()
{
	g_b();
	mk(a, n);
	int sum = 0;
	for (int i = 1; i < n; ++i)
	{
		if (a[i] < a[i - 1])
		{
			sum += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
	}
	cout << sum;
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

void Main(){
	ll a, b;
	cin >> a >> b;
	if(a==1 || b==1) cout << 1 << endl;
	else cout << (a*b+1)/2 << endl;
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

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


int main(void){
	int a, b, c;
	cin >> a >> b;
	if(a>0 && b>0){
		cout << "Positive" << endl;
	} else if(a<=0 && b>=0){
		cout << "Zero" << endl;
	} else {
		c = (b-a)%2;
		if(c==0) cout << "Negative" << endl;
		else cout << "Positive" << endl;
	}
	return 0;
}

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

ll gcd(ll x, ll y){
    if(x < y) return gcd(y, x);
    if(x%y == 0) return y;
    return gcd(y, x%y);
}

int main(){
    int n;
    cin >> n;
    vector<int>c(n-1);
    vector<int>s(n-1);
    vector<int>f(n-1);
    for(int i=0;i<(n-1);i++) cin >> c[i] >> s[i] >> f[i];

    for(int i=0;i<(n-1);i++){
        int ans = 0;
        ans += s[i] + c[i];
        for(int j=i+1;j<(n-1);j++){
            while(ans%f[j] != 0) ans++;
            ans = max(ans + c[j], s[j] + c[j]);
        }
        cout << ans << endl;
    }
    cout << "0"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n, a, b, c, d;
	char s[200005];
	scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
	scanf("%s", s);
	int i;
	a--;
	b--;
	c--;
	d--;
	for (i = a; i < c; i++)
	{
		if (s[i] == '#' && s[i + 1] == '#')
		{
			printf("No\n");
			return 0;
		}
	}
	for (i = b; i < d; i++)
	{
		if (s[i] == '#' && s[i + 1] == '#')
		{
			printf("No\n");
			return 0;
		}
	}
	if (d < c)
	{
		for (i = b - 1; i < d; i++)
		{
			if (s[i] != '#' && s[i + 1] != '#' && s[i + 2] != '#')
			{
				printf("Yes\n");
				return 0;
			}
		}
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 384
// atcoder/code-festival-2017-qualc/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s;
  while (cin >> s) {
    int i = 0;
    int j = s.size() - 1;

    int cnt = 0;
    while (i < j) {
      if (s[i] == s[j]) {
        ++i;
        --j;
      } else if (s[i] == 'x' && s[j] != 'x') {
        ++i;
        ++cnt;
      } else if (s[i] != 'x' && s[j] == 'x') {
        --j;
        ++cnt;
      } else if (s[i] != s[j]) {
        cnt = -1;
        break;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 3744
/// c.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < decltype(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
# define all(s) s.begin(),s.end()
# define CF
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
ll t[1 << 20];
pll lz[1 << 20];
void lazy(int p,int u,int node)
{
    const ll shit1 = lz[node].x;
    const ll shit2 = lz[node].y;
    if (p == u)
        t[node] += shit1;
    else
    {
        int m = (p + u) / 2;
        lz[node << 1].x += shit1;
        lz[node << 1].y += shit2;
        lz[node << 1 | 1].x += shit1 + (m - p + 1) * shit2;
        lz[node << 1 | 1].y += shit2;
    }
    lz[node] = mp(0ll,0ll);
};
void update(int p,int u,int l,int r,ll v1,ll v2,int node)
{
    if (l > r) return;
    lazy(p,u,node);
    if (l <= p && u <= r)
        lz[node].x += v1 + (p - l) * v2,lz[node].y += v2,lazy(p,u,node);
    else
    {
        int m = (p + u) / 2;
        if (l <= m)
            update(p,m,l,r,v1,v2,node << 1);
        if (m+1<=r)
            update(m+1,u,l,r,v1,v2,node << 1 | 1);
    }
}
ll query(int p,int u,int node)
{
    lazy(p,u,node);
    if (p == u)
        return t[node];
    else
    {
        int m = (p + u) / 2;
        return min(query(p,m,node << 1),query(m+1,u,node << 1 | 1));
    }
}
int main(void)
{
    #ifdef CF
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,m;
    fi>>n>>m;
    swap(n,m);
    static int s[1 << 20];
    for (int i = 1;i <= m;++i)
        fi>>s[i];
    for (int i = 1;i < m;++i)
    {
        int l = s[i];
        int r = s[i + 1];
        if (l < r)
        {
            update(1,n,l + 1,r,r - l,-1,1);
            update(1,n,1,l,r - l,0,1);
            update(1,n,r + 1,n,r - l,0,1);
        }
        else
        {
            update(1,n,l + 1,n,(n - l) + r,-1,1);
            update(1,n,1,r,r,-1,1);
            update(1,n,r + 1,l,(n - l) + r,0,1);
        }
    }
    fo << query(1,n,1) << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 12544
#include<bits/stdc++.h>
using namespace std;
 
typedef unsigned long long ull;
 
int main(){
  ull H,W;
  cin >>H>>W;
  ull ans;
  if (H==1 || W==1){
    ans=1;
  }
  else if (H%2==0) ans=(H*W/2);
  else ans=(H/2)*W+ceil((double)W/2);
  cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define print(v) for(auto &z:v) cout<<z<<' ';cout<<'\n'
#define db cout<<"db: "
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define all(v) v.B,v.E
#define sz(v) (int)((v).size())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define clk1 clock_t start_time=clock()
#define clk2 cout<<(clock()-start_time)/(double)CLOCKS_PER_SEC
#define clean(arr) memset(arr,0,sizeof(arr))
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    ll ans = b*d;
    ans=max(ans,b*c);
    ans=max(ans,a*d);
    ans=max(ans,a*c);

    cout<<ans;

    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(){
    int A,B;

    int res = 0;
    scanf("%d %d", &A, &B);

    res = (B - 1) / (A - 1);
    if((res * (A - 1) + 1) < B){
      res++;
    }
    
    printf("%d", res);

}

Measured memory_bytes: 128
n,q = (int(x) for x in input().split())
s = input()
l = []
r = []
for i in range(q):
    temp1,temp2 = (int(x) for x in input().split())
    l.append(temp1-1)
    r.append(temp2-1)

bb = []
bb.append(0)
# print(l)
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        bb.append(bb[i-1] + 1)
    else:
        bb.append(bb[i-1])

for i in range(q):
    print(bb[r[i]] - bb[l[i]])



Measured memory_bytes: 14244
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long LL;
const int INF = int(1e9);

LL N,A,B;
LL a[1000006];

bool pan(LL x)
{
    LL sum = 0;
    for(int i = N;i>=1;i--)
    {
        LL t = a[i] - x*B;
        if(t>0)
        {
            sum += (LL)ceil(t*1.0/(A-B));
            if(sum>x||sum<0)
                return false;
        }
        else
            break;
    }
    return true;
}

int main()
{
    cin>>N>>A>>B;
    for(LL i = 1;i<=N;i++)
        cin>>a[i];
    sort(a+1,a+1+N);

    LL L = 1,R = a[N]+1,mid;
    while(L<R)
    {
        mid = (R+L)>>1;
        //cout<<L<<" "<<R<<" "<<mid<<endl;
        if(pan(mid))
            R = mid;
        else
            L = mid+1;

    }

    cout<<R<<endl;

    return 0;
}


Measured memory_bytes: 1024
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=input()

scnt=0
m=0
for i in range(len(x))[::-1]:
    if x[i]=="T":
        m=i+1
        break

ans=len(x)
for i in range(m):
    if x[i]=="S":
        scnt+=1
    else:
        if scnt>0:
            scnt-=1
            ans-=2
    # print(scnt)
print(ans)

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

int main() {
  int N_yen, K_num;
  cin >> N_yen >> K_num;
  int Disfig[K_num];
  for(int i = 0; i < K_num; i++){
    cin >> Disfig[i];
  }
  for(int ans = N_yen; ans < 100000; ans++){
    set<int> digit_fig;
    int keep_yen = ans;
    //各桁の数を配列に入れる
  	while(keep_yen != 0){
    	digit_fig.insert(keep_yen%10);
    	keep_yen /= 10;
  	}
    bool judge = true;
  	for(int j = 0; j < K_num; j++){
    	if(digit_fig.count(Disfig[j])){
          judge = false;
        }
  	}
  	if(judge == true){
    	cout << ans << endl;
      	break;
  	}
  }
  return 0;
}

Measured memory_bytes: 256
/*
Written by Kabir Kanha Arora
@kabirkanha
 */

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        System.out.println(n + (n * n) + (n * n * n));
    }
}


Measured memory_bytes: 35712
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
 // freopen("input.txt","r",stdin);
#endif

  ll p,n;
  cin>>p>>n;
  vector<ll> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }

  vector<ll> dist;
  for(int i=1;i<n;i++)
  {
    dist.push_back(a[i]-a[i-1]);
  }

  dist.push_back(p-a[n-1]+a[0]);
  sort(dist.begin(),dist.end(),greater<ll>());

  cout<<p-dist[0]<<endl;
  

  return 0;
}

Measured memory_bytes: 3956
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

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

	static const int M = 1000;
	vector<ll> table(M*2, 0);

	for(ll i = -M; i < M; i++)
	{
		table[i+M] = i * i * i * i * i;
	}

	for (ll i = -M; i < M; i++)
	{
		for(ll j = -M; j < M; j++)
		{
			if (X == table[i + M] - table[j + M])
			{
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}

	return 0;
}


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

namespace abc71
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();
            long ans = 3;
            int m = 1000000007;
            char c = S[0];
            int f = 0;
            if (N >= 2)
            {
                if (c == S[1])
                {
                    f = 1;
                    ans *= 2;
                }
            }
            
            for(int i = f+1; i < N; i++)
            {
                c = S[i];
                if (f == 0)
                {
                    if (i != N - 1)
                    {
                        if (S[i + 1] == c)
                        {
                            i++;
                            f = 1;
                        }
                    }
                    ans *= 2;
                    if(ans >= m)
                    {
                        ans -= m;
                    }
                }else
                {
                    if (i != N - 1)
                    {
                        if (S[i + 1] == c)
                        {
                            ans *= 3;
                            if (ans >= m)
                            {
                                ans -= m;
                            }
                            if (ans >= m)
                            {
                                ans -= m;
                            }
                            i++;
                        }else
                        {
                            f = 0;
                        }
                    }else
                    {
                        f = 0;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main(){
    ll h,ans=0;
    cin >> h;
    ll x=1;
    ans=h;
    while(h!=0){
        if(h%2==0) ans+=x;
        h=h/2;
        x=x*2;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
using namespace std;


typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int gcd (int a, int b){
  while(true){
    if(a < b) swap(a, b);
    if(b == 0) break;
    a = a % b;
  }
  return a;
}

int main(){
  int n;
  cin >> n;
  vector<pair<ll, ll> > ab(n);
  rep(i, n){
    int a, b;
    cin >> a >> b;
    ab[i].first = b;
    ab[i].second = a;
  }
  sort(ab.begin(), ab.end());

  bool ans = true;
  ll sum = 0;
  ll nowb = ab[0].first;
  for(int i = 0; i < n; ++i){
    if(nowb != ab[i].first){
      if(sum > nowb){
        ans = false;
        break;
      } else {
        nowb = ab[i].first;
      }
    }
    sum += ab[i].second;
  }
  
  if(sum > nowb){
    ans = false;
  }

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


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define trace(x)  cerr << #x << ": " << x << endl;
typedef long long ll;
typedef long double ld;
ll fexp(ll a, ll b, ll p){ll ans = 1;while(b){if(b&1) ans = ans*a%p; b/=2;a=a*a%p;}return ans;}
const ll mod=1000000007;
const int N=1e5+5;
int main()
{
	fast;ll x,n;cin>>x>>n;map<ll,ll> mp;
	for(ll i=0;i<n;i++)
	{
		ll p;cin>>p;mp[p]++;
	}
	ll z=0;
	while(1)
	{
		if(mp[x-z]==0){cout<<x-z;break;}
		if(mp[x+z]==0){cout<<x+z;break;}
		z++;
	}

}

Measured memory_bytes: 3588
N= int(input())

# queryを投げて空の時の処理をする関数
def query1(i):
  print(i)
  tmp = input()
  if tmp[0] == 'V':
    exit()
  return tmp

# 最初に始点を探索
z = query1(0)
  
# 矛盾していないか判定する関数, Falseなら矛盾
def judge1(m):
  s = query1(m)
  if m % 2 == 0: # 偶数なら0番目と同じなら矛盾しない
    return z==s
  else:
    return z!=s
  
# 二分探索する
l = 0
r = N # N-1にするとN-1が探索されずにwhileを抜けてしまう
while r - l > 1:
  m = (l + r) // 2
  if judge1(m):
    # l~mまでが矛盾しない
    l = m
  else:
    r = m

Measured memory_bytes: 3660
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

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

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
//#define int long long

const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAXA = 0;

int f[MAXA];
int uf[MAXA];

long long inq(long long a, long long b)
{
    if (b == 0) return 1;
    ll l = inq(a, b / 2);
    if (b % 2) return l * l % MOD * a % MOD;
    return l * l % MOD;
}

long long cnk(long long n, long long k)
{
    if (k < 0 || k > n) return 0;
    return f[n] * uf[k] % MOD * uf[n - k] % MOD;
}

int n;
int a[500000], b[500000];

signed main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    int ans = 0;
    for (int by = 0; by < 29; by++)
    {
        int x = (1 << by);
        vector<int> A(n), B(n);
        for (int i = 0; i < n; i++) A[i] = a[i] % (2 * x);
        for (int i = 0; i < n; i++) B[i] = b[i] % (2 * x);
        int cnt = 0;
        int p1 = n - 1, p2 = n - 1, p3 = n - 1, p4 = n - 1;
        sort(all(A));
        sort(all(B));
        for (int i = 0; i < n; i++)
        {
            while (p1 >= 0 && A[i] + B[p1] >= x) p1--;
            while (p2 >= 0 && A[i] + B[p2] >= 2 * x) p2--;
            while (p3 >= 0 && A[i] + B[p3] >= 3 * x) p3--;
            while (p4 >= 0 && A[i] + B[p4] >= 4 * x) p4--;
            cnt += p4 - p3 + p2 - p1;
        }
        if (cnt % 2 != 0) ans += x;
    }
    cout << ans;
}


Measured memory_bytes: 3456
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;
 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  ll ans=0;
  ll n;
  cin>>n;
  rep(i,1,n+1)
  {
    if((i%5==0)||(i%3==0)) continue;
    else ans+=i;
  }
  cout<<ans;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 3776
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

const yes = "APPROVED"
const no = "DENIED"

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := nextInt()
	as := nextInts(n)
	ret := true
	for _, a := range as {
		if a % 2 != 0 {
			continue
		}
		if !(a % 3 == 0 || a % 5 == 0) {
			ret = false
			break
		}
	}
	if ret {
		fmt.Fprintln(out, yes)
	} else {
		fmt.Fprintln(out, no)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes(n int64) []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
using namespace std;

#define lint long long int

int main()
{
    lint a, b, n;
    cin >> a >> b >> n;
    
    lint x;
    if (b > n) x = n;
    else x = b-1;
    
    lint max = floor(a*x/b) - a*floor(x/b);
    cout << max << endl;
}


Measured memory_bytes: 3660
#include <stdio.h>

void call(int n)
{
	int i, x;

	for(i = 1;i <= n;i++)
	{
		x = i;
		if(x % 3 == 0)
			printf(" %d", i);
		else
			while(x)
			{
				if(x % 10 == 3)
				{
					printf(" %d", i);
					break;
				}
				x /= 10;
			}
	}
	printf("\n");
}

int main(void)
{
	int num;

	scanf("%d", &num);
	call(num);

	return 0;
}

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << (n < 1000 ? "ABC" : "ABD") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    return gcd(b, a%b);
}

int main()
{
    int k;

    cin >> k;

    int res = 0;

    for(int a=1; a <= k; a++){
        for(int b=1; b <= k; b++){
            for(int c=1;c <= k; c++){
                res += gcd(gcd(a,b), c);
            }
        }

    }

    cout << res << endl;

    return 0;
}

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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int>a(n);
  for(int i=0; i<n; i++)cin >> a[i];
  sort(a.begin(), a.end());
  int cnt=0;
  for(int i=0; i<n-1; i++){
    if(x>=a[i]){
      cnt++;
      x -= a[i];
    }
  }
  if(x==a[n-1])cnt++;
  cout << cnt;
  return 0;
}


Measured memory_bytes: 256
import sys
import itertools
import collections

input = sys.stdin.readline

def main():
    k, q = map(int, input().split())
    d = list(map(int, input().split()))
    for _ in range(q):
        n, x, m = map(int, input().split())
        dmodm = [y%m for y in d]
        kmod = (n-1)%k
        kdiv = (n-1)//k
        cnt = 0; cntm = 0
        for i in range(k):
            cnt += dmodm[i] == 0
            cntm += (dmodm[i] == 0 and i < kmod)
        #dmodmCounter = collections.Counter(dmodm)
        #dmodmkCounter = collections.Counter(dmodm[:kmod])
        dmodcum = list(itertools.accumulate(dmodm))
        #p0 = dmodmCounter[0] * kdiv + dmodmkCounter[0]
        p0 = cnt * kdiv + cntm
        an = x + (kmod != 0) * dmodcum[kmod-1] + dmodcum.pop() * kdiv
        p1 = an//m - x//m
        ans = n - (p0 + p1) - 1
        print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 92636