akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int a,b;
#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) For(i,0,n)

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll INF=1e17;


ll gcd(ll x,ll y){
return y? gcd(y,x%y):x;
}

int main(){
  int n;
  db sum=0;
  cin>>n;
  vector<pair<int,int>> d;
  rep(i,n){
    int x,y;
    cin>>x>>y;
    d.push_back(make_pair(x,y));
  }
  rep(i,n)for(int j=i+1;j<n;j++){
    int f=d[i].first-d[j].first;
    int e=d[i].second-d[j].second;
    int b=pow(f,2)+pow(e,2);
    sum+=pow(b,0.5);
  }
  cout<<fixed<<setprecision(10)<<sum*2/n<<endl;
return 0;
}

Measured memory_bytes: 4204
#include <bits/stdc++.h>
using namespace std;
#define ld long double 
signed main() {
  cout << setprecision(20) << fixed ;
  int n ;
  cin >>n ;
  vector<ld>a(n) ;
  for(int i=0;i<n;i++) 
    cin >> a[i];
  // for(int i=0;i<n;i++)
  //   cerr <<a[i] << " ";
  vector<vector<ld>>dp(n+1,vector<ld>(n+1)) ;
  //dp[i][h]-> probability of having j heads after processing i coins
  dp[0][0]=1.00 ;
  for(int i=1;i<=n;i++)
    for(int j=0;j<=i;j++)
      dp[i][j]=(j>0?dp[i-1][j-1]*a[i-1]:0)+dp[i-1][j]*(1.00-a[i-1]) ;
  // for(auto x:dp){
  //   for(auto c:x){
  //     cerr << c<< " " ;
  //   }
  //   cerr << endl;
  // }
  ld ans =0 ;
  for(int i=(n+1)/2;i<=n;i++){
    ans+=dp[n][i] ;
    cerr <<i<< " " << dp[n][i] << endl ;
  }
  cout << ans ;
}


Measured memory_bytes: 144300
# -*- coding: utf-8 -*-
import sys
# start: 00:47


H,W,K = map(int,input().split())
S = [[0]*W for _ in range(H)]
for i in range(H):
    st = list(input())
    for j,t in enumerate(st):
        S[i][j] = int(t)
#%%

ans = 10**9+7
for i in range(1<<(H-1)):
    res = 0
    tmp = i
    h = [0]*(H-1)
    idx = (H-2)
    while tmp>0:
        if tmp&1:
            h[idx]=1
            res += 1
        idx -= 1
        tmp>>=1
    group = [0]*H
    for j in range(H-1):
        group[j+1] = group[j] + h[j]
    
    L = group[-1]+1
    count = [0]*(L)
    possible = True
    for j in range(W):
        nxt = [0]*(L)
        for k in range(H):
            if S[k][j]:
                nxt[group[k]] += 1
        
        cut = False
        for l in range(L):
            if count[l]+nxt[l]>K:
                cut = True
                break
        
        if cut:
            for l in range(L):
                if nxt[l]>K:
                    possible = False
                    break
                count[l] = nxt[l]
            else:
                res += 1
                continue
            break
            
        else:
            for l in range(L):
                count[l] += nxt[l]
    if possible:
        ans = min(ans,res)
print(ans)
            

Measured memory_bytes: 47324
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int  A, B, A_B, X, Y;
    cin >> A >> B >> A_B >> X >> Y;
    int sum;

    //ABピザを買わない場合
    if (A + B <= A_B * 2) {//50 49 100
        sum = X*A + Y*B;
    }

    else {
        if (A >= A_B * 2 && B >= A_B * 2) {//120 120 100 3 2
            sum = A_B * 2 * max(X, Y);
        }

        else if (A >= A_B * 2) {
            if (X >= Y) {//130 90 100 3 2
                sum = A_B * 2 * X;
            }
            else {//130 90 100 2 3
                sum = (A_B * 2)*X;
                sum += B*(Y - X);
            }
        }
        else if (B >= A_B * 2) {
            if (Y >= X) {
                sum = A_B * 2 * Y;
            }
            else {
                sum = (A_B * 2)*Y;
                sum += A*(X - Y);
            }
        }
        else {
            if (X >= Y) {
                sum = A_B * 2 * Y;
                sum += A*(X - Y);
            }
            else if (Y >= X) {
                sum = A_B * 2 * X;
                sum += B*(Y - X);
            }
        }
    }
    cout << sum << endl;
}

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

class UnionFind
{
    std::vector<int> data;
    int root_count; // 集合の個数

public:
    UnionFind(int size) : data(size, -1), root_count(size) {}
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (data[y] < data[x])
                std::swap(x, y);
            data[x] += data[y];
            data[y] = x;
            root_count--;
        }
        return x != y;
    }
    bool find(int x, int y)
    {
        return root(x) == root(y);
    }
    int root(int x)
    {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x)
    {
        return -data[root(x)];
    }
    int count() const
    {
        return root_count;
    }
};

using namespace std;

void solve_dsl_1_a()
{
    int n, q;
    cin >> n >> q;
    UnionFind uf(n);
    for (int i = 0; i < q; i++)
    {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0)
            uf.unite(x, y);
        else
            cout << (uf.find(x, y) ? 1 : 0) << endl;
    }
}

int main()
{
    solve_dsl_1_a();
}



Measured memory_bytes: 3136
import numpy as np
ans = 0
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    arrayA = np.array(a)
    arrayB = np.array(b)
    array = arrayA * arrayB
    if array.sum() + c > 0:
        ans += 1
    
print(ans)

Measured memory_bytes: 13168
#include <iostream>
#include <queue>
#include <vector>
#include <iomanip>

using namespace std;

#define MAX_SIZE 50

vector<vector<char>> maze(MAX_SIZE,vector<char>(MAX_SIZE));
vector<vector<int>> move_n(MAX_SIZE,vector<int>(MAX_SIZE));
queue<vector<int>> route;
int R,C;

void confirm_move_n(int y, int x,int nom){
    if(y<0 || y>=R || x<0 || x>=C) return;
    if(maze[y][x]=='#') return;
    if(move_n[y][x]!=-1) return;
    move_n[y][x]=nom+1;
    route.push({y,x});
}

int main(){
    int sy,sx,gy,gx,y,x,nom,block=0;
    cin >> R >> C;
    sy = 1;
    sx=1;
    gy=R;
    gx=C;

    for(int i=0; i<R; i++){
        for(int j=0; j<C; j++){
            cin >> maze[i][j];
            move_n[i][j]=-1;
            if(maze[i][j]=='#') block++;
        }
    }

    move_n[sy-1][sx-1]=0;
    route.push({sy-1,sx-1});
    while(!route.empty()){
        y = route.front()[0];
        x = route.front()[1];
        nom = move_n[y][x];
        confirm_move_n(y+1, x, nom);
        confirm_move_n(y-1, x, nom);
        confirm_move_n(y, x+1, nom);
        confirm_move_n(y, x-1, nom);
        route.pop();
    }
    if(move_n[gy-1][gx-1]==-1){
        cout << -1 << endl;
    }else{
            cout << R*C - block -1 - move_n[gy-1][gx-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

// End of template.


int main(){
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    int h[100100];
    cin >> n >> k;
    rep(i, n) cin >> h[i];

    int ans = 0;
    rep(i, n) {
        if (h[i] >= k) ans++;
    }

    print(ans);

    return 0;
}



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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  int x,y,z,k;
  cin>>x>>y>>z>>k;
  vector<ll> a(x),b(y),c(z);
  REP(i,x) cin >> a[i];
  REP(i,y) cin >> b[i];
  REP(i,z) cin >> c[i];
  vector<ll> a1;
  REP(i,x) REP(j,y) {
    a1.pb(a[i]+b[j]);
  }
  sort(a1.rbegin(),a1.rend());
  vector<ll> a2;
  REP(i,min(k,(int)sz(a1))) REP(j,z) {
    a2.pb(a1[i]+c[j]);
  }
  sort(a2.rbegin(),a2.rend());
  REP(i,k) cout << a2[i] << endl;
  return 0;
}


Measured memory_bytes: 43384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define DUMP(v) for(auto& x : v) cerr << x << " "; cerr << endl;
using namespace std;

using ll = long long;

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; }
constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

constexpr int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return x ? mod - x : 0;}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}

  friend ostream& operator << (ostream& os, const mint& m) noexcept {
    return os << m.x;
  }

  friend istream& operator<< (istream& is, mint& m) noexcept {
    return is >> m.x;
  }
};

using P = pair<int, int>;

struct Sieve {
  int n;
  vector<int> f, primes;
  // 1~n までの素数を求める
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  // 素因数分解の結果を返す
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};


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

  ll n;
  cin >> n;

  map<int, int> fact;
  Sieve sieve(n);
  for (ll x = n; x >= 2; x--) {
    vector<P> f = sieve.factor(x);
    for (auto& p : f) {
      fact[p.first] += p.second;
    }
  }

  mint ans(1);
  for (auto& p : fact) {
    ans *= (p.second + 1);
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int n,m;
	cin>>n>>m;
	int x,y;
	int minx=100000;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		if(y<=m){
			minx=min(minx,x);
		}
	}
	if(minx==100000){
		cout<<"TLE";
	}else{
		cout<<minx;
	}
} 


Measured memory_bytes: 256
/*
Author: Fuadul Hasan(fuadul202@gmail.com)
BSMRSTU,Gopalganj
*/
#include<bits/stdc++.h>
using namespace std;
void    		print(int n)    {printf("%d ", n);}
void    		printl(long long n)     {printf("%I64d ", n);}
long long    	readline(){long long x;scanf("%I64d", &x);return x;}
/*
1.#define  gcd(a,b) __gcd(a,b) 2. #define  lcm(a,b) (a*b)/gcd(a,b) 3. #define  PI acos(-1.0) 4.#define  sqr(x) ((x)*(x))
5.#define  min3(a,b,c) min(a,min(b,c))6.#define  min4(a,b,c,d) min(d,min(a,min(b,c)))7.#define  max3(a,b,c) max(a,max(b,c))
8.#define  max4(a,b,c,d) max(d,max(a,max(b,c)))
*/
//.............ignore it................//
/*....... scanf.......*/
template <typename T> inline void readline(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';n = n * f;}
template <typename T, typename TT> inline void readline(T &n, TT &m) { readline(n); readline(m); }
template <typename T, typename TT, typename TTT> inline void readline(T &n, TT &m, TTT &l) { readline(n, m); readline(l);}
/*..........error........*/
#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {
  vector<string>v; stringstream ss(s); string x;
  while (getline(ss, x, c))v.emplace_back(x); return move(v);
} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}
//............ignore it..................//
typedef   pair<int, int> ii;
typedef   std::vector<ii> vii;
#define   vi   std::vector<int>
#define   vll  std::vector<ll>
#define   all(n) n.begin(),n.end()
#define  mpsi std::map<string, int>
#define  pb             push_back
#define  ll             long long int
#define  nl             printf("\n");
#define  happy          cin.tie(0);
#define  coding         ios::sync_with_stdio(false);

#define  max3(a,b,c) max(a,max(b,c))


int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)2e18 + 5;
const int N             = 4e5 + 5;
const int N1            = 1e5 + 5;
int n;
void dfs(string s,char a){
	if(s.size()==n){
		cout<<s<<endl;
		return ;
	}
	for(char c = 'a';c<=a+1;c++){
		string t = s+c;
		dfs(t,max(c,a));
	}
}
 
int solve() 
{
	//happy coding
	cin>>n;
	dfs("",'a'-1);

	//error();
}

int main(){
	
	int test = 1, tc = 0;
	//scanf("%d", &test);//(void)getchar();
	while (test--){
		solve();
	}


	return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

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

    public Main() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= S.length() - T.length(); i++) {
            int rewrite = 0;
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) != S.charAt(i + j)) rewrite++;
            }
            min = Math.min(min, rewrite);
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 35552
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;

#define MAX 200003
#define MOD 1000000007

ll modpow(ll a,ll n,ll mod){
  ll res=1;
  while(n>0){
    if(n&1){       //nのbitと...00001を比較  nが2で割り切れるならtrue
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a,ll mod){
  return modpow(a,mod-2,mod);
}

ll fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=(fac[i-1]*i)%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

ll COM(int n,int k){
  if(n<k){
    return 0;
  }
  if(n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
  int N;
  cin>>N;
  vector<ll> x(N);
  for(int i=0;i<N;i++){
    cin>>x.at(i);
  }

  COMinit();

  ll ans=0;
  ll sum=1;
  for(ll i=1;i<N;i++){
    ans+=(sum*(x.at(i)-x.at(i-1))%MOD)*fac[N-1-i]%MOD*COM(N-1,i);
    ans%=MOD;
    sum=sum*(i+1)+fac[i];
    sum%=MOD;
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 5760
import math

def check_prime(a):
    b = True
    for i in range(2,int(math.sqrt(a))):
        if a % i==0:
            b = False
            break
    if a==2:b = True
    return b      
a=int(input())
while True:
    if check_prime(a):
        print(a)
        break
    a += 1

Measured memory_bytes: 3060
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<",";}cerr<<endl //[l, r))

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

template<typename T> inline void in(T &e){cin>>e;}
template<typename H,typename... T>void in(H &a, T&... b){in(a);in(b...);}
template<typename T> inline void out(T e){cout<<e<<endl;}
template<typename H,typename... T> void out(H a, T... b){out(a);out(b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

const int MAX_N=1e5+10;

int n;
vi edge[MAX_N];

vi dist[2];

void dfs(int x,int d,int which){
    //show(x,d,which);
    dist[which][x]=d;

    for(auto e:edge[x]){
        if(dist[which][e]==INF){
            dfs(e,d+1,which);    
        }
    }
}

signed main(){
    io();
    
    in(n);
    rep(i,2) dist[i].resize(n,INF);
    rep(i,n-1){
        int a,b;
        scanf("%lld %lld", &a,&b);
        a--;b--;
        edge[a].pb(b);
        edge[b].pb(a);
    }

    dfs(0,0,0);
    dfs(n-1,0,1);
    int f=0, s=0;
    rep(i,n){
        if(dist[0][i]<=dist[1][i]) f++;
        else s++;
    }
    out(f>s?"Fennec":"Snuke");

    return 0;
}


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

#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define pii pair<int,int>
#define vi vector<int>
#define vit vector<int>::iterator it
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define si set<int>
#define ms(a,f) memset((a),(f),sizeof (a))

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int inf=0x7f7f7f7f;
const int N=1e5+10;
int n;
int main() {
    ll ans=0;
    cin>>n;
    rep(i,1,n) {
        if(i%3!=0 && i%5!=0) ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
import scala.io.StdIn.{readLine, readInt}

object Main extends App {
  var continue = true
  while (continue) {
    var cards = readLine()
    if (cards == "-") {
      continue = false
    } else {
      val m = readInt()
      for (_ <- 1 to m) {
        val (first, second) = cards.splitAt(readInt())
        cards = second + first
      }
      println(cards)
    }
  }
}



Measured memory_bytes: 43888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

// 各座標に格納したい情報を構造体にする
// 今回はX座標,Y座標,深さ(距離)を記述している
struct Corr {
    int x;
    int y;
    int depth;
};
queue<Corr> q;
int bfs(vector<string> grid) {
    vvi res(grid.size(),vi(grid[0].size(),INF));
    res[0][0]=0;
    // このような記述をしておくと，この後のfor文が綺麗にかける
    int dx[8] = {1, 0, -1, 0};
    int dy[8] = {0, 1, 0, -1};
    for(int i=0;i<grid.size();i++){
        for(int j=0;j<grid[0].size();j++){
            for(int k=0;k<2;k++){
                int nextx=j+dx[k];
                int nexty=i+dy[k];
                if(nextx==grid[0].size()||nexty==grid.size())continue;
                chmin(res[nexty][nextx],res[i][j]+(grid[i][j]!=grid[nexty][nextx]));
            }
        }
    }
    // for(int i=0;i<grid.size();i++){
    //     for(int j=0;j<grid[0].size();j++){
    //         cout<<res[i][j];
    //     }
    //     cout<<endl;
    // }
    return res[grid.size()-1][grid[0].size()-1];
}

int main() {
    
    int h,w;
    cin>>h>>w;
    vs v(h);
    rep(i,h)cin>>v[i];
    int d=0;
    if(v[0][0]=='#')d++;
    Corr c={0,0,d};
    q.push(c);
    int ans=bfs(v);
    if(v[h-1][w-1]=='#')ans++;
    // fin(ans);
    fin(ceil(ans/2.0));
}


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

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

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

	int N; cin >> N;
	int h[105];

	int p = 0;
	int ans = 0;

	for (int i = 0;i < N;i++){
		cin >> h[i];
		ans += max(0, h[i]-p);
		p = h[i];
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
use std::io;
use std::cmp;


// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}


fn rec(rest : Vec<i32>, choosed : Vec<i32>) -> i32 {
    let mut ans = 10000000;
    if rest.len() == 0 {
        // choosedの順番で計算を行う
        let mut ct = 0;
        // println!("{:?}", choosed);
        for a in choosed {
            ct = (ct + 9) / 10 * 10;
            ct += a;
        }
        ans = ct;
    }
    else{
        for i in 0..rest.len() {
            let r = rest[i];
            let mut rest2 = rest.clone();
            let mut choosed2 = choosed.clone();
            rest2.remove(i);
            choosed2.push(r);
            ans = min(ans, rec(rest2, choosed2));
        }
    }
    return ans;
}

fn main() {

    let mut v = vec![];
    for _ in 0..5 {
        v.push(read_t_in_line::<i32>()[0]);
    }
    println!("{}", rec(v, vec![]));
}



Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll H,W,K;
string S[11];
int main(){
    cin>>H>>W>>K;
    for(ll i=0;i<H;i++)cin>>S[i];
    ll ans=INF;
    for(ll state=0;state<(1<<H-1);state++){
        ll nowAns=0;
        for(ll i=0;i<H-1;i++) if((1<<i)&state)nowAns++;
        vector<ll> whiteCnt(H);
        ll preI=-1;
        for(ll i=0;i<W;i++){
            vector<ll> cnt(H);
            ll nowBlock=0;
            bool overed=false;
            for(ll j=0;j<H;j++){
                cnt[nowBlock]+=(S[j][i]-'0');
                if((1<<j)&state || j==H-1){
                    if(whiteCnt[nowBlock]+cnt[nowBlock]>K)overed=true;
                    nowBlock++;
                }
            }
            if(!overed){
                for(ll j=0;j<H;j++)whiteCnt[j]+=cnt[j];
            }else{
                i--;
                for(ll j=0;j<H;j++)whiteCnt[j]=0;
                nowAns++;
                if(i==preI){
                    nowAns=INF;break;
                }
                preI=i;
            }
        }
        ans=min(nowAns,ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import math
import decimal
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

class Library():
    @staticmethod
    def Swap(a,b):
        return [b,a]

    @staticmethod
    def myRound(a,dig=0): # 四捨五入
        p = 10 ** dig
        return (a * p * 2 + 1) // 2 / p

    @staticmethod
    def Roundup(a,dig=0): # 切り上げ
        if a < 0:
            return int(a)
        else:
            return int(a + 0.9)

    @staticmethod
    def Gcd(a,b): #最大公約数
        if (a<b):
            a,b = Library.Swap(a,b)
        if (b==0):
            return a
        else:
            return Library.Gcd(b,a%b)

    @staticmethod
    def Lcm(a,b): #最小公倍数
        return a//Library.Gcd(a,b)*b

    @staticmethod
    def Divisors(a): # 約数列挙
        divisors = []
        for i in range(1,int(a**0.5)+1):
            if a%i==0:
                divisors.append(i)
                if i!=a//i:
                    divisors.append(a//i)
        divisors.sort()
        return divisors

class Prime():
    # コンストラクタ
    # エラストテネスの篩
    def __init__(self,num):
        self.num = num
        self.sieve = [0] * (self.num + 1)
        self.sieve[0] = -1
        self.sieve[1] = -1
        for i in range(2,self.num + 1):
            if not self.sieve[i]:
                self.sieve[i] = i
                for j in range(i * i,self.num + 1,i):
                    if self.sieve[j]:
                        self.sieve[j] = i
    
    # 素数判定
    def isPrime(self,num = None):
        if num is None:
            num = self.num
        if self.sieve[num] == num:
            return True
        else:
            return False
    
    # 素数列挙
    def PrimeNum(self,num = None):
        if num is None:
            num = self.num
        prime = []
        for i in range(2,num):
            if self.sieve[i] == i:
                prime.append(i)
        return prime
    
    # 素因数分解
    def PrimeFact(self,num = None):
        if num is None:
            num = self.num
        fact = []
        while self.sieve[num] != num:
            fact.append(self.sieve[num])
            num //= self.sieve[num]
        fact.append(num)
        return fact

def main():
    h,a = map(int,input().split())
    if h%a==0:
        print(h//a)
    else:
        print(h//a+1)
    return

if __name__=='__main__':
    main()


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

using namespace std;
typedef long long ll;

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

    vector<ll> fromLeaf(n + 1);
    fromLeaf[n] = a[n];
    ll mi = 0;
    for (int i = n; i >= 0; i--) {
        mi = (mi + 1) / 2, mi += a[i];
        if (i < 60 && mi > (1LL << i)) {
            cout << -1 << endl;
            return 0;
        }
        if (i < n) {
            fromLeaf[i] = fromLeaf[i + 1] + a[i];
            if (i < 60)fromLeaf[i] = min(1LL << i, fromLeaf[i]);
        }
    }

    vector<ll> fromRoot(n + 1);
    fromRoot[0] = 1;
    for (int i = 1; i <= n; i++) fromRoot[i] = (min(fromRoot[i - 1], fromLeaf[i - 1]) - a[i - 1]) * 2;

    ll ret = 0;
    for (int i = 0; i <= n; i++)ret += min(fromLeaf[i], fromRoot[i]);
    cout << ret << endl;
    return 0;
}

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

int main(){
  string x;
  cin >> x;
  rep(i, x.size()){
    cout << x[i];
  }
  cout << endl;
}

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



void solve(){
    string s;
    cin >> s;
    if (s[0] != s[1] || s[0] != s[2] || s[1] != s[2])
        puts("Yes");
    else
        puts("No");
}

int main(){
    solve();
    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int A, B; cin >> A >> B;
	int C, D; cin >> C >> D;
	while (true) {
		C -= B;
		if (C <= 0) {
			print("Yes");
			return 0;
		}
		A -= D;
		if (A <= 0) {
			print("No");
			return 0;
		}
	}
}

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

int main() {

  int left, right;
  char key[10][10] = {
    {},
    {'.', ',', '!', '?', ' '},
    {'a', 'b', 'c'},
    {'d', 'e', 'f'},
    {'g', 'h', 'i'},
    {'j', 'k', 'l'},
    {'m', 'n', 'o'},
    {'p', 'q', 'r', 's'},
    {'t', 'u', 'v'},
    {'w', 'x', 'y', 'z'}
  };

  int size[10] = {0, 5, 3, 3, 3, 3, 3, 4, 3, 4};
  int N;
  char str[1024];
  
  std::cin >> N;
  
  for(int t = 0; t < N; ++t) {  
    scanf("%s", str);

    std::vector<char> buffer;
    int n = strlen(str);
  
    left = right = 0;
    for(int i = 0; right <= n; ++right) {
      if( str[left] != str[right] ) {
        if( str[left] != '0' ) {
          buffer.push_back(key[str[left] - '0'][(right-left-1)%size[str[left]-'0']]);
        }
        left = right;
      }
    }
    buffer.push_back('\0');

    std::cout << &buffer[0] << std::endl;
    buffer.clear();
  }
  
  return 0;
}

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

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (long long i = (a); i <= (b); i++)
#define FORD(i,b,a) for (long long i = (b); i >= (a); i--)
#define endl "\n"
#define ll long long
#define x1 asdasdsaas
#define y1 cdaca1231
#define fi first
#define se second
#define pb push_back
#define ms(s, n) memset(s, n, sizeof(s))
#define all(a) (a).begin(), (a).end()
#define prec(n) fixed<<setprecision(n)
#define bitcount(n) __builtin_popcountll(n)
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
const int MOD = 1e9 + 7;
const int MAXN = 1e6;
const int dx[4] = { -1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};

using namespace std;
inline int add(int x, int y) {
	return x + y >= MOD ? x + y - MOD : x + y;
}

inline int sub(int x, int y) {
	return x - y < 0 ? x - y + MOD : x - y;
}
inline int mul(int x, int y) {
	return (x * (ll)y) % MOD;
}
struct item {
	int w, v;
} a[MAXN];
ll n, w, dp[110][MAXN], v[MAXN], res;
void solve() {
	cin >> n >> w;
	FOR(i, 1, n) {
		cin >> a[i].w >> a[i].v;
	}
	FOR(j, 0, w) {
		FOR(i, 1, n) if (a[i].w > j) {
			dp[i][j] = dp[i - 1][j];
		} else dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a[i].w] + a[i].v);
	}
	cout << dp[n][w];
}
int main() {
	cout << prec(9);
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 289024
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
template <class T> void ckmax(T &x,T y){
	if (x<y)
		x=y;
}
template <class T> void ckmin(T &x,T y){
	if (y<x)
		x=y;
}
/*
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
*/
const int N=1005;
int k,n;
int a[N],baka[N],b[N];
int check_permutation(int L,int R){
	if (R>n||L<1||R-L+1!=k)
		return 0;
	static int vis[N],Time=0;
	Time++;
	For(i,L,R)
		if (vis[b[i]]==Time)
			return 0;
		else
			vis[b[i]]=Time;
	return 1;
}
int checkpos(int *pos){
	int mi=n,mx=-1;
	For(i,1,k)
		ckmin(mi,a[i]),ckmax(mx,a[i]);
	if (mi*2+1<mx)
		return 0;
	if (mi*2>=mx)
		return 1;
	//mi * 2 + 1 == mx
	int mip=n+1,mxp=-1;
	For(i,1,k)
		if (a[i]==mi)
			ckmin(mip,pos[i]);
		else if (a[i]==mx)
			ckmax(mxp,pos[i]);
	return mxp<=mip;
}
int check(int p,int las){
	static int pos[N];
	For(i,1,k)
		pos[i]=p+1;
	if (las==p)
		return checkpos(pos);
	int cut=p;
	{
		vi vis(k+1,0);
		vis[b[cut]]=1;
		while (cut-1>0&&!vis[b[cut-1]])
			cut--,vis[b[cut]]=1;
	}
//	outarr(b,1,n);
//	outval(cut);
//	outarr(a,1,k);
	if (cut>las+1)
		return 0;
	For(i,cut,p)
		pos[b[i]]=i;
	For(i,1,k)
		if (pos[i]==p+1)
			a[i]--;
//	outarr(pos,1,k);
//	outarr(a,1,k);
	if (checkpos(pos))
		return 1;
	For(i,cut,las){
		a[b[i]]--;
		pos[b[i]]=p+1;
		if (checkpos(pos))
			return 1;
	}
	return 0;
}
int main(){
	k=read(),n=0;
	For(i,1,k)
		a[i]=read(),n+=a[i];
	{
		int mi=n,mx=0;
		For(i,1,k)
			ckmin(mi,a[i]),ckmax(mx,a[i]);
		if (mi*2<mx)
			return puts("-1"),0;
	}
	memset(b,-1,sizeof b);
	int las=0;
	For(i,1,n){
		For(j,1,k)
			if (a[j]){
				For(t,1,k)
					baka[t]=a[t];
				a[j]--,b[i]=j;
				int nextlas=check_permutation(i-k+1,i)?i:las;
//				outarr(b,1,n);outval(nextlas);
				if (check(i,nextlas)){
					las=nextlas;
					For(t,1,k)
						a[t]=baka[t];
					a[j]--;
					break;
				}
				b[i]=-1;
				For(t,1,k)
					a[t]=baka[t];
			}
//		printf("b[%d] = %d\n",i,b[i]);
		assert(~b[i]);
	}
	For(i,1,n)
		printf("%d ",b[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 3760
XYZ = list(map(int, input().split()))

tmp = 0
tmp = XYZ[0]
XYZ[0] = XYZ[1]
XYZ[1] = tmp

tmp = XYZ[0]
XYZ[0] = XYZ[2]
XYZ[2] = tmp

print(XYZ[0], XYZ[1], XYZ[2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main(){
    ll a,b,k;
    cin>>a>>b>>k;
    ll c=a-k;
    if(c<0){
        cout<<0<<" ";
        c*=-1;
        if(b-c<0){
            cout<<0<<endl;
        }else{
            cout<<b-c<<endl;
        }
    }else{
        cout<<c<<" "<<b<<endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main()
{
    int cards[99][99]={0},a,c,i,j;
    char b, d[5]="SHCD";
    scanf("%d\n", &a);
    for(i = 0; i < a; cards[b][c] = 1,i++){
        scanf("%c %d\n",&b,&c);
    }
    for(i=0;i<4;i++){
        for(j=1;j<14;j++){
            if(!cards[d[i]][j]){
                printf("%c %d\n",d[i],j);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;

char b, a;

int main() {
	cin >> b;
	if (b == 'A') {
		a = 'T';
	}
	if (b == 'T') {
		a = 'A';
	}
	if (b == 'G') {
		a = 'C';
	}
	if (b == 'C') {
		a = 'G';
	}
	cout << a << endl;
}

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

def gcd(m, n):
    while n:
        m, n = n, m % n
    return m
def lcm(m, n):
    return m // gcd(m, n) * n
def carmichael(x):
    r = 1

    b = 0
    while x & 1 == 0:
        b += 1
        x >>= 1
    if b > 1:
        r = 2 if b == 2 else 2**(b-2)

    y = 3
    while y*y <= x:
        if x % y == 0:
            c = 0
            while x % y == 0:
                x //= y
                c += 1
            r = lcm(r, (y-1) * y**(c-1))
        y += 1
    if x > 1:
        r = lcm(r, x-1)
    return r

def solve(x, c):
    if c == 1:
        return 1
    x = x % c
    sq = int(c ** .5) + 1

    mp = {}
    y = 1
    for i in range(sq):
        mp[y] = i
        y = (y * x) % c
        if y == 1:
            return i+1
        if y in mp:
            return -1
    z = 1
    for i in range(sq):
        z = (z * y) % c
        if z in mp:
            return sq*(i+1) - mp[z]
    return -1
c = carmichael(N)
k = solve(N, c)
if k == -1 or pow(N, k, c) != 1 % c:
    print(-1)
else:
    print(k)


Measured memory_bytes: 7260
n,m = map(int,input().split())
A = list(map(int,input().split()))
asum=sum(A)

cnt=0
for i in range(n):
    if A[i]<(asum/(4*m)):
        continue
    else:
        cnt+=1

if cnt>=m:
    print('Yes')
else:
    print('No')

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

typedef long long ll;
const ll MOD = 1000000007;

using namespace std;

int n;
vector<vector<vector<pair<ll, ll> > > > dp(3001, vector<vector<pair<ll, ll> > >(3001, vector<pair<ll, ll> >(2, {-1, -1})));
vector<int> a;

pair<ll, ll> ans(int l, int r, int p) {
    if (l == r) {
        if (p == 1) {
            return {(ll)a[l], 0LL};
        } else {
            return {0LL, (ll)a[l]};
        }
    } else if (dp[l][r][p].first != -1)
        return dp[l][r][p];
    auto t1 = ans(l + 1, r, 1 - p);
    auto t2 = ans(l, r - 1, 1 - p);
    if (p == 1) {
        t1.first += (ll)a[l];
        t2.first += (ll)a[r];
        dp[l][r][p] = max(t1, t2);
        return dp[l][r][p];
    } else {
        t1.second += (ll)a[l];
        t2.second += (ll)a[r];
        if (t1.second > t2.second) {
            dp[l][r][p] = t1;
        } else {
            dp[l][r][p] = t2;
        }
        return dp[l][r][p];
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    ll sum = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        a.push_back(temp);
        sum += (ll)temp;
    }
    auto temp = ans(0, n - 1, 1);
    cout << temp.first - temp.second;

    return 0;
}

Measured memory_bytes: 634112
#include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const long long INF = 1LL << 60;
typedef pair<int, int> P;


/*
i番目以外の料理でT-1分以内に完食できるおいしさの合計の最大値
+B[i]をiについて全探索するのが答え
->T以降に食べるの全探索するのね...

この各最大値はdpでO(NT)で求まるが、各iについてこれでは間に合わないので
dp1とdp2を使う
dp1[i][j]...1~i番目の料理でj分以内完食可能最大
dp2[i][j]...i~N番目の料理でj分以内完食可能最大
として
i番目以外res = max(dp[i-1][j] + dp[i+1][T-1-j]) + Bi

*/

ll dp1[3001][6002];
ll dp2[3001][6002];

int main() {
    int N,T; cin >> N >> T;
    vector<ll> A(N), B(N);
    for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
    vector<pair<ll,ll> > P(N);
    for (int i = 0; i < N; i++) P[i] = make_pair(A[i],B[i]);
    sort(P.begin(),P.end());
    
    
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < T; j++) {
            dp1[i+1][j] = dp1[i][j];
            if (j-P[i].first >= 0)
            chmax(dp1[i+1][j], dp1[i][j-P[i].first]+P[i].second);
        }
    }
  
    //for (int i = 0; i < T; i++) cout << dp1[N-1][i]+P[N-1].second << " ";
    ll res = -1;
    for (int i = 0; i < N; i++) {
        ll tmp = -1;
        for (int j = 0; j < T; j++) {
            chmax(tmp,dp1[i][j]);
        }
        chmax(res,tmp+P[i].second);
    }
    cout << res << endl;





}




Measured memory_bytes: 142208
N = int(input())
H = list(map(int, input().split()))

count = 1 #西の旅館からは見えるため
No = True
for i, hi in enumerate(H):
    if i == 0:
        continue
    No = True
    for j in range(0, i):
        if H[j] > hi:
            No = False
            break
    if No:
        count += 1
print(count)


Measured memory_bytes: 2940
n, k = map(int,input().split())
A = list(map(int,input().split()))

A.sort()
# print(A)
A_set = list(set(A))

A_set = [int(i) for i in A_set]
A_set.sort()

#print(A_set)

le = -1
ri = len(A_set)
mid = (le + ri) // 2

while ri - le > 1:
    need = 0
    # print(le,ri,mid)

    DP = [0 for i in range(k)]
    DP[0] = 1
    jogai = 0
    for i in range(n):
        #print(DP)
        if jogai == 0 and A[i] == A_set[mid]:
            jogai = 1
        else:
            for p in range(k-1, A[i]-1, -1):
                DP[p] = int(DP[p-A[i]] or DP[p])
            # print(j)
    
            #print(DP)
        for p in range(max(0, k-A_set[mid]), k):
            if DP[p] == 1:
                need = 1
                break
        if need == 1:
            break
    
    if need == 1:
        ri = mid
    else:
        le = mid
    mid = (le + ri) // 2


ans = 0

if le != -1:
    jougen = A_set[le]
    for i in range(n):
        if A[i] <= jougen:
            ans += 1

print(ans)

Measured memory_bytes: 48220