akhauriyash/Code-Regression huggingface dataset:
/*
 Author: Vedang Karwa
 */

//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <map>
#include <set>
#include<vector>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mem(p,v) memset(p,v,sizeof(p))
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
//#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define debug4(x,y,z,a) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<" "<<#a<<" "<<a<<endl;
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
const long long inf = 1e18+5;
const lli M =1e9+7 ;
void show(vector<lli> v){fr(i,0,v.size())cout<<v[i]<<" ";cout<<endl;}
void show(vector<int> v){fr(i,0,v.size())cout<<v[i]<<" ";cout<<endl;}
void show(int a[], int arraysize){for (int i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(lli a[], lli arraysize){for (lli i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(bool a[], lli arraysize){for (lli i = 0; i < arraysize; ++i)cout << a[i] << " ";cout<<endl;}
void show(set<int> s){for (auto it = s.begin(); it != s.end(); it++){cout << *it << " ";}cout<<endl;}
void show(map<lli,lli> mp){for (auto it = mp.begin(); it != mp.end(); it++){cout << it->first << " "<<it->second<<endl;}cout<<endl;}
lli modpow(lli x,lli n){lli res=1;while(n>0){if(n&1) res=((res%M)*(x%M))%M;x=((x%M)*(x%M))%M;n>>=1;}return res;}
lli power(lli x, lli n){lli res=1;while(n>0){if(n&1) res=res*x;x=x*x;n>>=1;}return res;}
const int N =1e5+5;
/////// ------ Main code starts here ------ /////

void solve()
{
    lli n,x,t;
    cin>>n>>x>>t;
    cout<<ceil((double)n/(double)x)*t<<endl;
    
    
}
int main()
{
    run;cout<<fixed<<setprecision(0);
    int t;
    t=1;
    while(t){solve();t--;}
    return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

void solve(istream& cin, ostream& cout) {
  string sd;
  string t;
  cin >> sd >> t;
  int sl = sd.length();
  int tl = t.length();
  if (tl > sl) {
    cout << "UNRESTORABLE" << endl;
    return;
  }
  RFOR(i, sl - 1, tl - 1) {
    REP(j, tl) {
      if (sd[i - j] != t[tl - j - 1] && sd[i - j] != '?') break;
      if (j == tl - 1) {
        sd.replace(i - tl + 1, tl, t);
        REP(i, sl) {
          if (sd[i] == '?') sd.replace(i, 1, "a");
        }
        cout << sd << endl;
        return;
      }
    }
  }
  cout << "UNRESTORABLE" << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ioS            ios::sync_with_stdio(false);cin.tie(0);
#define li             long int
#define ll            long li
#define ull            unsigned ll
#define pi             pair<int,int>
#define vi             vector<int>
#define vli            vector<li>
#define vll           vector<ll>
#define vvi            vector<vector<int>>
#define pb             push_back
#define mp             make_pair
#define forn(i,s,n)    for(auto i=s;i<n;++i)               
#define forr(i,s,n)    for(auto i=s;i>=n;--i) 

void solve() 
{
    int x;
    cin>>x;
    x = x - 400;
    x = x/200;
    cout<<(8 - x)<<endl;
}
int main() {
    int t;
    // cin>>t;
    // while(t--)
        solve();
    return 0;
}


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

class UnionFind {
private:
  int size;
  int *par;
  int *rk;
  
public:
  UnionFind(int size) {

    this->size = size;
    par = new int[size];
    rk = new int[size];
    for(int i = 0; i < size; i++) {
      par[i] = i;
      rk[i] = 0;
    }
  }

  void merge(int x, int y) {
    x = find(x);
    y = find(y);
    if(rk[x] > rk[y]) {
      par[y] = x;
    }else if(rk[x] < rk[y]){
      par[x] = y;
    }else {
      par[x] = y;
      rk[y] += 1;
    }
  }

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

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

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

  vector<int> x(N), y(N);

  for(int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
  }

  vector< pair<int, int> > x_id(N), y_id(N);

  for(int i = 0; i < N; i++) {
    x_id[i] = make_pair(x[i], i);
    y_id[i] = make_pair(y[i], i);
  }

  sort(x_id.begin(), x_id.end());
  sort(y_id.begin(), y_id.end());

  typedef pair<int, pair<int, int> > dist_nodes;

  priority_queue<dist_nodes, vector<dist_nodes>, greater<dist_nodes> > pq;

  for(int i = 0; i < N - 1; i++) {
    pq.push(make_pair(x_id[i + 1].first - x_id[i].first, make_pair(x_id[i].second, x_id[i + 1].second)));
    pq.push(make_pair(y_id[i + 1].first - y_id[i].first, make_pair(y_id[i].second, y_id[i + 1].second)));
  }

  UnionFind uf(N);

  int ans = 0;

  while(!pq.empty()) {

    dist_nodes dn = pq.top();
    pq.pop();

    int distance = dn.first;
    int node1 = dn.second.first, node2 = dn.second.second;

    if(uf.same(node1, node2)) {
      continue;
    }

    ans += distance;
    uf.merge(node1, node2);
  }

  cout << ans << endl;


}


Measured memory_bytes: 7156
import sys
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().split()]
import fractions
from functools import reduce

def gcd(*numbers):
    return abs(reduce(fractions.gcd, numbers))

L = [A[0]]
R = [A[-1]]
A_R = A[::-1]
for i in range(1, N):
    L.append(fractions.gcd(L[-1], A[i]))
    R.append(fractions.gcd(R[-1], A_R[i]))
R = R[::-1]
ans = R[1]
R.append(0)
for i in range(N - 1):
    ans = max(ans, fractions.gcd(L[i],R[i+2]))
print(ans)
    


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

int n,m;

int par[300000];

int root(int x){
    return par[x]==x?x:par[x]=root(par[x]);
}

int main(){
    cin>>n>>m;
    rep(i,n)par[i]=i;
    rep(i,m)par[100000+i]=100000+i;
    rep(i,n){
        int k; cin>>k;
        rep(j,k){
            int l; cin>>l;
            l--;
            if(root(i)!=root(l+100000)){
                par[root(l+100000)]=root(i);
            }
        }
    }
    rep(i,n){
        if(root(i)!=root(0)){
            cout<<"NO\n";
            return 0;
        }
    }
    cout<<"YES\n";
    return 0;
}

Measured memory_bytes: 2560
while True:

    x,y=map(int,input().split())

    if x + y == 0:
        break

    if x - 3 > y:
        x = y - 3

    count = 0
    for i in range(x, 2, -1):
        for j in range(2, i, 1):
            for k in range(1, j, 1):
                if (i + j + k) == y:
                    count += 1

    print(count)




Measured memory_bytes: 5596
check = [True]*(3*10**5+1)
pri = []
for i in range(6,3 * 10 ** 5 + 1):
    if (i % 7 == 1 or i % 7 == 6) and check[i]:
        pri.append(i)
        for k in range(i * 2, 3 * 10 ** 5 + 1, i):
            check[k] = False

def main(n):
    res = ["{}:".format(n)]
    for p in pri:
        if n % p == 0:
            res.append(str(p))
    print(" ".join(res))
while 1:
    n = int(input())
    if n == 1:
        break
    main(n)


Measured memory_bytes: 9252
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 1 << 26;
ll dp[N];

ll f(ll n, vector<ll> A, vector<ll> B) {
	memset(dp, 0, sizeof dp);
	for (int i = 1; i < n + 10; i ++) {
		for (int j = 0; j < 3; j ++) {
			if (i >= A[j]) {
				dp[i] = max(dp[i], dp[i - A[j]] + B[j]);
			}
		}
		dp[i] = max(dp[i], (ll)i);
	}
	return dp[n];
}
int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll n;
    cin >> n;
    vector<ll> A, B;
    for (int i = 0; i < 6; i ++) {
   	ll x;
   	cin >> x;
   	(i < 3 ? A : B).pb(x);
    }
    cout << f(f(n, A, B), B, A);
    return (0);
}

Measured memory_bytes: 524672
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl
#define MOD 1000000007

//nの階乗を計算
//ll factorial(ll n){
//  ll answer = 1;
//  while(n > 1){
//    answer *= n;
//    n--;
//  }
//  return answer;
//}
////組み合わせの数nCrを計算
//ll calcNumOfCombination(ll n, ll r){
//  return factorial(n) / (factorial(r) * factorial(n-r));
//}

ll calcNumOfCombination(ll n, ll r) {
  ll res;
  if(n<=1)res = 0;
  else res = n*(n-1)/2;
  return res;
}

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

  ll N; cin >> N;
  vector<ll> A(N); rep(i,N) cin>>A[i];
  map<ll,ll> mp;
  rep(i,N) {
    mp[A[i]]++;
  }

  map<ll,ll> mp1; ll sum1 = 0;
  map<ll,ll> mp2;
  for(auto x:mp) {
    ll num1 = calcNumOfCombination(x.second, 2);
    sum1+=num1;
    mp1[x.first] = num1;
  }
  for(auto x:mp) {
    mp2[x.first] = calcNumOfCombination(x.second-1, 2);
  }

  rep(i,N) {
    ll res = sum1-mp1[A[i]]+mp2[A[i]];
    cout << res << endl;
  }

  return 0;
}


Measured memory_bytes: 26880
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  string s;
  cin>>s;
  long ans = 0;
  long acc = 0;
  int n = s.size();
  rep(i,n){
    if(s[i]=='B') acc++;
    else ans += acc;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG
#define ll long long
#define rep(i,n) for (ll i = 0; i < n; i++)
#define vl vector<ll>
#define vpl vector<pair<ll,ll>>
#define vvl vector<vector<ll>> //a(縦行,vector<ll>(横列));
#include<algorithm>//__gcd(a,b)
#include <iostream>
#include <vector>
#include <cstdlib>
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; }

const long long INF = 1LL << 60;

int main(){
    long double a,b;cin>>a>>b;
    ll c=a*b;
    cout<<c<<endl;

}

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

int main() {
  ios::sync_with_stdio(false); 
  cin.tie(0);
  int n;
  cin >> n;
  long double d;
  cin >> d;
  int res = 0;
  for (int i = 0; i < n; i++) {
    long double x, y;
    cin >> x >> y;
    long double dist = sqrt(x * x + y * y);
    res += dist <= d;
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3784
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in)){
			String s = sc.next();
			int result = 0;
			
			for (int i = 0; i < 4; i++) {
				String a = s.substring(i, i+1);
				if (a.equals("+")) {
					result += 1;
				} else {
					result -= 1;
				}
			}
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 21460
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace abc153
{
    class Program
    {
        static void Main(string[] args)
        {
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
			solve_abc153E();
        }

        public static void solve_abc153E()
        {
            int[] hn = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int h = hn[0];
            int n = hn[1];
            List<KeyValuePair<int, int>> pairs = new List<KeyValuePair<int, int>>();
            for (int i = 0; i < n; i++)
            {
                int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                int a = ab[0];
                int b = ab[1];
                pairs.Add(new KeyValuePair<int, int>(a, b));
            }
            int[] dp = new int[h + 1];
            dp[0] = 0;
            for (int i = 1; i < h + 1; i++)
            {
                dp[i] = 1000000000;
            }
            for (int i = 1; i < h + 1; i++)
            {
                for (int j = 0; j < pairs.Count; j++)
                {
                    dp[i] = Math.Min(dp[i], dp[Math.Max(i - pairs[j].Key, 0)] + pairs[j].Value);
                }
            }

            Console.WriteLine(dp[h]);
        }

        public static void solve_abc153D()
        {
            long h = Convert.ToInt64(Console.ReadLine());
            long k = 1;
            long cnt = 0;
            while (h > 0)
            {
                h /= 2;
                cnt += k;
                k *= 2;
            }
            Console.WriteLine(cnt);
        }

        public static void solve_abc153C()
        {
            int[] nk = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int n = nk[0];
            int k = nk[1];
            int[] h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            Array.Sort(h, (a, b) => b.CompareTo(a));

            long cnt = 0;
            for (int i = k; i < n; i++)
            {
                cnt += h[i];
            }
            Console.WriteLine(cnt);
        }

        public static void solve_abc153B()
        {
            int[] hn = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int h = hn[0];
            int n = hn[1];
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            for (int i = 0; i < n; i++)
            {
                h -= a[i];
            }
            if (h <= 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        public static void solve_abc153A()
        {
            int[] ha =  Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine((ha[0] + ha[1] - 1) / ha[1]);
        }
    }
}


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

int main(){
    string s; cin >> s;
    stack<char> st;
    for(int i=0; i<s.length(); i++){
        if(s.at(i)=='0' || s.at(i)=='1'){
            st.push(s.at(i));
        }else if(s.at(i)=='B'){
            if(!st.empty())
                st.pop();
        }
    }
    string ans="";
    while(true){
        if(st.empty()) break;
        ans += st.top();
        st.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
	int n, w, h, x, y, z, a;cin >> w >> h >> n;
	int ha = h, hi = 0, wa = w, wi = 0;
	rep(i, n) {
		cin >> x >> y >> a;
		if (a == 1) wi = max(wi, x);
		else if (a == 2) wa = min(wa, x);
		else if (a == 3) hi = max(hi, y);
		else ha = min(ha, y);
	}
	if (wa - wi <= 0 || ha - hi <= 0) cout << 0 << endl;
	else cout << (wa - wi) * (ha - hi) << endl;
}

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

const ll MAX = 1000000000;

int main() {
  ll s;
  cin >> s;
  vector<ll> x(3), y(3);

  x[0] = 0, y[0] = 0;
  x[1] = MAX;
  x[2] = 1;
  y[2] = ceil((double)s / MAX);
  y[1] = x[1] * y[2] - s;

  rep(i, 3) printf("%d %d%c", x[i], y[i], (i == 2 ? '\n' : ' '));

  return 0;
}


Measured memory_bytes: 3844
data=input()
count=0
start=0
maxLen=0
for i in range(len(data)):
  if data[i] in "AGCT":
    if i>0:
      if data[i-1] not in "AGCT":
        start=i
    else:
      start=i
    if i<len(data)-1:
      if data[i+1] not in "AGCT":
        length=i-start+1
        if length>maxLen:
          maxLen=length
    else:
      length=i-start+1
      if length>maxLen:
        maxLen=length
print(maxLen)
      
      


Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int A, B;
	cin >> A >> B;

	if ((A <= 8) && (B <= 8)) {
		cout << "Yay!" << endl;
	} else {
		cout << ":(" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
h, w, k = map(int, input().split())
A =[]
for i in range(h):
    a = input()
    A.append([a[i] == "#" for i in range(w)])
ans = 0
for bit in range(1 << h):
    for tib in range(1 << w):
        now = 0
        for i in range(h):
            for j in range(w):
                if(bit >> i) & 1 == 0 and (tib >> j) & 1 == 0 and A[i][j] == True: now += 1
        if now == k: ans += 1
print(ans)

Measured memory_bytes: 9156
using System.Linq;
using System.Collections.Generic;
using System;

namespace Wandbox
{
    class Program
    {
        static void Main(string[] args)
        {
            var ignrwe = new long[1000];//new Stack<long>();
            var aduahfi = Console.ReadLine().Split(' ');
            var gggg = 0;
            foreach (var sabyvas in aduahfi)
            {
                switch (sabyvas)
                {
                    case "+":
                    {
                        var kk = ignrwe[--gggg];
                        var fweop = ignrwe[--gggg];
                        ignrwe[gggg++] = kk + fweop;
                    }
                    break;
                    case "*":
                    {
                        var kk = ignrwe[--gggg];
                        var fweop = ignrwe[--gggg];
                        ignrwe[gggg++] = kk * fweop;
                    }
                    break;
                    case "-":
                    {
                        var kk = ignrwe[--gggg];
                        var fweop = ignrwe[--gggg];
                        ignrwe[gggg++] = -kk + fweop;
                    }
                    break;
                    default:
                        ignrwe[gggg++] = long.Parse(sabyvas);
                        break;
                }
            }
            Console.WriteLine(ignrwe[0]);
        }
    }
}



Measured memory_bytes: 9224
#include <stdio.h>
#include <algorithm>

using namespace std;

int n, q, r, a[100000];

int main()
{
    scanf("%d", &n); getchar_unlocked();
    
    for(int i = 0; i < n; i++)
    {
        while(true)
        {
            char c = getchar_unlocked();
            
            if('0' <= c && c <= '9')
            {
                a[i] = a[i] * 10 + (c - '0');
            }
            else
            {
                break;
            }
        }
    }
    
    scanf("%d", &q);
    
    int ret = 0;
    
    for(int i = 0; i < q; i++)
    {
        scanf("%d", &r);
        
        ret += binary_search(a, a + n, r) ? 1 : 0;
    }
    
    printf("%d\n", ret);
    
    return 0;
}

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



int main(){
  int n;
  cin >> n;
  int a[n];
  int max1 = 0;
  int max2 = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(max1<a[i]){
      max2 = max1;
      max1 = a[i];
    }else if(max2<a[i]){
      max2 = a[i];
    }
  }
  for(int i=0;i<n;i++){
    if(a[i]==max1){
      cout << max2 << endl;
    }else{
      cout << max1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2432
n = int(input())

sum3 = 3*0.5*(n//3)*(n//3+1)
sum5 = 5*0.5*(n//5)*(n//5+1)
sum15 = 15*0.5*(n//15)*(n//15+1)
sums = 0.5*n*(n+1)
print(int(sums - sum3 - sum5 + sum15))

Measured memory_bytes: 9176
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

s = input()
t = input()

vmin = len(t)
for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            count += 1
    # print(count)
    vmin = min(vmin, count)

print(vmin)


Measured memory_bytes: 68720
#include <iostream>
#include <vector>
#include <algorithm>
#define INF 1 << 30

using namespace std;

int Num, A, B, C;

int Search(int a, int b, int c, const vector<int> &d, int e) {
	if (e == Num) {
		if (min(a, min(b, c)) > 0)
			return abs(A - a) + abs(B - b) + abs(C - c);
		else
			return INF;
	}
	int ans = INF;
	ans = min(ans, Search(a, b, c, d, e + 1));
	ans = min(ans, Search(a + d[e], b, c, d, e + 1) + 10);
	ans = min(ans, Search(a, b + d[e], c, d, e + 1) + 10);
	ans = min(ans, Search(a, b, c + d[e], d, e + 1) + 10);
	return ans;
}

int main(void) {
	cin >> Num >> A >> B >> C;
	vector<int> d(Num);
	for (int i = 0; i < Num; i++)
		scanf("%d", &d[i]);
	printf("%d\n", Search(0, 0, 0, d, 0) - 30);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n, k;
    scanf("%ld%ld", &n, &k);

    ll sum = 0;
    long i;
    for(i=0; i<n; i++) {
        long x;
        scanf("%ld", &x);
        sum += (x>k/2? (k-x)*2: x*2);
    }
    printf("%lld\n", sum);
  
    return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline

def main():
	s = input().strip()
	rc = 0
	lc = 0
	i = 0
	n = len(s)
	ans = [0] * n
	while i <= n-2:
		if s[i] == 'R':
			rc += 1
		if s[i] == 'R' and s[i+1] == 'L':
			# 上でカウントしたのを覗く
			rc -= 1
			k = 0
			while i+2+k < n and  s[i+2+k] != 'R':
				k += 1
			# print("{rc k}", rc, k)
			tor = 1 + ((k+1) // 2) + (rc // 2)
			tol = 1 + ((rc+1) // 2) + (k // 2)
			# print('tor, rol',tor, tol)
			if max(rc, k) % 2 == 0:
				# RはRと同じ場所にいる
				ans[i] = tor
				ans[i+1] = tol
			else:
				# 違う場所
				ans[i] = tor
				ans[i+1] = tol

			rc = 0
			i = i + 1 + k
		i += 1
	for i in ans:
		print("{} ".format(i) , end="")
	print("")
if __name__ == '__main__':
	main()


Measured memory_bytes: 54616
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)

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

ll gcd(ll x, ll y) {
  // assume x > y
  if (x % y == 0)
    return y;
  else
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
  // assum x > y
  return x / gcd(x, y) * y;
}

void solve(ll N, vector<ll> T) {
  ll ans(1);
  REP(i, N)
    ans = lcm(max(ans, T[i]), min(ans, T[i]));
  cout << ans << endl;
}

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

  ll N;
  cin >> N;
  vector<ll> T(N);
  REP(i, N)
    cin >> T[i];

  solve(N, move(T));

  return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
 
int main(){
  int N;
  int idx;
  scanf("%d\n",&N);
  if(N>=10000 && N<100000){
    printf("%d\n",N-10000+909+1);
  }else if(N>=1000 && N<10000){
    printf("909\n");
  }else if(N>=100 && N<1000){
    printf("%d\n",N-100+9+1);
  }else if(N>=10 && N<100){
    printf("9\n");
  }else if(N==100000){
    printf("90909\n");
  }else{
    printf("%d\n",N);
  }

  return 0; 
}

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<double> p(N);
  for(int i=0;i<N;i++)  cin >> p.at(i);

  vector<double> sum(N+1,0);
  for(int i=0;i<N;i++){
    sum.at(i+1)=sum.at(i)+(p.at(i)+1)/2;
  }
  double ans=0;
  for(int i=K;i<=N;i++)  ans=max(ans,sum.at(i)-sum.at(i-K));
  printf("%.9lf\n",ans);

  return 0;
}


Measured memory_bytes: 3328
N, L = [int(i) for i in input().split()]
taste = [L+i-1 for i in range(1, N+1)]

sum_of_taste = sum(taste)

base = 10**10
answer = 0
for i in taste:
  if base > abs(i):
    base = abs(i)
    answer = sum_of_taste - i

print(answer)

Measured memory_bytes: 3064
N = int(input())
h = list(map(int,input().split()))
INF = 10**10

dp = [INF]*N
dp[0] = 0

for i in range(N):
    if i-1>=0:
        dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
    if i-2>=0:
        dp[i] = min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])

Measured memory_bytes: 13976
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define ld long double
#define pii pair <int,int>
#define pll pair <ll,ll>
#define pil pair <int,ll>
#define pli pair <ll,int>
#define ull unsigned long long
#define pdd pair <double,double>
#define pb push_back
#define mp make_pair
#define puu pair<ull,ull>
#define pvv pair<vector<int>, vector<int> >
#define _bp __builtin_popcount
#define ptt pair <Tree*,Tree*>
#define all(v) v.begin(),v.end()
#define en "\n"
//const long double pi = acos(-1);
void boos()
{
     ios_base :: sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
}
void file()
{
   freopen("max.in","r",stdin);
   freopen("max.out","w",stdout);
}
const ll INF = 1e9 + 7;
const ll INF1 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTmx = (int)1e9;
const ld EPS = (ld)1e-9;
const int N = 3e5 + 100;
int a[N];
int main()
{
    //file();
    boos();
    int n;
    cin >> n;
    ll sum = 0;
    for(ll i = n - 1;i >= 1;i--)sum += i;
    cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MN 100000
using namespace std;
inline ll read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9')if(ch=='-')f=-1,ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int main()
{
    int ans=1000005,n=read(),t=read();
    while(n--)
    {
        int c=read(),tt=read();
        if(tt<=t)ans=min(ans,c);
    }
    if(ans==1000005)puts("TLE");
    else printf("%d\n",ans);
    return 0;
}



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

typedef vector<vector<char>> testfield;
typedef pair<int, int> point_t;

void debug(testfield tf, int col, int row)
{
	for (int i = 0; i < row; i++)
	{
		for (int j = 0; j < col; j++)
		{
			printf("%c", tf[i][j]);
		}
		putchar('\n');
	}
}

point_t operator+(const point_t &lhs, const point_t &rhs)
{
	point_t p = { lhs.first + rhs.first, lhs.second + rhs.second };
	return p;
}

bool operator==(const point_t &lhs, const point_t &rhs)
{
	return (lhs.first == rhs.first) && (lhs.second == rhs.second);
}

bool is_in_field(int col, int row, const point_t &point)
{
	const int c = point.second;
	const int r = point.first;
	return (0 <= c && c < col) && (0 <= r && r < row);
}

int solve(int col, int row, testfield &field, const point_t &start, const point_t &goal)
{
	vector<vector<int>> memo;
	for (int i = 0; i < row; ++i) {
		vector<int> v(col, 0);
		memo.push_back(v);
	}

	const point_t points[] = {
		{ -1, 0 },{ 1, 0 },{ 0, -1 },{ 0, 1 },
	};

	queue<point_t> q;
	q.push(start);

	// キューが空になるまで繰り返す
	while (!q.empty()) {
		point_t cur = q.front(); q.pop();

		//printf_s("(%3d,%3d) = %3d\n", cur.first, cur.second, memo[cur.first][cur.second]);
		// 取り出したマスがゴールなら終了
		if (cur == goal) {
			return memo[cur.first][cur.second];
		}

		for (const auto &point : points) {
			// 取り出したマス(cur)から上下左右の何れかに移動する
			point_t next = cur + point;
			// 移動先のマス(next)が迷路外でないことを確認する
			if (is_in_field(col, row, next)) {
				const char s = field[next.first][next.second];
				// 移動先のマス(next)が道またはゴールであることを確認する
				if (s == '.' || s == 'g') {
					// 移動先のマス(next)が未訪問であることを確認する
					if (memo[next.first][next.second] == 0) {
						// 移動先のマス(next)をキューに格納し、訪問履歴を更新する
						field[next.first][next.second] = 'x';
						q.push(next);
						memo[next.first][next.second] = memo[cur.first][cur.second] + 1;
					}
					else if (memo[next.first][next.second] != 0 && memo[next.first][next.second] > memo[cur.first][cur.second] + 1)
					{
						memo[next.first][next.second] = memo[cur.first][cur.second] + 1;
					}
				}
			}
		}
	}
	return -1;
}

int main(int argc, char** argv)
{
	int H, W;
	cin >> H >> W;

	point_t start, goal;
	testfield field;

	int numRoad = 0;
	for (int i = 0; i < H; ++i) {
		vector<char> v;
		for (int j = 0; j < W; ++j) {
			char c;
			cin >> c;
			if (c == '.')
				numRoad++;

			// スタート地点とゴール地点は別途覚えておく
			if (i == 0 && j == 0) {
				c = 's';
				start.first = i;
				start.second = j;
			}
			else if (i == H - 1 && j == W - 1) {
				c = 'g';
				goal.first = i;
				goal.second = j;
			}
			v.push_back(c);
		}
		field.push_back(v);
	}

	int ret = solve(W, H, field, start, goal);
	if (ret == -1)
	{
		cout << ret << endl;
	}
	else
	{
		cout << (numRoad - 2) - (ret - 1) << endl;
	}

	//debug(field, W, H);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
int main(){
  int R;
  cin >> R;
  string res = "AGC";
  if (R < 1200) {
    res = "ABC";
  }else if (R < 2800) {
    res = "ARC";
  }
    cout << res << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define R register
#define inline __inline__ __attribute__((always_inline))
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
int read(){
    R int res,f=1;R char ch;
    while((ch=getchar())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getchar())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
double readdb()
{
    R double x=0,y=0.1,f=1;R char ch;
    while((ch=getchar())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(x=ch-'0';(ch=getchar())>='0'&&ch<='9';x=x*10+ch-'0');
    for(ch=='.'&&(ch=getchar());ch>='0'&&ch<='9';x+=(ch-'0')*y,y*=0.1,ch=getchar());
    return x*f;
}
const int N=1e5+5;
struct node{
    double x,y;
    inline node(){}
    inline node(R double xx,R double yy):x(xx),y(yy){}
    inline node operator +(const node &b)const{return node(x+b.x,y+b.y);}
    inline node operator -(const node &b)const{return node(x-b.x,y-b.y);}
    inline double operator *(const node &b)const{return x*b.y-y*b.x;}
    inline node operator *(const double &b)const{return node(x*b,y*b);}
    inline double operator ^(const node &b)const{return x*b.x+y*b.y;}
    inline double len2(){return x*x+y*y;}
    inline node rot(){return node(-y,x);}
}p[N],o;
struct Line{
    node p,v;
    inline Line(){}
    inline Line(R node pp,R node vv):p(pp),v(vv){}
    friend node cross(const Line &a,const Line &b){return a.p+a.v*(b.v*(b.p-a.p)/(b.v*a.v));}
};
node circle(const node &a,const node &b,const node &c){
    return cross(Line((a+b)*0.5,(b-a).rot()),Line((a+c)*0.5,(c-a).rot()));
}
int n;double r;
int main(){
    n=read();
    fp(i,1,n)p[i].x=readdb(),p[i].y=readdb();
    random_shuffle(p+1,p+1+n);
    r=0,o=node(0,0);
    fp(i,1,n)if((p[i]-o).len2()>r){
        o=p[i],r=0;
        fp(j,1,i-1)if((p[j]-o).len2()>r){
            o=(p[i]+p[j])*0.5,r=(p[j]-o).len2();
            fp(k,1,j-1)if((p[k]-o).len2()>r)
                o=circle(p[i],p[j],p[k]),r=(p[k]-o).len2();
        }
    }
    printf("%.10lf\n",sqrt(r));
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx,avx2")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int x, k, d;
    cin >> x >> k >> d;
    if (x >= 0) {
        int cnt = min(k, x / d);
        x -= cnt * d;
        k -= cnt;
    } else {
        int cnt = min(k, abs(x) / d);
        x += cnt * d;
        k -= cnt;
    }
    if (k == 0) {
        cout << abs(x) << "\n";
    } else {
        if (k & 1) {
            if (x >= 0) {
                x -= d;
            } else {
                x += d;
            }
            cout << abs(x) << "\n";
        } else {
            cout << abs(x) << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>

using namespace std;


int main(){
	queue<long long int>que;
	long long int n,a[200006],ireru[200006]={},count=0;
	cin>>n;
	cout<<3*n*n;
}


Measured memory_bytes: 256
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    string s; cin >> s;
    rep(i, s.size()) {
        if (s[i] == '?') {
            cout << 'D';
        } else {
            cout << s[i];
        }
    }
    cout << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

m1, m2 = 0, 0
A = [0] * N

for i in range(N):
  a = int(input())
  A[i] = a
  if a >= m2:
    if a >= m1:
      m2 = m1
      m1 = a
    
    else:
      m2 = a

for a in A:
  if a == m1:
    print(m2)
  
  else:
    print(m1)



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

int main(){
  int n;
  long long int y;
  cin>>n>>y;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){
      int t;
      if(n-i-j>=0) t=n-i-j;
      else continue;
        if(10000*i+5000*j+1000*t==y){
          cout<<i<<" "<<j<<" "<<n-i-j;
          return 0;
        }
    }
  }
  cout<<"-1"<<" "<<"-1"<<" "<<"-1";
}


Measured memory_bytes: 3632
//hail to jwalaji
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define N 100005
#define INF 1e18
int main(){
lli n,w;
cin>>n>>w;
vector<vector<lli>> dp(n+5,vector<lli>(100005,INF));
vector<lli> weight(n),value(n);
for(lli i=0;i<n;i++){
    cin>>weight[i]>>value[i];
}
dp[0][0]=0;
for(lli i=1;i<=n;i++){
    for(lli j=0;j<N;++j){
        dp[i][j]=min(dp[i][j],dp[i-1][j]);
        if((j-value[i-1])>=0){
            dp[i][j]=min(dp[i][j],(dp[i-1][j-value[i-1]]+weight[i-1]));
        }
    }
}
lli ans=-1;
for(lli i=0;i<N;++i){
    if(dp[n][i]<=w){
        ans=i;
    }
}
cout<<ans<<endl;
return 0;
}


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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  
  int train, taxi;
  
  train = N * A;
  taxi = B;
  
  if (train < taxi) { 
    cout << train << endl;
  }
  
  else {
    cout << taxi << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
parseline(str=readline()) = parse.(Int, split(str))
function PredictionAndRestriction()
    N, K = parseline()
    R, S, P = parseline()
    score = zeros(Int, N)
    T = readline()
    for n in 1:N
        if T[n]=='r'
            score[n] = P
        elseif T[n]=='s'
            score[n] = R
        else
            score[n] = S
        end
    end
    for k in 1:K
        now = k + K
        while now ≤ N
            (T[now-K] == T[now]) && (score[now-K] ≠ 0) && (score[now]=0)
            now += K
        end
    end
    println(sum(score))
end
PredictionAndRestriction()

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin  >> n;
    ll ans = 0;
    rep(i,1,n+1){
        if(i%3!=0 && i%5!=0) ans += i;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
	
	
	string sample;
	cin >> sample;//coffee
	
	if ((sample[2]==sample[3])&&(sample[4]==sample[5])){
		cout <<"Yes"<<endl;
	}
	else{
		cout <<"No"<<endl;
	}
	
	
	
	return 0;
	
	
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fori(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
string S;
int x[500005],dd[500005];
set<int> p[500005];
vector<int> ke[500005];
void dfs(int u)
{
    dd[u]=1;
   // cout<<u<<' ';
    for(auto v:ke[u])
    {
        if(!dd[v])
        {
            if(p[u].count(v)) x[v]=max(x[v],x[u]+1);
            dfs(v);
            if(!p[u].count(v)) x[u]=max(x[v]+1,x[u]);
        }
    }
}
main()
{
    //freopen("A-.inp","r",stdin);
    cin>>S;
    fori(i,0,S.size()-1)
    {
        if(S[i]=='>')
        {
            p[i+2].insert(i+1);
            ke[i+1].pb(i+2);
            ke[i+2].pb(i+1);
        }
        else
        {
            p[i+1].insert(i+2);
            ke[i+2].pb(i+1);
            ke[i+1].pb(i+2);
        }
    }
    fori(i,1,S.size()+1) if(p[i].empty())
    {
        dfs(i);
    }
    int kq=0;
    fori(i,1,S.size()+1) kq+=x[i];
    cout<<kq;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  string S[55];
  vector<vector <int>> dp(55, vector<int>(55, -1));
  int dx[4] = {0, -1, 0, 1}; // left > up > right > down (row)
  int dy[4] = {-1, 0, 1, 0}; // left > up > right > down (col)
  
  
  for(int i=0;i<H;++i){
    cin >> S[i];
  }
  
  bool flag = true;
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(S[i][j] == '.') continue;
      else{
        for(int k=0;k<4;++k){
          int next_x = i + dx[k];
          int next_y = j + dy[k];
          if(next_x < 0 || next_y < 0) continue;
          if(next_x > H || next_y > W) continue;
          if(S[i][j] == '#' && S[next_x][next_y] == '#'){
            dp[i][j] += 1;
            dp[next_x][next_y] += 1;
          }
        }
        if(dp[i][j] < 0) flag = false;
      }
    }
  }
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

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

int main() {
	// your code goes here
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long n,W,i,j,k,V;
	cin>>n>>W;
	long long w[n],v[n];

	V=0;
	for(i=0;i<n;i++)
	{
		cin>>w[i]>>v[i];
		V+=v[i];
	}

	long long dp[V+1];
	dp[0]=0;
	for(i=1;i<=V;i++)
	dp[i]=1e18L;

	for(i=0;i<n;i++)
	{
		for(j=V-v[i];j>=0;j--)
		{
			dp[v[i]+j]=min(dp[v[i]+j],dp[j]+w[i]);
		}
	}

	k=(long long )1e18;
	for(i=0;i<=V;i++)
	{
		if(dp[i]<=W)
		k=i;
	}
	cout<<k;
	return 0;
}


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




int main(){
  string S;
  int N;
  cin >> N >> S;

  char c = '0';
  for (int i = 0; i < S.size(); i++){
    if ((char)(S.at(i) + N) > 'Z'){
      c = (char)(S.at(i) + N - 26);
    }
    else
    {
      c = (char)(S.at(i) + N);
    }
    string C = {c};
    S = S.replace(i, 1, C);
  }

  cout << S << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
int main(void)
{
	int x;
	cin >> x;
	int ma = 1,i=1;
	int a,b;
	a = 1;
	for(int i=2; i<40; i++){
		a = i;
		while(1){
			if(a*i <= x){
				a = a*i;
				ma = max(ma,a);	
			}
			else{
				break;
			}
		}
	}	

	cout << ma;
	return 0;
}

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

int main(void){
    int N,M;
    int ret;
    scanf("%d",&N);
    scanf("%d",&M);
    ret = N % M;
    if(ret == 0){
      printf("0");
    }else{
      printf("1");
    }
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	vector<int> n(4);
	rep(i, 4)cin >> n[i];
	sort(ALL(n));
	if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9)co("YES");
	else co("NO");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
bool check(string s){
    int n = s.size();
    bool ok = true;
    for(int i=0;i<n/2;i++){
        if(s[i] == '('){
            ok &= s[n-1-i] == ')';
        }
        else if(s[i] == ')'){
            ok &= s[n-1-i] == '(';
        }
        else if(s[i] == '['){
            ok &= s[n-1-i] == ']';
        }
        else if(s[i] == ']'){
            ok &= s[n-1-i] == '[';
        }
        else if(s[i] == '}'){
            ok &= s[n-1-i] == '{';
        }
        else if(s[i] == '{'){
            ok &= s[n-1-i] == '}';
        }
        else{
            ok &= s[i] == s[n-1-i];
        }
    }
    int cnt = 0, pos = 0;
    while((pos = s.find("iwi",pos)) != s.npos){
        cnt++;
        pos++;
    }
    ok &= cnt == 1;
    return ok;
}

int main(){
    int n, ans = 0;
    string s;
    cin >> s;
    n = s.size();
    for(int S=1;S<1<<n;S++){
        string t;
        for(int i=0;i<n;i++){
            if((S>>i)&1){
                t.push_back(s[i]);
            }
            if(check(t)){
                ans = max(ans, int(t.size()));
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    string S;
    cin >> S;

    // 後ろから解くかわりにすべての文字列を「左右反転」する
    reverse(S.begin(), S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

    // 端から切っていく
    bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false; // 4 個の文字列たちどれかで divide できるか
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) { // d で divide できるか
                can2 = true;
                i += d.size(); // divide できたら i を進める
            }
        }
        if (!can2) { // divide できなかったら
            can = false;
            break;
        }
    }

    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3764
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

ans = 'No'
for x in range(0, n - m + 1):
    for y in range(0, n - m + 1):
        check = True
        for i in range(m):
            for j in range(m):
                if a[i+x][j+y] != b[i][j]:
                    check = False
                    break
            if check == False:
                break
        if check == True:
            ans = 'Yes'
            break
print(ans)


Measured memory_bytes: 9188