akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var b = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var diffs = a.Zip(b, (aa, bb) => aa - bb).OrderByDescending(v => v).ToArray();

        if (diffs.Sum() < 0)
        {
            Console.WriteLine(-1);
            return;
        }

        var remain = diffs.Where(d => d < 0).Sum();
        var changed = diffs.Count(d => d < 0);
        foreach (var d in diffs)
        {
            if (remain >= 0)
            {
                break;
            }
            remain += d;
            changed++;
        }

        Console.WriteLine(changed);
    }
}

Measured memory_bytes: 33888
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const double PI = 2 * acos(0);

int main() {
	int N;
	LL sum = 0;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		if ((i % 3 != 0) && (i % 5 != 0)) sum += i;
	}
	printf("%lld\n", sum);
}

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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n, a, b;
  cin >> n >> a >> b;
  int posi[n];
  int ans = 0;
  REP(i,n) {
    cin >> posi[i];
  }
  REP(i,n-1) {
    int dis = posi[i+1] - posi[i];
    ans += min(dis*a, b);
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


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

int main(){
    int n;
    while(cin >> n && n > 0) {
        if(n <= 16){
            cout << 0 << endl;
            continue;
        }
        LL f = n;
        REP(i, 7) f *= i + 1;

        if(n % 2 == 0) {

            n /= 2;
            vector<LL> dp1(n);
            vector<LL> dp2(n);
            dp1[0] = 1;

            REP(_, 7) {
                vector<LL> next1(n);
                vector<LL> next2(n);
                REP(i, n){
                    if(dp1[i]) {
                        for(int j = i + 2; j < n; j++) {
                            next1[j] += dp1[i];
                        }
                        for(int j = i + 1; j < n; j++) {
                            next2[j] += dp1[i];
                        }
                    }
                    if(dp2[i]) {
                        for(int j = i + 2; j < n; j++) {
                            next2[j] += dp2[i];
                        }
                        for(int j = i + 1; j < n; j++) {
                            next1[j] += dp2[i];
                        }
                    }
                }
                dp1.swap(next1);
                dp2.swap(next2);
            }
            LL ans = 0;
            REP(i, n-1) ans += dp1[i];
            REP(i, n)   ans += dp2[i];
            cout << f * ans << endl;
        } else {
            n--;
            vector<LL> dp(n);
            dp[0] = 1;
            REP(_, 7) {
                vector<LL> next(n);
                REP(i, n) if(dp[i]) {
                    for(int j = i + 2; j < n; j++) {
                        next[j] += dp[i];
                    }
                }
                dp.swap(next);
            }
            LL ans = 0;
            REP(i, n) ans += dp[i];
            cout << f * ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1200
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
LL sum[N];
LL check(LL a, LL b, LL c, LL d)
{
	LL v[] = { a,b,c,d };
	sort(v, v + 4);
	return v[3] - v[0];
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> sum[i];
		sum[i] += sum[i - 1];
	}
	LL ans = INF * INF;
	for (int i = 2; i + 2 <= n; i++)
	{
		int kx = 1;
		int l = 1, r = i - 1;
		while (l <= r)
		{
			int mid = (l + r) / 2;
			if (sum[mid] <= sum[i] - sum[mid]) kx = mid, l = mid + 1;
			else r = mid - 1;
		}
		int ky = i + 1;
		l = i + 1, r = n - 1;
		while (l <= r)
		{
			int mid = (l + r) / 2;
			if (sum[mid] - sum[i] <= sum[n] - sum[mid]) ky = mid, l = mid + 1;
			else r = mid - 1;
		}
		vector<pair<LL, LL>> vp1, vp2;
		vp1.emplace_back(sum[kx], sum[i] - sum[kx]);
		if (kx + 1 < i)
			vp1.emplace_back(sum[kx + 1], sum[i] - sum[kx + 1]);
		vp2.emplace_back(sum[ky] - sum[i], sum[n] - sum[ky]);
		if (ky + 1 < n)
			vp2.emplace_back(sum[ky + 1] - sum[i], sum[n] - sum[ky + 1]);
		for (auto& p1 : vp1)
		{
			for (auto& p2 : vp2)
			{
				ans = min(ans, check(p1.first, p1.second, p2.first, p2.second));
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod =1e+9+7;

int main(){
    ll n; cin>>n;
    vector<ll>a(n);
    vector<ll>A(n+1);
    A[0]=0;
    vector<vector<ll>>f(10000,vector<ll>(2));
    ll cnt=0,ans=0;
    rep(i,n){
        cin>>a[i];
        rep(j,a[i]){
            cin>>f[cnt][0]>>f[cnt][1];
            cnt++;
        }
    }
    a.resize(cnt);
    rep(i,n){
        A[i+1]=A[i]+a[i];
    }
    cnt=0;
    for(int tmp=0;tmp<(1<<n);tmp++){
        bitset<15>b=tmp;
        bool jud=false;
        rep(i,n){
            if(!b.test(i)){
                cnt+=a[i];
                continue;
            }
            rep(j,a[i]){
                if(f[A[i]+j][1]==1){
                    if(!b.test(f[A[i]+j][0]-1)){
                        jud=true;
                    }
                }
                else if(f[A[i]+j][1]==0){
                    if(b.test(f[A[i]+j][0]-1)){
                        jud=true;
                    }
                }
                cnt++;
            }
        }
        if(!jud){
            ll mx=b.count();
            ans=max(ans,mx);
        }
    }
    cout<<ans<<endl;
}









































Measured memory_bytes: 3912
#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 main() {
  int A, B;
  cin >> A >>B;
  if(A >= 13){
    std::cout << B << '\n';
  }else if(6 <= A && A <= 12){
    std::cout << B/2 << '\n';
  }else{
    std::cout << 0 << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int vis[25][25];
char s[25][25];
int x[4] = {0, 1, 0, -1};
int y[4] = {1, 0, -1, 0};
struct node { int x, y; } q[25 * 25];
int h, w;

int Solve(int a, int b, int c, int d) {
  if (s[a][b] == '#' || s[c][d] == '#') return 0;
  memset(vis, 0, sizeof(vis));
  vis[a][b] = 1;
  int head = 1, tail = 0;
  q[++tail] = (node){a, b};
  while (head <= tail) {
    node t = q[head++];
    for (RI i = 0; i < 4; ++i) {
      if (t.x + x[i] >= 1 && t.x + x[i] <= h && t.y + y[i] >= 1 && t.y + y[i] <= w)
        if (!vis[t.x + x[i]][t.y + y[i]] && s[t.x + x[i]][t.y + y[i]] != '#')
          vis[t.x + x[i]][t.y + y[i]] = vis[t.x][t.y] + 1, q[++tail] = (node){t.x + x[i], t.y + y[i]};
    }
  }
    return vis[c][d] - 1;
}

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  cin >> h >> w;
  for (RI i = 1; i <= h; ++i)
    cin >> (s[i] + 1);
  int ans = 0;
  for (RI i = 1; i <= h; ++i)
    for (RI j = 1; j <= w; ++j)
      for (RI k = 1; k <= h; ++k)
        for (RI l = 1; l <= w; ++l)
          ans = max(ans, Solve(i, j, k, l));
  printf("%d\n", ans);

  return 0;
}

// created by Daniel yuan

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        sc.close();
        int len = input.length() - 2;
        String result = input.substring(0,1) + len + input.charAt(input.length()-1);
        System.out.println(result);
    }
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin>>n;
    
    int a[n],b[n],c[n-1];
    
    for(int i=0;i<n;i++)
    cin>>a[i];
    
    for(int i=0;i<n;i++)
    cin>>b[i];
    
    for(int i=0;i<n-1;i++)
    cin>>c[i];
    
    //
    int sum=0;
    
    for(int i=0;i<n;i++)
    {
        sum+=b[i];
    }
    for(int i=0;i<n-1;i++)
    {
        if(a[i]+1==a[i+1])
        {
            sum+=c[a[i]-1];
        }
        
    }
    
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline

INF = float('inf')


def main():
    s = map(int, input()[::-1])
    mod = 2019
    counts = [0] * mod
    counts[0] = 1
    t = 0
    x = 1
    for num in s:
        t = (t + num * x) % mod
        counts[t] += 1
        x = (x * 10) % mod
    ans = 0
    for count in counts:
        if count > 1:
            ans += count * (count - 1) // 2
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9272
#include <stdio.h>
int main() {
	int n, k, d, a, s[100] = {0}, cnt = 0;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < k; i++) {
		scanf("%d", &d);
		for (int j = 0; j < d; j++) {
			scanf("%d", &a);
			s[a - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		if (s[i] == 0) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,x,y;
    int piza = 0,pizb = 0,pizc =0;
    cin >> a >> b >> c >> x >> y;
    int ans = a*x + b*y;
    if(a + b <= 2*c){
        piza = x;
        pizb = y;
        ans = a*piza + b*pizb;
    }else{
        for(int i = 0;i <= max(x,y);i++){
            pizc = 2*i;
            piza = max(0,x - pizc/2);
            pizb = max(0,y - pizc/2);
            ans = min(ans,a*piza + b*pizb + c*pizc);
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
k, s = [], []
for i in range(m):
        tmp = list(map(int, input().split()))
        k.append(tmp.pop(0))
        s.append(tmp)
p = list(map(int, input().split()))
ans = 0

for bn in range(2**n):
        bn = str(bin(bn))[2:].zfill(n)
        bright = 0
        for i in range(m):
                p_exp = 0
                for j in range(n):
                        #print("switch num",j, "bn", bn) 
                        if (j+1 in s[i]) and (bn[j] == '1'): p_exp += 1
                if p_exp%2 == p[i]: bright += 1
                #print("on botton", p_exp)
        #print("bright light", bright)
        if bright == m: ans += 1
print(ans)


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

const int MAX_N = 1e5;
int n;
struct vertex {
    int par = 0;
    vector<int> to;
};
vertex v[MAX_N];
int sum;

void init(int x) {
    for (auto &i : v[x].to) {
        if (i == v[x].par) continue;
        v[i].par = x;
        init(i);
    }
}

void count(int x, int y) {
    sum += 1;
    for (auto &i : v[x].to) {
        if (i == v[x].par || i == y) continue;
        count(i, y);
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        v[a - 1].to.push_back(b - 1);
        v[b - 1].to.push_back(a - 1);
    }

    init(0);
    
    int p = n - 1, cnt = 0;
    while (true) {
        p = v[p].par;
        if (p == 0) break;
        cnt++;
    }
    p = n - 1;
    for (int i = 0; i < cnt / 2; i++) {
        p = v[p].par;
    }
    
    count(0, p);
    if (sum - 1 > (n - 2) / 2) printf("Fennec\n");
    else printf("Snuke\n");

    return 0;
}


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

using ll = long long;
#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 INF 1e9


int main(){
  int N;
  cin >> N;
  int ans = 0;
  for(int n = 1; n <= N; n+=2){
    set<int> yakusu;
    for(int i=1; i*i <= n; i++){
      if(n % i == 0){
        yakusu.insert(i);
        yakusu.insert(n/i);
      }
    }
    if(yakusu.size() == 8){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}


constexpr int contest_num {26};
constexpr int order_max_cnt {20000}; // TODO : changeble

ll calc_satisfy(const vector<vector<ll>>& S, const vector<ll>& C, const vector<int>& order, const int& D) {
  ll answer {};
  vector<int> fin_day(contest_num, -1);
  rep(i, D) {
    answer += S[i][order[i]-1];
    fin_day[order[i]-1] = i;
    rep(j, contest_num) {
      answer -= C[j]*(i-fin_day[j]);
    }
  }
  return answer;
}

#include <random>

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

  int D;
  cin >> D;
  vector<ll> c(contest_num);
  rep(i, contest_num) cin >> c[i];
  vector<vector<ll>> s(D, vector<ll>(contest_num));
  rep(i, D) {
    rep(j, contest_num) {
      cin >> s[i][j];
    }
  }
  //vector<int> order(D);
  //rep(i, D) cin >> order[i];
  //int M;
  //cin >> M;
  //vector<std::pair<int, int>> query(M);
  //rep(i, M) cin >> query[i].first >> query[i].second;
  //rep(i, M) {
  //  order[query[i].first-1] = query[i].second;
  //  calc_satisfy(s, c, order, D);
  //}
  std::random_device rnd;

  ll max_params {-LLINF};
  vector<int> max_order(D);
  rep(i, order_max_cnt) {
    vector<int> order(D);
    rep(j, D) {
      order[j] = (rnd() % contest_num) +1;
    }
    ll tmp = calc_satisfy(s, c, order, D);
    if (max_params < tmp) {
      max_order = order;
    }
  }
  rep(i, D) cout << max_order[i] << '\n';
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
int a[100001];
int main()
{
	string s;
	cin>>s;
	for (int i=1;i<=s.size();i++)  a[i]=s[i-1]-48;
	int n=s.size(),pos=a[1],total=0;
	for (int i=1;i<=n;i++)
	{
		if (a[i]!=pos)  break;
		else total++;
	}
	if (total==n)
	{
		cout<<0<<endl;
		return 0;
	}
    int total_1=0,total_0=0;
    for (int i=1;i<=n;i++)
    {
    	if (a[i]==1)  total_1++;
    	else total_0++; 
	}
	cout<<n-abs(total_1-total_0)<<endl;
	return 0;
}

Measured memory_bytes: 896
#include<iostream>

int S, h, m, s;

int main(){
	std::cin >> S;
	h = S / (60 * 60);
	m = (S % (60 * 60)) / 60;
	s = (S % (60 * 60)) % 60;
	std::cout << h << ':' << m << ':' << s << '\n';
	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define drep(i,a,b) for(int i=(a); i>=(b);i--) 

const int maxn = 2e5 + 5;
const int MOD = 1e9 + 7;

int n;
int a[maxn],b[maxn];

int main()
{
   ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
   cin >> n;
   rep(i,1,n) {
        cin >> a[i];
        b[i] = a[i];
    }
   sort(a + 1, a + 1 + n);
   rep(i,1,n){
        if(b[i] == a[n]) cout << a[n - 1] << endl;
        else cout << a[n] << endl;
   }
   return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
	using namespace std;
	int a[100005];
	int main()
	{
		int n,sumv=0;
		cin>>n;
		for (int i=1;i<=n;i++)  cin>>a[i];
		for (int i=1;i<=n-1;i++)
		{
			for (int j=i+1;j<=n;j++)  sumv+=a[i]*a[j];
		}
		cout<<sumv<<endl;
		return 0;
	}

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

const ll mod=1000000007;

int main() {
  string s;
  cin >> s;
  cout<<s.substr(0,3)<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S,T;
    int count = 0;
    cin >> S >> T;
    
    int size = S.size();
    int i;
    for(i=0;i<size;i++){
        if(S.at(i) != T.at(i)){
            count ++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3848
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  ll A;
  string B;
  cin>>A>>B;
  ll C=(B[0]-'0')*100+(B[2]-'0')*10+(B[3]-'0');
  A*=C;
  A/=100;
  cout<<A<<endl;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	LL n;
	cin>>n;
	LL sum=0;
	for(LL i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0){
			sum+=i;
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;

const ll mod197 = 1000000007LL;
const ll INF = 200LL * 200 * 100000 + 10;

const double PI11 = 3.14159265359;

ll a[50] = {};


int main(void)
{
	ll n, u = 0, d = 0;
	cin >> n;

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

		if (a[i] < 0) {
			d = 1;
		}
		else if (a[i] > 0) {
			u = 1;
		}
	}

	if (u && d) {

		ll m = 0;

		for (int i = 0; i < n; i++) {
			if (abs(a[i]) > abs(a[m]))
				m = i;
		}

		if (a[m] > 0) {

			cout << n - 1 + n << endl;

			for (int i = 0; i < n; i++) {
				if (i == m)continue;
				cout << m + 1 << " " << i + 1 << endl;
			}
			cout << m + 1 << " " << m + 1 << endl;
			cout << m + 1 << " " << 2 << endl;
			for (int i = 1; i < n - 1; i++) {
				cout << i + 1 << " " << i + 2 << endl;
			}

		}
		else {

			cout << n - 1 + n << endl;

			for (int i = 0; i < n; i++) {
				if (i == m)continue;
				cout << m + 1 << " " << i + 1 << endl;
			}
			cout << m + 1 << " " << m + 1 << endl;
			cout << m + 1 << " " << n - 1 << endl;
			for (int i = n; i > 2; i--) {
				cout << i - 1 << " " << i - 2 << endl;
			}
		}

	}
	else if (u) {
		ll m = 0;

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

		cout << n - 1 << endl;
		cout << m + 1 << " " << 2 << endl;
		for (int i = 1; i < n - 1; i++) {
			cout << i + 1 << " " << i + 2 << endl;
		}

	}
	else if (d) {
		ll m = 0;

		for (int i = 0; i < n; i++) {
			if (a[i] < a[m])
				m = i;
		}

		cout << n - 1 << endl;
		cout << m + 1 << " " << n - 1 << endl;
		for (int i = n; i > 2; i--) {
			cout << i - 1 << " " << i - 2 << endl;
		}
	}
	else {
		cout << 0 << endl;
	}



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  if(A==1) A=14;
  if(B==1) B=14;
  if(A>B) cout<<"Alice"<<endl;
  else if(A==B) cout<<"Draw"<<endl;
  else cout<<"Bob"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int N, K;
  map<int, int> nums;
  cin >> N >> K;
  REP(i, N) {
    int num;
    cin >> num;
    nums[num]++;
  }
  vi cnt;
  for (auto a : nums) {
    cnt.push_back(a.second);
  }
  sort(cnt.begin(), cnt.end());
  int ans = 0;
  REP(i, cnt.size() - K) { ans += cnt.at(i); }
  cout << ans << endl;
}

Measured memory_bytes: 13524
#include <iostream>
#include <string>

using namespace std;

string ss;
int main()
{
	cin >> ss;
	int len = ss.length();
	bool n=false,e=false,w=false,s=false;
	for(int i=0;i<len;i++)
	{
		if(ss[i]=='N') n=true;
		if(ss[i]=='S') s=true;
		if(ss[i]=='W') w=true;
		if(ss[i]=='E') e=true;
	}
	if(((n&&s)||(!n&&!s))&&((w&&e)||(!w&&!e))) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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


using namespace std;


int main(){
	int n;
	int ans = 100000;

	while(cin >> n){
		for(int i=0;i<n;i++){
			ans = ans * 1.05;
			if(ans % 1000 > 0){
				ans = ((ans / 1000) + 1) * 1000;
			}
		}
		printf("%d\n",ans);

		ans = 100000;
	}

	return 0;
}

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

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const bool DEBUG = 0;
const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n; cin>>n;
	ll a[n];
	forn(i,0,n) cin>>a[i];
	
	sort(a,a+n);
	
	ll ans=0;
	forn(i,0,n) forn(j,i+1,n) forn(k,j+1,n){
		if(a[i]==a[j] || a[i]==a[k] || a[j]==a[k]) continue;
		if(a[i]+a[j]>a[k]) ans++;
	}
	
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5;
const int INF=0x3f3f3f3f;
int dist[maxn*8+10];
int vis[maxn*8+10];
int n,m;
int cnt=n;
map <pair<int,int>,int> P;
struct edge
{
  int y;
  int v;
  edge(int a,int b)
  {
    y=a;
    v=b;
  } 
};
vector<edge> G[maxn*8+10];
inline int rebuild_(int x,int v)
{
  if(P.find(make_pair(x,v))!=P.end())
    return P[make_pair(x,v)];
  return P[make_pair(x,v)]=++cnt;
}
inline void Iinsert(int xx,int yy,int vv)
{
  G[xx].push_back(edge(yy,vv));
  G[yy].push_back(edge(xx,vv));
}
inline void spfa(int st)
{
  memset(dist,0x3f,sizeof(dist));
  memset(vis,false,sizeof(vis));
  queue<int> q;
  q.push(st);
  vis[st]=true;
  dist[st]=0;
  while(!q.empty())
  {
    int x=q.front();
    q.pop();
    vis[x]=false;
    for(int i=0;i<G[x].size();i++)
    {
	  int y=G[x][i].y;
	  int v=G[x][i].v;
	  if(dist[y]>dist[x]+v)
	  { 
	    //cout<<dist[y]<<' '<<dist[x]+v<<endl;
	    dist[y]=dist[x]+v;
	   
	    if(!vis[y])
	    {
		  vis[y]=true;
		  q.push(y);
		}
	  }
	}
  }
}
int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	scanf("%d%d",&n,&m);
	cnt=n;
	for(int i=1;i<=m;i++)
	{
	  int x,y,v;
	  scanf("%d%d%d",&x,&y,&v);
	  int id1=rebuild_(x,v);
	  int id2=rebuild_(y,v);
	  //cout<<id1<<' '<<id2<<endl;
	  Iinsert(id1,id2,0);  //在这之间坐车需要0元 
	  Iinsert(x,id1,1);  //上车1元 
	  Iinsert(y,id2,1);  //下车1元 
	}
	spfa(1); 
	if(dist[n]==INF)
	   puts("-1");
	else
	  printf("%d\n",dist[n]/2);
	return 0;
}


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

void dfs(int r) {
  C.at(r) = ++color;
  stack<int> S;
  S.push(r);
  while (S.size() > 0) {
    int u = S.top(); S.pop();
    rep(i, G.at(u).size()) {
      if (C.at(G.at(u).at(i)) == -1) {
        C.at(G.at(u).at(i)) = color;
        S.push(G.at(u).at(i));
      } 
    }
  }
}

void assing_color() {
  rep(i, n) {
    if (C.at(i) == -1){
      dfs(i);
    }
  }
}

int main() {
  cin >> n >> m;
  rep(i, n) G.push_back({});
  rep(i, n) C.push_back(-1);
  rep(i, m) {
    int a, b; cin >> a >> b;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  assing_color();
  int q; cin >> q;
  rep(i, q) {
    int a, b; cin >> a >> b;
    if(C.at(a) == C.at(b)) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }
}



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

int main(void){
    int n, tim, t[200010], sum=0;
    cin >> n >> tim;
    for(int i=0;i<n;++i) cin >> t[i];
    for(int i=1;i<n;++i){
        if(tim<=(t[i]-t[i-1])) sum += tim;
        else sum += t[i]-t[i-1];
    }
    cout << (sum+tim) << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LL long long
#define M
using namespace std;
namespace IO{
	const int BS=(1<<20)+5; int Top=0;
	char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
	char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;}
	void flush(){fwrite(OT,1,OS-OT,stdout);}
	void Putchar(char c){*OS++ =c;if(OS==fin)flush(),OS=OT;}
	void write(int x){
		if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-');
		while(x) SS[++Top]=x%10,x/=10;
		while(Top) Putchar(SS[Top]+'0'),--Top;
	}
	int read(){
		int nm=0,fh=1; char cw=getchar();
		for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
		for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
		return nm*fh;
	}
}
using namespace IO;
int n,m,sum,p[200],ans;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),m=100000000;
	for(int i=0;i<n;i++) p[i]=read(),sum+=p[i];
	for(int i=0;i<n;i++){
		if(abs(p[i]*n-sum)<m) m=abs(p[i]*n-sum),ans=i;
	}
	printf("%d\n",ans);
	return 0;
}


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

using namespace std;

int n,i,a[100005],d[100005];

int main(){
	scanf("%d", &n);
	
	for(i = 0; i < n; i++)
	scanf("%d", &a[i]);
	
	long long s = 0;
	
	for(i = 0; i < n; i++)
	s += a[i];
	
	long long tmp = (long long)n * (n + 1) / 2;
	if(s % tmp != 0)
	return 0 * printf("NO\n");
	
	long long k = s / tmp;
	
	for(i = 0; i < n; i++){
		if(i == n - 1)
		d[i] = a[0] - a[i];
		else
		d[i] = a[i + 1] - a[i];
	}
	
	//(k - d[i]) % n == 0
	
	for(i = 0; i < n; i++){
		if((k - d[i]) % n != 0 || k - d[i] < 0)
		return 0 * printf("NO\n");
	}
	
	printf("YES\n");
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

VI e[100000];
int ans[100000], x[100000];

void dfs(int now, int past, int d, int c){
    if (ans[now] == 0) ans[now] = c;
    if (d <= x[now]) return;
    x[now] = max(x[now], d);
    if (d == 0) return;
    REP(i,e[now].size()){
        int next = e[now][i];
        if (next == past) continue;
        dfs(next, now, d-1, c);
    }
}

int main() {
    int n, m, q;
    cin >> n >> m;
    while (m--){
        int a, b;
        scanf("%d %d", &a, &b);
        a--;
        b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    cin >> q;
    VI v(q), d(q), c(q);
    REP(i,q){
        scanf("%d %d %d", &v[i], &d[i], &c[i]);
        v[i]--;
    }
    reverse(ALL(v));
    reverse(ALL(d));
    reverse(ALL(c));
    REP(i,n) x[i] = -1;
    REP(i,q){
        if (d[i] <= x[v[i]]) continue;
        dfs(v[i], -1, d[i], c[i]);
    }

    REP(i,n){
        printf("%d\n", ans[i]);
    }

    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  int Q;
  cin >> S >> Q;
  bool order = true;
  queue<char> left, right;
  for (int i = 0; i < Q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      order ^= true;
    } else {
      int f;
      char c;
      cin >> f >> c;
      if (f == 1 && order) left.push(c);
      if (f == 1 && !order) right.push(c);
      if (f == 2 && order) right.push(c);
      if (f == 2 && !order) left.push(c);
    }
  }
  string res = "";
  string tmp = "";
  while (!left.empty()) {
    tmp += left.front();
    left.pop();
  }
  reverse(tmp.begin(), tmp.end());
  res += tmp;
  res += S;
  while (!right.empty()) {
    res += right.front();
    right.pop();
  }
  if (order) {
    cout << res << '\n';
  } else {
    reverse(res.begin(), res.end());
    cout << res << '\n';
  }
  return 0;
}


Measured memory_bytes: 1456
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
long long p[20];

int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%lld",p+i);
	long long ret=inf;
	for(int i=0;i<(1<<a);i++){
		if(__builtin_popcount(i)!=b)continue;
		long long tmp=0;
		long long cur=0;
		for(int j=0;j<a;j++){
			if(i&(1<<j)){
				cur=max(cur,p[j]);
			}else{
				cur=max(cur,p[j]+1);
			}
			if(i&(1<<j)){
				tmp+=cur-p[j];
				cur++;
			}
		}
		ret=min(ret,tmp);
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 128
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
B = np.zeros(A.shape)

memo = A[0]
B[0] = A[0]
sig = 1
for i in range(1,len(A)):
    sig *= -1
    B[i] = memo + sig * A[i]
    memo = B[i]

output = ""
output += str(int(B[-1]))
memo = B[-1]
for j in range(0,len(A)-1):
    output += " "+str(int(A[j]*2-memo))
    memo = A[j]*2-memo
print(output)

Measured memory_bytes: 23112
fn solve(n: usize, d: usize) -> usize {
    let a = 2 * d + 1;

    n / a + if n % a == 0 { 0 } else { 1 }
}

#[test]
fn solve_test() {
    assert_eq!(solve(6, 2), 2);
    assert_eq!(solve(14, 3), 2);
    assert_eq!(solve(20, 4), 3);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let (n, d) = parse_line!(usize, usize);
    println!("{}", solve(n, d));
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
    int A, B, C, D;
    scanf("%d %d %d %d", &A, &B, &C, &D);
    if(A + B > C + D)printf("Left\n");
    else if(A + B < C + D)printf("Right\n");
    else printf("Balanced\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  LL n; cin>>n;
  vector<LL> v(n);
  LL s = 0;
  forn(i,n) {
  	cin>>v[i];
  	s^=v[i];
  }
  forn(i,n){
  	cout<<(s^v[i])<<" ";
  }
  cout<<endl;
  return 0;	
}

Measured memory_bytes: 4764
n=int(input())
a_list=list(map(int,input().split()))
current=1000
kabu=0
for i in range(n-1) :
  if a_list[i]<a_list[i+1] :
    kabu+=current//a_list[i]
    current=current%a_list[i]
    current += a_list[i+1] * kabu
    kabu = 0




print(current)

Measured memory_bytes: 8956
n = int(input())
l = list(map(int, input().split()))

l.sort(reverse=True)
ans = 0
for i in range(n-2):
    j = i+1
    k = n-1
    while (j < k):
        if l[i] - l[j] - l[k] < 0:
            ans += k - j
            j += 1
        else:
            k -= 1

print(ans)


 

 


                                        




    




        


    







        



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

int hantei(int n){
	if(n==2){
      return 1;
    }else if(n==4 || n==6 || n==9 ||n==11){
      return 2;
    }else{
      return 3;
    }
}

int main() {
	int x,y;
  	cin>>x>>y;
  
  	if(hantei(x)==hantei(y)){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int H, A;
	cin >> H >> A;

	if (H % A == 0) 
	{
		cout << H / A << endl;
	}
	else 
	{
		cout << (H / A + 1) << endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const double EPS=1e-9;

const int N_MAX=100;
bool Gauss_Jordan(int n,const double A[N_MAX][N_MAX],const double *b,double *x){
	static double B[N_MAX][N_MAX+1];
	rep(i,n){
		rep(j,n) B[i][j]=A[i][j];
		B[i][n]=b[i];
	}

	rep(i,n){
		int piv=i;
		for(int j=i;j<n;j++) if(abs(B[j][i])>abs(B[piv][i])) piv=j;
		rep(j,n+1) swap(B[i][j],B[piv][j]);

		if(abs(B[i][i])<EPS) return false;

		for(int j=i+1;j<=n;j++) B[i][j]/=B[i][i];
		rep(j,n) if(i!=j) for(int k=i+1;k<=n;k++) B[j][k]-=B[j][i]*B[i][k];
	}

	rep(i,n) x[i]=B[i][n];
	return true;
}

int main(){
	int s,n,k; scanf("%d%d%d",&s,&n,&k);
	s=abs(s);

	double p[101]={1}; // p[x] := ³¢±ëÌÚÌaª x ÉÈém¦
	rep(i,k){
		double q[101]={};
		for(int j=1;j<=n;j++) rep(x,101-j) q[x+j]+=p[x]/n;
		copy(q,q+101,p);
	}

	// ¬³¢Æ±ëÍA§ûö®ÉµÄð­
	static double A[N_MAX][N_MAX];
	double b[N_MAX],E_small[N_MAX];
	A[0][0]=1;
	for(int i=1;i<n*k;i++){
		A[i][i]=1;
		rep(j,n*k+1) A[i][abs(i-j)]-=p[j];
		b[i]=1;
	}
	Gauss_Jordan(n*k,A,b,E_small);

	if(s<n*k){
		printf("%.15f\n",E_small[s]);
		return 0;
	}

	// å«¢Æ±ëÍµËÔèªÈ¢ÌÅAsñ×«æÅêCÉißé
	static double P[101][101]; // JÚsñ
	rep(i,n*k) P[0][i]=p[i+1];
	P[0][n*k]=P[n*k][n*k]=1;
	rep(i,n*k-1) P[i+1][i]=1;

	double v[101]; // úxNg v0[i]:=(Êu nk-i-1 É¨¯éúÒl)
	rep(i,n*k) v[i]=E_small[n*k-i-1];
	v[n*k]=1;

	// P^(s-nk+1)*v0 ÌvZ
	rep(t,30){
		double v2[101]={};
		if((s-n*k+1)&(1<<t)){
			rep(i,n*k+1) rep(j,n*k+1) v2[i]+=P[i][j]*v[j];
			copy(v2,v2+n*k+1,v);
		}

		// P <- P^2
		double P2[101][101]={};
		rep(i,n*k+1) rep(j,n*k+1) rep(l,n*k+1) P2[i][j]+=P[i][l]*P[l][j];
		rep(i,n*k+1) rep(j,n*k+1) P[i][j]=P2[i][j];
	}

	printf("%.15f\n",v[0]);

	return 0;
}

Measured memory_bytes: 1036
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<stack>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
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;}
using namespace std;

int factorial(int n){
  int x=1;
  for(int i=1; i<=n; ++i) x*=i;
  return x;
}

int main(){
  int N;
  char mx='a';
  cin>>N;
  deque<string> L;
  L.push_back("a");
  
  if(N==1){
    cout<<"a"<<endl;
    return 0;
  }
  
  while(L.size()!=factorial(N)){
    mx='a';
    string S=L.front();
    L.pop_front();
    
    for(int i=0; i<S.size(); ++i){
      if(mx<S.at(i)) mx=S.at(i);
    }
    
    for(int i=0; i<=mx-'a'+1; ++i){
      char A='a'+i;
      if(S.size()==N-1) cout<<S+A<<endl;
      L.push_back(S+A);
      if(S+A=="a" && N==1) return 0;
      if(S+A=="ab" && N==2) return 0;
      if(S+A=="abc" && N==3) return 0;
      if(S+A=="abcd" && N==4) return 0;
      if(S+A=="abcde" && N==5) return 0;
      
      if(S+A=="abcdef" && N==6) return 0;
      if(S+A=="abcdefg" && N==7) return 0;
      if(S+A=="abcdefgh" && N==8) return 0;
      if(S+A=="abcdefghi" && N==9) return 0;
      if(S+A=="abcdefghij" && N==10) return 0;
    }
  }
  
}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define inf (int)1e18+7
const int nmax = (int) 1e5 + 10;

int n, W;
int w[nmax], v[nmax];

int V[110][nmax];
                     
signed main() {

    ios_base :: sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> W;


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

    memset(V, 0, sizeof V);
    
    for (int i = 1; i <= n; i ++) {
        for (int j = 1; j <= W; j ++) {
            V[i][j] = V[i - 1][j];
            if ( j - w[i] < 0) continue;
            V[i][j] = max(V[i][j], V[i - 1][j - w[i]] + v[i]);
        }
    }

    cout << V[n][W] << endl;
    
                                                           

    return 0;
}

Measured memory_bytes: 86272
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int D,C[26],S[365][26],T[365],Tans[365],V[365],Vorigin[365];
int last[365][26],last_sim[365][26],last2[26];
int vmax;
int steps=0;

void greedy(){
    int dadd,i,j,k,l,i_calc,tbest,score,vbest;
    for(dadd=0;dadd<=26;++dadd){
        //リセット
        for(i=0;i<D;i++){
            if(i<26)last2[i]=0;
            for(j=0;j<26;j++){
                last[i][j]=0;
            }
        }

        for(i=0;i<D;i++){
            i_calc=min(i+dadd+1,D);
            //cout<<i_calc<<endl;
            for(j=0;j<26;j++){
                //得点の初期化
                //cout<<i<<endl;
                if(i==0){
                    V[i]=0;
                }else{
                    V[i]=V[i-1];
                }
                //lastの初期化
                if(i==0)for(k=0;k<26;k++)last[i][k]=0;
                else for(k=0;k<26;k++)last[i][k]=last[i-1][k];

                last[i][j]=i;
                V[i]+=S[i][j];

                for(k=0;k<26;k++)
                    for(l=i;l<i_calc;l++)V[i]-=C[k]*(l-last[i][k]);

                if(j==0||V[i]>=vmax){
                    vmax=V[i];
                    tbest=j;
                }
            }
            if(i==0)for(j=0;j<26;j++)last[i][j]=0;
            else for(j=0;j<26;j++)last[i][j]=last[i-1][j];
            T[i]=tbest;
            last[i][tbest]=i;
        }

        //得点の再計算
        score=0;
        for(i=0;i<26;i++)last2[i]=0;
        for(i=0;i<D;i++){
            score+=S[i][T[i]];
            last2[T[i]]=i;
            for(j=0;j<26;j++)score-=C[j]*(i-last2[j]);
        }

        if(dadd==0||score>vbest){
            vbest=score;
            for(i=0;i<D;i++){
                if(i<26)Tans[i]=T[i];
                for(j=0;j<26;j++)last_sim[i][j]=last[i][j];
            }
        }
    }

    vmax=vbest;
    for(i=0;i<D;i++){
        if(i<26)T[i]=Tans[i];
        for(j=0;j<26;j++)last[i][j]=last_sim[i][j];
    }
}

int main(){
    int i,j;
    cin>>D;
    for(i=0;i<26;i++)cin>>C[i];
    for(i=0;i<D;i++)for(j=0;j<26;j++)cin>>S[i][j];
    greedy();

    for(i=0;i<D;i++)cout<<T[i]+1<<"\n";
    return 0;
}

Measured memory_bytes: 3756
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int x = sc.nextInt();
		int y = sc.nextInt();
		List<Integer> ls = new ArrayList<>();
		int c = 0;
		for(int i = 0; i < s.length; i++) {
			if(s[i] == 'F')
				c++;
			else {
				ls.add(c);
				c = 0;
			}
		}
		ls.add(c);
		x -= ls.get(0);
		boolean[][] dpx = new boolean[2][16001];
		boolean[][] dpy = new boolean[2][16001];
		dpx[0][8000] = dpy[0][8000] = true;
		if(ls.size() <= 2)
			dpx[1][8000] = dpy[1][8000] = true;
		for(int i = 1; i < ls.size(); i++) {
			if(i % 2 == 0){
				dpx[1] = new boolean[16001];
				for(int j = 0; j <= 16000; j++)
					if(dpx[0][j] == true) {
						dpx[1][j+ls.get(i)] = true;
						dpx[1][j-ls.get(i)] = true;
					}
				dpx[0] = dpx[1].clone();
			}
			else {
				dpy[1] = new boolean[16001];
				for(int j = 0; j <= 16000; j++)
					if(dpy[0][j] == true) {
						dpy[1][j+ls.get(i)] = true;
						dpy[1][j-ls.get(i)] = true;
					}
				dpy[0] = dpy[1].clone();
			}
		}
		if(8000+x >= 0 && dpx[1][8000+x] && dpy[1][8000+y])
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}

Measured memory_bytes: 91040
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

ll a[210000];
int main(){
    ll n,k,ans=0;
    //cin>>n;
    string s,t;
    cin>>s>>t;
    bool q=true;
    rep(i,0,s.length())if(s[i]!=t[i])q=false;
    if(q)cout<<"Yes";
    else cout<<"No";
    
    
}


Measured memory_bytes: 3628