akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back
#define fir first
#define sec second

const int N = 2e5L + 11;
char s[N];
int cnt[N];

int main() {
	scanf("%s", s);
	int n = strlen(s);
	for(int i = 0; i < n; i ++)
		cnt[s[i] - 'a'] ++;
	
	ll ans = 0;
	for(int i = 0; i < 26; i ++)
		for(int j = i + 1; j < 26; j ++)
			ans += ll(cnt[i]) * cnt[j];
	cout << ans + 1 << '\n';
	
	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define lowbit(x) (x)&(-x)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define maxd 1000000007
typedef long long ll;
const int N=100000;
const double pi=acos(-1.0);
int n,a[1010],x;
ll dp[210][100100],inv[100100];

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

ll qpow(int x,int y)
{
	ll ans=1,sum=x;
	while (y)
	{
		int tmp=y&1;y/=2;
		if (tmp) ans=(ans*sum)%maxd;
		sum=(sum*sum)%maxd;
	}
	return ans;
}

int main()
{
	n=read();x=read();
	rep(i,1,n) a[i]=read();
	dp[0][x]=1;
	sort(a+1,a+1+n);
	reverse(a+1,a+1+n);
	inv[0]=1;inv[1]=1;
	rep(i,2,n) inv[i]=maxd-(1ll*maxd/i*inv[maxd%i])%maxd;
	rep(i,1,n)
	{
		rep(j,0,x)
		{
			dp[i][j]=(dp[i][j]+(dp[i-1][j]*(maxd+1-inv[n-i+1]))%maxd)%maxd;
			dp[i][j%a[i]]=(dp[i][j%a[i]]+(dp[i-1][j]*inv[n-i+1])%maxd)%maxd;
		}
	}
	ll ans=0;
	rep(i,0,x) ans=(ans+(dp[n][i]*(i%a[n]))%maxd)%maxd;
	rep(i,1,n) ans=(ans*i)%maxd;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 158464
#define DEBUG 1
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k, S;
  std::cin >> n >> k >> S;
  int max = 1'000'000'000;
  std::vector<int> a(n);
  rep(i,0,n) {
    int & x = a.at(i);
    if (i < k) {
      x = S;
    } else {
      x = S == max ? 1 : max;
    }
  }
  rep(i,0,n){
    std::cout << (0 < i ? " " : "") << a.at(i);
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll ans[101][1000001];
int main()
{
  ll n,w;
  cin>>n>>w;
  ll ans[2][100001],flag=0;
  memset(ans,0,sizeof(ans));
  for(ll i=0;i<n;i++)
  {
     ll val,ww;
      cin>>ww>>val;
      for(int j=0;j<ww;j++)
        ans[flag][j] = ans[flag^1][j];
      for(ll j=ww;j<=w;j++)
      {
          ans[flag][j] = max(ans[flag^1][j],max(ans[flag^1][j-ww]+val , ans[flag][j-1]));
      }
     /* for(int i=0;i<=w;i++)
        cout<<ans[flag][i]<<" ";
      cout<<endl;*/
      flag ^=1;
  }
  cout<<ans[flag^1][w]<<endl;
}
              

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define lPair pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll dp[101][100100] = {0};
ll N,W;
ll w[101],v[101];
int main(){
    int N,K; cin >> N >> K;
    int H[100100];
    int dp[100100];
    for(int i = 0; i < N; i++){
        cin >> H[i];
        dp[i] = MM;
    }
    dp[0] = 0;
    dp[1] = abs(H[1]-H[0]);
    for(int i = 0; i < N; i++){
        for(int j = 1; j <= K; j++){
            if(i + j < N){
                dp[i+j] = min(dp[i]+abs(H[i+j]-H[i]),dp[i+j]);
            }
        }
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
import sys

fin = sys.stdin.readline

MOD = 10 ** 9 + 7
N, M = [int(elem) for elem in fin().split()]
a_list = set([int(fin()) for _ in range(M)])


dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 1 if 1 not in a_list else 0
for i in range(2, N + 1):
    if i in a_list:
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= MOD
print(dp[-1])


Measured memory_bytes: 50140
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI 3.14159265358979
 
signed main(){
 
 	lli r;
 	cin>>r;

 	cout<<r*r<<endl;
 
	return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: Closed Rooms
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_H = 800, MAX_W = 800;
const int INF = 1 << 30;
const int dxs[] = {1, 0, -1, 0}, dys[] = {0, -1, 0, 1};

/* typedef */

typedef pair<int,int> pii;

/* global variables */

string flds[MAX_H];
int ds[MAX_H][MAX_W];

/* subroutines */

/* main */

int main() {
  int h, w, k;
  cin >> h >> w >> k;

  int sx, sy;
  for (int y = 0; y < h; y++) {
    cin >> flds[y];
    for (int x = 0; x < w; x++)
      if (flds[y][x] == 'S') flds[y][x] = '.', sx = x, sy = y;
  }

  memset(ds, -1, sizeof(ds));
  ds[sy][sx] = 0;
  queue<pii> q;
  q.push(pii(sx, sy));

  int mind = INF;
  while (! q.empty()) {
    pii u = q.front(); q.pop();
    int &ux = u.first, &uy = u.second;
    int vd = ds[uy][ux] + 1;

    int dd = min(min(ux, w - 1 - ux), min(uy, h - 1 - uy));
    if (mind > dd) mind = dd;
    if (vd > k) continue;

    for (int di = 0; di < 4; di++) {
      int vx = ux + dxs[di], vy = uy + dys[di];
      if (vx >= 0 && vx < w && vy >= 0 && vy < h &&
	  flds[vy][vx] == '.' && ds[vy][vx] < 0) {
	ds[vy][vx] = vd;
	q.push(pii(vx, vy));
      }
    }
  }
  //printf("mind=%d\n", mind);

  printf("%d\n", (mind + k - 1) / k + 1);
  return 0;
}


Measured memory_bytes: 3712
N, D = map(int, input().split())
X = [[int(i) for i in input().split()] for _ in range(N)]
count = 0
for i in range(N):
  for j in range(i + 1, N):
    res = sum([(X[i][k] - X[j][k])**2 for k in range(D)])
    if (res**0.5) % 1 == 0:
      count += 1
print(count)

Measured memory_bytes: 3188
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define range_for(i, b, e) for(int i=(b), i##_len=(e); i<=i##_len; ++i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define pb push_back
# define len(x) ((int)(x).size())
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
# define cauto const auto
using namespace std;
using lint = long long;
template <class Type> inline constexpr bool InRange(const Type& x, const Type& i, const Type& a) { return (i <= x) && (x <= a); }
template<class Integer>bool chmax(Integer &a, const Integer &b) { if (a<b) { a=b; return 1; } return 0; }
template<class Integer>bool chmin(Integer &a, const Integer &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Integer>bool IsOdd(Integer &n) { return n & 1; }
template<class Integer>bool IsEven(Integer &n) { return !(n & 1); }
int ctoi(const char c) { return ('0' <= c && c <= '9') ? (c - '0') : -1; }
string YesNo(bool b) { return b ? "Yes" : "No"; }
string YESNO(bool b) { return b ? "YES" : "NO"; }
string yesno(bool b) { return b ? "yes" : "no"; }
static const lint MOD9 = (lint)1e9+7;
int dy[4] = {0, 1, 0, -1};
int dx[4] = {1, 0, -1, 0};

// 整数の桁数を返す ( log(N) )
template <class Integer> Integer GetDigit(Integer n) {
    Integer d = 0;
    while (n) {
        n /= 10;
        d++;
    }
    return d;
}

// 素数かどうかを返す ( O(sqrt(N)) )
template <class Integer>
constexpr bool IsPrime(const Integer n) noexcept {
    if (n < 4) return n == 2 || n == 3;
    if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false;
    for (Integer i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
}


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

    if (N >= 10)
    {
        cout << R << "\n";
    }
    else
    {
        cout << R + 100 * (10 - N) << "\n";
    }

    return 0;
}



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

#define fi first
#define se second
#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)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

vector<vector<int> > to;
vector<bool> visited;
vector<int> order;
int dp[100100];

void dfs(int v) {
    if (visited[v]) return;
    visited[v] = true;
    for (auto u: to[v]) {
        if (visited[u]) continue;
        dfs(u);
    }
    order.pb(v);
}

int main() {
    int n,m;
    cin >> n >> m;
    to.resize(n);
    visited.resize(n);
    rep(i,m) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        to[x].pb(y);
    }
    
    rep(i,n) {
        if (visited[i]) continue;
        dfs(i);
    }
    reverse(all(order));
    rep(i,n) {
        int x = order[i];
        for (auto y: to[x]) {
            dp[y] = max(dp[y],dp[x]+1);
        }
    }
    int ans = 0;
    rep(i,n) {
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
    return 0;
}






















Measured memory_bytes: 8696
inks = {
 1 => [[0, 1, 0],
       [1, 1, 1], 
       [0, 1, 0]],
 2 => [[1, 1, 1], 
       [1, 1, 1], 
       [1, 1, 1]],
 3 => [[0, 0, 1, 0, 0], 
       [0, 1, 1, 1, 0], 
       [1, 1, 1, 1, 1], 
       [0, 1, 1, 1, 0], 
       [0, 0, 1, 0, 0]] }
cell = Array.new(10).map { cell = Array.new(10, 0) }

while s = gets
  break if s.nil? || s.chomp == ""
  x, y, i = s.split(',').map(&:to_i)

  ink = inks[i]
  iy   = ink.size
  cy  = (iy / 2).floor
  ix   = ink[cy].size
  cx  = (ix / 2).floor
  sx  = x - cx
  sy  = y - cy
  
  ix.times { |x| 
    next if sx + x < 0 || sx + x > 9 
    iy.times { |y| 
      next if sy + y < 0 || sy + y > 9 
      cell[sy + y][sx + x] += ink[y][x]
    }   
  }
end

e, m = 0, 0
cell.each { |c| c.each { |v| 
  e += 1 if v == 0
  max = c.max
  m = max if max > m 
} }

puts e
puts m

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

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

  // ここにプログラムを追記
  for ( int i = 0; i < N; i ++ ) {
    string A;
    cin >> A;
    if ( A == "Y" ) {
      B = "Four";
      break;
    } else {
      B = "Three";
    }
  }
  cout << B << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/c++io.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
int x,y,z;
cin>>x>>y>>z;
if((x*100+y*10+z)%4==0)
    cout<<"YES"<<endl;
else cout<<"NO"<<endl;

 return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define N 109
using namespace std;
typedef long long ll;
int main(void)
{
    //freopen("in.txt","r",stdin);
 
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i] == '7')
        {
            puts("Yes");
            return 0;
        }
    }
puts("No");
    return 0;
}


Measured memory_bytes: 3636
/* ex7_3
   kohei0713 */

#include <stdio.h>
#include <stdlib.h>

int main(void){
    
    int height, width, i, j;
    char **block;
    int *destroyHeight, *destroyWidth;
    
    //input
    scanf("%d %d", &height, &width);

    //各行の配列へのポインタ分のメモリ領域を確保
    block = (char**)calloc(height, sizeof(char*));
    if(block == NULL){
        exit(1);
    }
    //各行の要素分のメモリ領域を確保
    for(i = 0; i < height; i++){
        block[i] = (char*)calloc(width, sizeof(char));
        if(block[i] == NULL){
            exit(1);
        }
    }

    //destroyHeightとdestroyWidthも同様にメモリ領域を確保する
    destroyHeight = (int*)calloc(height, sizeof(int));
    if(destroyHeight == NULL){
        exit(1);
    }

    destroyWidth = (int*)calloc(width, sizeof(int));
    if(destroyWidth == NULL){
        exit(1);
    }

    //destroyHeightをすべて0の配列にする
    for(i = 0; i < height; i++){
        destroyHeight[i] = 0; 
    }

    //destroyWidthをすべて0の配列にする
    for(j = 0; j < width; j++){
        destroyWidth[j] = 0;
    } 

    for(i = 0; i < height; i++){
        for(j = 0; j < width; j++){
            //行列のマス(i,j)を読み取る
            scanf(" %c", &block[i][j]);
            if(block[i][j] == '#'){
                //マス(i,j)が黒のとき,destroyHeight[i],destroyWidth[j]を1にする
                destroyHeight[i] = 1;
                destroyWidth[j] = 1;
            }
        }   
    }

    for(i = 0; i < height; i++){
        if(destroyHeight[i] == 1){
            for(j = 0; j < width; j++){
                if(destroyWidth[j] == 1){
                    //destroyHeight[i] = 1かつdestroyWidth[j] = 1のときblock[i][j]を表示
                    printf("%c", block[i][j]);
                }
            }
            //1行すべて処理が終わると改行する
            printf("\n");  
        } 
    }

    //確保したメモリ領域を解放する
    for(i = 0; i < height; i++){
        free(block[i]);
    }
    free(block);
    free(destroyHeight);
    free(destroyWidth);

    return 0;
}


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

int main(){
    ll n; cin >> n;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];

    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,less<pair<ll,ll>>> que;
    ll count = 0;
    rep(i,n){ if(b[i] > a[i]) que.push(make_pair(b[i],i)); else if(b[i] == a[i]) count++; }
  
    ll ans = 0;
    while(!que.empty()){
      	pair<ll,ll> p = que.top(); que.pop();
        ll num, id; tie(num,id) = p;
        ll div = b[(id+1)%n] + b[(id+n-1)%n];
        ll k = (num - a[id]) / div;
        ans += k; if(k == 0){ cout << -1 << endl; return 0; }
        b[id] -= k * div; 
        if(b[id] > a[id]) que.push(make_pair(b[id],id));
        else if( b[id] == a[id]) count++;
    }
    cout << (count == n ? ans : -1) << endl;
    return 0;
}

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

const int MAX_N = 100005;
const long long INF = 1LL << 60;

int N;
long long h[MAX_N];
long long dp[MAX_N];

int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> h[i];

  for (int i = 0; i < MAX_N; i++) dp[i] = INF;
  
  dp[0] = 0;
  
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= K; ++j) {
      dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }
  cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
const int maxn = 10000001;
const int mod = 998244353;
map<ll,ll>mp;
ll n, a, b, c, d;
ll solve(ll x) {
    if (mp.count(x)) {
        return mp[x];
    }
    ll mi = x * d;
    if (mi < 0) {
        mi = 1e18;
    }
    ll tar = x / 2;
    if (tar < x) {
        mi = min(mi,solve(tar) + d * (x - tar * 2) + a);
    }
    tar++;
    if (tar < x) {
        mi = min(mi,solve(tar) + d * (-x + tar * 2) + a);
    }
    tar = x / 3;
    if (tar < x) {
        mi = min(mi,solve(tar) + d * (x - tar * 3) + b);
    }
    tar++;
    if (tar < x) {
        mi = min(mi,solve(tar) + d * (-x + tar * 3) + b);
    }
    tar = x / 5;
    if (tar < x) {
        mi = min(mi,solve(tar) + d * (x - tar * 5) + c);
    }
    tar++;
    if (tar < x) {
        mi = min(mi,solve(tar) + d * (-x + tar * 5) + c);
    }
    return mp[x] = mi;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        mp.clear();
        cin >> n >> a >> b >> c >> d;
        cout << solve(n) << '\n';
    }
}  


Measured memory_bytes: 4776
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

void process();

int main(){
    bool ans[3] ={true,true,true};
    int a;
    int i;
    for(i=0;i<2;i++){
        cin >> a;
        ans[a-1] = false;
    }
    for(i=0;i<3;i++){
        if(ans[i] == true){
            cout << i + 1 << endl;
            break;
        }
    }
    return 0;
}

void process(){
    
}

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

int main(){
	const int N =104729+1;
	bool isPrime[N];
	std::fill(isPrime,isPrime+N,true);
	isPrime[0]=isPrime[1]=false;
	int i,j;
	for(i =2;i*i<=N;i++){
		if(isPrime[i])
			for(j=i*2;j<N;j+=i)
				isPrime[j]=false;
	}
	
	int n;
	int s;
	int count;
	while(scanf("%d",&n),n){
		i=3;s=2;count=1;
		while(count!=n){
			if(isPrime[i]){
				count++;
				s+=i;
			}
			i+=2;
		}
		printf("%d\n",s);
	}
}

Measured memory_bytes: 1128
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <list>
using namespace std;

int main(){

    int H, W, h, w;
    cin >> H >> W >> h >> w;

    cout << H*W - h*W - H*w + h*w << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
#define MAXN 100000

int N,M;
vector<int> pe(MAXN,0);
vector<bool> isAC(MAXN,false);

int main(){
  cin>>N>>M;
  int cAC=0;
  int cpe=0;
  int p;
  string s;
  for(int i=0;i<M;i++){
    cin>>p>>s;
    p--;
    if(s=="WA"){
      if(isAC[p]) continue;
      pe[p]++;
    }
    else{
      if(isAC[p]) continue;
      isAC[p]=true;
      cAC++;
      cpe+=pe[p];
    }
  }
  cout<<cAC<<" "<<cpe<<endl;
  return 0;
}
  
  

Measured memory_bytes: 1272
import java.util.*;
public class Main
{
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] a = new int [n];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();
        int [] ret = new int[n]; int temp = 0;
        for (int i = 0; i < n; i++) temp ^= a[i];
        for (int i = 0; i < n; i++) {
            ret[i] = temp ^ a[i];
        }
        for (int i = 0; i < n; i++) {
            System.out.print(ret[i] + " ");
        }
    }


}

Measured memory_bytes: 61612
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: usize,
        M: usize,
        AB: [(i64,i64); N],
        CD: [(i64,i64); M],
    }
    for i in 0..N{
        let (a,b) = AB[i];
        let mut r = 9999999999;
        let mut ans = 0;
        for j in 0..M{
            let (c,d) = CD[j];
            if r > (a-c).abs()+(b-d).abs(){
                r = (a-c).abs()+(b-d).abs();
                ans = j;
            }
        }
        println!("{}",ans+1);
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;
int main()
{
    fastRead;
    int a, b;
    cin>>a>>b;
    cout<<a*b<<'\n';
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans=(n/(a+b))*a+min(a,n%(a+b));
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int D = scanner.nextInt();

    int observedRange = D * 2 + 1;
    int answer;
    if (N % observedRange == 0) {
      answer = N / observedRange;
    } else {
      answer = N / observedRange + 1;
    }

    System.out.println(answer);

  }
}

Measured memory_bytes: 21972
def main():
    n = int(input())
    a = []
    a.append(list(map(int,input().split())))
    a.append(list(map(int,input().split())))
    cnt = sum(a[1]) + a[0][0]
    ans = cnt
    for i in range(1,n):
        cnt += a[0][i] -a[1][i-1]
        ans = max(ans,cnt)

    print(ans)

if __name__ == '__main__':
    main()

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

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

int main(){
  int H, N;
  cin >> H >> N;
  
  vector<int> A(N);
  int sum = 0;
  rep(i, N){
    cin >> A.at(i);
    sum += A.at(i);
  }

  if(H>sum) cout << "No";
  else cout << "Yes";
  
  
}

Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 45

const int dx[4] { -1, 0, 1, 0 };
const int dy[4] { 0, -1, 0, 1 };
const char dir[4] { 'u', 'l', 'd', 'r' };

int MDT[N2][N2];

struct Puzzle {
    int f[N2], space, MD;
};

int getAllMd(Puzzle p) {
    int sum = 0;
    for (int i = 0; i < N2; ++i) {
        if (p.f[i] == N2)
            continue;
        sum += MDT[i][p.f[i] - 1];
    }
    return sum;
}

Puzzle state;
int limit;
int path[LIMIT];
bool dfs(int depth, int prevR) {
    if (state.MD == 0)
        return true;
    if (depth + state.MD > limit)
        return false;

    int sx = state.space / N;
    int sy = state.space % N;
    Puzzle tmp;
    for (int r = 0; r < 4; ++r) {
        if (max( prevR,r) - min(r, prevR) == 2)
            continue;
        int tx = sx + dx[r];
        int ty = sy + dy[r];
        if (tx < 0 || ty < 0 || tx >= N || ty >= N)
            continue;
        tmp = state;
        state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
        state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
        swap(state.f[sx * N + sy], state.f[tx * N + ty]);
        state.space = tx * N + ty;
        if (dfs(depth + 1, r)) {
            path[depth] = r;
            return true;
        }
        state = tmp;
    }
    return false;
}

string deepening(Puzzle p) {
    p.MD = getAllMd(p);
    for (limit = p.MD; limit <= LIMIT; ++limit) {
        state = p;
        if (dfs(0, -100)) {
            string ans;
            for (int i = 0; i < limit; ++i) {
                ans += dir[path[i]];
            }
            return ans;
        }
    }
    return "";
}

int main() {
    for (int i = 0; i < N2; ++i) {
        for (int j = 0; j < N2; ++j) {
            MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
        }
    }
    Puzzle p;
    for (int i = 0; i < N2; ++i) {
        scanf("%d", &p.f[i]);
        if (p.f[i] == 0) {
            p.f[i] = N2;
            p.space = i;
        }
    }
    string ans = deepening(p);
    cout << ans.size() << endl;

    return 0;
}

Measured memory_bytes: 3216
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,k;cin>>n>>k;
    ll ans=0;
    for(int i=k+1;i<=n;i++){
        for(int j=0;j<=n/i;j++){
            int nd=j*i;
            int am=min(1+n-nd,i);
            int rm=max(0LL,am-k);
            ans+=rm;
            if(rm&&j==0&&k==0) ans--;
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int mark[1000];
int main()
{
    int n,res=0;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];

    if(n<3){
        cout<<0<<endl;
        return 0;
    }
    for(int i=1;i<n-1;i++){
        vector<int>vv;
        vv.push_back(v[i-1]);
        vv.push_back(v[i]);
        vv.push_back(v[i+1]);
        sort(vv.begin(),vv.end());
        if(vv[1]==v[i])
            res++;

            vv.clear();
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w, a, b; cin >> h >> w >> a >> b;
	int ans = h * w;
	if (h >= a && w >= b) {
		ans -= (h - h % a) * (w - w % b);
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    int n; //整数の個数
    long long int k; //何番目か
    cin >> n >> k;

    vector<long long int> A(n); //要素数が何番目か、要素がi番目の数
    long long int neg = 0; //負の数
    long long int zero = 0; //０の数
    long long int pos = 0; //正の数
    for(int i=0; i<n; i++){
        cin >> A[i];
        if(A[i] > 0) pos++;
        else if(A[i] == 0) zero++;
        else neg++;
    }
    
    sort(A.begin(),A.end());
    vector<long long int> Neg(neg); //負の数のVector（昇順）
    vector<long long int> Pos(pos); //正の数のVector（昇順）
    for(int i=0; i<neg; i++) Neg[i] = A[i];
    for(int i=0; i<pos; i++) Pos[i] = A[i+neg+zero];

    /* K番目が負、０、正になるかで場合分けする */
    if(k <= neg*pos){
        
        /* 二分探索でK番目が何か特定する */
        long long int l = -pow(10,18)-1;
        long long int r = -1;
        while(r-l != 1){
           long double mid = (l+r)/2; 
           
           /* 整数の積がいくつmidを超えるのかカウント K以上の場合はr=mid */
           long long int count = 0;
           int j = pos - 1;
           for(int i=neg-1; i>=0; i--){
               while(j >= 0 && mid >= Neg[i]*Pos[j]) j--;
               count += pos - j - 1;
           }

           if(count >= k) r = mid;
           else l = mid;
        }

        cout << r << endl;

    }else if(k <= neg*pos + (neg+pos)*zero + (zero*(zero-1))/2){
        cout << 0 << endl;
    }else{

        k -= (neg*pos + (neg+pos)*zero + (zero*(zero-1))/2);

        /* 二分探索でK番目が何か特定する */
        long long int l = 1;
        long long int r = pow(10,18)+1;
        while(r-l != 1){
            long double mid = (l+r)/2;

            /* 整数の積がいくつmidを超えるのかカウント K以上の場合はr=mid */
           long long int count = 0;
           long long int count_neg = 0;
           long long int count_pos = 0;

           //負＊負のカウント
           int j = neg - 1;
           for(int i=0; i<neg; i++){
               while(j >= 0 && mid >= Neg[i]*Neg[j]) j--;
               count_neg += min(neg-i-1,neg-j-1);
           }

           //正＊正のカウント
           j = 0;
           for(int i=pos-1; i>=0; i--){
               while(j < pos && mid >= Pos[i]*Pos[j]) j++;
               count_pos += min(i,j);
           }

           count = count_neg+count_pos;

           if(count >= k) r = mid;
           else l = mid;
        }

        cout << r << endl;
    }
    
} 

Measured memory_bytes: 3200
# coding: utf-8
# Your code here!
def prime_factorize(N): #素因数分解
    exponent = 0
    while N%2 == 0:
        exponent += 1
        N //= 2
    if exponent: factorization = [[2,exponent]]
    else: factorization = []
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        exponent = 0
        while N%i == 0:
            exponent += 1
            N //= i
        factorization.append([i,exponent])
    if N!= 1: factorization.append([N,1])
    assert N != 0, "zero"
    return factorization

def divisor_list(N): #素因数分解
    res = []
    i = 1
    while i*i < N:
        if N%i == 0:
            res.append(i)
            res.append(N//i)
        i += 1
    if i*i == N: res.append(i)
    return sorted(res)    

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

#n,a = [int(i) for i in readline().split()]
#n,x = [int(i) for i in readline().split()]
n = int(input())

from collections import defaultdict
d = defaultdict(int)

for i in range(1,n+1):
    l = prime_factorize(i)
    for p,e in l:
        d[p] += e


l = sorted([i for i in d.values() if i > 1])

div = divisor_list(75)
#dp[i][j] = 「i 番目の素因数まで見て、約数の個数が j であるような選び方
dp = [[0]*76 for i in range(1+len(l))]
dp[0][1] = 1
for i,c in enumerate(l):
    for j in div:
        for a in div:
            if a <= c+1 and j*a <= 75:
                dp[i+1][j*a] += dp[i][j]

#print(*dp,sep="\n")
print(dp[-1][75])














    







Measured memory_bytes: 3316
//
// Created by sark2 on 23-10-2019.
//

#include "bits/stdc++.h"

using namespace std;
#define PB push_back
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define CASES int t;cin>>t;while(t--)
#define MP make_pair

using ll = long long;
using ld = long double;

ll mod = 1e9 + 7;

int main() {
    IOS


    int a,b;
    cin>>a>>b;

    cout<<(a-2*b > 0 ? a-2*b : 0);


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) (x.begin(), x.end())

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b;
    cin >> a >> b;
    cout << a + 1 - b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

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

	int_least32_t n;
	cin >> n;

	vector<int_least32_t> a( n ), b( n );
	for(auto i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	int_fast32_t count{ 0 }, temp;
	for(auto i = n - 1; i >= 0; --i) {
		temp = (count + a[i]) % b[i];
		if(temp == 0) {
			continue;
		}
		count += b[i] - temp;
	}

	cout << count << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int a[500][500];

void f(int i0, int i1, int d) {
    if (i1 - i0 < 2) return;
    int i2 = (i0 + i1) / 2;
    for (int i = i0; i < i2; i++) {
        for (int j = i2; j < i1; j++) {
            a[i][j] = d;
        }
    }
    f(i0, i2, d + 1);
    f(i2, i1, d + 1);
}

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

    int n;
    cin >> n;

    f(0, n, 1);

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            cout << a[i][j] << " \n"[j == n - 1];
        }
    }
    cout << flush;

    //それぞれが二部グラフ
    //Nが偶数のとき

    return 0;
}

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

#define fi       first
#define se       second
#define pf       printf
#define mp       make_pair
#define pb       push_back
#define si(x)    scanf("%d", &x)
#define pi(x)    printf("%d\n", x)
#define sl(x)    scanf("%lld", &x)
#define pl(x)    printf("%lld\n", x)
#define all(x)   x.begin(), x.end()
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, ll> mll;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef map<char, int> mci;
typedef map<char, char> mcc;
typedef pair<char, int> pci;
typedef unsigned long long ull;

const ll MAX = 100005;
const ll MOD = 1000000007;
const ll INF = 1000000000000000;
const double PI = 2 * acos(0.0);
const double EPS = 0.00000000001;

int main() {
    int n, a, b;
    si(n);

    if (n == 1) puts("Hello World");
    else {
        si(a), si(b);
        pi(a + b);
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int array[3];
    int i, j;
    int temp;

    scanf("%d %d %d", &array[0], &array[1], &array[2]);

    for(i = 0; i < 2; i++)
    {
        for(j = 1; i + j <= 2; j++)
        {
            if(array[i] > array[i + j])
            {
                temp = array[i];
                array[i] = array[i + j];
                array[i + j] = temp;
            }
        }
    }
    
    printf("%d %d %d\n", array[0], array[1], array[2]);

    return 0;
}

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

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

int main(){
	string S;
	cin >> S;
	S[3]='8';
	cout << S << endl;

	return 0;
}

Measured memory_bytes: 256
n, q = map(int, input().split())

l = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    l[a].append(b)
    l[b].append(a)

value = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    value[p-1] += x

s = [0]
flag = [False]*(n)
while s:
    v = s.pop()
    flag[v] = True
    for e in l[v]:
        if flag[e]:
            continue

        value[e] += value[v]
        s.append(e)

print(*value)

Measured memory_bytes: 105600
#include <iostream>
typedef long long ll;
using namespace std;

int main(void) {
    int n;cin>>n;
    ll ma = -1000001;
    ll mi = 1000001;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        ll a;cin>>a;
        if (ma < a) ma = a;
        if (mi > a) mi = a;
        sum += a;
    }
    cout << mi << " " << ma << " " << sum << endl;
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <memory.h>
using namespace std;

int prime[1000000];
void initTbl(){
	//sieve of Eratosthenes
	// 0 : prime
	// 1 : not prime
	memset(prime, 0, sizeof(prime));
	prime[0] = 1;
	prime[1] = 1;

	int limit = 1000000;
	for(int i=4; i<limit; i+=2){
		prime[i] = 1;
	}

	for(int j=3; j*j<=limit; j+=2){
		for(int k=j; j*k<=limit ;k+=2){
			prime[j*k] = 1;
		}
	}
}

//0009
int main()
{
	int n=10;
	initTbl();

	while(cin >> n){
		int cnt = 0;

		for(; n>0; n--){
			if(!prime[n])
				++cnt;
		}
		cout << cnt << endl;

	}
  return 0;
}

Measured memory_bytes: 4768
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i, a, b) for(auto (i)=a;i<b;i++)
#define list(i, N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
#define mp make_pair
#define pb push_back
#define eb emplace_back

#define int ll
#define INF 1e18+5
#define mod 1000000007

template<class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

#define MAX_N 200005
int n; int arr[MAX_N];

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cin >> n;
    list(i,n) cin >> arr[i];

    int currFinding = 1;
    int ans = 0;

    list(i,n){
        if(arr[i]==currFinding){
            currFinding += 1;
        }else ans++;
    }

    if(currFinding==1){
        cout << "-1\n"; return 0;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define lol long long
using namespace std;
int main(){
  int a,b,c,ans=0;
  string s;
  cin>>a>>b;
  for(int i=0;i<b;i++){
    cin>>c;
    ans+=c;
  }
  if(ans>=a) cout<<"Yes\n";
  else cout<<"No\n";
  return(0);
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
						 {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

int main() {
	int x;
	scanf("%d",&x);
	if(x==3||x==5||x==7){
		printf("YES");
	}else{
		printf("NO");
	}
	
	
	
	
	/* --------------------------------- */
	printf("\n");
	return 0;
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define ll long long
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD ll(1000000007)

int main()
{ FAST
    int n; cin >> n;
    bool ans = 1;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(a%2 == 0){
            if(a%3 != 0 && a%5 != 0){
                ans = 0;
            }
        }
    }
    if(ans){
    cout << "APPROVED" << endl;
    }
    else{
        cout << "DENIED" << endl;
    }
    return 0;
}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n; cin >> n;
    vector<ll> dp(200000, INF);
    dp[0] = 0;
    frep(i, 0, n) {
        if(dp[i]+1 < dp[i+1]) {
            dp[i+1] = dp[i]+1;
        }
        ll tmp = 6;
        while(tmp <= n) {
            if(dp[i]+1 < dp[i+tmp]) {
                dp[i+tmp] = dp[i]+1;
            }
            tmp *= 6;
        }
        tmp = 9;
        while(tmp <= n) {
            if(dp[i]+1 < dp[i+tmp]) {
                dp[i+tmp] = dp[i]+1;
            }
            tmp *= 9;
        }
    }
    cout << dp[n] << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 4816
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))

D = [a[i] for i in range(N)]
ans = sum(D)

for i in range(1, N):
  for j in range(N):
    D[j] = min(D[j], a[(N + j - i) % N]) 
  ans = min(ans, sum(D) + x * i)

print(ans)

Measured memory_bytes: 74084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define repn(a,b,c) for(int a=b; a>=c; a--)
#define ll long long
#define sum(a,b) a=a+b
#define mem(a, b) memset(a, (b), sizeof(a))

int main(){
    
    int n;
    cin>>n;
    
    if(n<=111){
        cout<<111;
    }else if(n<=222){
        cout<<222;
    }else if(n<=333){
        cout<<333;
    }else if(n<=444){
        cout<<444;
    }else if(n<=555){
        cout<<555;
    }else if(n<=666){
        cout<<666;
    }else if(n<=777){
        cout<<777;
    }else if(n<=888){
        cout<<888;
    }else if(n<=999){
        cout<<999;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(z) (z).begin(),(z).end() 
#define MOD 1000000007
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll isprime(ll n)
{
	for(int i=2;i<n;i++)
		if(n%i==0)
		return 0;
		
	return 1;	
}
int main()
{ 
    FAST;
    ll n;
    cin>>n;
	string s1,s2;
	cin>>s1>>s2;
	string s3="";
	for(int i=0;i<n;i++)
	{
		s3+=s1[i];
		s3+=s2[i];
	}
	cout<<s3;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

typedef pair<int, int> P;

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<P> q;
    rep(i, N) {
        int a;
        cin >> a;
        q.push(make_pair(a, 1));
    }
    rep(i, M) {
        int b, c;
        cin >> b >> c;
        q.push(make_pair(c, b));
    }

    ll ans = 0;
    rep(i, N) {
        auto p = q.top();
        q.pop();
        ans += p.first;
        if (p.second > 1) {
            p.second--;
            q.push(p);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420