akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int mp[11][11];
int a[210][210];

int main()
{
	int h,w;cin >> h >> w;
	
	REP(i,10)REP(j,10)
	{
		cin >> mp[i][j];
	}
	
	REP(k,10)REP(i,10)REP(j,10)
	{
		mp[i][j] = min(mp[i][j] ,mp[i][k] + mp[k][j]);
	}
	
	ll ans = 0;
	
	REP(i,w)
	{
		REP(i,h)
		{
			int tmp;
			cin >> tmp;
			if(tmp != -1 && tmp != 1)
			{
				ans += mp[tmp][1];
			}
		}
	}
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
BIG_NUM = 2000000000


N = int(input())
x = 0

for i in range(1,N+1):

    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()



Measured memory_bytes: 5876
h, w = map(int, input().split())
inf = 10**8
d = [[inf for _ in range(10)] for _ in range(10)]
c = []
for i in range(10):
    c = list(map(int, input().split()))
    for j in range(10):
        d[i][j] = c[j]


# 各数字から１への最小コストを求める
for k in range(10):
    for i in range(10):
        for j in range(10):
            d[i][j]= min(d[i][j], d[i][k] + d[k][j])

ans = 0
for i in range(h):
    a = list(map(int, input().split()))
    for j in range(w):
        if a[j] != -1 and a[j] != 1:
            ans += d[a[j]][1]

print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    REP(i,3){char a; cin >> a; if(a=='1')cout << 9; else cout << 1;}

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(); // 1 が書かれたカード
        int B = sc.nextInt(); // 0 が書かれたカード
        int C = sc.nextInt(); // -1 が書かれたカード
        int K = sc.nextInt(); // 取る枚数

        int ans = 0;
        int nokori = K;

        if (A >= nokori) {
            System.out.println(K);
        } else {
            nokori = nokori - A;
            if (B >= nokori) {
                ans = A;
                System.out.println(ans);
            } else {
                nokori = nokori - A - B;
                ans = ans - nokori;
                System.out.println(ans);
            }
        }
    }
}

Measured memory_bytes: 35744
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    long n,m;
    cin>>n>>m;
    long l[m];
    long r[m];
    for(int i = 0;i<m;i++){
      cin>>l[i]>>r[i];
    }
    sort(l,l+m);
    sort(r,r+m);
    int hidari = l[m-1];
    int migi = r[0];
    int k = migi-hidari+1;
    if(k <= 0) cout<<"0";
    else cout<<k;
    return 0;
}

Measured memory_bytes: 1792
n, k = map(int, input().split())
X, Y, C = [], [], []
for _ in range(n):
  x, y, c = input().split()
  X.append(int(x)%(2*k))
  Y.append(int(y)%(2*k))
  C.append(c=="B")
G = [[0]*k for _ in range(k)]
cnt = 0
for x, y, c in zip(X, Y, C):
  if (x >= k and y < k) or (x < k and y >= k):
    x += k
    c ^= 1
  x %= k
  y %= k
  G[x][y] += (-1)**c
  cnt += c
for i in range(k):
  for j in range(k-1):
    G[i][j+1] += G[i][j]
for j in range(k):
  for i in range(k-1):
    G[i+1][j] += G[i][j]
ans = 0
for i in range(k):
  for j in range(k):
    temp = G[k-1][k-1] - G[i][k-1] - G[k-1][j] + G[i][j]*2 + cnt
    ans = max(ans, temp, n-temp)
print(ans)

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

const long mod = 1e9+7;

long sumto(int n){
  long r;
  if(n % 2)  r = (n+1)/2%mod * (n%mod) % mod;
  else  r = n/2% mod * ((n+1)%mod) % mod;
  return r;    
}

int main(){
  int n, k;  cin >> n >> k;
  vector<long> a(n);
  for(int i=0; i<n; i++)  cin >> a[i];

  vector<long> aftb(n, 0), bfrb(n, 0);
  for(int i=0; i<n; i++){
    for(int j=0; j<i; j++)
      if(a[j] < a[i])  bfrb[i]++;
    for(int j=i+1; j<n; j++)
      if(a[j] < a[i])  aftb[i]++;
  }

  long ans = 0;
  for(int i=0; i<n; i++)
    ans = (ans + sumto(k)*aftb[i]%mod + sumto(k-1)*bfrb[i]%mod) % mod;

  ans = (ans + mod) % mod;
  cout << ans << endl;
  
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    int n = (int)s.length();
    int in = 0, ans = 0, cnt = 0;
    while (in < n) {
        if (s[in] == 'R') ++cnt;
        else {
            ans = max(ans, cnt);
            cnt = 0;
        }
        ++in;
    }
    ans = max(ans, cnt);
    cout << ans << endl;
    return 0;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n = 2;
  vector<ll> a(n),c(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> c[i];

  ll ans = -INF_LL;
  rep(i,n){
    rep(j,n){
      ans = max(ans,a[i]*c[j]);
    }
  }

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


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

int solve(const int n, const int m, const vector<int>& x) {
  if (n >= m)
    return 0;

  vector<int> ds;
  for (int i = 0; i < m - 1; ++i)
    ds.push_back(x[i + 1] - x[i]);
  sort(ds.begin(), ds.end());
  int ret = accumulate(ds.begin(), ds.begin() + m - n, 0);
  return ret;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  for (int i = 0; i < m; ++i)
    cin >> x[i];
  sort(x.begin(), x.end());
  cout << solve(n, m, x) << "\n";

  return 0;
}


Measured memory_bytes: 1276
#include <stdio.h>
#include <map>
#include <algorithm>
#include <vector>
#include <queue>

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

typedef pair<int,int> s;
typedef long long int ll;

int abs(int x){
  return x > 0 ? x : -x;
}

int length(char c[]){
  int cnt=0;
  for(cnt=0;c[cnt]!='\0';cnt++){
  }
  return cnt;
}

typedef pair<int,s> ss;
void clear( queue<ss> &q )
{
   std::queue<ss> empty;
   std::swap( q, empty );
}

int n;
int t[100001];
int x[100001];
int y[100001];

int main(){
  scanf("%d",&n);
  REP(i,n){
    scanf("%d %d %d",&t[i], &x[i], &y[i]);
  }
  int nx = 0;
  int ny = 0;
  int nt = 0;
  REP(i,n){
    int tt = t[i]-nt;
    int tx = abs(x[i]-nx);
    int ty = abs(y[i]-ny);
    if(((tt-(tx+ty))%2 == 1) || tt < tx+ty){
      printf("No\n");
      return 0;
    }
    nt = t[i];
    nx = x[i];
    ny = y[i];
  }
  printf("Yes\n");
  return 0;
}

/*
int n;
int t[100001];
int x[100001];
int y[100001];
bool flag[100001];
queue<ss> qu;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int F[200001][200001];
int main(){
  scanf("%d",&n);
  REP(i,n){
    scanf("%d %d %d",&t[i],&x[i],&y[i]);
    flag[i] =false;
  }
  qu.push(ss(0,s(0,0)));
  int i = 0;
  while(!qu.empty()){
    if(i==n)break;
    int now = qu.front().first;
    int now_x = qu.front().second.first;
    int now_y = qu.front().second.second;
    qu.pop();
    //printf("%d %d %d\n",now, now_x, now_y);
    if(now == t[i]){
      if(now_x == x[i] && now_y == y[i]){
        clear(qu);
        flag[i] = true;
        i++;
      }else{
        continue;
      }
    }
    REP(j,4){
      if(F[now_x+dx[j]][now_y+dy[j]] == now +1) continue;
      F[now_x+dx[j]][now_y+dy[j]] = now + 1;
      qu.push(ss(now+1,s(now_x+dx[j],now_y+dy[j])));
    }
  }
  REP(j,n){
    if(flag[j]==false){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
}
*/


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n, minimum = 200001, p, ans = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> p;
        if (p < minimum) {
            ++ans;
            minimum = p;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter writer = new PrintWriter(System.out);
		
		String str = br.readLine();
		writer.println(str.substring(0, str.length() - 8));
		
		br.close();
		writer.close();
	}
}

Measured memory_bytes: 22996
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

int n;
int m;
pair<int,int> dat1[2*(1<<19)-1];
pair<int,int> dat2[2*(1<<19)-1];
vector<pair<int,int> >ans;
priority_queue<pair<int,pair<int,int> >,vector<pair<int,pair<int,int> > >,greater<pair<int,pair<int,int> > > > pq;
void init(int n_){
	n = 1;
	while(n<n_) n *= 2;
	for(int i=0;i<2*n-1;i++){
		dat1[i] = make_pair(100000000,i);
		dat2[i] = make_pair(100000000,i);
	}
}

void update1(int k,int a){
	k += n-1;
	dat1[k] = make_pair(a,k-n+1);
	while(k>0){
		k = (k-1)/2;
		dat1[k] = min(dat1[k*2+1],dat1[k*2+2]);
	}
}


void update2(int k,int a){
	k += n-1;
	dat2[k] = make_pair(a,k-n+1);
	while(k>0){
		k = (k-1)/2;
		dat2[k] = min(dat2[k*2+1],dat2[k*2+2]);
	}
}

pair<int,int> query1(int a,int b,int k,int l,int r){
	if(r <= a || b<= l)return make_pair(10000000,-1);
	if(a <= l && r <= b) return dat1[k];
	else{
		pair<int,int> vl = query1(a,b,k*2+1,l,(l+r)/2);
		pair<int,int> vr = query1(a,b,k*2+2,(l+r)/2,r);
		return min(vl,vr);
	}
}

pair<int,int> query2(int a,int b,int k,int l,int r){
	if(r <= a || b<= l)return make_pair(10000000,-1);
	if(a <= l && r <= b) return dat2[k];
	else{
		pair<int,int> vl = query2(a,b,k*2+1,l,(l+r)/2);
		pair<int,int> vr = query2(a,b,k*2+2,(l+r)/2,r);
		return min(vl,vr);
	}
}

void add(int a,int b){
	if(a>=b)return;
	if(a%2==0){
		pq.push(make_pair(query1(a/2,b/2+1,0,0,n).first,make_pair(a,b)));		
	}else{
		pq.push(make_pair(query2(a/2,b/2,0,0,n).first,make_pair(a,b)));			
	}	
	return;
}


int main(){
	cin >> m;
	init(m);
	int tmp;
	vector<int>p;
	for(int i=0;i<m;i++){
		cin >> tmp;
		p.push_back(tmp);
		if(i%2==0){
			update1(i/2,tmp);
		}else{
			update2(i/2,tmp);
		}
	}
	pq.push(make_pair(query1(0,m/2,0,0,n).first,make_pair(0,m-1)));
	while(!pq.empty()){
		pair<int,pair<int,int> > k;
		k = pq.top();
		pq.pop();
		int a,b;
		a = k.second.first;
		b = k.second.second;
		pair<int,int> v1;
		pair<int,int> v2;
		int l,r;
		if(a%2==0){
			v1 = query1(a/2,b/2+1,0,0,n);
			l = v1.second*2;
			v2 = query2(v1.second,b/2+1,0,0,n);
			r = v2.second*2+1;
		}else{
			v1 = query2(a/2,b/2,0,0,n);
			l = v1.second*2+1;
			v2 = query1(v1.second+1,b/2+1,0,0,n);
			r = v2.second*2;
		}
		ans.push_back(make_pair(l,r));
		add(a,l-1);
		add(l+1,r-1);
		add(r+1,b);
	}
	for(int i=0;i<ans.size()-1;i++){
		cout << p[ans[i].first] << " " << p[ans[i].second] << " ";
	}
	cout << p[ans[ans.size()-1].first] << " " << p[ans[ans.size()-1].second] << endl;
	return 0;
}

Measured memory_bytes: 16884
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

ll py_sum(ll n){
    return ((2*n+1)/6);
}

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    //Sum_{m=1..floor(sqrt(n))} m*(m+floor(n/m))*(floor(n/m)+1-m) - A000330(floor(sqrt(n)))
    for (int k=1;k<=N; k++){
        ans += k*floor(N/k)*(1+N/k);
    }
    cout << ans/2 << endl;
}

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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  ll sum = 0, ans;
  int neg_count = 0, min = INF, abs_a;
  bool zero_exist = false;
  REP(i, 0, N) {
    cin >> A[i];
    abs_a = abs(A[i]);
    sum += abs_a;
    if (A[i] < 0) neg_count++;
    if (A[i] == 0) zero_exist = true;
    if (min > abs_a) min = abs_a;
  }

  if (zero_exist) {
    ans = sum;
  } else if (neg_count % 2 != 0) {
    ans = sum - min*2;
  } else {
    ans = sum;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

bool sym(const string &s){
	rep(i, s.size() / 2) if(s[i] != s[s.size() - 1 - i]) return 0;
	return 1;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	string s; cin >> s;
	cout << (sym(s) && sym(s.substr(0, s.size() / 2)) ? "Yes" : "No") << endl;
	
	return 0;
}

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

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a * b > c * d || a * b == c * d) {
        cout << a * b;
    } else {
        cout << c * d;
    }
}

Measured memory_bytes: 256
N = int(input())
a_sum = 0
b_sum = 0
Sum = []
for a in range(1,N):
  b = N-a
  a_sum = 0
  b_sum = 0
  while (a>0):
    a_sum += a%10
    a //= 10
  while (b>0):
    b_sum += b%10
    b //= 10
  Sum.append(a_sum+b_sum)
print(min(Sum))
    
  
  

Measured memory_bytes: 3864
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn read_stdin() -> String {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

fn main() {
    read_line();
    let mut v: Vec<(u64, usize)> = read_stdin()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .enumerate()
        .map(|(i, x)| (x, i))
        .collect();
    v.sort();
    
    let mut out = vec![0; v.len()];
    for (j, &(_, i)) in v.iter().enumerate() {
        let last = v.len() - 1;
        if j == last {
            out[i] = v[last - 1].0;
        } else {
            out[i] = v[last].0;
        }
    }
    
    println!("{}", out.into_iter().map(|x| x.to_string()).collect::<Vec<_>>().join("\n"));
}


Measured memory_bytes: 18036
s = input()

Ans = []

for i in range(len(s)):
	if s[i] == "0":
		Ans.append("0")
	
	if s[i] == "1":
		Ans.append("1")
		
	if s[i] == "B":
		if len(Ans) == 0:
			continue
		
		else:
			del Ans[-1]
		
a = ''.join(Ans)

print(a)
		

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, w, items[105], weights[105];
	int ans = 0;
	cin >> n >> w;
	int total_value = 0;
	for (int i = 1; i <= n; i++) {
		cin >> weights[i] >> items[i];
		total_value += items[i];
	}
	vector<vector<long long>> dp (n+1, vector<long long> (total_value+1));
	for (int i = 1; i <= total_value; i++)
		dp[0][i] = 1e18;
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= total_value; j++) {
			dp[i][j] = dp[i-1][j];
			if (items[i] <= j)
				dp[i][j] = min(dp[i][j], dp[i-1][j-items[i]] + weights[i]);
			if (dp[i][j] <= w)
				ans = max(ans, j);
		}
	}
	cout << ans;
}

Measured memory_bytes: 80256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Contexts;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
namespace AOJ {
    internal class Program {
        public static void Main(string[] args) { new Program().solve(); }
        void solve() {
            Func <double, double> rad = (theta) => theta * (Math.PI) / 180D;
            Func <double, double, double, double> area = (e1, e2, theta) => (e1 * e2 * Math.Sin(rad(theta))) / 2;
            Func <double, double, double, double> surroundings = (e1, e2, theta) =>
                e1 + e2 + Math.Sqrt(e1 * e1 + e2 * e2 - 2 * e1 * e2 * Math.Cos(rad(theta)));
            Func <double, double, double> height = (bottom, theta) => bottom * Math.Sin(rad(theta));
            var inputs = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();
            var a = inputs[0];
            var b = inputs[1];
            var C = inputs[2];
            Console.WriteLine(area(a, b, C));
            Console.WriteLine(surroundings(a, b, C));
            Console.WriteLine(height(b, C));
        }
    }
}



Measured memory_bytes: 9592
N = int(input())
if N < 105:
    print(0)
else:
    ans = 1
    for a in range(107, N+1, 2):
        tmp = 2
        for b in range(2, a//2):
            if a % b == 0:
                tmp += 1
        if tmp == 8:
            ans += 1
    print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define int long long
#define rint register int
using namespace std;

template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}
const int N = 3e5 + 2333;
const int M = N * 2;
struct Edge {
  int nxt, to, w;
}e[M];
int head[N], e_cnt = 0;
int n, m, ans = 0, mn = 1e18;
int sz[N], dp[N], f[N], isheart[N], cc = 0;
inline void add(int x, int y, int w) {
  e[++ e_cnt] = (Edge) {head[x], y, w}; head[x] = e_cnt;
}

inline void upd(int u, int v, int w) {
  sz[u] += sz[v];
  dp[u] += min(sz[v], n - sz[v]) * w + dp[v];
}

inline void del(int u, int v, int w) {
  sz[u] -= sz[v];
  dp[u] -= min(sz[v], n - sz[v]) * w + dp[v];
}

inline void dfs(int u, int fat) {
  sz[u] = 1; f[u] = 0;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    int w = e[i].w;
    if (v != fat) {
      dfs(v, u);
      upd(u, v, w);
      f[u] = max(f[u], sz[v]);
    }
  }
  f[u] = max(f[u], n - sz[u]);
  if (f[u] * 2 <= n)
    isheart[u] = true, ++ cc;
}

inline void gao(int u, int v, int w) {
  int res = dp[u] + dp[v];
  res += min(sz[u], sz[v]) * w;
  // cout << u << " " << v << " " << dp[u] << " " << dp[v] << " " << res << "\n";
  if (cc == 2 && isheart[u] && isheart[v])
    ans = max(ans, res * 2 - w);
  else if(cc == 1 && (isheart[u] || isheart[v]))
    ans = max(ans, res * 2 - w);
}

inline void fsd(int u, int fat) {
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    int w = e[i].w;
    if (v != fat) {
      del(u, v, w); gao(u, v, w); upd(v, u, w);
      fsd(v, u);
      del(v, u, w); upd(u, v, w);
    }
  }
}

main(void) {
  read(n);
  for (int i = 2; i <= n; i ++) {
    int x, y, w; read(x); read(y); read(w);
    add(x, y, w); add(y, x, w); mn = min(mn, w);
  }
  dfs(2, 0);
  // for (int i = 1; i <= n; i++)
  //   if (isheart[i]) cout << i << "\n";
  fsd(2, 0);
  cout << ans << "\n";
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int X, Y; cin >> X >> Y;
	cout << X + Y / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N, sum = 0;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    if (A.at(i) > A.at(i + 1)) {
      sum += A.at(i) - A.at(i + 1);
      A.at(i + 1) = A.at(i);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3996
package main

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

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func main() {
	solve()
}

func solve() {
	s, t := nextWord(), nextWord()
	res := 0
	for i := 0; i < 3; i++ {
		if s[i] == t[i] {
			res++
		}
	}
	fmt.Fprint(writer, res)
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
package main
 
import (
	"fmt"
)
 
func main() {
	var n int
	fmt.Scanf("%d", &n)

	A := make([]int64, n)
    // 数列の長さの分だけScanfを繰り返す
    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &A[i])
	}

	var sum int64
	var tmp int64 = 0
	for j := 0; j < n; j ++{
		tmp += A[j]
	} 

	for i := 0; i < n-1 ; i ++{
		tmp -= A[i]
		sum += (A[i] * (tmp % 1000000007))% 1000000007
	}

	fmt.Printf("%d\n", sum % 1000000007)
}

Measured memory_bytes: 6500
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    int cnt=0;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
    {
        int idx=i;
        for(int j=i;j<n;j++)
            if(a[j]<a[idx])
            idx=j;
        cnt+=i!=idx;
        swap(a[i],a[idx]);
    }
    for(int i=0;i<n;i++)
    {
        if(i)
        cout<<" ";
    cout<<a[i];
}
cout<<"\n";
cout<<cnt<<endl;
return 0;
    }



Measured memory_bytes: 3104
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#include <bit>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  string s;

  cin >> s;

  ll cur = 0;

  ll a[2019] = {0};

  a[0] = 1;

  ll ans = 0;

  ll n = s.size();

  for(ll i = 0; i < n; i++) {
    cur = (cur * 10 + (s[i] - '0')) % 2019;
    ans += a[cur];
    a[cur]++;
    ll b[2019] = {0};
    for(ll j = 0; j < 2019; j++)
      b[j * 10 % 2019] = a[j];
    for(ll j = 0; j < 2019; j++)
      a[j] = b[j];
  }

  cout << ans;

  return 0;
}
/*

*/


Measured memory_bytes: 3804
#include <iostream>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
 
using namespace std;
 
void solve()
{
    int H, W;
    while (cin >> H >> W, H || W)
    {
        for (int i = 0; i < H; ++i)
        {
            for (int j = 0; j < W; ++j)
            {
                if ((i + j) % 2)
                {
                    cout << ".";
                }
                else
                {
                    cout << "#";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}
 
int main()
{
    solve();
    return(0);
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL h1,h2,m1,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    cout<<(h2-h1)*60+m2-m1-k<<endl;
    return 0;
}

Measured memory_bytes: 3676
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    long ans;
    if(Math.abs(N-M) > 1) ans = 0;
    else{
      if(N != M) ans = 1;
      else ans = 2;
      long s = 1;
      long t = 1;
      while(N > 0){
        s *= N;
        s %= MOD;
        N--;
      }
      while(M > 0){
        t *= M;
        t %= MOD;
        M--;
      }
      ans = s * t * ans % MOD;
    }
    out.println(ans);
  }

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

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
const int N = 200010, INF = (int)1e9;
struct data {
  int x,y;
  bool operator < (const data& a) const {
    return x < a.x;
  }
} dat[N];
typedef long long ll;
int n,bmx = 0,bmn = INF,amx = 0,amn = INF,mx,mn,cur,tmp = INF;
ll ans = 1ll * INF * INF;
int main() {
  scanf("%d",&n);
  for (int i = 1 ; i <= n ; ++ i) {
    scanf("%d%d",&dat[i].x,&dat[i].y);
    if (dat[i].x > dat[i].y) swap(dat[i].x,dat[i].y);
    bmx = max(bmx,dat[i].x);
    bmn = min(bmn,dat[i].x);
    amx = max(amx,dat[i].y);
    amn = min(amn,dat[i].y);
  }
  ans = min(ans,1ll * (bmx - bmn) * (amx - amn));
  mx = amx, mn = bmn, cur = bmx;
  sort(dat+1,dat+n+1);
  for (int i = 1 ; i <= n ; ++ i) {
    ans = min(ans,1ll * (mx - mn) * (cur - min(tmp,dat[i].x)));
    cur = max(cur,dat[i].y);
    tmp = min(tmp,dat[i].y);
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;

        static void SolveA()
        {
            string s = Console.ReadLine();
            var map = new HashSet<char>();
            for (int i = 0; i < s.Length; ++i)
            {
                if (!map.Contains(s[i])) { map.Add(s[i]); }
            }
            string ans = map.Count == s.Length ? "yes" : "no";
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 13396
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, t = map(int, readline().split())
cost = 9999
for i in range(n):
    inpt = list(map(int, readline().split()))
    if inpt[1] <= t:
        cost = min(cost, inpt[0])
print(cost if cost != 9999 else 'TLE')


Measured memory_bytes: 9236
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string O,E; cin >> O >> E;
    int olen = O.length();
    int elen = E.length();

    int now = 0;
    while(1){
        if(now == olen) {
            cout << endl;
            return 0;
        }
        cout << O[now];
        if(now == elen) {
            cout << endl;
            return 0;
        }
        cout << E[now];
        now++;
    }

}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;


long long int n, z, w, x, y, k, l, s;
long long int a[2010], ax[2010], ay[2010], ix[2010], iy[2010], ansi, ansm, ans;

int main(){
	cin >> n >> z >> w;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	if(n==1){
		cout << abs(a[0]-w) << endl;	
	}else{
		cout << max(abs(a[n-1]-w), abs(a[n-1]-a[n-2])) << endl;
	}
	return 0;
}

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

int main() {
	// your code goes here
	int a, b;
	cin >> a >> b;
	if(a!=1 && b!=1){cout << 1 << endl;}
	else if(a!=2 && b!=2){cout << 2 << endl;}
	else{cout << 3 << endl;}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    char c;
    cin>>c;
    if(c>='a' && c<='z') cout<<'a'<<endl;
    else cout<<'A'<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3588
# 辞書型のキーで数字を判別し、バリューにカウンタを用意
# 上記辞書を元に出現頻度操作関数を行う関数を作成し、都度呼び出す
# 出現頻度操作関数では不動点を求めるまでループさせ続ける

def transport(L,before_L=[],cnt=0):
    cnt += 1
    if L==before_L:
        print(cnt-2)
        return cnt
    L_before = L[:]
    dic = {}
    for i in L:
        dic[i] = 0
    for i in L:
        dic[i] += 1
    # 上の2つのfor文でカウントは出来たので、keyの数字の値をvalueに置き換える
    for i in range(len(L)):
        L[i] = dic[L[i]]
    transport(L,L_before,cnt)

    return L

while 1:
    n = int(input())
    if n==0:
        break
    S = list(map(int,input().split()))
    P = transport(S)
    for i in range(len(P)-1):
        print(P[i],end=" ")
    print(P[-1])


Measured memory_bytes: 5596
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
for i in range(n):
    if a[i] >= b[i]:
        count += b[i]
    else:
        count += a[i]
        b[i] -= a[i]
        if a[i+1] >= b[i]:
            count += b[i]
            a[i+1] -= b[i]
        else:
            count += a[i+1]
            a[i+1] = 0
print(count)

Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define PER(i,a,b) for(int (i)=(a);(i)>=(b);--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(x) ((int)((x).size()))
#define ALL(t) t.begin(),t.end()
#define CLR(x) memset(x,0,sizeof(x))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long double ld;
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define FLASH ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
inline void rwFile(string file) {freopen((file+".in").c_str(),"r",stdin); freopen((file+".out").c_str(),"w",stdout);}
inline bool EQ(ld a,ld b) {return fabs(a-b)<=(1e-7);}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;} return res;}
ll inv(ll a,ll mod) {return powmod(a,mod-2,mod);}
void clk() {cout<<" Execution Time = "<<(int)(clock()*1000./CLOCKS_PER_SEC)<<" ms\n";}
const ll inf=1000000007;
const ld pi=3.141592653589;
//==============================================CUT_BEGINS==========================================================//

int main() {
	string str;
	cin >> str;
	if ((str[0] == str[1] && str[1] == str[2]) || (str[1] == str[2] && str[2] == str[3])) {
		cout << "Yes\n";
	}	else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 764
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>

using namespace std;

#define ALL(a) (a).begin(),(a).end()
#define REP(index, begin, end) for (int (index) = (begin); (index) < (end); (index)++)
#define RE(index, end) REP(index, 0, end)
#define INF INT_MAX / 3
#define LLINF LLONG_MAX / 3
#define DINT(x) printf(#x " = %d\n", x);
#define GETINT(x) scanf("%d", &x)
#define GETLL(x) scanf("%lld", &x)
#define GETSTR(x) scanf("%s", x)

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int main()
{
	int tomo_n, cnt;
	vi targets;
	vector<vector<int>> yosou;
	vi points;
	GETINT(tomo_n);
	points.resize(tomo_n, 0);
	GETINT(cnt);
	RE(i, cnt)
	{
		int temp;
		GETINT(temp);
		targets.push_back(temp - 1);
	}
	assert(targets.size() == cnt);
	RE(i, cnt)
	{
		vi line;
		RE(j, tomo_n)
		{
			int temp;
			GETINT(temp);
			line.push_back(temp - 1);
		}
		assert(line[targets[i]] == targets[i]);
		yosou.push_back(line);
	}
	assert(yosou.size() == cnt);
	RE(i, cnt)
	{
		int lose_num = 0;
		RE(j, tomo_n)
		{
			if (yosou[i][j] == targets[i])
			{
				points[j]++;
			}
			else
			{
				lose_num++;
			}
		}
		points[targets[i]] += lose_num;
	}
	RE(i, tomo_n)
	{
		printf("%d\n", points[i]);
	}
	return 0;
}

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

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

ll power(ll x,ll y)
{
    ll res = 1;
    while(y>0){
        if(y&1)
            res *= x;
        y>>=1;
        x*=x;
    }
    return res;
}

void seive_prime(ll n)
{
    ll p[n+1]={0};
    for(ll i=2;i*i<=n;i++){
        if(p[i]==0){
            for(ll j=i*i;j<=n;j+=i){
                p[j]=1;
            }
        }
    }
    for(ll i=2;i<=n;i++)
        if(p[i]==0)
            cout<<i<<' ';
}
int main()
{
    ll n,k,q;
    cin>>n>>k>>q;
    vector<int> a;
    map<int,int> mp;
    for(int i=0;i<q;i++){
        int val;
        cin>>val;
        mp[val]++;
        //a.push_back(val);
    }
    for(int i=1;i<=n;i++){
        if(((mp[i]+k)-q)<=0){
            cout<<"No"<<'\n';
        }
        else{
            cout<<"Yes"<<'\n';
        }
    }
    return 0;
}


Measured memory_bytes: 5376
N = int(input())
A = list(map(int, input().split()))
C = [0 for i in range(N)]

for i in range(N, 0, -1):
    if i > N // 2:
        C[i-1] = A[i-1]
    else:
        sum_b = 0
        for k in range(1, 10**6):
            if i * k > N:
                break
            else:
                sum_b += C[i * k - 1]
        if sum_b % 2 == A[i-1]:
            C[i-1] = 0
        else:
            C[i-1] = 1

print(sum(C))
B = []
for i in range(N):
    if C[i] == 1:
       B.append(i+1)
for i in range(len(B)):
    if i == len(B) - 1:
        print(B[i], end=" ")
    else:
        print(B[i], end=" ")



Measured memory_bytes: 70504
import math
import fractions
import sys
input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))

#################################################
#################################################
#################################################
#################################################


n = int(input())

ans = 0
for ii in range(n):
    i = ii+1
    if(not(i%3==0 or i%5==0)):
        ans += i

print(ans)












Measured memory_bytes: 72956
main :: IO ()
main = do
  n <- readLn :: IO Int
  [t, a] <- map read . words <$> getLine :: IO [Double]
  hs <- map read . words <$> getLine
  let id = foldl1 (\(ai,ah) (i,h) -> if abs (a-(f t h)) < abs (a-(f t ah)) then (i,h) else (ai,ah)) $ zip [1..n] hs 
  print $ fst id 

f :: Double -> Double -> Double
f t h = t-h*0.006 :: Double

Measured memory_bytes: 1276
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}

void solve(){
	int n;
	cin>>n;
	int a[n];
	rep(i,n)cin>>a[i];
	int c=0;
	for(int i=1;i<n-1;i++){
		int b[3];
		b[0]=a[i-1];
		b[1]=a[i];
		b[2]=a[i+1];
		sort(b,b+3);
		if(b[1]==a[i])c++;
	}
	cout<<c;
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int a=(s[0]-'0')*10+s[1]-'0',b=(s[2]-'0')*10+s[3]-'0';
	if(a>=1&&a<13){
		if(b>=1&&b<13)cout<<"AMBIGUOUS";
		else cout<<"MMYY";
	}
	else{
		if(b>=1&&b<13)cout<<"YYMM";
		else cout<<"NA";
	}
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top = 0,S[1000];

void push(int x){
    S[++top] = x;
}

int pop(void){
    top--;
    return S[top+1];
}

int main(void){
    int a,b;
    top = 0;
    char s[100]; //スタックではない　scanf用
    while(scanf("%s",s) != EOF){//scanfは成功したら読み込んだデータ数を、失敗したらEOFを返す
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        }else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        }else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        }else if(s[0] == '/'){
            a = pop();
            b = pop();
            push(a/b);
        }else{
            push(atoi(s));
        }
    }
    printf("%d\n",pop());

    return 0;
}


Measured memory_bytes: 2104
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

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

list<PII> l;

int main(void){
	int n,w,d;
	while(cin>>n>>w>>d, w){
		l.clear();
		l.PB(MP(w,d));
		REP(i,n){
			int p,q;
			cin>>p>>q;
			p--;
			list<PII>::iterator it = l.begin();
			REP(j,p)it++;
			PII tmp=(*it);
			l.erase(it);
			q %= 2*(tmp.first+tmp.second);
			PII a1, a2;
			if(q < tmp.first){
				a1 = MP(q, tmp.second);
				a2 = MP(tmp.first-q, tmp.second);
			}else if(q < tmp.first+tmp.second){
				a1 = MP(tmp.first, q-tmp.first);
				a2 = MP(tmp.first, tmp.second-(q-tmp.first));
			}else if(q < tmp.first+tmp.second+tmp.first){
				a1 = MP(q-(tmp.first+tmp.second), tmp.second);
				a2 = MP(tmp.first-(q-(tmp.first+tmp.second)), tmp.second);
			}else{
				a1 = MP(tmp.first, q-(2*tmp.first+tmp.second));
				a2 = MP(tmp.first, tmp.second-(q-(2*tmp.first+tmp.second)));
			}
			if(a1.first*a1.second > a2.first*a2.second)swap(a1, a2);
			l.PB(a1);
			l.PB(a2);
		}
		vector<int> v(n+1);
		list<PII>::iterator it2 = l.begin();
		REP(i,n+1){
			v[i] = it2->first*it2->second;
			it2++;
		}
		SORT(v);
		REP(i,n+1){
			cout << v[i];
			if(i!=n)cout<<" ";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
import math
i = list(map(int,input().split()))
a = i[0]
b = i[1]
h = i[2]
m = i[3]
thete = 6*m - (30*h+m/2)
if thete<0:
    thete = thete*(-1)
if thete > 180:
    thete = 360 - thete
cos = math.cos(math.radians(thete))
ans = math.sqrt(a**2+b**2-2*a*b*cos)
print(ans)

Measured memory_bytes: 9520