akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int main(){
    string s;
    cin>>s;
    int an=100000;
    REP(c,26){
        VI d;
        REP(i,SZ(s)){
            if(s[i]==c+'a')d.PB(i);
        }
        if(SZ(d)==0)continue;
        int ma=-1;
        REPP(i,1,SZ(d)){
            ma=max(ma,(d[i]-d[i-1]-1));
        }
        ma=max(ma,d[0]);
        ma=max(ma,SZ(s)-1-d.back());
        an=min(an,ma);
    }
    cout<<an<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
double pi = 3.141592653589793;
ll mod = 1000000007;

int main() {
    int N;
    cin >> N;
    ll a[N];
    for (int i = 0; i < N; i++){
        int x;
        cin >> x;
        a[x - 1] = i;
    }
    set<ll> s;
    s.insert(-1);
    s.insert(N);
    ll ans = 0;
    for(int i = 0; i < N; i++){
        s.insert(a[i]);
        set<ll>::iterator itr = s.find(a[i]);
        itr--;
        ll left = *itr;
        itr++;
        itr++;
        ll right = *itr;
        ans += (a[i] - left) * (right - a[i]) * (i + 1);
    }
    cout << ans << endl;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    string s;
    cin >> s;
    const ll MOD = 1e9+7;
    ll n = s.size();
    vector<vector<ll>> dp(n,vector<ll>(13,0));
    vector<ll> spare(n);
    spare.at(0) = 1;
    if(s.at(n-1) != '?'){
        ll now = s.at(n-1)-'0';
        ++dp.at(0).at(now);
    }else{
        for(i = 0;i < 10;++i){
            dp.at(0).at(i)++;
        }
    }
    for(i = 1;i < n;++i){
        spare.at(i) = spare.at(i-1)*10%13;
        if(s.at(n-1-i) != '?'){
            ll now = s.at(n-1-i) - '0';
            ll sp = now*spare.at(i)%13;
            rep(j,13){
                dp.at(i).at(j) += dp.at(i-1).at((j + 13 - sp)%13);
                dp.at(i).at(j) %= MOD;
            }
        }else{
            rep(j,10){
                ll sp = j*spare.at(i)%13;
                ll l;
                rep(l,13){
                    dp.at(i).at(l) += dp.at(i-1).at((l + 13 - sp)%13);
                    dp.at(i).at(l) %= MOD;
                }
            }
        }
    }
    cout << dp.at(n-1).at(5) << endl;
    return 0;
}

Measured memory_bytes: 14464
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b;
  char op;
  cin >> a >> op >> b;
  while(op!='?'){
    int c;
    if(op=='+') c=a+b;
    if(op=='-') c=a-b;
    if(op=='*') c=a*b;
    if(op=='/') c=a/b;
    cout << c << endl;
    cin >> a >> op >> b;
  }
  return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    char X, Y; cin >> X >> Y;

    if (X > Y) {
        cout << ">" << endl;
    } else if (X == Y) {
        cout << "=" << endl;
    } else {
        cout << "<" << endl;
    }

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

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

  int res = 0;

  repi(i, a, b + 1) {
    string s = to_string(i);
    string r = string(s.rbegin(), s.rend());
    if (s == r) {
      res++;
    }
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) cout << #var << ": " << var << endl
using namespace std;
using Int = int64_t;
using Uint = uint64_t;
constexpr Uint mod = 1e9 + 7;
constexpr Int INF = INT_MAX;
using Container = vector<Int>;
template<typename T>
using Grid = vector<vector<T>>; // 二次元配列。[y][x]
template<typename T, typename U>
using Umap = unordered_map<T, U>;
template<typename T>
using Uset = unordered_set<T>;
template<typename T>
using P = pair<T, T>;

int main() {

	string S, T; cin >> S >> T;
	Int a, b; cin >> a >> b;
	string U; cin >> U;
	if (U == S)a--;
	else b--;

	cout << a << " " << b;

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <cmath>
using namespace std;
template<class T> T ceil(T a, T b) { return a / b + !!(a % b); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using pll = pair<long long, long long>;
using edge = pair<int, pll>;
using Graph = vector<vector<edge>>;
int main() {
    int n, m; cin >> n >> m;
    int s, t; cin >> s >> t; s--, t--;
    Graph g(n);
    while (m--) {
        int u, v; cin >> u >> v; u--, v--;
        long long a, b; cin >> a >> b;
        g[u].emplace_back(v, pll(a, b));
        g[v].emplace_back(u, pll(a, b));
    }
    using T = long long;
    const T INF = numeric_limits<T>::max();
    vector<T> dp(n, INF);
    using P = pair<T, int>;
    priority_queue<P, vector<P>, greater<P>> que;
    que.emplace(dp[s] = 0, s);
    auto calc = [&](long long cur, pll &p) {
        long long a, b; tie(a, b) = p;
        auto f = [&](long long t) { return t + ceil(b, t + a); };
        long long mi = f(cur), t = sqrt(b) - a;
        for (int d: {-1, 0, 1}) if (cur <= t + d) chmin(mi, f(t + d));
        return mi;
    };
    while (!que.empty()) {
        long long cur; int u; tie(cur, u) = que.top(); que.pop();
        if (dp[u] < cur) continue;
        for (auto &e: g[u]) {
            int v = e.first;
            if (chmin(dp[v], calc(cur, e.second))) que.emplace(dp[v], v);
        }
    }
    cout << (dp[t] == INF ? -1 : dp[t]) << endl;
    return 0;
}



Measured memory_bytes: 26548
parseInt(x) = parse(Int,x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  (H,N) = map(parseInt, split(readline()))
  A = map(parseInt, split(readline()))
  if sum(A) >= H
    println("Yes")
  else
    println("No")
  end
end

main()

Measured memory_bytes: 113296
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
 
// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
using namespace __gnu_pbds;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;

const int maxn = 3e3 + 7;
double dp[maxn][maxn], p[maxn];
int n;

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> p[i];
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++)
        for(int j = 0; j <= i; j++)
            dp[j][i] = dp[j][i-1] * (1 - p[i]) + (j > 0 ? dp[j-1][i-1] : 0) * p[i];
    double ans = 0;
    for(int i = (n + 1) / 2; i <= n; i++)
        ans += dp[i][n];
    cout << setprecision(12);
    cout << fixed;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 70016
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> a(N, true);
  
  for(int i=0; i<K; i++){
    int d;
    cin >> d;
    for(int j=0; j<d; j++){
      int n_no;
      cin >> n_no;
      a.at(n_no-1) = false;
    }
  }
  
  int res = 0;
  for(int i=0; i<N; i++){
    if(a.at(i)){
      res+=1;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
    ll A,B;
  	cin >> A >> B;
  	if((A+B)%2==0){
      cout << (A+B)/2;
    }else{
      cout << "IMPOSSIBLE";
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define ll long long

int main()
{
    int n;cin>>n;
    ll a,b,sum=0;
    vector<pair<ll,ll> > v;
    for(int i=0; i<n; i++){
        cin >> a >> b;
        v.push_back(make_pair(b,a));
    }
    // cout << endl;
    sort(v.begin(),v.end());
    for(auto value:v){
        sum += value.second;
        if(sum > value.first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 6384
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
string s, t;
int main(void){
    cin >> s >> t;
    sort(ALL(s));
    sort(t.rbegin(), t.rend());
    (s < t ? puts("Yes") : puts("No"));
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define FOR(i, s, n) for(int i=(int)(s); i<(int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> mat;
// mat dtable(M, vl(N, 0)); M行N列 のサイズで,0で初期化


const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 998244353;

int main(){
    int N; cin >> N;
    vl A(N);
    REP(i, N) cin >> A[i];
    sort(ALL(A));
    int l = 0;
    int r = A.size() - 1;
    vector<pair<ll, ll>> ans;
    REP(i, N-1){
        int x = A[l] - A[r];
        int y = A[r] - A[l];
        // cout << l << " " << r << endl;
        if (l + 1 == r){
            ans.pb(make_pair(A[r], A[l]));
            // cout << A[r] << " " << A[l] << endl;
            break;
        }
        if (A[r-1] - x > y - A[l+1]){
            ans.pb(make_pair(A[l], A[r]));
            // cout << A[l] << " " << A[r] << endl;
            A[l] = x;
            --r;
        }else{
            ans.pb(make_pair(A[r], A[l]));
            // cout << A[r] << " " << A[l] << endl;
            A[r] = y;
            ++l;
        }
    }
    cout << (ans[ans.size()-1].first - ans[ans.size()-1].second) << endl;
    REP(i, ans.size()){
        cout << ans[i].first << " " << ans[i].second << endl;
    }
}

Measured memory_bytes: 4336
#include<stdio.h>
int main(void)
{
	int g[1000],k[1000],i,w[1000],z[1000];
	char n[1000][1000];
	for(i=0;i<9;i++){
		scanf("%s %d %d",n[i],&g[i],&k[i]);
	}	
	for(i=0;i<9;i++){
		z[i]=g[i]+k[i];
		w[i]=g[i]*200+k[i]*300;
	}
	for(i=0;i<9;i++){
		printf("%s %d %d\n",n[i],z[i],w[i]);
	}
	return 0;
}

Measured memory_bytes: 1048
# 156-C
N = int(input())
X = [int(x) for x in input().split()]
cnt = 0
A = 0
while cnt <= 100:
  cnt += 1
  i = 0
  while i < N:
    A += (int(X[i])-cnt)*(int(X[i])-cnt)
    i += 1
  if cnt == 1:
    ans = A
  else:
    ans = min(ans, A)
  A = 0
print (ans)


Measured memory_bytes: 3060
from collections import defaultdict
xs,ys,xt,yt=map(int,input().split())
P=[]
inf=float("inf")
P.append((xs,ys,0))
P.append((xt,yt,0))
N=int(input())
for i in range(N):
  x,y,r=map(int,input().split())
  P.append((x,y,r))

G=defaultdict(int)
for i in range(N+2):
  for j in range(N+2):
      x1,y1,r1,x2,y2,r2=P[i][0],P[i][1],P[i][2],P[j][0],P[j][1],P[j][2]
      d=((x1-x2)**2+(y1-y2)**2)**(1/2)
      G[(i,j)]=max(0,d-r1-r2)

def dijkstra():
  d=[inf]*(N+2)
  d[0]=0
  used=[False]*(N+2)
  
  while True:
    v=-1
    for i in range(N+2):
      if used[i]==False and (v==-1 or d[i]<d[v]):
        v=i
    if v==-1:
      break
    used[v]=True
    for j in range(N+2):
      d[j]=min(d[j],d[v]+G[(v,j)])    
  return d[1]
print(dijkstra())


Measured memory_bytes: 151376
#include <iostream>

using namespace std;
using ll = long long;

int main() {
    int K, S, ans = 0;
    cin >> K >> S;

    for (int y = 0; y <= K; y++) {
        for (int z = 0; z <= K; z++) {
            int x = S - y - z;
            if (0 <= x && x <= K) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>
bool p[111111];
int rui[111111];

bool is_prime(int n){
    if(n<=1)
        return 0;
    for(int i=2;i*i<=n;i++){
        if(n%i==0)
            return 0;
    }
    return 1;
}

int main() {
    int q;
    cin>>q;
    for(int i=2;i<=100000;i++){
        if(is_prime(i)&&is_prime((i+1)/2))
            rui[i]++;
    }
    for(int i=2;i<=100000;i++)rui[i]+=rui[i-1];

    while(q--){
        int l,r;
        cin>>l>>r;
        cout<<rui[r]-rui[l-1]<<endl;
    }
    return 0;
}


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

class Dijkstra{ //O((N+M)logN)
    private:
        vector<vector<pair<int,long long>>> graph; //pair<next.path,cost>
        vector<long long> total_cost;
        vector<vector<int>>  shortest_path;
    
    public:
        Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
            priority_queue<
                pair<int,long long>,
                vector<pair<int,long long>>,
                greater<pair<int,long long>>> q;
            vector<long long> cost(size,1e18+7);
            vector<vector<int>> path(size);
            if(path_check) for(int i=0;i<size;i++) path[i].push_back(i);//自分は必ず通る
            cost[start] = 0;
            q.push(make_pair(0ll,start));
            while (!q.empty()){
                auto now = q.top();
                q.pop();
                int prev = now.first;
                if( cost[prev] < now.second) continue;
                for (auto next : graph[prev]){
                    if (cost[next.first] <= cost[now.first] + next.second) continue;
                    cost[next.first] = cost[now.first] + next.second;
                    //先頭からpathを追加
                    if(path_check) path[next.first].insert(path[next.first].begin(),path[now.second].begin(),path[now.second].end()); 
                    q.push(next);
                }
            }
            total_cost = cost;
            if(path_check) shortest_path = path;
        }
        vector<long long> get_cost(){ return total_cost; }
        vector<vector<int>> get_path(){ return shortest_path; }
};
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
const long long inf = 1e18+7;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    //長さ、次の場所のペア
    vector<vector<pair<int,ll>>> graph(n);
    rep(i,0,m){
        int l,r,c;
        cin >> l>>r>>c;
        l--;
        r--;
        graph[l].push_back(make_pair(r,c));
    }
    rep(i,1,n) graph[i].push_back(make_pair(i-1,0));

    Dijkstra g(graph,0,n);
    if(g.get_cost()[n-1] == inf) cout << -1 << endl;
    else cout << g.get_cost()[n-1] << endl;
    /*
    vector<ll> ans = Dijk(graph,0,n);
    if(ans[n-1] == inf) cout << -1 << endl;
    else cout << ans[n-1] << endl;
    */
}

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

int main()
{
    int n, k;
    cin >> n >> k;

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

    for(int i=0; i<n-k; i++){
        if(a[i] >= a[i+k]) cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;


string str;
bool Q(size_t &i);
ll E(size_t &i);
ll T(size_t &i);
ll F(size_t &i);
ll N(size_t &i);

bool Q(size_t &i){
	ll lhs = 1, rhs = 0;
	try{
		lhs = E(i);
		if(i == str.size() || str[i] != '=')return false;
		rhs = E(++i);
	} catch(int){
		return false;
	}
//	cerr << lhs << " " << rhs << endl;
	if(i < str.size())return false;
	if(lhs == rhs)return true;
	else return false;
}

ll E(size_t &i){
	auto lhs = T(i);
//	cerr << lhs << ";";
	while(i < str.size()){
		auto ope = str[i];
		if(ope != '+' && ope != '-')return lhs;
		auto rhs = T(++i);
		if(ope == '+')lhs = lhs + rhs;
		else if(ope == '-')lhs = lhs - rhs;
		else return lhs;
	}
	return lhs;
}

ll T(size_t &i){
	ll lhs = F(i);
	while(i < str.size() && str[i] == '*'){
		auto rhs = F(++i);
		lhs = lhs * rhs;
	}
	return lhs;
}

ll F(size_t &i){
	if(i >= str.size())throw -1;
	if(str[i] == '('){
		ll ret = E(++i);
		if(i >= str.size() || str[i] != ')')throw -1;
		i++;
		return ret;
	}
	if(str[i] == '-'){
		auto ret = F(++i);
		return -ret;
	}
	return N(i);
}

ll N(size_t &i){
	if(str[i] == '0'){i++; return 0;}
	if(str[i] != '1')throw -1;
	ll ret = 1;
	i++;
	for(;i < str.size() && isdigit(str[i]);i++){
		ret <<= 1;
		if(str[i] == '1')ret += 1;
	}
	return ret;
}

bool next_combination(const vector<int>::iterator begin, const vector<int>::iterator end, const int r){
	if(r == 0)return false;
	auto target = upper_bound(begin, begin+r, *(end-1));
	if(target != begin)--target;
	if(target == begin && *target >= *(end-1)){
		rotate(begin, begin+r, end);
		return false;
	}
//	cerr << "hi";
	auto next = upper_bound(begin+r, end, *target);
	swap(*target, *next);
	++target; ++next;
	vector<int> arr;
	for(auto itr = next; itr != end; ++itr)arr.push_back(*itr);
	for(auto itr = target; itr != begin+r; ++itr)arr.push_back(*itr);
	size_t idx = 0;
	for(auto itr = target; itr != end && idx < arr.size(); ++itr){
		if(itr == begin+r && next != end)itr = next;
		swap(arr[idx], *itr);
		idx++;
	}
	return true;
}

signed main(){
	string raw;
	cin >> raw;
	map<char, int> m;
	int cnt = 0;
	for(auto e : raw){
		if(isalpha(e) && m.find(e) == m.end()){
			m[e] = cnt++;
		}
	}
//	cerr << cnt << endl;
	if(cnt > 8){
		cout << 0 << endl;
		return 0;
	}
	vector<char> c = {'0', '1', '+', '-', '*', '(', ')', '='};
	vector<int> idx={0,1,2,3,4,5,6,7};
	int ans = 0;
	do{	
		do{
			size_t i = 0;
			for(auto &e : raw){
				if(m.find(e) != m.end()){
					str.push_back(c[idx[m[e]]]);
				}
				else{
					str.push_back(e);
				}
			}
//			cerr << str << endl;
			if(Q(i)){
				ans++;
			}
			str.resize(0);
		}while(next_permutation(idx.begin(), idx.begin()+cnt));
	}while(cnt != 8  && next_combination(ALL(idx),cnt));
	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 3288
#include <iostream>
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define li long ll
#define pp pair<ll, ll>
#define lb lower_bound
#define ub upper_bound
#define mk make_pair
#define pb push_back
#define llp(i, x, n) for (ll i = x; i < n; i++)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define fr first
#define ss second
#define mod 1000000007
using namespace std;
int main()
{
	fast;
    float d,t,s;
    cin>>d>>t>>s;
    float x=d/s;
    if(x<=t)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3736
#include        "algorithm"
#include        "iostream"
#include        "numeric"
#include        "iomanip"
#include        "cstring"
#include        "math.h"
#include        "bitset"
#include        "string"
#include        "vector"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        "ext/pb_ds/assoc_container.hpp" // Common file
#include        "ext/pb_ds/tree_policy.hpp" // Including tree_order_statistics_node_update
#include        "ext/pb_ds/detail/standard_policies.hpp"

using namespace std;
using namespace __gnu_pbds;


#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          N (int)2e5+5
#define          pb push_back
#define          mod 1000000007
#define          ld long double
#define          vi vector<int>
#define          eb emplace_back
#define          vpii vector<pii>
#define          mii map<int,int>
#define          int long long 
#define          pii pair<int,int>
#define          pq priority_queue
#define          BLOCK (int)sqrt(N)
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) rbegin(x),rend(x)
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          PI acos(-1.0)
#define 		 bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > 
OS ;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,m,k,q;
string s;
vi adj[N];
int vis[N],par[N],a[N];

void go()
{
	cin >> n >> m >> k;

	swap( n , m );
	swap( n , k );

	cout << n << ' '  << m << ' ' << k << endl;
}

int32_t main()
{
	//INP(); 
	FAST;     
	int t=1; 
	// cin>>t;
	test(t) go();
}

 

Measured memory_bytes: 5504
a,b,c,d = map(int,input().split())
from fractions import gcd
lcm = c * d // gcd(c, d)
def num_of_complements(x,c,d,lcm):
    num = x + x//lcm - x//c - x//d
    return num

ans = num_of_complements(b,c,d,lcm) - num_of_complements(a-1,c,d,lcm)
print(ans)


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


typedef struct dic{
	int value;
	struct dic* under;
	struct dic* over;
} dictionary;

int getChar(char ch){
	if ( ch == 'A') return 1;
	else if ( ch == 'C') return 2;
	else if ( ch == 'G') return 3;
	else if ( ch == 'T') return 4;
}
int CharValue(char ch[]){
	int ret = 0;
	for(int i = 0;ch[i] != '\0'; i++){
		ret *= 5;
		ret += getChar(ch[i]);
	}
	return ret;
}

int main() {
	int n;
	scanf("%d",&n);

	dictionary first;
	first.value = 0;
	first.under = NULL;
	first.over = NULL;
	
	for(int i = 0; i < n; i++){
		char type[10];
		scanf("%s",type);
		if(strcmp(type,"insert") == 0){
			char value[15];
			if(first.value == 0){
				scanf("%s",value);
				first.value = CharValue(value);
			}else{
				dictionary *p = &first;
				scanf("%s",value);
				int v = CharValue(value);
				for(int quit = 0;quit < 5 ;){
					if(p->value < v){
						if(p->over == NULL){
								//導入
							dictionary *ins;
							if ((ins = (dictionary *) malloc(sizeof(dictionary))) == NULL) {
								break;
							}
							ins->value = v;
							ins->under = NULL;
							ins->over = NULL;
							p->over = ins;
							quit = 10;
						}else{
							p = p->over;
						}
					}else if(p->value > v){
						if(p->under == NULL){
							//導入
							dictionary *ins;
							if ((ins = (dictionary *) malloc(sizeof(dictionary))) == NULL) {
								break;
							}
							ins->value = v;
							ins->under = NULL;
							ins->over = NULL;
							p->under = ins;
							quit = 10;
						}else{
							p = p->under;
						}
					}else{
						quit = 10;
					}
				}
			}
		}else if(strcmp(type,"find") == 0){
			char value[15];
			scanf("%s",value);
			int v = CharValue(value);
			
			dictionary *p = &first;
			
			for(int quit = 0;quit < 5 ;){
				if(p->value < v){
					if(p->over == NULL){
						quit = 10;
						printf("no\n");
					}else{
						p = p->over;
					}
				}else if(p->value > v){
					if(p->under == NULL){
						quit = 10;
						printf("no\n");
					}else{
						p = p->under;
					}
				}else{
					printf("yes\n");
					quit = 10;
				}
				
				
			}
		}
	}
	return 0;
}






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

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(){
  string N;
  int ans = 0;
  cin >> N;
  for(int i = 0;i < N.length();i++){
    ans += N[i] - '0';
  }
  
  if(ans%9 == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <stdio.h>

#define rep(i,min,sup) for(int i=min;i<sup;i++)
#define per(i,min,sup) for(int i=(sup-1);i>=min;i--)
#define swap(a,b) {a+=b;b=a-b;a-=b;}
#define ll long long

using namespace std;

main(){
  int N,M,X;
  scanf("%d %d %d",&N,&M,&X);
  int C[N];
  int A[N][M];
  rep(i,0,N){
    scanf("%d",&C[i]);
    rep(j,0,M){
      scanf("%d",&A[i][j]);
    }
  }
  
  int U[M];
  bool b=false,c;
  int minc=0;
  int p;
  rep(i,0,(1<<N)){
    p=0;
    rep(j,0,N){
      if(i&(1<<j))p+=C[j];
    }
    if(!b||p<minc){
      c=true;
      rep(j,0,M)U[j]=0;
      rep(j,0,N){
        if(i&(1<<j)){
          rep(k,0,M)U[k]+=A[j][k];
        }
      }
      rep(j,0,M){
        if(U[j]<X)c=false;
      }
      if(c){
        minc=p;
        b=true;
      }
    }
  }
  if(b)printf("%d",minc);
  else printf("-1");
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;

vector<string> v;
string cur;
int n;

void f() {
    if (cur.size() == n) {
        v.pb(cur);
        return;
    }
    for (int i=1; i<=n; i++) {
        bool ok = 1;
        for (char c : cur) {
            if (c - '0' == i) {
                ok = 0;
            }
        }
        if (ok) {
            char c = '0' + i;
            cur += c;
            f();
            cur.pop_back();
        }
    }

}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    cin >> n;
    string p, q;
    for (int i=1; i<=n; i++) {
        char c;
        cin >> c;
        p += c;
    }
    for (int i=1; i<=n; i++) {
        char c;
        cin >> c;
        q += c;
    }
    f();
    sort(v.begin(), v.end());
    int x = 0, y = 0;
    for (int i=0; i<v.size(); i++) {
        if (v[i] == p) x = i;
        if (v[i] == q) y = i;
    }
    cout << abs(x - y) << "\n";

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 2424
X = int(input())

if X >= 1800:
    print(1)
elif X >= 1600:
    print(2)
elif X >= 1400:
    print(3)
elif X >= 1200:
    print(4)
elif X >= 1000:
    print(5)
elif X>= 800:
    print(6)
elif X >= 600:
    print(7)
else:
    print(8)


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

int c[] = {500, 100, 50, 10, 5, 1};

int main(){
	for(;;){
		int N;
		cin >> N;
		if(N == 0) break;
		N = 1000 - N;
		int res = 0;
		for(int i = 0; i < 6; i++){
			int num = N / c[i];
			res += num;
			N -= c[i] * num;
		}
		cout << res << endl;
	}
	return 0;
}


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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF INT_MAX/2 //(1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

  int N;
  cin>>N;
  vector<vector<int> >a(N,vector<int>(3));
  for(int i=0;i<N;i++)for(int j=0;j<3;j++)cin>>a[i][j];

  vector<vector<int> >dp(N+1,vector<int>(3,0));
  
  for(int i=1;i<=N;i++){
    for(int j=0;j<3;j++){

      int Max=-INF;
      for(int k=0;k<3;k++){
        if(j==k)continue;
        Max = max(dp[i-1][k]+a[i-1][j],Max);
      }

      dp[i][j] = Max;

    }
  }

  int ans = 0;
  for(int j=0;j<3;j++){
    ans=max(ans,dp[N][j]);
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

int h, w;
vector<vector<bool>> senbei;

vector < vector<bool>> rev(int a) {
	auto tmp = senbei;
	int ct = 0;
	for (int i = 1; i < (1 << h); i = i << 1) {
		ct++;
		if (a & i) {
			for (int j = 0; j < w; j++) {
				tmp[ct - 1][j] = !tmp[ct - 1][j];
			}
		}
	}
	return tmp;
}

int main() {
	while (cin >> h >> w, h * w) {
		senbei.resize(h);
		for (int i = 0; i < h; i++) {
			senbei[i].resize(w);
			for (int j = 0; j < w; j++) {
				int tmp;
				cin >> tmp;
				senbei[i][j] = static_cast<bool>(tmp);
			}
		}
		int ans = 0;
		for (int i = 0; i < (1 << h); i++) {
			auto tmp = rev(i);
			int ct = 0;
			for (int i = 0; i < w; i++) {
				int c = 0;
				for (int j = 0; j < h; j++) {
					if (tmp[j][i])c++;
				}
				c = max(c, h - c);
				ct += c;
			}
			ans = max(ct, ans);
		}
		cout << ans << endl;
		senbei.clear();
	}
	return 0;
}

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


struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main(){
    string S;
    cin>>S;
    int s = (S[0]-48)*10 + (S[1]-48);
    int ss = (S[2]-48)*10 + (S[3]-48);
    if(s>12 || s==0){
        if(ss>12||ss==0){
            cout<<"NA";
        }

        else{
            cout<<"YYMM";
        }    

    }
    else{
        if(ss>12||ss==0){
            cout<<"MMYY";
        }
        else{
            cout<<"AMBIGUOUS";
        }
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,m,mx,mc,F,A,B,vis[maxn],cnt;
vector <int> mp[maxn];

inline void dfs(int u)
{
	vis[u]=1;
	for(int i=0;i<mp[u].size();i++)
	{
		int v=mp[u][i]; if(v==B) cnt++;
		if(vis[v]) continue; dfs(v);
	}
}

int main()
{
	n=read(); m=read(); rep(i,1,m){int u=read(),v=read(); mp[u].pb(v); mp[v].pb(u);}
	rep(i,1,n)
	{
		if(mp[i].size()%2==1) return puts("No"),0;
		if(mx<mp[i].size()) mx=mp[i].size(),mc=1;
		else mc+=(mx==(int)mp[i].size());
	}
	if(mx>=6) F=1;
	else if(mx==2||mc==1) F=0;
	else if(mx==4&&mc>2) F=1;
	else
	{
		rep(i,1,n) if(mp[i].size()==4) if(!A) A=i; else B=i;
		vis[B]=1; dfs(A);
		if(cnt==4) F=0; else F=1;
	}
	puts(F?"Yes":"No");
	return 0;
}

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

INF = 10**18

N = int(input())
X = [0] * N
Y = [0] * N
U = [''] * N
for i in range(N):
    x, y, u = input().split()
    X[i] = int(x)
    Y[i] = int(y)
    U[i] = u
M = 200000

def rotate():
    s = 'ULDR'
    for i in range(N):
        X[i], Y[i] = M - Y[i], X[i]
        U[i] = s[(s.index(U[i]) + 1) % 4]

def calc1():
    v = [[] for _ in range(M+1)]
    for x, y, u in zip(X, Y, U):
        if u in 'RL':
            v[y].append((x, u))
    ret = INF
    for y in range(M+1):
        v[y].sort(key=lambda p: p[0])
        for i in range(len(v[y])-1):
            if v[y][i][1] == 'R' and v[y][i+1][1] == 'L':
                ret = min(ret, (v[y][i+1][0] - v[y][i][0]) * 5)
    return ret

def calc2():
    v = [[] for _ in range(2*M+1)]
    for x, y, u in zip(X, Y, U):
        if u in 'UR':
            v[x+y].append((x, u))
    ret = INF
    for xy in range(2*M+1):
        v[xy].sort(key=lambda p: p[0])
        for i in range(len(v[xy])-1):
            if v[xy][i][1] == 'R' and v[xy][i+1][1] == 'U':
                ret = min(ret, (v[xy][i+1][0] - v[xy][i][0]) * 10)
    return ret

ans = INF
for i in range(4):
    ans = min(ans, calc1(), calc2())
    rotate()
print(ans if ans < INF else 'SAFE')

Measured memory_bytes: 260876
#pragma comment(linker, "/STACK:10240000")
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 220;
const int MAX_INF = 0x3fffffff;

int n, r, mins;
int a[MAXN], c[MAXN], w[MAXN][MAXN];
bool use[MAXN];

void floyd ()
{
    for (int k = 1; k <= n; k ++)
    {
        for (int i = 1; i <= n; i ++)
        {
            for (int j = 1; j <= n; j ++)
            {
                if (w[i][k] + w[k][j] < w[i][j])
                {
                    w[i][j] = w[i][k] + w[k][j];
                }
            }
        }
    }
}

void dfs (int k)
{
    if (k > r)
    {
        int tmp = 0;
        for (int i = 1; i < n; i ++)
        {
            tmp += w[a[c[i]]][a[c[i + 1]]];
        }
        if (tmp < mins)
        {
            mins = tmp;
        }
    }
    else
    {
        for (int i = 1; i <= r; i ++)
        {
            if (use[i])
            {
                c[k] = i;
                use[i] = false;
                dfs (k + 1);
                use[i] = true;
            }
        }
    }
}

int main ()
{
    int m;
    scanf ("%d%d%d", &n, &m, &r);
    for (int i = 1; i <= r; i ++)
    {
        scanf ("%d", &a[i]);
    }
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= n; j ++)
        {
            w[i][j] = MAX_INF;
        }
    }
    for (int i = 1; i <= m; i ++)
    {
        int x, y, z;
        scanf ("%d%d%d", &x, &y, &z);
        w[x][y] = w[y][x] = z;
    }
    floyd ();
    mins = MAX_INF;
    memset (use, true, sizeof (use));
    dfs (1);
    printf ("%d\n", mins);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>
#include <cstdio>
using namespace std;
stack <int> st;
int solve(string);
int main(){
  string str;
  while(cin>>str){
    if(str=="+"||str=="-"||str=="*"||str=="/")
      st.push(solve(str));
    else st.push(atoi(str.c_str()));
    if(getchar()=='\n'){
      cout << st.top() << endl;
      return 0;
    }
  }
}
int solve(string str){
  int b = st.top(); st.pop();
  int a = st.top(); st.pop();
  if(str=="+")return a+b;
  else if(str=="-")return a-b;
  else if(str=="*")return a*b;
  else if(str=="/")return a/b;
}


Measured memory_bytes: 3196
// みなさん私はカーティキー・シャルマです。LNMIITで勉強しています。私は2年目で、コロナパンデミックが発
// 生しています。世界は終わりそうだ。だから私はそれを最大限に生きたいと思っています。それはつまり、コー
// ドを最大限に意味しているのです。私の好きなアニメは「キメツノヤイバ」で、私の一番の男の子はゼニツで、
// 私の一番の女の子はネズコです。私の好きな呼吸スタイルは息吹です。私の最高の悪魔の血の芸術は、
// ククシボによって使用される月の息です。ムーザンは亡くなり、今ではタンジローがポップの新しい魔王です。
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(lld i = 0; i < n; i+=1)
#define fod(i,n) for(lld i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
      FastIO
      lld a, b;
      cin >> a >> b;
      if ((b-(2*a))%2 == 0){
            lld y = (b-(2*a))/2;
            lld x = a-y;
            if (y >= 0 && x >= 0 && x+y == a){
                  cout << "Yes";
            }
            else{
                  cout << "No";
            }
      }
      else{
            cout << "No";
      }
      return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using P = std::pair<int, int>;

int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    std::vector<std::string> W(N);
    for (int i = 0; i < N; i++) {
        std::cin >> W[i];
    }

    bool flag = true;
    for (int i = 0; i < N-1; i++) {
        if (W[i].back() != W[i+1].front()) {
            flag = false;
        }
    }

    for (int i = 0; i < N-1; i++) {
        for (int j = i+1; j < N; j++) {
            if (W[i] == W[j]) {
                flag = false;
            }
        }
    }

    if (flag) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No"  << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

k = I()
print("ACL"*k)

Measured memory_bytes: 65464
#include <stdio.h>

int main(void)
{
	int x, y, i, j;
	char op=0;


	for(;;){
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0) {
			break;
		}

		for (i = 0; i < x; i++) {
			
			for (j = 0; j < y; j++) {
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2668
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) int {
	ans := l[0]
	for _, n := range l {
		if n > ans {
			ans = n
		}
	}
	return ans
}

func min(l []int) int {
	ans := l[0]
	for _, n := range l {
		if n < ans {
			ans = n
		}
	}
	return ans
}

func invalid(s int) int {
	if s == 1000000000 {
		return s - 1
	}
	return s + 1
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()
	s := nextInt()
	ans := make([]int, n, n)
	if k == n {
		for i := 0; i < n; i++ {
			ans[i] = s
		}
	} else if k == 0 {
		for i := 0; i < n; i++ {
			ans[i] = invalid(s)
		}
	} else if s%2 == 0 {
		a := s / 2
		for i := 0; i < n; i++ {
			if i < k+1 {
				ans[i] = a
			} else {
				ans[i] = invalid(s)
			}
		}
	} else {
		a := s / 2
		if a == 0 {
			for i := 0; i < n; i++ {
				if i < k {
					ans[i] = a + 1
				} else {
					ans[i] = invalid(s)
				}
			}
		} else {
			for i := 0; i < n; i++ {
				if i < k+1 {
					ans[i] = a + (i % 2)
				} else {
					ans[i] = invalid(s)
				}
			}
		}
	}
	for i, x := range ans {
		if i != n-1 {
			fmt.Printf("%v ", x)
		} else {
			fmt.Printf("%v\n", x)
		}
	}
}


Measured memory_bytes: 3328
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define fastAF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define int ll
#define ull unsigned ll
#define ld long double
#define pb push_back
#define pf push_front
#define dll deque<ll>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mapll map<ll,ll>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ms(a,x) memset(a,x,sizeof(a))
using namespace std;
void swap(auto*,auto*);
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fastAF
    string s; cin>>s;
    ll n=s.length(); 
    string t; cin>>t;
    ll m=t.length();
    ll minChanges=INT_MAX;
    for(ll i=0;i+m-1<n;i++)
    {
    	string temp=s.substr(i,m);
    	ll c=0;
    	for(ll j=0;j<m;j++)
    	{
    		if(temp[j]!=t[j]) c++;
    	}
    	minChanges=min(minChanges,c);
    }
    cout<<minChanges<<endl;
    return 0;
}
void swap(auto &a,auto &b)
{
    auto temp=a; a=b; b=temp;
}

Measured memory_bytes: 3664
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int n,k,a[105],dp[105][N],num[N];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=0;i<=k;i++)
		num[i]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=k;j++)
		{
			if(a[i]<j)
				dp[i][j]=(num[j]-num[j-a[i]-1]+mod)%mod;
			else
				dp[i][j]=num[j];
		}
		num[0]=dp[i][0]%mod;
		for(int j=1;j<=k;j++)
			num[j]=(num[j-1]+dp[i][j]%mod)%mod;
	}
	cout<<dp[n][k]%mod;
	return 0;
}

Measured memory_bytes: 40832
#include <stdio.h>

#define n_MAX 20
#define TRUE 1
#define FALSE 0

int combination(int [],int,int,int);

int main(){
  int A[n_MAX],n;
  int m,q;
  int i;

  scanf("%d",&n);
  for (i = 0;i < n;i++)
  scanf("%d",&A[i]);

  scanf("%d",&q);
  for (i = 0;i < q;i++){
    scanf("%d",&m);

    if (combination(A,0,n,m))
    printf("yes\n");

    else
    printf("no\n");
    
  }
  
  return 0;
}

int combination(int A[],int i,int n,int m){
int res;

  if (m == 0)
  return TRUE;

  if (i == n)
  return FALSE;

res = combination(A,i + 1,n,m) || combination(A,i + 1,n,m - A[i]);

return res;
}


Measured memory_bytes: 2148
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x, y, z = LI()
ans = (x - z) // (y+z)
print(ans)

Measured memory_bytes: 65548