akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

int n, m, q;
vector<int> a, b, c, d;
vector<int> val;
ll ans = 0;

void dfs(int x, int v)
{
	if(x == val.size())
	{
		ll cnt = 0;
		rep(i,0,q)
		{
			if(val[b[i]-1] - val[a[i]-1] == c[i])
				cnt += d[i];
		}
		ans = max(ans, cnt);
		return;
	}

	rep(i,v,m)
	{
		val[x] = i;
		dfs(x+1, i);
	}
}

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	cin >> n >> m >> q;
	a.resize(q);
	b.resize(q);
	c.resize(q);
	d.resize(q);
	val.resize(n);
	rep(i,0,q)
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	dfs(0,0);
	cout << ans;
}


Measured memory_bytes: 3620
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
  int n ,l, i;
  int answer = 0;
  int min_abs = 0;

  cin >> n >> l;
  
  
  for(i = 0; i < n; ++i) {
    answer = answer + l + i;
    if(i==0) {
      min_abs = abs(l+i);
    } else {
      if(abs(l+i) == min(abs(min_abs), abs(l+i))) {
        min_abs = l+i;
      }
    }
  }
  
  answer = answer - min_abs;
  
  cout << answer;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;
 
 int main(void){
     long long s,a[1000000]={},count=2;
     cin >> s;
     if(s==1){
         cout << '4' << endl;
         return 0;
     }
     a[1]=s;
     while(s!=1){
         if(s%2==0){
             s=s/2;
             a[count]=s;
         }else{
             s=s*3+1;
             a[count]=s;
         }
         count+=1;
     }
     for(int i=1; i<count; i++){
         for(int j=i+1; j<count; j++){
             if(a[i]==4){
                 cout << count << endl;
                 return 0;
             }if(a[i]==2){
                 cout << count+1 << endl;
                 return 0;
             }if(a[i]==1){
                 cout << count+2 << endl;
                 return 0;
             }
             if(a[i]==a[j]){
            cout << j << endl;
            return 0;
             }
         }
     }
 }

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a,b,c;
  cin >>a>>b>>c;
  int x=700;
  if(a=='o')x+=100;
  if(b=='o')x+=100;
  if(c=='o')x+=100;
  
  
  
  cout<<x<<endl;
  
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
  int n;
  scanf("%d", &n);
  int s[n];
  for (int i = 0; i < n; ++i)
    scanf("%d", &s[i]);

  int q;
  scanf("%d", &q);
  int t[q];
  for (int i = 0; i < q; ++i)
    scanf("%d", &t[i]);

  int c = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < q; ++j)
      if (s[i] == t[j]) {
        ++c;
        t[j] = t[q - 1];
        --q;
      }
  }

  printf("%d\n", c);
}

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

int main() {
	// 変数の宣言
	int A, B, C, D;

	// 値の取得
	cin >> A >> B>> C>> D;

	// 判定
	if ( A+B>C+D)
	{
		// 左に傾くの場合
		cout << "Left";
	}else if (A+B<C+D)
	{
		// 右に傾く場合
		cout << "Right";
	}
	else
	{
		cout << "Balanced";
	};
}

Measured memory_bytes: 256
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto X = readln.chomp.to!(long);

    long res = 0;
    foreach (b; 1..X+1) {
        foreach (p; 2..10) {
            if (b^^p <= X) {
                res = max(res, b^^p);
            }
        }
    }
    writeln(res);
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	if (a <= 0 && b >= 0) {
		puts("Zero");
		return 0;
	}
	if (a > 0) {
		puts("Positive");
		return 0;
	}
	puts(a - b & 1 ? "Positive" : "Negative");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  pair<int, int>a;
  bool t=false;
  vector<bool>b(n,false);
  for (int i=0;i<n;++i){
    cin >>a.first>>a.second;
    if(a.first==a.second) b[i]=true;
  }
  for(int i=0;i<n-2;++i){
    if(b[i]==true and b[i+1]==true and b[i+2]==true) t=true;
  }
  if (t) cout << "Yes" <<endl;
  else cout <<"No" <<endl;
}
    

Measured memory_bytes: 3628
#include <stdio.h>
int main(void){
    int i,x,y;
    for(i=1;;i++){
        scanf("%d %d",&x,&y);
        if(x==0 && y==0)break;
    if(x<y)
        printf("%d %d\n",x,y);
        else
        printf("%d %d\n",y,x);}
    return 0;
}


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

int main(){
  vector<int> city1, city2,cityadd;
  int n,m,temp1,temp2,temp3;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> temp1 >> temp2;
    city1.push_back(temp1);
    city2.push_back(temp2);
  }
  for(int i=0;i<n;i++){
    temp3 = count(city1.begin(),city1.end(),i+1) + count(city2.begin(),city2.end(),i+1);
    cityadd.push_back(temp3);
  }
  for (int i=0;i<n;i++){
    cout << cityadd.at(i) << endl;
  }
  
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	ll a, b, k;
	cin >> a >> b >> k;
	if (k > a) {
		cout << 0 << " " << max((ll)0, b - (k - a)) << endl;
	}
	else {
		cout << a - k << " " << b << endl;
	}
}

Measured memory_bytes: 256
/*
 Read problem and understand it 100%
 Make observation
 SOLVE THE PROBLEM
*/
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define int long long
#define szof(s) (int)s.size()
#define all(s) (int)s.begin(), s.end()
using namespace std;
 
const int N = (int)1e6 + 5;
const int INF = (int)1e9 + 9;
const int MOD = (int)1e9 + 7;
 
main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		ans += (s[i] == t[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import Data.List
import Control.Monad

main :: IO ()
main = do
  [n, m] <- (map read . words) <$> getLine :: IO [Int]
  students <- parse 1 n []
  points <- parse 1 m []
  forM_ students $ \st -> print $ findNearest st points

findNearest :: (Int, Int, Int) -> [(Int, Int, Int)] -> Int
findNearest st points = fst $ minimumBy compareDist $ map (\p@(pid, _, _) -> (pid, distance st p)) points

compareDist :: (Int, Int) -> (Int, Int) -> Ordering
compareDist (id1, dist1) (id2, dist2) =
  if dist1 == dist2 then compare id1 id2
                    else compare dist1 dist2

distance :: (Int, Int, Int) -> (Int, Int, Int) -> Int
distance (s, sx, sy) (p, px, py) = abs(sx - px) + abs(sy - py)

parse :: Int -> Int -> [(Int, Int, Int)] -> IO [(Int, Int, Int)]
parse i n carry
  | i == n + 1 = return $ reverse carry
  | otherwise = do
      [a, b] <- (map read . words) <$> getLine :: IO [Int]
      parse (i + 1) n ((i, a, b):carry)


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
using namespace std;

int main() {
    vector<int> vec(3);
    REP(i,3) cin >> vec[i];
    sort(vec.begin(),vec.end());
    print_array(vec);
}



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

public class AtCoderD
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int answer = int.MaxValue;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            for (int i = 0; i < n; i++)
            {
                int num = int.Parse(words[i]);
                int div = 0;
                while (num % 2 == 0)
                {
                    div++;
                    num /= 2;
                }
                answer = Math.Min(answer, div);
            }
        }

        Console.WriteLine(answer);
    }
}

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

using namespace std;

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

	int n;
	cin >> n;

	vector<int> a(n);
	vector<int> b(n);

	for(int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	if(n % 2 == 1) {
		int l = a[(n + 1) / 2 - 1];
		int r = b[(n + 1) / 2 - 1];
		cout << r - l + 1 << '\n';
	} else {
		int l = a[n / 2 - 1] + a[n / 2];
		int r = b[n / 2 - 1] + b[n / 2];
		cout << r - l + 1 << '\n';
	}

	return 0;
}


Measured memory_bytes: 4796
def gcd(x, y):
    if x > y:
        y, x = x, y
    if x == 0:
        return y
    return gcd(y % x, x)
 
 
def lcm(x, y):
    d = gcd(x, y)
    return x * y // d
 
 
N = int(input())
 
ans = 1
for _ in range(N):
    a = int(input())
    ans = lcm(ans, a)
print(ans)

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

int main() {
    using namespace std;
    unsigned long X;
    cin >> X;
    vector<unsigned long> dp(X + 1);
    dp[0] = 1;
    for(unsigned long i = 100; i <= 105; ++i)for(unsigned long j = 0; j + i <= X; ++j)dp[j + i] |= dp[j];
    cout << dp.back() << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int gcd(int a,int b){
    return (b?gcd(b,a%b):a);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    string t="MARCH";
    vector<ll> d(5);
    for(int i=0;i<n;i++){
        string s;cin >> s;
        for(int j=0;j<5;j++){
            if(s[0]==t[j]){
                d[j]++;
            }
        }
    }
    ll ans=0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                ans+=d[i]*d[j]*d[k];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, w int
	var f []rune
	fmt.Scan(&h, &w)
	a := make([]string, h)
	for i := range a {
		fmt.Scan(&a[i])
	}
	for i := 0; i < w+2; i++ {
		f = append(f, '#')
	}
	fmt.Println(string(f))
	for i := 0; i < h; i++ {
		s := "#" + a[i] + "#"
		fmt.Println(s)
	}
	fmt.Println(string(f))
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n, m, q;
	cin >> n >> m >> q;
	vector<int> a(q), b(q), c(q), d(q);
	rep(i, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--; b[i]--;
	}
	int ans = 0;
	vector<int> num(n, 1);
	while (true) {
		int res = 0;
		rep(i, q) if (num[b[i]] - num[a[i]] == c[i]) res += d[i];
		chmax(ans, res);
		if (num[0] == m) break;
		int idx = n - 1;
		while (num[idx] == m) idx--;
		num[idx]++;
		for (int i = idx + 1; i < n; i++) num[i] = num[idx];
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3660
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;
	vector<int> arr(n);
	bool can = 1;
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
		if(arr[i] % 2 == 0 && arr[i] % 3 && arr[i] % 5) can = 0;
		LOG << arr[i] % 2 << ' ' << arr[i] % 3 << ' ' << arr[i] % 5 << '\n';
	}
	if(can) cout << "APPROVED\n";
	else cout << "DENIED\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<vector>
#include<queue>
#include<stdio.h>
using namespace std;
 
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<25
 
typedef pair<int, int> P;
int d[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

int main()
{
	int h, w;
	cin >> h >> w;
	char field[h + 1][w + 1];
	int b[h + 1][w + 1];
	int white_count = 0;
	REP(i,1, h + 1) {
		REP(j, 1, w + 1) {
			cin >> field[i][j];
			if (field[i][j] == '.') white_count++;
		}
	}
	queue<P> q;
	q.push(make_pair(1, 1));
	field[1][1] = '#';
	b[h][w] = INF;
	b[1][1] = 1;
	while (!q.empty()) {
		P p = q.front();
		q.pop();
		int cx = p.second;
		int cy = p.first;
		if (cx == w && cy == h) {
			break;
		}
		rep(i, 4) {
			int dx = cx + d[i][0];
			int dy = cy + d[i][1];
			if (dx > w || dx <= 0 || dy > h || dy <= 0) continue;
			if (field[dy][dx] == '#') continue;
			b[dy][dx] = b[cy][cx] + 1; 
			field[dy][dx] = '#';
			q.push(make_pair(dy, dx));
		}
	}
	if (b[h][w] == INF) {
		cout << -1 << endl;
	} else {
		cout << white_count - b[h][w] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int m,f,r;
    for(int i=0;i<100;i++){
        cin >> m >> f >> r;
        if(m==-1&&f==-1&&r==-1){
            break;
        }
        else if(m==-1||f==-1){
            cout << "F" << endl;
        }
        else if(m+f>=80){
            cout << "A" << endl;
        }
        else if(m+f>=65){
            cout << "B" <<endl;
        }
        else if(m+f>=50){
            cout << "C" << endl;
        }
        else if(m+f>=30&&r>=50){
            cout << "C" << endl;
        }
        else if(m+f>=30){
            cout << "D" << endl;
        }
        else {
            cout << "F" << endl;
        }
    }
}


Measured memory_bytes: 3092
#include <stdio.h>

int main() {
  long long n;
  scanf("%lld", &n);
  long long ans = 0;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (i > 1) {
        if (n / (i - 1) == n % (i - 1)) {
          ans += i - 1;
        }
      }
      long long d = n / i - 1;
      if (d > 0) {
        if (n / d == n % d) {
          ans += d;
        }
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  rep(go, a + 1){
    rep(hyaku, b + 1){
      int nokori = x - go*500 - hyaku*100;
      nokori /= 50;
      if(nokori >= 0 && nokori <= c) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
int main(){
    ll n;
    cin>>n;
    vector<int> va(n);
    for(ll i=0;i<n;i++){
        ll a;
        cin>>a;
        va[i]=a;
    }

    sort(va.begin(),va.end(),greater<>());
    int last=-1;
    int cnt=0;
    vector<ll> memo;
    for(int i=0;i<n;i++){
        
        if(last!=va[i]){
            last=va[i];
            cnt=1;
            continue;
        }else{
            cnt++;
        }
        if(cnt>=2){
            memo.push_back(va[i]);
            cnt-=2;
        }
        if(memo.size()==2) break;
    }
    if(memo.size()>=2){
        cout<<memo[0]*memo[1]<<endl;
    }else{
        cout<<0<<endl;
    }
    
    return 0;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int x, a, b;
    cin >> x >> a >> b;

    int na = a * -1;
    int nb = na + b;

    if (nb < 1) {
        cout << "delicious";
    } else {
        if (nb <= x) {
            cout << "safe";
        } else {
            cout << "dangerous";
        }
    }
    cout << endl;

    return 0;
}


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

using namespace std;
#define int long long
#define all(v) v.begin(), v.end()
#define pii pair <int , int>
#define F first
#define S second
const int N = 1e5 + 5;
int a[N];

int check(int n, int x) {
    while (n % x == 0) n/=x;
    return (n % x == 1);
}
int32_t main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, m, sum = 0; cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i], sum += a[i];
    sum = (sum + 4 * m - 1) / (4 * m);
    sort(a, a + n, greater <int> ());
    for (int i = 0; i < m; i++) if (a[i] < sum) return cout << "No\n", 0;
    cout << "Yes\n";
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();		
		System.out.println(360/gcd(360,a));
	}
}

Measured memory_bytes: 35688
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

for j in range(1,4):
    D=0
    for i in range(n):
        D+=(abs(a[i]-b[i]))**j
    D**=1/j
    print('{:.6f}'.format(D))
lst=[]
for k in range(n):
    lst.append(abs(a[k]-b[k]))
print('{:.6f}'.format(max(lst)))


Measured memory_bytes: 5652
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,K; cin>>N>>K;
	map<int,int> ct;
	for (int i=0; i<K; i++) {
		int d; cin>>d;
		for (int j=0; j<d; j++) {
			int A; cin>>A;
			ct[A]++;
		}
	}
	int ret=0;
	for (int i=1; i<=N; i++)
		if(!ct[i])
			ret++;
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 3664
N = {} #10000以上key以下の回文数の個数
cnt = 0
for i in range(10000, 100000):
    L = list(str(i))
    if L == list(reversed(L)):
        cnt += 1
    N[i] = cnt
A, B = map(int, input().split())
print(N[B]-N[A-1] if A > 10000 else N[B])

Measured memory_bytes: 19168
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define inf 1e18 
 
using namespace std;
 
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int k,n,i;
    cin>>k>>n;
    vi v(n);
    for(i=0;i<n;i++) cin>>v[i];
    sort(v.begin(),v.end());
    int maxl=-inf;
    for(i=1;i<n;i++)
    {
        maxl=max(maxl,v[i]-v[i-1]);
    }
    maxl=max(maxl,k-(v[n-1]-v[0]));
    cout<<k-maxl;
}

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

const int MAX_N = 100000;
int par[MAX_N];
int _rank[MAX_N];

void init(int n){
  for(int i = 0 ; i < n ; i++){
    par[i] = i;
    _rank[i] = 0;
  }
}

int find(int x){
  if(par[x] == x){
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if (x == y) return;

  if(_rank[x] < _rank[y]){
    par[x] = y;
  } else {
    par[y] = x;
    if(_rank[x] == _rank[y])_rank[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}


int main(){
  int N,M;
  int p[MAX_N];
  cin >> N >> M;
  for(int i = 0 ; i < N ; i++){
    cin >> p[i];
    p[i]--;
  }

  init(N);

  for(int i = 0 ; i < M ; i++){
    int x,y;
    cin >> x >> y;
    unite(x-1,y-1);
  }

  int count = 0;
  for(int i = 0 ; i < N ; i++){
    if(same(i,p[i]))count++;
  }
  cout << count << endl;

  return 0;
}


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

const int N = 200000;
int n;
long long k;
bool u[N];
int a[N];

int main() 
{
	scanf("%d%lld", &n, &k);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a + i);
		--a[i];
	}
	int t = 0;
	vector<int> v;
	while (!u[t]) {
		u[t] = true;
		v.push_back(t);
		t = a[t];
	}
	int i;
	for (i = 0; v[i] != t && k; ++i, --k);
	if (!k) printf("%d\n", v[i] + 1);
	else {
		int ln = v.size() - i;
		k %= ln;
		printf("%d\n", v[i + k] + 1);
	}
	return 0;
}


Measured memory_bytes: 4748
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
using namespace std;



long long n[100000+1];

int main() {

	
	int N;
	long long K;
	cin >> N >> K;


	/*
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; //デフォルトだと降順になってしまう
	pair<int, int> p; // first : key
					  // second : 個数

	for (int i = 0; i < N; i++) {
		cin >> p.first >> p.second; // keyが同じものが入ってもつぶさない
		pq.push(p);
	}

	int ans;

	while (K > 0) {
		p = pq.top();
		if (p.second >= K) cout << p.first << endl;
		K -= p.second;
		pq.pop();
	}
	*/
	
	for (int i = 0; i <= 100000; i++) n[i] = 0;

	for (int i = 0; i < N; i++) {
		long long a, b; cin >> a >> b;
		n[a] += b;
	}

	for (int i = 0; i < 100001 && K>0; i++) {
		if (K <= n[i]) cout << i << endl;
		K -= n[i];
	}

	return 0;
}

Measured memory_bytes: 1024
#入力
N, M = map(int, input().split())

AB = []
AB_append = AB.append
C = []
C_append = C.append
for _ in range(M):
    a, b = map(int, input().split())
    AB_append((a, b))
    c = list(map(int, input().split()))
    C_append(c)


ans = [10 ** 18] * (2 ** (N + 1))
ans[0] = 0
for i in range(M):
    tmp = 0
    for j in C[i]:
        tmp += 2 ** (j - 1)
    # print ('tmp', tmp)
    for j in range(2 ** N):
        # print (j, '-->', j | tmp)
        if ans[j] == 10 ** 18:
            pass
        else:
            ans[j | tmp] = min(ans[j | tmp], ans[j] + AB[i][0])

if ans[2 ** N - 1] == 10 ** 18:
    print (-1)
    exit()
print (ans[2 ** N - 1])

Measured memory_bytes: 45544
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}


 main()

{
    fast
    int x,k;
    cin>>x>>k;
    int ses=x;
    if(x>k)
    {
        int gap=x-k;
        int cnt=gap/k;
        x=x-cnt*k;
    }
    int tmp=100009;
    while(tmp--)
    {
         ses=min(ses,x);
         x=abs(x-k);
    }
    cout<<ses<<endl;

    return 0;

}













Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int W, H, x, y, r;
    char buf[256];
    fgets(buf, 256, stdin);
    buf[255] = '\0';

    sscanf(buf, "%d %d %d %d %d", &W, &H, &x, &y, &r);

    if (W - (x + r) >= 0 &&
        (x - r) >= 0 &&
        H - (y + r) >= 0 &&
        (y - r) >= 0)
    {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n,m,q; cin>>n>>m>>q;
    vector<int> a(q),b(q),c(q),d(q);
    rep(i,q) {
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        --a[i],--b[i];
    }

    vector<int> x;
    x.push_back(1);
    int ans = 0;
    auto dfs = [&](auto &&f) -> void {
        if (x.size() < n) {
            int s = x.back();
            for (int i = s; i <= m; ++i) {
                x.push_back(i);
                f(f);
                x.pop_back();
            }
            return;
        }
        int tmp = 0;
        rep(i,q) {
            if (x[b[i]]-x[a[i]] == c[i]) {
                tmp += d[i];
            }
        }

        chmax(ans, tmp);
    };

    dfs(dfs);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3600
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	int N, K;
	cin >> N >> K;
	
	Vec< int > v(N);
	for (int i=0; i<N; ++i) cin >> v[i];
	
	int ans = 0;
	for (int L=0; L<=N; ++L) for (int R=0; R<=N; ++R) {
		if (L+R > N || L+R > K) continue;
		// L + R <= K
		vector< int > use;
		for (int i=0; i<L; ++i) use.push_back(v[i]);
		for (int i=0; i<R; ++i) use.push_back(v[N-1-i]);
		//
		sort(use.begin(), use.end());
		int sum = accumulate(use.begin(), use.end(), 0);
		for (int i=0; i<min(L+R,K-R-L); ++i) if (use[i] < 0) sum -= use[i];
		ans = max(ans, sum);
	}
	cout << ans << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

using namespace std;

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

    long k;
    for(k=1; k*(k-1)/2 < n; k++);

    if(k*(k-1)/2 != n) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    vector<vector<int>> v(k);

    int t = 1;
    for(int i=0; i<k; i++)
        for(int j=i+1; j<k; j++)
            v[i].push_back(t), v[j].push_back(t), t++;

    cout << v.size() << endl;
    for(auto &vv: v) {
        cout << vv.size();
        for(auto &vvv: vv) {
            cout << ' ' << vvv;
        }
        cout << endl;
    }
}


Measured memory_bytes: 2304
N = int(input())
W = list(map(int, input().split()))

T = N
DIFFMIN = 100000
lidx = 0
ridx = N-1

while(True):
    T = (lidx + ridx)//2
    if T == N-1:
        T -= 1

    L = sum(W[:T+1])
    R = sum(W[T+1:])
    #print(T, L, R)
    if ridx - lidx <= 1:
        DIFFMIN = min(abs(L-R), abs(sum(W[:T+2])-sum(W[T+2:])))
        break
    if L<R:
        lidx = T
    elif L>R:
        ridx = T
    else:
        DIFFMIN = abs(L-R)
        break
    DIFFMIN = abs(L-R)
    
print(DIFFMIN)


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

using namespace std;

#define int long long

int h,n;
int a[1001], b[1001];
int f[10001];

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

	cin >> h >> n;
	for (int i=1;i<=n;i++)
		cin >> a[i] >> b[i];
	for (int i=0;i<=10000;i++)
		f[i] = 1e18;
	f[0] = 0;
	for (int i=1;i<=10000;i++)
		for (int j=1;j<=n;j++)
			f[i] = min(f[i],f[max(0LL,i - a[j])] + b[j]);
	cout << f[h];
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

int main(){
	
	int a,b,x;
  	cin >> x >> a >> b;
  	if(abs(x-a)<abs(x-b)) cout << "A\n";
  	else cout << "B\n";
	
	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#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
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main() {
    int n;
    cin>>n;
    int sum=0;
    int a[15000];
    REP(i,n) cin>>a[i];
    sort(a,a+n, greater<int>());
    a[0]=a[0]/2;
    REP(i,n)
    sum+=a[i];
cout<<sum<<endl;
    }


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX1 100006
#define f first
#define s second
#define pi 2*acos(0.0)
void solve()
{
    ll n,x;  cin>>n>>x;
    ll ans=0,count=0;
    rep(i,0,n)
    {
        ll a;  cin>>a;
        if(a+ans<=x) {  count++;  ans+=a;  }
        else break;
    }cout<<count+1;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for getting error from error.txt
    freopen("error.txt", "w", stderr);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<"\n";
    cerr<<"My CLOCKS_PER_SEC= "<<CLOCKS_PER_SEC<<"\n";
    return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  string s = to_string(n);
  rep(i, s.size()) ans += ctoi(s.at(i));
  if (ans == 1) {
    cout << 10 << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
def gcd(x,y):
    if x<y:x,y=y,x
    if y==0:return x
    return gcd(y,x%y)
a = 1
for i in range(N):
    a = a*A[i]//gcd(a,A[i])
ans = 0
for i in range(N):
    ans+= a//A[i]
print(ans%mod)

Measured memory_bytes: 4084
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define len(s) s.length()
#define forp(i,a,b) for( i=a;i<=b;i++)
#define rep(i,n)    for( i=0;i<n;i++)
#define ren(i,n)    for( i=n-1;i>=0;i--)
#define forn(i,a,b) for( i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define b(v) v.begin()
#define e(v) v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vii vector<int>
#define vll vector<long long>
#define gl(cin,s)  getline(cin,s);
#define bitc(n) __builtin_popcountll(n)
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define SIZE 100001

typedef long long  ll;
typedef unsigned long long ull;
typedef long double  ldo;
typedef double  db ;
using namespace std;
int N,K;
int H[SIZE];
int dp[SIZE];
int main()
{  	
	/* #ifndef ONLINE_JUDGE
	freopen(fi, "r", stdin);
	#endif */
	//freopen("route.in","r",stdin);
	//freopen("route.out","w",stdout);
	//cin.ignore();
	//cin.clear();
	boost;
	//cin.tie(0);
	//cout<<"Case "<<tt<<": ";
	cin>>N;
	K = 2;
	for(int i=1;i<=N;i++){
	    cin>>H[i];
	}
	for(int i=1;i<=N;i++){
	    dp[i] = INT_MAX;
	}
	dp[1] = 0;
	for(int i=2;i<=N;i++){
	    for(int j=1;j<=K;j++){
	        if(i-j < 1)
	        break;
	        dp[i] = min(dp[i],dp[i-j]+abs(H[i]-H[i-j]));
	    }
	}
	cout<<dp[N]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    ll q,h,s,d;cin>>q>>h>>s>>d;
    ll n;cin>>n;
    ll d_min=min(8*q,min(4*h,min(2*s,d)));
    ll s_min=min(4*q,min(2*h,s));
    cout<<(n/2)*d_min+(n%2)*s_min<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  int ans=0;
  for(int i=0;i<n;i++){
    int a[30]={0};
    int b[30]={0};
    
    // iを境に左右に分割.
    for(int j=0;j<=i;j++){
      a[s[j]-'a']++;
    }
    for(int k=i+1;k<n;k++){
      b[s[k]-'a']++;
    }
    
    // 両側にある要素のカウント.
    int cnt=0;
    for(int l=0;l<26;l++){
      if(a[l]!=0 && b[l]!=0) cnt++;
    }
    if(cnt>=ans) ans=cnt;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math


n = int(input())
#tmp = input().split()
#n,m,k = list(map(lambda a: int(a), tmp))

total=0
for i in range(1,n+1):
	if(i%3!=0 and i%5!=0):
		total+=i
print(total)

Measured memory_bytes: 9108
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;

using namespace std;

ll n, m, k;
ll h, w;

ll calc_gcd(ll x, ll y){
    if(y>x){
        ll z = x;
        x = y;
        y = z;
    }
    while( y > 0){
        ll z = x % y;
        x = y;
        y = z;
    }
    return x;
}

int main(){
    cin >> n >> m;
    vector<ll> a(n);
    for (ll i=0; i<n; ++i){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    ll x  =a[0];
    ll y = 1;
    while(x % 2 == 0){
        y *= 2;
        x /=2;
    }
    ll lcm = a[0] / y;
    for (ll i=1; i<n; ++i){
        if ( (a[i] % y != 0) || ((a[i]/y) %2 == 0)){
            cout << 0 << endl;
            return 0;
        }
        ll b = a[i] / y;
        lcm = (b * lcm) / calc_gcd(lcm, b);
    }
    lcm = lcm * y / 2;
    ll ret = m / lcm;
    ret = (ret / 2) + (ret % 2);
    cout << ret << endl;
    return 0;
}

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

int main() {
  int n;

  while(1) {
    cin >> n;
    if(n == 0)break;

    int max = 0;
    int min = 1000;

    for(int i = 0; i < n; i++) {
      int sum = 0;
      for(int j = 0; j < 5; j++) {
	int point;
	cin >> point;
	sum += point;
      }
      if(sum > max) max = sum;
      if(sum < min) min = sum;
    }
    cout << max << ' ' << min << endl;
  }
}

Measured memory_bytes: 1160
n,k=map(int,input().split())
summin=0
for i in range(k-1):
    summin+=i
summax=0
for i in range(k-1):
    summax+=(n-i)
ans=0
for x in range(k,n+2):
    summin+=(x-1)
    summax+=(n-(x-1))
    ans+=(summax-summin+1)
    ans%=(10**9+7)
print(ans)


Measured memory_bytes: 64488
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class AACOrWA {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n, m;
	    in >> n >> m;
	    ans(n == m, out);
	}
};


int main() {
	AACOrWA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int a,b,k;
	scanf("%lld %lld %lld",&a,&b,&k);
	if(a > k){
      a = a-k;
	}else{
      k = k-a;
      a = 0;
      if(k > b){
        b = 0;
      }else{
        b = b-k;
      }
    }
	printf("%lld %lld\n", a, b);
	return 0;
}


Measured memory_bytes: 1736
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using D = double;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_num(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, a[101010], ans = INF;
int b[101010];
int main() {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
	}
	for (int i = 0; i <= a[0]; i++) {
		int cnt = i;
		REP(j, n)b[j] = a[j];
		b[0] -= i;
		REP(j, n - 1) {
			cnt += b[j] * 2;
			b[j + 1] = max(0, b[j + 1] - b[j]);
		}
		cnt += b[n - 1];
		ans = min(cnt, ans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
 
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    ll i,j,k,l,n;
    cin>>n;
    ll ar[n+1],flg=0;
    for(i=1;i<=n;i++){
        cin>>ar[i];
        if(ar[i]==0) flg=1;
    }

    if(flg){
        cout<<"0";return 0;
    }
    ll an=1;
    for(i=1;i<=n;i++){
        if((an*1.0l*ar[i])>1e18){
            cout<<"-1";return 0;
        }
        else an=(an*ar[i]);
    }
    cout<<an;
    return 0;   
}

Measured memory_bytes: 4440