akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string S;
    cin >> S;
    if(S == "SAT") {
        cout << "1" << endl;
    } else if(S == "SUN") {
        cout << 7 << endl;
    } else if(S == "MON") {
        cout << 6 << endl;
    } else if(S == "TUE") {
        cout << 5 << endl;
    } else if(S == "WED") {
        cout << 4 << endl;
    } else if(S == "THU") {
        cout << 3 << endl;
    } else if(S == "FRI") {
        cout << 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(input()) for i in range(n)]

ans = 0
c = a[0]
for i in range(n - 1):
    b = c
    c = a[i + 1]
    use = b // 2 * 2
    ans += use // 2
    b -= use
    if b and c >= 1:
        ans += 1
        c -= 1
ans += c // 2

print(ans)


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

public class Main {
    public static void main(String[] args) {
        final int[] array = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        final MyScanner sc = new MyScanner();
        int k = sc.nextInt();
        System.out.println(array[k - 1]);
    }
}

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int pointer = 0;
    private int bufLength = 0;

    private boolean hasNextByte() {
        if (pointer < bufLength) {
            return true;
        } else {
            pointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (final IOException e) {
                e.printStackTrace();
            }
            if (bufLength <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[pointer++];
        } else {
            return -1;
        }
    }

    private static boolean isNumberChar(final int c) {
        return '0' <= c && c <= '9';
    }

    private static boolean isPrintableChar(final int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[pointer])) {
            pointer++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        final StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long num = 0;
        boolean isNegative = false;
        int b = readByte();
        if (b == '-') {
            isNegative = true;
            b = readByte();
        }
        if (!isNumberChar(b)) {
            throw new NumberFormatException();
        }
        while (true) {
            if (isNumberChar(b)) {
                num *= 10;
                num += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return isNegative ? -num : num;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        final long temp = nextLong();
        if (temp < Integer.MIN_VALUE || Integer.MAX_VALUE < temp) {
            throw new NumberFormatException();
        }
        return (int) temp;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 32592
N = gets.to_i
D, X = gets.split(' ').map(&:to_i)
A = N.times.map{gets.to_i}

sum = 0

N.times do |i|
  tmp = 0
  j = 0
  while true
    tmp = (A[i] * j) + 1
  if tmp <= D
    sum += 1
    j += 1
  else
    break
  end
  end
end
puts sum + X

Measured memory_bytes: 14280
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  if(a*b*c == 5*5*7){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include "string.h"
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i<5;i++){
cout<<s[i];
}
cout<<" ";
for(int i=6;i<13;i++){
cout<<s[i];
}
cout<<" ";
for(int i=14;i<19;i++){
cout<<s[i];
}
cout<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(long long (i)=0;(i)<(long long)(n);(i)++)
#define RREP(i,n) for(long long (i)=(long long)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int H,W;
char S[100][100];
char ans[100][100];

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

int main() {

	cin >> H >> W;
	REP(i,H) REP(j,W) cin >> S[i][j];

	REP(i,H) REP(j,W) {
		if (S[i][j] == '#') {
			ans[i][j] = '#';
			continue;
		}
		char t = '0';
		REP(k,8) {
			int ny = i + dy[k];
			int nx = j + dx[k];
			if (nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
			if (S[ny][nx] == '#') t++;
		}
		ans[i][j] = t;
	}

	REP(i,H) {
		REP(j,W) cout << ans[i][j];
		cout << endl;
	}

    return 0;
}

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

using ll = long long;
using namespace std;

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

int main(void) {
	int n, a, b;
	cin >> n >> a >> b;
	
	cout << min(n * a, b) << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	int N;
	List<Integer> h;
	long[] costs;

	Main() {
		Scanner in = new Scanner(System.in);
		N = in.nextInt();
		h = new ArrayList<>(N);
		for (int i = 0; i < N; ++i) {
			h.add(in.nextInt());
		}
		in.close();

		costs = new long[N];
		costs[0] = 0;
		costs[1] = Math.abs(h.get(1) - h.get(0));
	}

	void calc() {
		for (int i = 2; i < N; ++i) {
			costs[i] = Math.min(costs[i - 2] + Math.abs(h.get(i) - h.get(i - 2)),
					costs[i - 1] + Math.abs(h.get(i) - h.get(i - 1)));
		}
	}

	public static void main(String[] args) {
		Main ins = new Main();
		ins.calc();
		System.out.println(ins.costs[ins.N - 1]);
	}

}

Measured memory_bytes: 64268
def abc149_c():

  def primes_list(n):
    # n以下の素数リスト
    # https://qiita.com/chun1182/items/ddf2b6cba932b2bb0d4e
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
      primes.difference_update(range(i*2, n+1, i))
    return list(primes)

  # 制約範囲内とその次まで、すべて用意しておく
  all_primes = primes_list(10**5)
  all_primes.append(100003)
  all_primes.sort()

  # 小さい順にxと比較してx以上なら出力して終了
  x = int(input())
  for p in all_primes:
    if x <= p:
      print(p)
      return

abc149_c()

Measured memory_bytes: 14312
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

map<ll,ll> mp;

ll rec(ll x){
    if(x==1){
        return 1;
    }
    if(mp.count(x)){
        return mp[x];
    }
    ll half = x / 2;
    return mp[x] = 2 * rec(half) + 1;
}

int main(){
    ll h;
    cin >> h;
    cout << rec(h) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
void READ() {
#define R READ();
#define INFI 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MEMX(x,num) memset(x,num,sizeof(x))
#define prln(x) cout<<#x<<"="<<x<<endl
#define sz(x) int(x.size())
#define PB(x) push_back(x)
#define LINK(x,y) G[x].PB(y),G[y].PB(x)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#ifndef ONLINE_JUDGE
    freopen ( "A.in", "r", stdin );
#endif
    std::ios::sync_with_stdio ( 0 );
    cin.tie ( 0 );
    cout << fixed << setprecision ( 6 );
}
//////////////////////////////////////////
const int N = 5 + 2e3;

int n;
int ans;
int main() {
    
    cin>>n;
    if(n==10||n==100||n==1000||n==10000||n==100000)
    {
        cout<<10;
    }
    else
    {
        while(n)
        {
            ans+=n%10;
            n/=10;
        }
        cout<<ans;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<cmath>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    rep(i, n){
        cin >> x[i] >> y[i];
    }
    vector<vector<double> > dist(n, vector<double>(n)); 
    rep(i, n){
        rep(j, n){
            double dx = x[i] - x[j], dy = y[i] - y[j];
            dist[i][j] = sqrt(dx * dx + dy * dy);
        }
    }
    vector<int> perm;
    rep(i, n) perm.push_back(i);
    double ans = 0;
    double num = 0;
    do{
        num += 1;
        for (int i = 0; i < n - 1; i++){
            ans += dist[perm[i]][perm[i+1]];
        }
    }while(next_permutation(perm.begin(), perm.end()));
    ans /= num;
    printf("%.10lf\n", ans);
}

Measured memory_bytes: 3800
import java.util.*;
import java.io.*;
public class Main {
    public static long sum(int arr[] , int x , int y){
        long ans = 0;
        for(int i = x ; i <= y ; i++){
            ans += arr[i];
        }
        return ans;
    }
    public static long solve(int arr[] , int n){
        long dp[][] = new long[n+1][n+1];
        for(int j = 2 ; j <= n ; j++){
            for(int i = j-1 ; i >= 1 ; i--){
                long ans = Long.MAX_VALUE;
                for(int k = i ; k < j ; k++){
                    ans = Math.min(ans , dp[i][k] + dp[k+1][j] + sum(arr,i,k) + sum(arr,k+1 ,j));
                }
                dp[i][j] = ans;
            }
        }
        return dp[1][n];
    }
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int arr[] = new int[n+1];
        for(int i = 1 ; i <= n ; i++){
            arr[i] = s.nextInt();
        }
        System.out.println(solve(arr , n));

    }
}

Measured memory_bytes: 38488
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {

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

        int ans=0;
        for(int i=0;i<N;++i){
            if(V[i]>C[i]){
                ans+=V[i]-C[i];
            }
        }
        cout<<ans<<endl ;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int mysin[] = {0, 1, 0, -1};
const int mycos[] = {1, 0, -1, 0};

int main(void){
  int n, m;
  while(cin >> n, n){
    vector< vector<P> > c(n);
    vector< vector<P> > target;
    cin >> m;
    target = vector< vector<P> >(8, (vector<P>(m)));
    int subx, suby;
    for(int i=0; i < m; i++){
      cin >> target[0][i].first >> target[0][i].second;
      if(i == 0) subx = target[0][i].first, suby = target[0][i].second;
      target[0][i].first -= subx;
      target[0][i].second -= suby;
    }

    for(int i=1; i < 4; i++){
      //x'+y'i = (x+yi)(cost + isint)
      //       = (xcost - ysint) + (xsint + ycost)i
      for(int j=0; j < m; j++){
        target[i][j].first = target[0][j].first*mycos[i]
        - target[0][j].second*mysin[i];
        target[i][j].second = target[0][j].first*mysin[i]
        + target[0][j].second*mycos[i];
      }
    }
    reverse_copy(target[0].begin(), target[0].end(), target[4].begin());
    subx = target[4][0].first; suby = target[4][0].second;
    for(int j=0; j < m; j++){
      target[4][j].first -= subx;
      target[4][j].second -= suby;
    }
    for(int i=5; i < 8; i++){
      for(int j=0; j < m; j++){
        target[i][j].first = target[4][j].first*mycos[i-4]
        - target[4][j].second*mysin[i-4];
        target[i][j].second = target[4][j].first*mysin[i-4]
        + target[4][j].second*mycos[i-4];
      }
    }


    for(int p=0; p < n; p++){
      cin >> m;
      c[p].resize(m);
      for(int q=0; q < m; q++){
        if(q == 0){
          cin >> subx >> suby;
          c[p][q].first = 0;
          c[p][q].second = 0;
        }else{
          cin >> c[p][q].first >> c[p][q].second;
          c[p][q].first -= subx;
          c[p][q].second -= suby;
        }
      }
      for(int r=0; r < target.size(); r++){
        bool flg = true;
        if(target[r].size() != c[p].size()){
          continue;
        }
        for(int s=0; s < target[r].size(); s++){
          if(!(target[r][s].first == c[p][s].first && target[r][s].second == c[p][s].second)){
            flg = false;
          }
        }
        if(flg){
          cout << p+1 << endl;
          continue;
        }
      }

    }
    cout << "+++++" << endl;
  }

  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <functional>
using namespace std;
using ll = long long;
int dfs(int N, int p, vector<bool> v, vector<vector<bool>> ab);

int main() {
	int N, M, p;
	cin >> N >> M;
	vector<vector<bool>> ab(N, vector<bool>(N));
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		ab[a-1][b-1] = ab[b-1][a-1] = true;
	}
	vector<bool> v(N,false);
	v[0] = true;
	cout << dfs(N, 0, v, ab) << endl;
	return 0;
}

int dfs(int N, int p, vector<bool> v, vector<vector<bool>> ab){
	bool all_v = true;
	for (int i = 0; i < N; i++) {
		if(!v[i]) all_v = false;
	}
	if (all_v) return 1;

	int root = 0;
	for (int i = 0; i < N; i++) {
		if (!ab[p][i]) continue;
		if (v[i]) continue;
		v[i] = true;
		root += dfs(N, i, v, ab);
		v[i] = false;
	}
	return root;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    long n, m;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextLong();
        m = sc.nextLong();
        solve();
    }

    void solve() {
        if (n * 2 >= m) {
            System.out.println(m / 2);
            return;
        }
        System.out.println(n + (m - 2 * n) / 4);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 20180
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.141592653289793;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define lld long double
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << endl;
	else
	{
		cout << min(a*b, min(b*c, c*a)) << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<tuple>
#include<set>

#include<algorithm>
using namespace std;

#define INF ((int)(1e9))
#define MAX 110000


int main(){
	int n, m, temp;
	set<int> ve;
	
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>temp;
		ve.insert(temp);
	}
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>temp;
		ve.insert(temp);
	}
	
	for(int y : ve) cout<<y<<endl;
	return 0;
}


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

int main() {
    string S;
    cin >> S;
    int day = 0;
    
    if(S.at(0) == 'R' && S.at(1) == 'R' && S.at(2) == 'R'){
        day = 3;
    }
    else if((S.at(0) == S.at(1) && S.at(0) == 'R') || 
       (S.at(1) == S.at(2) && S.at(1) == 'R')){
        day = 2;
    }
    else if(S.at(0) == 'S' && S.at(1) == 'S' && S.at(2) == 'S'){
        day = 0;
    }
    else{
        day = 1;    
    }
    cout << day << endl;
}

Measured memory_bytes: 3480
#include <iostream>

int main(){

    int a, b, c;
    bool result = false;
    std::cin >> a >> b >> c;

    if(a == 5 || a ==7){
        if(b == 5 || b == 7){
            if(a + b + c == 17){
                result = true;
            }
        }
    }
    
    if(result){
        std::cout << "YES" << std::endl;
    }else{
        std::cout << "NO" << std::endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int n,k;
int gcd(int x,int y) {
	if (y==0) return x;
	return gcd(y,x%y);
}
int main() {
	scanf("%d%d",&n,&k);
	int max0=-1e9,d=0;
	for (int i=1;i<=n;i++) {
		int x;
		scanf("%d",&x);
		max0=max(max0,x);
		d=gcd(d,x);
	}
	if (k>max0||k%d) printf("IMPOSSIBLE\n");
		else printf("POSSIBLE\n");
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(var) var.begin(), var.end()
#define input freopen("input", "r", stdin)
#define output freopen("output", "w", stdout)
#define Fast ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
typedef long long ll;
using namespace std;

int dr[] = {0, 0, -1, +1, -1, -1, +1, +1};
int dc[] = {-1, +1, 0, 0, -1, +1, -1, +1};

int main(){
    string a, b;
    cin >> a >> b;
    int ans = INT_MAX;
    int n = a.size();
    int m = b.size();
    for(int i = 0; i < n-m+1; i++){
        int cnt = m;
        for(int j = 0; j < m; j++){
            if(b[j] == a[i+j])
                cnt--;
        }
        ans = min(cnt, ans);
    }
    cout << ans << endl;
}



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

int main() {

	ll n; cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	vector<ll> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	vector<ll> c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end());
	ll ans = 0;
	for (int j = 0; j < n; j++) {		
		auto itr_a = lower_bound(a.begin(), a.end(), b[j]);
		ll a_cnt = itr_a - a.begin();
		auto itr_c = upper_bound(c.begin(), c.end(), b[j]);
		ll c_cnt = c.end() - itr_c;
		ans += a_cnt * c_cnt;
	}

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

Measured memory_bytes: 2560
# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
		n = int(input())
		ans = 0
		for i in range(1, n+1):
			if i%5==0 or i%3==0:
				continue
			ans+=i
		print(ans)
		
		


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n") + (not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode("ascii"))
		self.read = lambda: self.buffer.read().decode("ascii")
		self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
	main()

Measured memory_bytes: 67280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
struct qu
{
	ll l;
	ll r;
}q[11];
struct tree
{
	ll l;
	ll r;
	ll lazy;
	ll ans;
}t[4*200005];
void build(ll l,ll r,int pos)
{
	t[pos].l=l;
	t[pos].r=r;
	if(l==r)
	{
		if(l==1)
		{
			t[pos].ans=1;
		}
		return ;
	}
	ll mid=(l+r)/2;
	build(l,mid,pos*2);
	build(mid+1,r,pos*2+1);
}
void pushdown(int pos)
{
	if(t[pos].lazy)
	{
		ll k=t[pos].lazy;
		t[pos*2+1].lazy+=k;
		t[pos*2].lazy+=k;
		t[pos*2].ans+=(t[pos*2].r-t[pos*2].l+1)*k;
		t[pos*2+1].ans+=(t[pos*2+1].r-t[pos*2+1].l+1)*k;
		t[pos].lazy=0;
	}
}
void update(ll l,ll r,int pos,ll k)
{
	if(l<=t[pos].l && t[pos].r<=r)
	{
		t[pos].ans+=k*(t[pos].r-t[pos].l+1);
		t[pos].ans%=mod;
		t[pos].lazy+=k;
		return ;
	}
	pushdown(pos);
	ll mid=(t[pos].l+t[pos].r)/2;
	if(l<=mid)
	{
		update(l,r,pos*2,k);
	}
	if(r>mid)
	{
		update(l,r,pos*2+1,k);
	}
}
ll ask(ll l,ll r,int pos)
{
	if(l<=t[pos].l && t[pos].r<=r)
	{
		return t[pos].ans;
	}
	pushdown(pos);
	ll res=0;
	ll mid=(t[pos].l+t[pos].r)/2;
	if(l<=mid)
	{
		res+=ask(l,r,pos*2);
	}
	if(r>mid)
	{
		res+=ask(l,r,pos*2+1);
	}
	return res%mod;
}
int main()
{
	ll n;
	int m;
	scanf("%lld%d",&n,&m);
	set<int> s;
	for(int i=1;i<=m;i++)
	{
		scanf("%lld%lld",&q[i].l,&q[i].r);
	}
	build(1,n,1);
	for(int i=1;i<=n;i++)
	{
		ll tp=ask(i,i,1);
		if(tp)
		{
			for(int j=1;j<=m;j++)
			{
				if(i+q[j].l>n)
				{
					continue;
				}
				update(i+q[j].l,min(n,i+q[j].r),1,tp);
			}
		}
	}
	printf("%lld\n",ask(n,n,1));
	return 0;
}

Measured memory_bytes: 20108
S = input()
for i in range(26):
    c = chr(i + 97)
    prev = -3
    for j in range(len(S)):
        if S[j] == c:
            if j - prev <= 2:
                print(prev + 1, j + 1)
                break
            prev = j
    else:
        continue
    break
else:
    print(-1, -1)

Measured memory_bytes: 9208
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;

long long mod = 1000000007;

int main() {
	long long N, K, sum = 0; cin >> N >> K;
	for (int i = K; i <= N + 1; i++) {
		long long cl = 1LL * i * (i - 1) / 2LL;
		long long cr = cl + 1LL * i * (N + 1LL - i);
		sum += (cr - cl + 1) % mod;
		sum %= mod;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3636
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;

const int MOD = 998244353;
const int P = ll(1e18) % MOD;

int prod(int a, int b) {
  return ll(a) * b % MOD;
}

int &add(int &a, int b) {
  if ((a += b) >= MOD) {
    a -= MOD;
  }
  return a;
}

bool solve() {
  int n;
  if (scanf("%d", &n) != 1) { return false; }

  vector<vector<int>> g(3);
  for (int ii = 0; ii < 3; ++ii) {
    int m;
    scanf("%d", &m);
    vector<vector<int>> ed(n);
    for (int j = 0; j < m; ++j) {
      int u, v;
      scanf("%d%d", &u, &v);
      --u, --v;
      if (u > v) { swap(u, v); }
      ed[u].push_back(v);
    }
    vector<int> gr(n);
    gr[n - 1] = 0;
    int maxGr = 0;
    for (int i = n - 2; i >= 0; --i) {
      set<int> next;
      for (int v : ed[i]) {
        next.insert(gr[v]);
      }
      int j = 0;
      for (auto k : next) {
        if (k != j) break;
        j++;
      }
      gr[i] = j;
      maxGr = max(maxGr, j);
    }
    
    g[ii].resize(maxGr + 1);
    int curPow = 1;
    for (int i = 0; i < n; ++i) {
      curPow = prod(curPow, P);
      add(g[ii][gr[i]], curPow);
    }
  }

  sort(g.begin(), g.end(), [](const auto &a, const auto &b) { return a.size() < b.size(); });
  int ans = 0;
  for (int i0 = 0; i0 < int(g[0].size()); ++i0) {
    for (int i1 = 0; i1 < int(g[1].size()); ++i1) {
      int i2 = i0 ^ i1;
      if (i2 < int(g[2].size())) {
        add(ans, prod(prod(g[0][i0], g[1][i1]), g[2][i2]));
      }
    }
  }
  printf("%d\n", ans);

  return true;
}

int main() {
  int tt = -1;
  //scanf("%d", &tt);
  while (tt-- && solve());
  return 0;
}


Measured memory_bytes: 4816
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        StringBuilder ans = new StringBuilder();
        int begin,end;
        String op;
        sb.append(br.readLine());
        int q = Integer.parseInt(br.readLine());
        while(q-->0){
            String str[] = br.readLine().split(" ");
            op = str[0];
            begin = Integer.parseInt(str[1]);
            end = Integer.parseInt(str[2])+1;
            if(op.equals("print")){
                ans.append(sb.substring(begin, end)).append("\n");
            }else if(op.equals("reverse")){
                StringBuilder sb2 = new StringBuilder(sb.substring(begin,end));
                sb.replace(begin, end, sb2.reverse().toString());
            }else{
                sb.replace(begin, end, str[3]);
            }
        }
        System.out.print(ans);
    }
}

Measured memory_bytes: 24636
def main():
    H, W, K = map(int, input().split())
    c = [list(input()) for _ in range(H)]
    res = 0
    for i in range(1 << H):
        for j in range(1 << W):
            cnt = 0
            for a in range(H):
                for b in range(W):
                    if not (i >> a & 1 or j >> b & 1) and c[a][b] == '#':
                        cnt += 1
            if cnt == K:
                res += 1
    print(res)

main()

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

struct StCrd
{
  string m_sMrk;
  int    m_nNum;
  int    m_nSeq;
};

void fnInput(vector<StCrd> &rvoCrd)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvoCrd.resize(nMaxSiz);
  for (int i = 0; i < nMaxSiz; i++)
  {
    cin >> rvoCrd[i].m_sMrk >> rvoCrd[i].m_nNum;
    rvoCrd[i].m_nSeq = i + 1;
  }
}

int fnPartition(vector<StCrd> &rvoCrd, int nFront, int nBack)
{
  int nMid = nFront;

  for (int i = nFront; i < nBack; i++)
    if (rvoCrd[i].m_nNum <= rvoCrd[nBack].m_nNum)
      swap(rvoCrd[nMid++], rvoCrd[i]);

  swap(rvoCrd[nMid], rvoCrd[nBack]);
  return nMid;
}

void fnQuickSort(vector<StCrd> &rvoCrd, int nFront, int nBack)
{
  if (nFront < nBack)
  {
    int nMid = fnPartition(rvoCrd, nFront, nBack);
    fnQuickSort(rvoCrd, nFront, nMid - 1);
    fnQuickSort(rvoCrd, nMid + 1, nBack);
  }
}

void fnResult(const vector<StCrd> &cnrvoCrd)
{
  bool bStable = true;
  for (int i = 0; i < cnrvoCrd.size();    )
  {
    int j = i;
    while (cnrvoCrd[i].m_nNum == cnrvoCrd[++j].m_nNum)
      if (cnrvoCrd[i].m_nSeq < cnrvoCrd[j].m_nSeq);
      else
      {
        bStable = false; 
        goto LOOP_END;
      }

    i = j;
  }

LOOP_END:
  if (bStable)  cout << "Stable" << endl;
  else          cout << "Not stable" << endl;

  for (int i = 0; i < cnrvoCrd.size(); i++)
    cout << cnrvoCrd[i].m_sMrk << " " << cnrvoCrd[i].m_nNum << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StCrd> voCrd;

  fnInput(voCrd);
  fnQuickSort(voCrd, 0, voCrd.size() - 1);
  fnResult(voCrd);

  return 0;
}

Measured memory_bytes: 7332
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables **************/
int x;
set<int> st;
/**********************************************/

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x;
    st.insert(1);
    for(int a = 2; a <= sqrt(1000); a++){
        for(int b = 2; ; b++){
            if(pow(a, b) > 1000) break;
            st.insert(pow(a, b));
        }
    }
    auto itr = st.upper_bound(x);
    itr--;
    cout << *itr << endl;
}


Measured memory_bytes: 256
import math
li=[chr(i) for i in range(97, 97+26)]
AnsFromRight = []
AmsFromLeft=[]
def GetN_Hidari(j):
        tmp=0
        for k in range(j+1):
            tmp+=26**k
        return tmp-1        
#---------
N=int(input())
i=0
while True:
    N_HidariCut=N-GetN_Hidari(i)
    if N_HidariCut<=0:
        break
    OrderWithinKatamari = N_HidariCut%(26**(i+1))
    AnsFromRight.append(li[math.ceil(OrderWithinKatamari/(26**i)-1)])
    i+=1    
AnsFromLeft= AnsFromRight[::-1]
print("".join(AnsFromLeft))

Measured memory_bytes: 9216
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll N;
vector<ll>A;
vector<ll>a;

int main() {
    cin >> N;
    rep(i,N){
        ll temp; cin >> temp;
        A.push_back(temp);
    }
    rep(i,N) a.push_back(A[i]-(i+1));
    sort(a.begin(),a.end());
    ll ans = 0;
    ll center = a[a.size()/2];
    rep(i,a.size()){
        ans += abs(a[i]-center);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4848
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)

class SegmentTree():
    def __init__(self,param,default,func):
        if isinstance(param,list):
            n=len(param)
        else:
            n=param
        i=1
        while 2**i<n:
            i+=1
        self.d=default
        self.leaf=2**i
        if isinstance(param,list):
            self.tree=[default]*(self.leaf-1)+param+[default]*(self.leaf-n)
            for i in range(self.leaf-2,-1,-1):
                self.tree[i]=func(self.tree[i*2+1],self.tree[i*2+2])
        else:
            self.tree=[default]*(self.leaf*2-1)
        self.f=func
    def find(self,i):
        return self.A[i+self.leaf-1]
    def update(self,idx,a):
        idx+=self.leaf-1
        self.tree[idx]=a
        while idx:
            idx=(idx-1)//2
            self.tree[idx]=self.merge(self.tree[idx*2+1],self.tree[idx*2+2])
    def merge(self,a,b):
        return self.f(a,b)
    def get_top(self):
        return self.tree[0]
    def query(self,a,b): #[a,b)
        T=self.tree
        l=a+self.leaf-1
        r=b+self.leaf-1
        res=self.d
        while l<r:
            if not l%2:
                res=self.merge(res,T[l])
                l+=1
            if not r%2:
                r-=1
                res=self.merge(res,T[r])
            l>>=1
            r>>=1
        return res

def f(a,b):
    return max(a,b)

n=int(input())
H=list(map(int,input().split()))
A=list(map(int,input().split()))
seg=SegmentTree(n+1,0,f)
for h,a in zip(H,A):
    t=seg.query(0,h)
    seg.update(h,a+t)
print(seg.get_top())

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

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

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int l, r, d; cin >> l >> r >> d;
    int cnt = 0;
    rep3(i, l, r){
        if(i%d == 0) cnt++;
    }
    cout << cnt << endl;
    return;
}

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;



int main(){
    int N, M; cin >> N >> M;
    vector<vector<int>> A(N+1);
    for(int i = 0; i < M; i++){
        int a, b; cin >> a >> b;
        A[a].push_back(b);
        A[b].push_back(a);
    } 
    queue<int> Q;
    for(auto x : A[1]) Q.push(x);
    while(!Q.empty()){
        int x = Q.front(); Q.pop();
        for(auto v : A[x]) if(v == N){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    } 
    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 12400
#include <iostream>
#include <random>
#include <fstream> //iostreamのファイル入出力をサポート
#include <vector>
#include <algorithm>
#include <string>
#include <math.h> 
#include <time.h>
#define FOR(i,k,n) for((i)=(k);(i)<(n);(i)++)
#define rep(i,n) for (int i=0;i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()  //greater<int>()
#define ll long long
#define PII pair<int,int>
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define vs vector<string>
#define VI vector<int>
#define vi vector<int>
using namespace std;

int main(){
	int r,g,b;
	cin>>r>>g>>b;

	int a = 10*g+b;
	if(a%4==0){
		cout<<"YES"<<endl;
		return 0;
	}

	cout<<"NO"<<endl;
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

template <typename T1, typename T2> 
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

/* Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
typedef vector<vm> vvm;
//*/

const ll INF = 1e10;
ll dp[1000010][2]; 
// dp[i][0] 下からi番目の桁を見て、支払い会計よりも小さい場合に達成される最小のお釣り
// dp[i][1] 下からi番目の桁を見て、支払い会計よりも大きい場合に達成される最小のお釣り

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

  reverse(all(s));
  s.push_back('0');
  int n = s.size();

  rep(i,n+1) rep(j,2) dp[i][j] = INF;
  dp[0][1] = 0;

  rep(i,n){
    int num = s[i] - '0';
    chmin(dp[i+1][0], 10 - num + dp[i][1]);
    chmin(dp[i+1][0], 9 - num + dp[i][0]); 
    chmin(dp[i+1][1], num + 1 + dp[i][0]); 
    chmin(dp[i+1][1], num + dp[i][1]); 
  }
  
  cout << dp[n][1] << endl;
  return 0;
}



Measured memory_bytes: 17052
#include <iostream>
using namespace std;
bool has3(int x1) {
	while (x1) {
		if (x1 % 10 == 3)return true;
		x1 /= 10;
	}
	return false;
}

int main()
{
	int x;
	cin >> x;
	for (int i = 3; i <= x; i++) {
		if (i% 3 == 0 || has3(i)) {
			cout << " " << i;

		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <set>
#include <cmath>
#include <math.h>

using namespace std;
        
int main(){
    int n;
    cin>>n;
    vector<long int> a(n),b(n),c(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        cin>>c[i];
    }
     sort(a.begin(),a.end());
     sort(b.begin(),b.end());
     sort(c.begin(),c.end());
    
    long long int ans=0,disa=0,disc=0;
    for(int i=0;i<n;i++){
        auto j=lower_bound(a.begin(),a.end(),b[i]);
        disa=distance(a.begin(),j);
        auto k=upper_bound(c.begin(),c.end(),b[i]);
        disc=(n-distance(c.begin(),k));
        ans+=(disa*disc);
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
import java.util.*;

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

        long n = sc.nextLong();
        long checkx = 0;
        long x = 0;
        long checky = 0;
        long y = 0;


        for(checkx = 1;checkx <= Math.sqrt(n);checkx++){
            if(n%checkx==0){
                checky = n/checkx;
                if(x==0 && y==0){
                    x = checkx;
                    y = checky;
                }
                if(checkx + checky <  x +y){
                    x = checkx;
                    y = checky;
                }
            }
        }
        System.out.println(x+y-2);
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> dp(31);
  dp.at(0)=1;
  for(int i=0;i<30;i++){
    dp.at(i+1)+=dp.at(i);
    if(i<29){
      dp.at(i+2)+=dp.at(i);
    }
    if(i<28){
      dp.at(i+3)+=dp.at(i);
    }
  }
  while(true){
    int N;
    cin >> N;
    if(N==0){
      break;
    }
    cout << (dp.at(N)+3649)/3650 << endl;
  }
}


Measured memory_bytes: 3048
#include <stdio.h>

int main(){
	int a,b;
	int panjanga, panjangb;
	int luas;
	scanf("%d %d", &a, &b);
	panjanga= a-1;
	panjangb= b-1;
	luas=panjanga*panjangb;
	printf("%d\n", luas);
}

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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;
const double EPS=1e-12;


template <ll mod>
struct ModCombination{
    ll N;
    vector<ll> fact,inv,finv;

    ModCombination(ll n):N(n){
        fact.assign(n+1, 1);
        inv.assign(n+1, 1);
        finv.assign(n+1,1);
        for(int i=1;i<n;i++){
            fact[i+1] = fact[i]*(i+1)%mod;
            inv[i+1] = inv[mod%(i+1)]*(mod-mod/(i+1))%mod;
            finv[i+1] = finv[i]*inv[i+1]%mod;
        }
    }

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

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,K;cin>>N>>K;
  ModCombination<MOD> C(N);
  for(ll k=1;k<=K;k++){
    cout<<C.Comb(K-1,k-1)*C.Comb(N-K+1,k)%MOD<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    if(s[0] != 'A'){
        cout << "WA" << endl;
        return 0;
    }

    if(count(s.begin()+2,s.end()-1,'C')!=1){
        cout << "WA" << endl;
        return 0;
    }
    if(count(s.begin()+2,s.end()-1,'C') != count(ALL(s),'C')){
        cout << "WA" << endl;
        return 0;
    }
    
    
    FOR(i,1,s.length()){
        if(s[i]!='C' && s[i] <= 'Z'){
            cout << "WA" << endl;
            return 0;
        }
    }
    cout << "AC" << endl;
    return 0;
}


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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    double a, b;
    cin >> a >> b;
    double x = a / 0.08, y = b / 0.1;
    for(double i = 1; i <= N; i++){
        if(floor(i * 0.08) == a && floor(i * 0.1) == b){
            cout << i;
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    ll a[3*n];
    rep(i,3*n)cin>>a[i];
    sort(a,a+3*n);
    ll ans=0;
    rep(i,n){
        ans+=a[3*n-2*i-2];
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans;
    if(a>=b) swap(a,b);
    ll sa=abs(a-b);
    if(sa%2==0) ans=sa/2;
    else{
        ll sa2=min(a-1,n-b);
        ans=sa2+1+(sa/2);
    }
    
    cout << ans << endl;

    return 0;
}

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

using namespace std;
int main(void){
    long long r, d, x;
    cin >> r >> d >> x;
    
    for (int i = 0; i < 10; i++){
        x = r * x - d;
        cout << x << endl;
    }
    
}


Measured memory_bytes: 3632