akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

 
int main(void) { 
    int n;
    int x;
    vector<int> lst(n);
    cin>>n;

    for (int i=0;i<n;i++){
        cin>>x;
        if (x %2==0){
            lst.push_back(x);
        }
    }
    for (int j =0;j<lst.size();j++){
        if (lst.at(j) %2==0 && (lst.at(j) %3!=0 && lst.at(j) % 5!=0)){
            cout<<"DENIED"<<endl;
            return 0;
        }
    }
    cout<<"APPROVED"<<endl;
    return 0;
}

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

int main() {

  string in;

  vector< string > wall_s, wall_v;
  wall_s.push_back( "0000000000" );
  for ( long long int i = 0; cin >> in; i++ ) {
    if ( ( i % 2 ) == 0 ) {
      wall_v.push_back( "0" + in + "0" );
    }else {
      wall_s.push_back( in );
    }
    if ( i == 8 ) break;
  }
  wall_s.push_back( "0000000000" );
  long long int mx = 0;
  long long int my = 0;
  long long int d = 0;
  while( true ) {
    if ( d == 0 ) {
      if ( wall_v[my][mx+1] == '1' ) {
	cout << "R";
	mx++;
	if ( wall_s[my][mx] == '1' ) {
	  d = 3;
	}
      }else {
	d = 1;
      }
    }else if ( d == 1 ) {
      if ( wall_s[my+1][mx] == '1' ) {
	cout << "D";
	my++;
	if ( wall_v[my][mx+1] == '1' ) {
	  d = 0;
	}
      }else {
	d = 2;
      }
    }else if ( d == 2 ) {
      if ( wall_v[my][mx] == '1' ) {
	cout << "L";
	mx--;
	if ( wall_s[my+1][mx] == '1' ) {
	  d = 1;
	}
      }else {
	d = 3;
      }
    }else {
      if ( wall_s[my][mx] == '1' ) {
	cout << "U";
	my--;
	if ( wall_v[my][mx] == '1' ) {
	  d = 2;
	}
      }else {
	d = 0;
      }
    }
    if ( mx == 0 && my == 0 && d == 0 ) break;

  }
  cout << endl;
  return 0;

}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

bool f(string S) {
  array<string, 4> str = {"dream", "dreamer", "erase", "eraser"};
  int n = S.length();
  int tail = n;
  for(int i = n - 1; i >= 0; --i) {
    if(tail - i > 7) return false;
    REP(j,4) {
      if(S.substr(i, tail - i) != str[j]) continue;
      tail = i;
      break;
    }
  }
  return (tail == 0);
}

int main(){
  string S;
  cin >> S;
  cout << (f(S) ? "YES" : "NO") << endl;
  return 0;
}



Measured memory_bytes: 512
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front priority_queue

#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#endif

#define endl '\n'
#define ll long long
#define rint register int
#define minpq priority_queue <int, vector<int>, greater<int> >
#define maxpq  priority_queue <int>

#define re register
#define pb(x) push_back(x);
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;
#define scan(a, n) 		for(int i = 0; i < n; i++)cin >> a[i];

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 200007

std::vector<ll> g[hell];
ll b, w;

void dfs(ll v, ll c, ll p = -1) {
	w += c == 0;
	b += c == 1;

	for (auto zx : g[v]) {
		if (zx != p) {
			dfs(zx, c ^ 1, v);
		}
	}
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t, i, x, j, y, 	z, k, n;
	cin >> n;
	string s;
	unordered_map<string, ll> ma;

	while (n--) {
		cin >> s;
		ma[s]++;
	}

	ce("AC x " << ma["AC"])
	ce("WA x " << ma["WA"])
	ce("TLE x " << ma["TLE"])
	ce("RE x " << ma["RE"])

}

/*

AC x 3
WA x 1
TLE x 2
RE x 0

*/

Measured memory_bytes: 8340
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int w[1501]={0}, h[1501]={0};
int W[2250000]={0}, H[2250000]={0};
 
int sum(int* a , int i,int n,int size){
    int s = 0;
    for(int j=n ; j-- ; ){
        if( i >= size ){
            return 0;
        }
        s += a[i++];
    }
    return s;
}
 
int main(){
    int n,m,w_,h_;
    while( cin >> n >> m , n||m ){
        int cnt_w[1000000] = {0};
         
        for(int i=0 ; i<n ; i++ ){
            cin >> h[i];
        }
        int pos=0;
        for(int j=1 ; j <= n ; j++ ){
            for(int i=0 ; i+j <= n ; i++ ){
                H[pos++] = sum( h , i , j , n );
            }
        }
         
        for(int i=0 ; i<m ; i++ ){
            cin >> w[i];
        }
        int pos_2=0;
        for(int j=1 ; j <= m ; j++ ){
            for(int i=0 ; i+j <= m ; i++ ){
                W[pos_2++] = sum( w , i , j , m );
            }
        }
        for(int i=0 ; i < pos_2 ; i++ ){
            cnt_w[ W[i] ] += 1;
        }
         
        int ans = 0;
        for(int i=0 ; i < pos ; i++ ){
        	ans += cnt_w[ H[i] ];
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 13000
N = int(input())
S = input()
ans = 10 ** 9
White = [0] * (N + 1)
Black = [0] * (N + 1)

for i, c in enumerate(S):
    if c == ".":
        White[i + 1] = White[i] + 1
        Black[i + 1] = Black[i]
    else:
        White[i + 1] = White[i]
        Black[i + 1] = Black[i] + 1

ans = min(ans, Black[N], White[N])

for i in range(1, N):
    temp = Black[i] + White[N] - White[i]
    ans = min(ans, temp)
print(ans)


Measured memory_bytes: 12808
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> // sqrt
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


int main(void) {
    string str;
    cin >> str;
    str.push_back('B');
    str.push_back('B');
    int len = str.length();

    int cnt = 0;
    int64_t sum = 0;
    for(int i = 0; i < len-1; i++) {
        switch(str[i]) {
            case 'A':
                cnt++;
                break;
            case 'B':
                if(str[i+1] == 'C') {
                    i++;
                    sum += cnt;
                } else {
                    cnt = 0;
                }
                break;
            default:
                cnt = 0;
                break;
        }
        debug("[%c: idx: %d]%d %d\n", str[i], i, cnt, sum);
    }

    cout << sum << endl;
    return 0;
}

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

// int/long:            -2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

/*
int     gcd(int A, int B) {
        while (0!=B) {
                A %=B;
                swap(A, B);
        }
        return A;
}
*/

#define MOD 1000000007

int     main() {
        int X;
        cin >>X;
        cout <<X*X*X <<endl;
        return 0;
}


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

vector<int> xs, ys;

double dist(double x, double y) {
  double ans = 0;
  for (int i = 0; i < xs.size(); i++) {
    double dx = x - xs.at(i), dy = y - ys.at(i);
    ans = max(ans, sqrt(dx * dx + dy * dy));
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int xi, yi;
    cin >> xi >> yi;
    xs.push_back(xi);
    ys.push_back(yi);
  }
  double x0 = 0, x1 = 1000, y0 = 0, y1 = 1000;
  const int s = 53;
  while (x1 - x0 > 1e-8 && y1 - y0 > 1e-8) {
    cerr << x0 << " " << x1 << endl;
    cerr << y0 << " " << y1 << endl;
    double dx = x1 - x0, dy = y1 - y0;
    vector<vector<double>> d(s + 1, vector<double>(s + 1));
    for (int i = 0; i <= s; i++) {
      for (int j = 0; j <= s; j++) {
        d.at(i).at(j) = dist(x0 + i * dx / s, y0 + j * dy / s);
      }
    }
    int imin = 0, jmin = 0;
    for (int i = 0; i <= s; i++) {
      for (int j = 0; j <= s; j++) {
        if (d.at(i).at(j) <= d.at(imin).at(jmin)) {
          imin = i;
          jmin = j;
        }
      }
    }
    if (imin < (s + 1) / 2) {
      x1 = (x1 * (s - 1) + x0) / s;
    } else {
      x0 = (x0 * (s - 1) + x1) / s;
    }
    if (jmin < (s + 1) / 2) {
      y1 = (y1 * (s - 1) + y0) / s;
    } else {
      y0 = (y0 * (s - 1) + y1) / s;
    }
  }
  cout << setprecision(17) << dist((x0 + x1) / 2, (y0 + y1) / 2) << endl;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef vector<int> VI;
typedef pair<int, int> PII;
# define mp make_pair
# define pb push_back
# define FOR(i, a, b) for (int i = a; i <= b; ++i)
# define FDR(i, a, b) for (int i = a; i >= b; --i)
const int N = 100005;
const int MOD = 1000000007;
// code begin...

i64 a[N];
map<int, int> M;

int main ()
{
    int n, m;
    cin >> n >> m;
    M[0] = 1;
    FOR(i, 1, n) cin >> a[i], a[i] = (a[i] + a[i - 1]) % m, ++M[a[i]];
    i64 ans = 0;
    for (auto i: M) ans += (i64)i.second * (i.second - 1);
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
#define VI vector<int>
#define VL vector<LL>
#define VII vector< vector<int> >
#define VLL vector< vector<LL> >
#define VS  vector<string>
#define VSS vector< vector<string> >
#define PII pair<int,int>
#define PIS pair<int,string>
#define PSI pair<string,int>
#define PLL pair<LL,LL>
const LL MOD = 1000000007;
const LL INF = 1e16;
LL facctorialMethod(int k);
int main(){
    LL n,s1,s2,total;
    cin >> n;
    VL d(n);
    s1 = 0, s2 = 0, total = 0;
    for(int i = 0; i < n; i++) {
        cin >> d[i];
    }

    for(int a = 0; a < n; a++) {
        for(int b = a+1; b < n; b++) {
            total += d[a] * d[b];
//            cout << "d[a] * d[b] : " << d[a] * d[b] << " total :" << total << endl;
        }
    }
    cout << total << endl;
    return 0;
}
/*
int main(){
    LL n,s1,s2,total;
    cin >> n;
    VL d(n);
    s1 = 0, s2 = 0, total = 0;
    for(int i = 0; i < n; i++) {
        cin >> d[i];
        s1 += d[i] * d[i];
        s2 += d[i];
        cout << "s1 :" << s1 << " s2 :" << s2 << endl;
    }
    total =  (s2 * s2 - s1) / 2;
    cout << total << endl;
    return 0;
}
*/

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int Q;
ll X1,Y1,X2,Y2;
ll p3[32];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	p3[0]=1;
	FOR(i,31) p3[i+1]=p3[i]*3;
	
	cin>>Q;
	while(Q--) {
		cin>>X1>>Y1>>X2>>Y2;
		X1--;
		Y1--;
		X2--;
		Y2--;
		
		ll ret=abs(X1-X2)+abs(Y1-Y2);
		for(i=29;i>=0;i--) {
			ll x1=X1/p3[i];
			ll y1=Y1/p3[i];
			ll x2=X2/p3[i];
			ll y2=Y2/p3[i];
			if(x1==x2 && x1%3==1 && abs(y1-y2)>=2) {
				ret=abs(Y2-Y1)+min(X1%p3[i]+X2%p3[i]+2,2*p3[i]-X1%p3[i]-X2%p3[i]);
				break;
			}
			if(y1==y2 && y1%3==1 && abs(x1-x2)>=2) {
				ret=abs(X2-X1)+min(Y1%p3[i]+Y2%p3[i]+2,2*p3[i]-Y1%p3[i]-Y2%p3[i]);
				break;
			}
			
		}
		cout<<ret<<endl;
		
		
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int gcd(int a, int b) {
   int r;
   while((r = a % b) != 0)
   {
       a = b;
       b = r;
   }
   return b;
}

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
	b = a;
	a = tmp;

   }
   while(cin >> a >> b) {
     int lcm = b / gcd(a,b)*a;
     cout << gcd(a,b) << " " << lcm << endl;
   }
   return 0;
}



Measured memory_bytes: 3068
def main():
    while True:
        w, h = map(int, input().split())
        if w == 0: break

        #          R  ↑ → ← ↓ ... 進めるなら1壁なら0
        field = [[[0, 0, 0, 0, 0] for i in range(w)] for j in range(h)]

        for i in range(h * 2 - 1):
            wall = list(map(int, input().split()))
            y = i // 2
            # ┃仕切り
            if i % 2 == 0:
                for x in range(w - 1):
                    item = wall[x]
                    if item == 0:
                        field[y][x][2] = 1
                        field[y][x + 1][3] = 1

            # ━仕切り
            else:
                for x in range(w):
                    item = wall[x]
                    if item == 0:
                        field[y][x][4] = 1
                        field[y + 1][x][1] = 1

        field[0][0][0] = 1

        i = 1
        while True:
            nextt = 0
            for y in range(h):
                for x in range(w):
                    if field[y][x][0] == i:
                        if field[y][x][1] == 1 and field[y - 1][x][0] == 0:
                            field[y - 1][x][0] = i + 1
                        if field[y][x][2] == 1 and field[y][x + 1][0] == 0:
                            field[y][x + 1][0] = i + 1
                        if field[y][x][3] == 1 and field[y][x - 1][0] == 0:
                            field[y][x - 1][0] = i + 1
                        if field[y][x][4] == 1 and field[y + 1][x][0] == 0:
                            field[y + 1][x][0] = i + 1

                        nextt += 1

                        if field[h - 1][w - 1][0] != 0:
                            print(i + 1)
                            nextt = -1
                            break
                if nextt == -1: break
            

            if nextt == -1: break
            if nextt == 0:
                print("0")
                break

            i += 1
        
                
main()



Measured memory_bytes: 5792
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;

int main() {
	ll n, m;
	cin >> n >> m;
	ll ans = 0;
	ll k = min(n, m / 2);
	n -= k;
	m -= k * 2;
  	ans = k;
	if (n == 0)ans += m / 4;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int h[100005], dp[100005], n, k;

int go(int idx){
    //cout << idx << endl;
    if(idx == n-1)return 0;
    if(dp[idx] != -1)return dp[idx];
    int ans = 1e9 + 7;
    for(int j = 1; j <= k; j++){
        if(idx + j < n){
            ans = min(ans, go(idx+j) + abs(h[idx]-h[idx+j]));
        }
    }
    return dp[idx] = ans;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    for(int i = 1; i < n; i++){
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        for(int j = 2; j <= k; j++){
            if(i-j >= 0){
                dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]));
            }
        }
    }
    cout << dp[n-1] << endl; /*
    memset(dp, -1, sizeof dp);
    cout << go(0) << endl;*/
    return 0;
}

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

int main() {
  long D;
  cin >> D;
  
  //減点量の入力
  long c[27];
  for(int i=1; i<26+1; i++){
    cin >> c[i];
  }
  
  //加点量の入力
  long s[D+1][26+1];
  for(int i=1; i<D+1; i++){
  for(int j=1; j<26+1; j++){
    cin >> s[i][j];
  }}
  
  //開催日程の入力
  long t[D+1];
  for(int i=1; i<D+1; i++){
    cin >> t[i];
  }
  
  //過去の最終開催日を保持する配列
  long past[26+1] = {0};
  
  //日々の処理
  long ans=0;
  for(int day=1; day<D+1; day++){
    
    //満足度の加点計算
    ans += s[day][t[day]];
    
    //開催日の更新
    past[t[day]] = day;
    
    //満足度の減点計算
    for(int num=1; num<26+1; num++){
      ans -= ( c[num] * (day - past[num]) );
    }
    
    //その日の終わりの満足度を出力
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3700
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 500000

void maxHeapify(int);
void buildHeap(void);
int parent(int);
int left(int);
int right(int);
 
int A[N];
 
int H,L;

int main(){

  int i;
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  buildHeap();
  for(i=1;i<=H;i++){
    maxHeapify(i);
  }
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}


void maxHeapify(int i){
  int l,r,largest,stac;

  l=left(i);
  r=right(i);
  if (l<=H && A[l]>A[i])
    largest=l;
  else 
    largest=i;
  if(r<=H && A[r]>A[largest])
    largest=r;

  if(largest!=i){
    stac=A[i];
    A[i]=A[largest];
    A[largest]=stac;
    maxHeapify(largest);
  }

}
 
void buildHeap(void){
  int i;
 L=H;
 for(i=L/2;i>1;i--){
   maxHeapify(i);
 }
}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1; 
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
ll N, K, T, W, H, M, C;
 
const int MAX = 5100000;
const int MOD = 1e9 + 7;
 
const double PI=3.14159265358979323846;
 
 
long long fac[MAX], finv[MAX], inv[MAX];
 
vector<double> cx, cy, c;
 ll MM = 1e12;
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
std::vector<int> Eratosthenes(int n ){
    std::vector<bool> is_prime( n + 1 );
    for( int i = 0; i <= n; i++ ) is_prime[ i ] = true;
    std::vector<int> P;
    for( int i = 2; i <= n; i++ ){
        if( is_prime[ i ] ){
            for( int j = 2 * i; j <= n; j += i ){
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}
 
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
 
 
 
int main(){
    cin >> N; 
    ll ans = 0;
    for(int i = 1; i <= N; ++i){
        if(i % 3 == 0 or i % 5 ==0) continue;
        ans+= i;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 0x3f3f3f3f;
typedef vector<ll> vll;
typedef pair<ll, ll> Pll;

ll N;

int main() {
    char X, Y;
    cin >> X >> Y;
    if (X < Y) {
        cout << "<" << endl;
    } else if (Y < X) {
        cout << ">" << endl;
    } else {
        cout << "=" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int d[5005];
int main(void){
  while(1){
    int n;
    scanf("%d",&n);
    if(!n) break;
    for(int i=0;i<n;i++){
      scanf("%d",&d[i]);
      if(i) d[i]+=d[i-1];
    }
    int sum=d[0];
    for(int i=0;i<n;i++){
      sum=max(d[i],sum);
      for(int j=0;j<i;j++){
	sum=max(d[i]-d[j],sum);
      }
    }
    printf("%d\n",sum);
  }
}

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

int main() {
  int N;
  cin >> N;
 vector<int> rally(N);
  for(int i = 0; i < N; i++){
    cin >> rally.at(i);
  }
  double sum = 0;
  for(int i = 0; i < N; i++){
    sum += rally.at(i);
  }
  float P = sum/N;
  int A = sum/N;
  int bodypower = 0;
  float sa = P-A;
  if(sa <= 0.5) {
  for(int i = 0; i < N; i++){
  bodypower +=   (rally.at(i)-A)*(rally.at(i)-A);
  }
  }
 if(sa > 0.5){
    for(int i = 0; i < N; i++){
  bodypower +=   (rally.at(i)-A-1)*(rally.at(i)-A-1);
  }
  }
  cout << bodypower << endl;
}

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

int main(){
    const int n=9;
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            cout << i << "x" << j << "=" << i*j << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    vector<int> x(n), l(n);
    REP(i, n) cin >> x[i] >> l[i];

    vector<pint> ps(n);
    for(int i = 0; i < n; i++) {
        ps[i] = make_pair(x[i] + l[i], x[i] - l[i]);
    }
    sort(ALL(ps));

    int cur = -1000000000;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if (cur <= ps[i].second) {
            ans++;
            cur = ps[i].first;
        }
    }


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

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>

int norm_sqare(const std::vector<int>& a, const std::vector<int>& b) {
	int result = 0;
	for (auto i = 0; i < a.size(); ++i) {
		result += (a[i] - b[i]) * (a[i] - b[i]);
	}
	return result;
}
int main() {
	int n, d; std::cin >> n >> d;
	std::vector<std::vector<int>> points(n, std::vector<int>(d));
	for (auto& p : points) {
		for (auto& x : p) std::cin >> x;
	}
	auto count = 0;
	for (auto i = 0; i < n; ++i) {
		for (auto j = i + 1; j < n; ++j) {
			auto norm = norm_sqare(points[i], points[j]);
			auto sqrt = static_cast<int>(std::sqrt(norm));
			if (sqrt * sqrt == norm || (sqrt + 1) * (sqrt + 1) == norm) {
				++count;
			}
		}
	}
	std::cout << count << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <tuple>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort((v).begin(), (v).end())
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main()
{
    int n,m;
    cin>>n>>m;
    bool g[10][10]={false};
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a][b]=g[b][a]=true;
    }

    vector<int> p;
    for(int i=0;i<n;i++)p.push_back(i);

    int cnt=0;

    do{
        if(p[0]!=0)continue;
        bool ok=true;
        for(int i=0;i<p.size()-1;i++){
            if(!g[p[i]][p[i+1]])ok=false;
        }
        if(ok)cnt++;
    }
    while(next_permutation(ALL(p)));
    
    cout << cnt <<endl;
    
    return 0;
}


Measured memory_bytes: 256
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li      int32_t
#define lli     long long
#define ulli unsigned long long

#define pn           printf("\n")
#define nl           cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))

#define pb      push_back
#define pob     pop_back
#define itr     iterator
#define sz()    size()
#define szof    sizeof
#define lb      lower_bound
#define ub      upper_bound
#define mp      make_pair
#define vlli    vector<lli>
#define plli    pair<lli,lli>
#define vplli   vector<plli >
#define F       first
#define S       second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000
#define MX2     1000000
#define mod     1000000007
#define Inf     1000000000000000
using namespace std;

vlli V[2*MX1+1];
bool visited[2*MX1+1];
lli level[2*MX1+1];

void bfs(lli x)
{
    queue<lli>Q;
    lli i;
    
    Q.push(x);
    visited[x]=1;
    
    while(!Q.empty())
    {
        x=Q.front();
        Q.pop();
        
        rep(i,0,V[x].sz())
        {
            if(!visited[V[x][i]])
            {
                level[V[x][i]]=level[x]+1;
                Q.push(V[x][i]);
                visited[V[x][i]]=1;
            }
        }
    }
}

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    lli N,i,M;
    cin>>N>>M;
    
    while(M--)
    {
        lli x,y;
        cin>>x>>y;
        
        V[x].pb(y);
        V[y].pb(x);
    }
    
    bfs(1);
    
    if(level[N]==2)
    {
        cout<<"POSSIBLE";
    }
    else
    {
        cout<<"IMPOSSIBLE";
    }
    








 return 0;
}


Measured memory_bytes: 15336
#include<stdio.h>

int main(int argc, char*argv[]){
  long n,a[10001],Sum = 0,Min = 1000001,Max = -1000001;
  scanf("%ld\n",&n);
  
  for(int i = 1;i <= n;i++){
    scanf("%ld",&a[i]);
    Sum += a[i];
    if(a[i] > Max){
      Max = a[i];
    }
    if(a[i] < Min){
      Min = a[i];
    }
  }
  
    printf("%ld %ld %ld\n",Min,Max,Sum);
    return 0;
}

  



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

const int MAX = 1100000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    if ((X + Y) % 3 != 0)
    {
        cout << 0 << endl;
        return 0;
    }
    else if (abs(X - Y) > (X + Y) / 3)
    {
        cout << 0 << endl;
        return 0;
    }

    int N = (X + Y) / 3;

    // 前処理
    COMinit();

    cout << COM(N, min(Y, X) - N) << endl;
    return 0;
}

Measured memory_bytes: 29368
#include <iostream>

using namespace std;

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = 1;
  for(int i=1; i<N; i++){
    if(S[i-1] != S[i]) ans++;
  }

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


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

namespace AtCoder_Cs
{
    class Program
    {
        static void Main(string[] args)
        {
            //List<int> Group1 = new List<int>() { 1, 3, 5, 7, 8, 10, 12 };
            //List<int> Group2 = new List<int>() { 4, 6, 9, 11 };
            //List<int> Group3 = new List<int>() { 2 };

            //int[] line1 = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            //List<int> resultList = new List<int>();
            //foreach ( var item in line1)
            //{
            //    if (Group1.Contains(item))
            //    {
            //        resultList.Add(1);
            //    }
            //    else if (Group2.Contains(item))
            //    {
            //        resultList.Add(2);
            //    }
            //    else if (Group3.Contains(item))
            //    {
            //        resultList.Add(2);
            //    }
            //}
            List<int> Group = new List<int> (){ 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
            List<int> line1 = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
            List<int> resultList = new List<int>();

            foreach ( var item in line1)
            {
                resultList.Add(Group[item]);
            }

            Console.WriteLine((resultList[0] == resultList[1]) ? "Yes" : "No");
            Console.ReadLine();
        }
    }
    //class Program
    //{
    //    static void Main(string[] args)
    //    {
    //        int[] line = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
    //        int N = line[0];
    //        int K = line[1];
    //        List<string> list = new List<string>();
    //        //string[] list = null;
    //        int a = 0;

    //        for (int i = 0; i < N; ++i)
    //        {
    //            string[] line2 = Console.ReadLine().Trim().Split(' ');
    //            for (int j = 0; j < int.Parse(line2[1]); ++j)
    //            {
    //                list.Add(line2[0]);

    //            }
    //        }

    //        //var ans = list.OrderBy(s => s).Select(s => s);
    //        var newList = list.ToArray();
    //        Array.Sort(newList);
    //        int cnt = 1;
    //        string result = string.Empty;
    //        foreach (var item in list)
    //        {
    //            if (cnt == K)
    //            {
    //                result = item.ToString();
    //                break;
    //            }
    //            ++cnt;
    //        }
    //        Console.WriteLine($"{result}");
    //        Console.ReadLine();
    //    }
    //}
}


Measured memory_bytes: 13268
object Main extends App {
  for (line <- scala.io.Source.stdin.getLines() if line.size > 0 && line.split(" ")(1) != "?") {
    val in = line.split(" ").toList
    println(calc(in(0).toInt, in(2).toInt, in(1)))
  }

  def calc(a: Int, b: Int, op: String): Int = {
    op match {
      case "+" => a + b
      case "-" => a - b
      case "*" => a * b
      case "/" => a / b
    }
  }
}

Measured memory_bytes: 43996
import java.util.*;

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

        if (n % 2 == 1) {
            System.out.println((n / 2) + 1);
        } else {
            System.out.println(n / 2);
        }
        sc.close();
    }
}


Measured memory_bytes: 22868
w = int(raw_input())
n = int(raw_input())
list = []

for i in range(1, w+1):
    list.append(i)
    #print list
#print list[0]

for j in range(1, n+1):
    num1, num2 = map(int, raw_input().split(","))
    temp = list[num1-1]
    list[num1-1]=list[num2-1]
    list[num2-1]=temp
    #print temp

for k in range(0, w):
    print list[k]


Measured memory_bytes: 4656
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXPERS=200000;

int npers,nchair;
pair<int,int> r[MAXPERS];
map<int,int> opt,req;

void run() {
	scanf("%d%d",&npers,&nchair);
	REP(i,npers) scanf("%d%d",&r[i].first,&r[i].second),--r[i].second;
	sort(r,r+npers);

	int at=0;
	REPE(i,nchair) {
		while(at<npers&&i>=r[at].first) {
			opt[r[at].second]++;
			++at;
			auto it=opt.begin();
			req[it->first]++;
			if(--it->second==0) opt.erase(it);
		}
		if(i==nchair) break;
		if(at<npers&&i<r[at].first) {
			opt[r[at].second]++;
			++at;
		} else if(SZ(req)>0) {
			auto it=req.begin();
			if(i>=it->first) {
				if(--it->second==0) req.erase(it);
			}
		}
	}
	int ret=0; for(auto it=req.begin();it!=req.end();++it) ret+=it->second; printf("%d\n",ret);
}

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


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n, k, x, y;

int main() {
    cin >> n >> k >> x >> y;
    int ans = min(n, k) * x + max(0, n - k) * y;
    cout << ans << endl;
    return 0;
}


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

/*bool subseq(string s,string t){
    ll y=0;
    for(ll i=0;y<s.size()&& i<t.size();i++){
        if(s[y]==t[i]){
            y++;
        }
    }
        if(y==s.size())
            return true;
        else  return false;
}*/
/*ll x=1000000001;
vector<bool>p(x,false);
void prime(){
    p[2]=true;
    for(ll i=3;i<x;i=i+2)
        p[i]=true;
    for(ll i=0;i<x;i=i+2){
        if(p[i]){
            for(ll j=i*i;j<x;j=j+i)
                p[j]=false;
        }
    }
}*/
/*vector<ll> divisor(ll n){
    vector<ll> d;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
        d.push_back(i);
        d.push_back(n/i);
        }
    }
    sort(d.begin(),d.end(),greater<ll>());
    return d;
}*/
/*bool bs(ll n,string s){
    ll a[4]={0};
    for(ll i=0;i<n-1;i++){
        a[s[i]-'0']++;
    }
    for(ll i=n-1;i<s.size();i++){
        a[s[i]-'0']++;
        if(a[1]>0 && a[2]>0 && a[3]>0)
        return true;
        a[s[i-n+1]-'0']--;
    }
    return false;
}*/


/*ll binarySearch(ll n,ll a[],ll x){
    ll low=0,high=n-1,mid,ans=-1;
    while(low<=high){
        mid=low+(high-low)/2;
        if(a[mid]>=x){

            high=mid-1;
        }
        else{
                ans=mid;
            low=mid+1;
        }
    }
    return a[ans];
}*/




/*bool subseq(string s,string t){
    ll y=0;
    for(ll i=0;y<s.size()&& i<t.size();i++){
        if(s[y]==t[i]){
            y++;
        }
    }
        if(y==s.size())
            return true;
        else  return false;
}*/
/*ll x=1000000001;
vector<bool>p(x,false);
void prime(){
    p[2]=true;
    for(ll i=3;i<x;i=i+2)
        p[i]=true;
    for(ll i=0;i<x;i=i+2){
        if(p[i]){
            for(ll j=i*i;j<x;j=j+i)
                p[j]=false;
        }
    }
}*/
/*vector<ll> divisor(ll n){
    vector<ll> d;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
        d.push_back(i);
        d.push_back(n/i);
        }
    }
    sort(d.begin(),d.end(),greater<ll>());
    return d;
}*/
/*bool bs(ll n,string s){
    ll a[4]={0};
    for(ll i=0;i<n-1;i++){
        a[s[i]-'0']++;
    }
    for(ll i=n-1;i<s.size();i++){
        a[s[i]-'0']++;
        if(a[1]>0 && a[2]>0 && a[3]>0)
        return true;
        a[s[i-n+1]-'0']--;
    }
    return false;
}*/


/*ll binarySearch(ll n,ll a[],ll x){
    ll low=0,high=n-1,mid,ans=-1;
    while(low<=high){
        mid=low+(high-low)/2;
        if(a[mid]>=x){

            high=mid-1;
        }
        else{
                ans=mid;
            low=mid+1;
        }
    }
    return a[ans];
}*/

string solve(ll n){


}

int main() {
    ll n,s=0,x,y,q;
    cin>>n;
    ll f[100001]={0};
   // vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin>>x;
        f[x]++;
        s=s+x;
    }
    cin>>q;
    //vector<ll>b(q);
    //vector<ll>c(q);
    for(ll i=0;i<q;i++){
        cin>>x>>y;
        if(f[x]>0 && x!=y){
            s=s-f[x]*x+f[x]*y;
            f[y]=f[y]+f[x];
            f[x]=0;
        }
         cout<<s<<endl;
    }

}


Measured memory_bytes: 4396
#include<stdio.h>
int main()
{
    int n,p,q,j;
    scanf("%d %d %d",&n,&p,&q);
    if(p>q){j=q*n;}
    else j=p*n;
    if(j<=q) printf("%d\n",j);
    else printf("%d\n",q);
    return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX / 10;
const ll LINF = LLONG_MAX / 10;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


int main()
{
	int n;
	cin >> n;
	Vl A(n);
	rep(i, n)  cin >> A[i];

	queue<ll> Q;
	sort(A.begin(), A.end(), greater<ll>());

	Q.push(A[0]);
	ll ans = 0;
	for (int i = 1; i < n; i++) {
		ans += Q.front();
		//cout << ans << endl;
		Q.pop();
		Q.push(A[i]);
		Q.push(A[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 6428
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int cal(int x){
	rep(i,100100){
		if(i*100<=x && x<=i*105) return 1;
	}
	return 0;
}
int main()
{
	int n;cin>>n;cout<<cal(n)<<endl;
}


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

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
static const ll INF = 1LL << 60;
//Write From this Line

int main()
{
	ll n, k;
	cin >> n >> k;
	if(n == k) {
		cout << 0 << endl;
		return 0 ;
	}
	if(k == 0){
		cout << n << endl;
		return 0;
	}
	if(k == 1){
		cout << 0 << endl;
		return 0;
	}
	cout <<min(n, abs((n%k) - k)) << endl;
}


Measured memory_bytes: 256
a,b = map(int, input().split())
s = input()
flg = 1
for i in range(len(s)):
    if i == a: continue
    elif '0' <= s[i] <= '9': flg = 1
    else: 
        flg = 0
        break

if (len(s) == a+b+1 and s[a] == '-' and flg) :print("Yes")
else: print("No")

Measured memory_bytes: 9136
n = int(input())
x_list = list(map(int, input().split()))

min_x = min(x_list)
max_x = max(x_list)
min_power = 10000 * 1000
for i in range(min_x, max_x + 1):
    check_power = 0
    for j in x_list:
        check_power += (j - i) * (j - i)
    if(check_power < min_power):
        min_power = check_power
print(min_power)

Measured memory_bytes: 3064
#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 main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define INF 1e8
typedef long long int ll;
const double PI = acos(-1);

using Graph = vector<vector<int>>;
int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i, n)
  {
    cin >> a[i];
  }
  int total = accumulate(a.begin(), a.end(), 0);
  double border = double(total) / (4 * m);
  // cout << border << endl;
  int num = 0;
  rep(i, n)
  {
    if (a[i] >= border)
      num++;
  }
  if (num >= m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
    int n,b,i,j;
    int d=0,f,g,h;

    scanf("%d",&n);

    int x[n];
    char c[12];
    for(i=0;i<n;i++)
    {
        scanf("%s %d",c,&b);

        if(c[0]=='i')x[i]=b;
        else if(c[6]=='F'){i-=2;n-=2;}
        else if(c[6]=='L'){i--;n--;d++;}
        else{
            i--;n--;
            f=0;
            for(j=i;j>=0;j--)
            {
                if(f>0)break;
                if(b==x[j])
                {
                    g=i-j;
                    h=0;
                    f++;
                    while(g!=h++)x[j+h-1]=x[j+1+h-1];
                    i--;n--;
                }
            }
        }
    }

    for(i=0;i<n-d;i++)
    {
        if(i==n-d-1)printf("%d\n",x[n-1-i]);
        else printf("%d ",x[n-1-i]);
    }

    return 0;
}

Measured memory_bytes: 5332
#include <iterator>
#include <list>
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <sstream>
#include <iomanip>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main() {
  int N; cin >> N;
  vector<int> w(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i];
  }

  // sort(w.begin(), w.end());

  int sm = accumulate(w.begin(), w.end(), 0);

  int prev = w.front();
  sm -= prev;
  int ans = 1e9;
  for (int i = 1; i < N; i++) {
    ans = min(ans, abs(sm - prev));
    prev += w[i];
    sm -= w[i];
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
struct NODE{
    int ID;
    int depth;
    vector<int> child;
};
vector<vector<int> > cs(100010);
int parent[100010];
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    REP(i, 100010) parent[i]=-1;
    for(int i=0; i<n; ++i){
        int id, k; cin >> id >> k; //Node iはk個の子を持つ
        for(int j=0; j<k; ++j){
            int c; cin >> c;
            parent[c] = id; //親の決定
            cs[id].push_back(c);
        }
    }
    
    //根を求める
    int root;
    for(int i=0; i<n; ++i){
        if(parent[i]==-1){
            root = i;
            break;
        }
    }
    //出力
    for(int i=0; i<n; ++i){
        int depth=0;
        int t=i;
        while(t!=root){
            t = parent[t];
            depth++;
        }
        string s;
        if(i==root) s="root";
        else if(cs[i].size()!=0) s="internal node";
        else s="leaf";
        cout << "node " << i << ": parent = " << parent[i] << ", ";
        cout << "depth = " << depth << ", " << s << ", [";
        for(int j=0; j<cs[i].size(); ++j){
            if(j) cout << ", ";
            cout << cs[i][j];
        }
        cout << "]" << endl;
    }
	return 0;
}


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

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

    vector<int> mt;
    mt.resize(n);
    for (int i = 0; i < n; i++)
    {
        cin >> mt[i];
    }

    int max = mt[0];
    int cnt = 1;

    for (int i = 1; i < n; i++)
    {
        if (mt[i] >= max)
        {
            cnt++;
            max = mt[i];
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256