akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int x;
  cin>>x;
  int ans = 1;
  FOR(i,2,33) {
    FOR(j, 2, 10) {
      if(pow(i,j) <= x) {
        ans = max(ans, (int)pow(i,j));
      } else {
        break;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main(void){
    int n, m;
    string s[100], t[100];
    
    cin >> n;
    for(int i = 0; i < n; i++) cin >> s[i];
    cin >> m;
    for(int i = 0; i < m; i++) cin >> t[i];
    
    int ans = 0, cnt;
    for(int i = 0; i < n; i++){
        cnt = 1;
        for(int j = i+1; j < n; j++)
            if(s[j] == s[i]) cnt++;
        
        for(int k = 0; k < m; k++)
            if(t[k] == s[i]) cnt--;
            
        if(cnt > ans) ans = cnt;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
using namespace std;
int  gcd(int a, int b) {
	if (a < b) gcd(b, a);
	int r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}
namespace NTT {
	const int MOD = 998244353;  // to be set appropriately
	const long long PR = 3;     // to be set appropriately

	void trans(vector<long long> &v, bool inv = false) {
		int n = (int)v.size();
		for (int i = 0, j = 1; j < n - 1; j++) {
			for (int k = n >> 1; k >(i ^= k); k >>= 1);
			if (i > j) swap(v[i], v[j]);
		}
		for (int t = 2; t <= n; t <<= 1) {
			long long bw = modpow(PR, (MOD - 1) / t, MOD);
			if (inv) bw = modinv(bw, MOD);
			for (int i = 0; i < n; i += t) {
				long long w = 1;
				for (int j = 0; j < t / 2; ++j) {
					int j1 = i + j, j2 = i + j + t / 2;
					long long c1 = v[j1], c2 = v[j2] * w % MOD;
					v[j1] = c1 + c2;
					v[j2] = c1 - c2 + MOD;
					while (v[j1] >= MOD) v[j1] -= MOD;
					while (v[j2] >= MOD) v[j2] -= MOD;
					w = w * bw % MOD;
				}
			}
		}
		if (inv) {
			long long inv_n = modinv(n, MOD);
			for (int i = 0; i < n; ++i) v[i] = v[i] * inv_n % MOD;
		}
	}

	// C is A*B
	vector<long long> mult(vector<long long> A, vector<long long> B) {
		int size_a = 1; while (size_a < A.size()) size_a <<= 1;
		int size_b = 1; while (size_b < B.size()) size_b <<= 1;
		int size_fft = max(size_a, size_b) << 1;

		vector<long long> cA(size_fft, 0), cB(size_fft, 0), cC(size_fft, 0);
		for (int i = 0; i < A.size(); ++i) cA[i] = A[i];
		for (int i = 0; i < B.size(); ++i) cB[i] = B[i];

		trans(cA); trans(cB);
		for (int i = 0; i < size_fft; ++i) cC[i] = cA[i] * cB[i] % MOD;
		trans(cC, true);

		vector<long long> res((int)A.size() + (int)B.size() - 1);
		for (int i = 0; i < res.size(); ++i) res[i] = cC[i];
		return res;
	}
};
typedef pair<int, int>p;
p point[200003];
#define int long long
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a[100004];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int l = 2, r = 2;
	for (int i = n - 1; i >= 0; i--) {
		int x = l / a[i] + (l%a[i] ? 1 : 0);
		int y = r / a[i];
		if (x > y) {
			cout << -1; return 0;
		}
		l = x*a[i];
		r = y*a[i] + a[i] - 1;
	}
	cout << l << " " << r;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

const int MAX = 30000000;
ll f[MAX],finv[MAX],inv[MAX];
void COMinit(int N){
    f[0] = 1;
    f[1] = 1;
    finv[0] = 1;
    finv[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=N;++i){
        f[i] = f[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 || N<0 || K <0){ return 0; }
    return f[N]*(finv[K]*finv[N-K]%MOD) %MOD;
}
ll fmod(ll x){
    return (x>=MOD?x%MOD:x);
}

ll bpow(ll a,ll N){
    if(N==0){
        return 1;
    }else if(N%2==0){
        return fmod(bpow(fmod(a*a),N/2));
    }else{
        return fmod(bpow(a,N-1)*a);
    }
}

int main(){
    int K; cin>>K;
    string s; cin>>s;
    int N = s.size();
    COMinit(N+K+1);
    ll ans = 0;
    for(int idx_N=N;idx_N<=N+K;++idx_N){
        ll temp = COM(idx_N-1,N-1);
        temp *= bpow(25,idx_N-N);
        temp = fmod(temp);
        temp *= bpow(26,N+K-idx_N);
        temp = fmod(temp);
        ans += temp;
        ans  = fmod(ans);
    }
    
    cout << ans << "\n";
}

Measured memory_bytes: 51132
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <queue>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

const double INF = 1e+18;

struct edge{
    int from, to;
    double cost;
};

template <typename T>
void dijkstra(int s, vector<T>& d, vector<vector<edge>>& G){
    d[s] = 0;

    priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> q;
    q.push({(T) 0, s});
    while(!q.empty()){
        auto tmp = q.top(); q.pop();
        T d_min = tmp.first;
        int v = tmp.second;
        if(d[v] < d_min) continue;
        for(auto e: G[v]){
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                q.push({d[e.to], e.to});
            }
        }
    }
}

int main()
{
    int xs, ys, xt, yt;
    cin >> xs >> ys >> xt >> yt;
    int N;
    cin >> N;
    vector<int> x(N+2), y(N+2), r(N+2);
    FOR(i, 1, N+1) cin >> x[i] >> y[i] >> r[i];

    x[0] = xs, y[0] = ys, r[0] = 0;
    x[N+1] = xt, y[N+1] = yt, r[N+1] = 0;

    vector<vector<edge>> G(N+2);
    REP(i, N+2){
        FOR(j, i+1, N+2){
            double d = max(0., sqrt(pow(x[i]-x[j], 2) + pow(y[i]-y[j], 2)) - (r[i]+r[j]));
            G[i].push_back({i, j, d});
            G[j].push_back({j, i, d});
        }
    }

    vector<double> d(N+2, INF);
    dijkstra<double>(0, d, G);
    cout << setprecision(10) << d[N+1] << endl;

    return 0;
}

Measured memory_bytes: 22000
def resolve():
    import sys
    input = sys.stdin.readline

    a, b, c = [int(x) for x in input().rstrip().split(" ")]

    if (a * b * c) % 2 == 0:
        print(0)
        return

    a, b, c = sorted([a, b, c])

    print(a * b)



if __name__ == "__main__":
    resolve()


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

#define PI acos(-1)
#define all(a) a.begin(), a.end()
#define full(a, n) a, a + n
#define ma(type, size) (type *)malloc(sizeof(type) * size)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define f0n(i, n) for (i = 0; i < (n); i++)
#define f1n(i, n) for (i = 1; i <= (n); i++)
#define fab(i, a, b) for (i = (a); i <= (b); i++)
#define fr(i, b, a) for (i = (b); i >= (a); i--)

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
	tree_order_statistics_node_update> indexed_set;
//*/
typedef long long int ll;
typedef long int lo;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

//* utility function
inline bool compare(ll i, ll j)
{
    return i < j;
}
//*/

//* function prototypes

//*/

//int row, column;
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
#ifdef DEBUG
#endif // DEBUG
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

// Returns LCM of array elements
ll findlcm(ll arr[], ll n)
{
    // Initialize result
    ll ans = arr[0];

    // ans contains LCM of arr[0], ..arr[i]
    // after i'th iteration,
    for (ll i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll n, i;

    cin >> n;
    ll arr[n];
    ll mul = 1;
    f0n(i, n)
    {
        cin >> arr[i];
    }
    mul = findlcm(arr, n);
    ll sum = 0;
    f0n(i, n)
    {
        sum += mul / arr[i];
    }
    cout << setprecision(15) << fixed << ((double)mul)/sum << endl;


    return 0;
}


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

template <typename T, typename U>
struct min_cost_flow_graph {
	
	struct edge {
		int from, to;
		T cap, f;
		U cost;
	};
	
	vector<edge> edges;
	vector<vector<int>> g;
	int n, st, fin;
	T required_flow, flow;
	U cost;
	
	min_cost_flow_graph(int n, int st, int fin, T required_flow)
		: n(n), st(st), fin(fin), required_flow(required_flow) {
			assert(0 <= st && st < n && 0 <= fin && fin < n && st != fin);
			g.resize(n);
			flow = 0;
			cost = 0;
	}
	
	void clear_flow() {
		for (const edge &e : edges) {
			e.f = 0;
		}
		flow = 0;
		cost = 0;
	}
	
	void add(int from, int to, T cap = 1, T rev_cap = 0, U cost = 1) {
		assert(0 <= from && from < n && 0 <= to && to < n);
		g[from].emplace_back(edges.size());
		edges.push_back({from, to, cap, 0, cost});
		g[to].emplace_back(edges.size());
		edges.push_back({to, from, rev_cap, 0, -cost});
	}
	
	U min_cost_flow() {
		while (flow < required_flow) {
			vector<int> prevv(n), preve(n);
			vector<U> dist(n, numeric_limits<U>::max() / 4);
			dist[st] = 0;
			for (bool update = true; update; ) {
				update = false;
				for (int i = 0; i < n; i++) {
					for (int id : g[i]) {
						const edge &e = edges[id];
						if (0 < e.cap - e.f && dist[e.from] + e.cost < dist[e.to]) {
							dist[e.to] = dist[e.from] + e.cost;
							prevv[e.to] = e.from;
							preve[e.to] = id;
							update = true;
						}
					}
				}
			}
			if (dist[fin] == numeric_limits<U>::max() / 4) {
				return -1;
			}
			T d = required_flow - flow;
			for (int v = fin; v != st; v = prevv[v]) {
				d = min(d, edges[preve[v]].cap - edges[preve[v]].f);
			}
			flow += d;
			cost += d * dist[fin];
			for (int v = fin; v != st; v = prevv[v]) {
				edges[preve[v]].f += d;
				edges[preve[v] ^ 1].f -= d;
			}
		}
		return cost;
	}
};

int main() {
	int n, m, f;
	cin >> n >> m >> f;
	min_cost_flow_graph<int, int> g(n, 0, n - 1, f);
	for (int i = 0; i < m; i++) {
		int from, to, cap, cost;
		cin >> from >> to >> cap >> cost;
		g.add(from, to, cap, 0, cost);
	}
	cout << g.min_cost_flow() << endl;
	return 0;
}

Measured memory_bytes: 3240
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
vector<long long> vv;
bool isPrime(long long  n)
{
  if (n == 1)
  {
    return false;
  }
  long i = 2;
  while (i*i <= n)
  {
      if (n % i == 0)
      {
          return false;
      }
      i += 1;
  }
  return true;
}
long long  gcd(long long a, long long b){
	if (a == 0)
		return b;
	return gcd(b%a, a);
} 

int main(){ 
	
	ll a,b; cin>>a>>b;
	cout<<(a*b)/__gcd(a,b)<<"\n";
	
	
	
	
	
	
	
	
}


Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int count = 1;
  int ans = 0;
  rep(i, N) {
    int A;
    cin >> A;
    if (A != count)
      ans++;
    else
      count++;
  }
  if (count == 1) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rbf(a, x) for (auto& a : x)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    template<typename Num>
        constexpr Num mypow(Num a, long long b) {
            if(b==0)return 1;
            if (a==0)return 0;
            Num x = 1;
              while (b > 0) {
                if(b & 1)x*=a;
                a*=a;
                b >>= 1;
              }
              return x;
        }

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen

    inline int RANDAM(){
        return rand()%26+1;
    }

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        vl c(26);
        rep(i,26)cin>>c[i];
        vvl s(n,vl(26));
        rep(i,n)rep(j,26)cin>>s[i][j];
        rep(i,n){
            cout<<RANDAM()<<endl;
        }
    }

Measured memory_bytes: 3744
fun main(args : Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val cities = mutableListOf<City>()

    repeat(m) { idx ->
        val (p, y) = readLine()!!.split(" ").map { it.toInt() }
        cities.add(City(idx, p, y, ""))
    }

    cities.sortWith(Comparator { c1, c2 ->
        when {
            c1.prefecture < c2.prefecture -> -1
            c1.prefecture > c2.prefecture -> 1
            c1.year < c2.year -> -1
            c1.year > c2.year -> 1
            else -> 0
        }
    })

    var prevP = 0
    var yIdx = 1
    cities.forEach { c ->
        if (c.prefecture != prevP) {
            prevP = c.prefecture
            yIdx = 1
        }
        c.num = c.prefecture.toString().padStart(6, '0') + yIdx.toString().padStart(6, '0')
        yIdx++
    }

    cities.sortedBy { it.idx }.forEach { println(it.num) }
}

data class City(val idx: Int, val prefecture: Int, val year: Int, var num: String)

Measured memory_bytes: 78252
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int n, m;
vi res;
vi primes;
vector<bool> isP;

bool check(int i){
    if(i < 4) return true;

    rep(j1, i){
        rep(j2, j1+1, i){
            rep(j3, j2+1, i){
                rep(j4, j3+1, i){
                    int j5 = i;
                    int sum = res[j1] + res[j2] + res[j3] + res[j4] + res[j5];
                    if(isP[sum]) return false;
                }
            }
        }
    }
    return true;
}

bool dfs(int i, int j){
    if(i == n){
        return true;
    }
    rep(k, j, m){
        res[i] = primes[k];
        if(not check(i)) continue;
        if(dfs(i + 1, k + 1)){
            return true;
        }
    }
    return false;
}

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

	const int N = (int)1e6;
	isP = vector<bool>(N, true);
    isP[0] = isP[1] = false;
	for(int i = 2; i * i < N; i++) if(isP[i]) for(int j = i; i * j < N; j++) isP[i * j] = false;

    int n; cin >> n;

    const int M = 55555;
    vi res;
    rep(i, M+1){
        if(not isP[i] or i % 10 != 1) continue;
        res.emplace_back(i);
    }

    rep(i, n){
        cout << (i ? " ":"") << res[i];
    }
    cout << endl;

    return 0;
}


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

from collections import defaultdict

def score(D, c, s, v):

    ret = []
    last = defaultdict(int)

    satisfaction = 0
    for d in range(1, D+1):
        satisfaction += s[(d, v[d])]
        last[v[d]] = d
        for i in range(1,27):
            satisfaction -= c[i]*(d - last[i])
        ret += [satisfaction]

    return '\n'.join(map(str, ret))

D = int(input())
c = input().split(' ')
c = list(map(int, c))
c = [float("inf")] + c
s = dict()
v = [float("inf")]
for i in range(D):
    row = input().split(' ')
    for j, e in enumerate(row):
        e = int(e)
        s[(i+1, j+1)] = e
for _ in range(D):
    v += [int(input())]

print(score(D, c, s, v))

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

ll a[100005];
ll ans, b, c, n;
int main() 
{
    cin >> n >> b >> c;
    for(ll i = 1; i <= n; i++)
        cin >> a[i]; 
    for(ll i = 1; i < n; i++)
        ans += min(b * (a[i + 1] - a[i]), c); 
    cout<<ans<<endl;
    return 0; 
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }


int main() {
	ll N;
	cin >> N;
	cout << N * 800 - N / 15 * 200;
	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    string a, b;
    cin >> a >> b;
    a += b;
    int t = stoi(a);
    int n = sqrt(t);
    if (n * n == t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long K = scan.nextLong();
		int N = scan.nextInt();
		long [] house = new long[N];
		long way = 0;
		long ans = 0;

		for (int i = 0; i < N; i++){
			house[i] = scan.nextLong();
		}

		long second_way = 0;
		for(int i = 0; i < N; i++){
			way = house[(i + (N-1)) % N] - house[i];
			if(way <= 0){
				way = (K - house[i]) + house[(i + (N-1)) % N];
			}
			second_way = house[i] + (K - house[(i+1) % N]);
			if(second_way >= K){
				second_way = house[i] - house[(i+1) % N];
 			}

			if(i ==0 || ans > Math.min(way, second_way)){
				ans = Math.min(way, second_way);
			}

		}
		System.out.println(ans);


	}
}

Measured memory_bytes: 86384
#include <stdio.h>
char main(){
  int a,b,c,d,i;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  for(i=0;1==1;i++){
  if(a<=0){
    printf("No");
    return 0;
  }
  else{
    c=c-b;
  }
  if(c<=0){
    printf("Yes");
    return 0;
  }
  else{
  a=a-d;
  }
  }
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;
typedef vector<ll> vel;
typedef vector<string> ves;
typedef vector<int> vei;
typedef vector<vector<ll>> vvel;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main() {
    int a;cin>>a;
    cout <<a+a*a+a*a*a<<endl;
}

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

int dp[N]; 
vector<vector<int> > g(N);  

int find_longest(int ind){
	if(g[ind].size() == 0){
		return 0; 
	}
	int maxi = 0; 
	for(int i = 0; i < g[ind].size(); i++){
		if(dp[g[ind][i]] == -1){
			dp[g[ind][i]] = find_longest(g[ind][i]); 
		}
		maxi = max(dp[g[ind][i]], maxi); 
	}

	return maxi + 1; 
}

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


	for(int i = 0; i < m; i++){
		int a, b; 
		cin >> a >> b; 
		g[a].push_back(b);  
	}

	for(int i = 1; i <= n; i++){
		dp[i] = -1; 
	}

	int res = 0; 

	for(int i = 1; i <= n; i++){
		if(dp[i] == -1)
			dp[i] = find_longest(i); 

		res = max(res, dp[i]); 
	}


	cout << res << endl;
}

Measured memory_bytes: 8192
#include <iostream>
#include <cmath>

using namespace std;

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

  if (W == 1 || H == 1) {
    cout << 1 << endl;
    return 0;
  }


  long long n1 = ceil(double(W) / 2);
  long long n2 = floor(double(W) / 2);

  long long h1 = ceil(double(H) / 2);
  long long h2 = floor(double(H) / 2);

  cout << n1 * h1 + n2 * h2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
typedef long long ll;
const int MOD = 1e9 + 7;

ll N,ans=0;
ll str[200001];


int main(void)
{
	cin >> N;
	FOR(i, 0, N) {
		ll a;
		cin >> a;
		if (i != 0)str[i] = str[i - 1] + a;
		else str[i] = a;
	}
	sort(str, str + N);
	ll cnt = 0;
	FOR(i, 1, N) {
		if (str[i - 1] == str[i]) {
			cnt++;
		}
		else {
			if (cnt > 0) {
				cnt++;
				ans += cnt*(cnt - 1) / 2;
			}
			cnt = 0;
		}
		if (str[i] == 0)ans++;
	}
	if (str[0] == 0)ans++;
	if (cnt > 0) {
		cnt++;
		ans += cnt * (cnt - 1) / 2;
	}
	ct(ans);
	return 0;
}

Measured memory_bytes: 1792
from statistics import median

N=int(input())
A=list(map(int,input().split()))
B=[]

for i in range(N):
    B.append(A[i]-i-1)
B.sort()

b=median(B)

ans=0
for i in range(N):
    ans+=abs(A[i]-b-i-1)

print(int(ans))

Measured memory_bytes: 27248
#include <iostream>
#include <cmath>


using namespace std;

int main() {
	int N, T, A;
	int ans;
	double temp;

	cin >> N;
	cin >> T >> A;

	int h;
	cin >> h;
	ans = 0;
	temp = fabs(A - (T - h * 0.006));
	for (int i = 1; i < N; i++) {
		cin >> h;
		if (fabs(A - (T - h * 0.006)) < temp) {
			temp = fabs(A - (T - h * 0.006));
			ans = i;
		}
	}

	cout << ans + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define boost ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define M 1000000007
#define eb emplace_back
#define watch(x) cout << (#x) <<" is "<< x <<"\n";


using namespace std;
//const int N = 1e6;

void convertToAlpha(int num)
{
	int q = num;
	int r = 0;
	if (num < 1)
		return;
	r = q % 26;
	q = q / 26;
	if (r == 0)
	{
		q = q - 1;
		r = 26;
	}
	if (q == 0)
		cout << (char)(r + 'a' - 1);
	else
	{
		convertToAlpha(q);
		cout << (char)(r + 'a' - 1);
	}
}

int32_t main(){
  boost;
  int tc = 1; //cin >> tc;
  while(tc--)
  {
  	int n; cin >> n;
  	string ans = "";
  	convertToAlpha(n);
  }
}



Measured memory_bytes: 3648
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
N = int(input())
S = [input() for _ in range(N)]

d = defaultdict(int)
for s in S:
    d[s] += 1

maxn = max(list(d.values()))

for s in sorted(d.items()):
    if s[1] == maxn:
        print(s[0])



Measured memory_bytes: 46100
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
 
int prime(int i) {
    int k;
 
    if(i==1)
        return 0;
 
    if(i==2||i==3)
        return 1;
 
    for(k=2;k<=sqrt(i);k++)
        if(i%k==0) return 0;
 
    return 1;
}
 
int main() {
 
    int a,d,n;
    int i,count;
 
    while(1){
        scanf("%d %d %d",&a,&d,&n);
        if(!a&&!d&&!n) break;
        count=0,i=a;
        while(count<n) {
            if(prime(i)) {
                count++;
            }
            i+=d;
        }
        printf("%d\n",i-d);
    }
 
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;


int main(){
  int N; cin >> N;
  vector<vector<int>> a(2, vector<int>(N));
  rep(i, 2) rep(j, N) cin >> a[i][j];

  int ans = 0;
  for (int i = 0; i < N; ++i){
    int tmp = 0;
    for (int j = 0; j <= i; ++j){
      tmp += a[0][j];
    }
    for (int j = i; j < N; ++j){
      tmp += a[1][j];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}


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

using namespace std;

int main(){
    int n;
    char color = ' ';
    int num = 0;
    string s;
    scanf("%d", &n);
    cin >> s;

    for(int i = 0; i < n;i++){
        if(s[i] != color){
            num++;
            color = s[i];
        }
    }

    printf("%d\n", num);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a-=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

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

  int n,k;
  cin >> n >> k;

  vector<ll> dp;
  vector<ll> tup;
  vector<ll> width;
  for(int i=1; i*i<=n;i++){    
    dp.pb(1);
    width.pb(1);
    if(i!=(n/i)){
      int st=n/(i+1)+1;
      int ed=n/i;
      tup.pb(ed-st+1);
      //      width.pb(ed-st+1);
    }
  }
  int len=0;
  len=tup.size();
  rep(i,len){
    dp.pb(tup[len-1-i]);
    width.pb(tup[len-1-i]);
  }
  vector<ll> ndp(dp.size(),0);
  

  rep(i,k-1){
    ll sum=0;
    //    cout << "wid "<<endl;
    //    rep(j,dp.size()) cout <<  width[j] << " ";
    //    cout << "" << endl;
    for(int j=dp.size()-1; j>=0;j--){      
      sum = ad(dp[dp.size()-1-j],sum);
      ndp[j] = mu(sum,width[j]) ;
    }
    rep(j,dp.size()){
      dp[j]=ndp[j];
    }
  }
  //  cout << "seni kai " << i << endl;
  //  rep(j,dp.size()) cout <<  dp[j] << " ";
    
  ll ans=0;
  rep(i,dp.size()) ans = ad(dp[i],ans);
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 2288
n,m=map(int,input().split())

k=[]
for _ in range(m):
  t = list(map(int,input().split()))[1:]
  j=0
  for i in t:j+=2**(i-1)
  k.append(j)

p=list(map(int,input().split()))

def checkMod(binStr,swStr,p):
  return 1 if bin(binStr & swStr).count("1")%2==p else 0

result=0

for i in range(2**n):
  count=1
  for j in range(m):
    count=count*checkMod(i,k[j],p[j])
    if count==0:
      break
  if count==1:
    result+=1

print(result)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define test() ll t;cin>>t;for(ll test = 1;test<=t;test++)
#define f first
#define s second
#define pb push_back
#define ins insert
#define nl cout<<"\n"
#define P 1000000007
#define N 100005
#define MOD(x) ((x%P)+P)%P
#define show(x) cout<<x<<" "
#define vec(v) loop(i,0,v.size()) show(v[i]); nl

string s;

ll mem[13][N];

void solve(int n)
{
	for(int idx = 1; idx<n+1; idx++)
	{
		if(s[idx-1]=='?')
		{
			for(int i = 0; i<10; i++)
			{
				for(int j = 0; j<13; j++)
				{
					int next = (i + j*10)%13;
					mem[next][idx] += mem[j][idx-1];
					mem[next][idx] = MOD(mem[next][idx]);
				}
			}
		}
		else
		{
			int i = s[idx-1]-'0';
			for(int j = 0; j<13; j++)
			{
				int next = (i + j*10)%13;
				mem[next][idx] += mem[j][idx-1];
				mem[next][idx] = MOD(mem[next][idx]);
			}
		}
	}
}

int main()
{
	fastio();

	cin>>s;
	mem[0][0] = 1;

	solve(s.size());

	cout<<mem[5][s.size()],nl;

	//cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
	return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)

const int MOD = 1e9+7;
const int MAXN = 5e3+5;

int gcd(int a, int b) {
    return (b == 0) ? a : gcd(b,a%b);
};

vector<int> primes;
vector<int> smallest;

void sieve(int n) {
    smallest = vector<int>(n+1);
    for (int p=2; p<=n; p++) smallest[p] = p;
    for (int p=2; p<=n; p++) {
        if (smallest[p] == p) {
            primes.pb(p);
            for (int i = p+p; i <= n; i += p)
                smallest[i] = p;
        }
    }
}

vector<pii> merge(vector<pii> &v1, vector<pii> &v2) {
    vector<pii> ret;
    int i = 0, j = 0;
    while(i < (int)v1.size() && j < (int)v2.size()) {
        if(v1[i].fi == v2[j].fi) {
            ret.eb(v1[i].fi, max(v1[i].se, v2[j].se));
            i++; j++;
        } else if(v1[i].fi < v2[j].fi) {
            ret.pb(v1[i]);
            i++;
        } else {
            ret.pb(v2[j]);
            j++;
        }
    }

    while(i<(int)v1.size()) ret.pb(v1[i++]);
    while(j<(int)v2.size()) ret.pb(v2[j++]);
    return ret;
}

LL pw(int a, int p) {
    if(p == 1) return a;
    LL r = pw(a,p/2);
    r = (r*r) % MOD;
    if(p%2) r = (r*a) % MOD;
    return r;
}

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    sieve(1e6);
    vector<vector<pii>> factors(1e6+1);
    factors[1].eb(1,1);
    vector<int> inv(1e6+1);
    fore(i,1,1e6) inv[i] = pw(i,MOD-2);

    fore(i,2,1e6) {
        factors[i].eb(1,1);
        int t = i;
        while(t > 1) {
            int f = smallest[t];
            int c = 0;
            while(t%f == 0) {
                t /= f;
                c++;
            }

            factors[i].eb(f,c);
        }
        sort(factors[i].begin(),factors[i].end());
    }

    int N;
    cin >> N;
    vector<int> A(N);
    fori(i,N) cin >> A[i];

    sort(A.begin(),A.end());
    int mx = A[N-1];

    vector<pii> cur{{1,1}};
    fori(i,N) {
        int g = gcd(A[i],mx);
        int k = A[i]/g;
        cur = merge(cur, factors[k]);
    }
    
    LL X = 1;
    for(auto p: cur) {
        int f = p.fi;
        fori(c,p.se) {
            (X *= f) %= MOD;
        }
    }

    (X *= A[N-1]) %= MOD;
    LL ans = 0;
    fori(i,N) {
        (ans += X*inv[A[i]]) %= MOD;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 85752
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    ll a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    sort(h.begin(), h.end());
    int l = -1;
    int r = 1e9;
    int m;
    while(r-l>1) {
        m = (l+r)/2;
        ll cnt = 0;
        rep(i, n) {
            if (h[i] - m * b > 0) {
                cnt += ((h[i] - m * b) + (a - b - 1)) / (a - b); 
            }
        }
        if (m < cnt) {
            l = m;
        }
        else {
            r = m;
        }
    }
    cout << r << endl;
    return 0;
}


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

int h, w;
string g;

int main() {
	cin >> h >> w;
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			cin >> g;
			if (g == "snuke") {
				cout << (char)(j+'A') << i+1 << endl;
				return 0;
			}
		}
}

Measured memory_bytes: 256
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$K) = explode(" ",trim(fgets(STDIN)));
//$a = explode(" ",trim(fgets(STDIN)));
//$H = explode(" ",trim(fgets(STDIN)));

for($i=0;$i<$N;$i++) {
  $h[]=trim(fgets(STDIN));
}
sort($h);
$m = 999999999999999;
for($i=0;$i<$N-$K+1;$i++) {
  $m = min($h[$i+$K-1]-$h[$i],$m);
}
printf("%d\n",$m);


Measured memory_bytes: 22004
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

using ll = long long;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() int t; cin>>t; while(t--)
#define print(n) cout<<n<<"\n"
#define inp(n) int n; cin>>n
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define maxn 1000010
#define mod 1e9+7
#define ff  first
#define ss  second
#define fora(var, start, end) for(int var = start; var < end; var++)
int main()
{
    fast();
    ll l;
    cin>>l;
    cout.precision(12); cout<<fixed; 
    l= l*l*l;
    debug(l);
    double ans= 1.0*(l)/27;
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int maxn=100005;
int n,m;
int head[maxn*2],nxt[maxn*2],to[maxn*2],e;
int ans[maxn];
bool vis[maxn];
void add_edge(int x,int y)
{
	to[e]=y;
	nxt[e]=head[x];
	head[x]=e++;
}
int main()
{
	memset(head,-1,sizeof(head));
	memset(ans,-1,sizeof(ans));
	scanf("%d",&n);
	rep(i,1,n-1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add_edge(x,y);add_edge(y,x);
	}
	priority_queue<pii,vector<pii>,greater<pii> > q;
	while(!q.empty()) q.pop();
	scanf("%d",&m);
	rep(i,1,m)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		ans[a]=b;
		vis[a]=1;
		q.push(mp(b,a));
	}
	while(!q.empty())
	{
		pii qq=q.top();
		q.pop();
		int x=qq.se,val=qq.fi;
		for(int i=head[x];i+1;i=nxt[i])
		{
			int y=to[i];
			if(!vis[y])
			{
				ans[y]=ans[x]+1;
				q.push(mp(ans[y],y));
				vis[y]=1;
			}
		}
	}
	rep(x,1,n)
	{
		for(int i=head[x];i+1;i=nxt[i])
		{
			int y=to[i];
			if(abs(ans[x]-ans[y])!=1)
			{
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	rep(i,1,n) cout<<ans[i]<<endl;
	return 0;
}
//5
//1 2
//3 1
//4 3
//3 5
//2
//2 6
//5 7

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

using namespace std;

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

    if(S=="Sunny")
    {
        S="Cloudy";
    }
    else if(S=="Cloudy")
    {
        S="Rainy";
    }
    else
    {
        S="Sunny";
    }
    
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 3528
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;


void solve()
{
   
    int x;
    cin>>x;
    cout<<(x^1)<<endl;
    
    
    
}

int32_t main()
{
    IOS;
    
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}







Measured memory_bytes: 3640
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func main() {
	defer write.Flush()

	var s string
	fmt.Fscan(read, &s)

	if s[2] == s[3] && s[4] == s[5] {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <numeric>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	while (A > 0 && C >> 0) {
		C = C - B;
		A = A - D;
	}
	if (C > 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 3592
#include <iostream>
//#include <bits/stdc++.h>
// a&1 check odd or not and a>>=1 halfs a
// (n-1-i)%i previous in circle (i+n-1)%n next one
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb(x) push_back(x)
#define F first
#define S second
using namespace std;

int n;

void dp(){
	cin>>n;
	vector<int> v(n);
	for(int &i:v)
		cin>>i;
	vector<int> dp(n);
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	loop(i,2,n){
		dp[i]=min(dp[i-2]+abs(v[i-2]-v[i]),dp[i-1]+abs(v[i-1]-v[i]));
	}
	cout<<dp[n-1]<<endl;
}



int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	dp();
	return 0;
}



Measured memory_bytes: 1152
from itertools import combinations_with_replacement

N,M,Q=map(int,input().split())

A,B,C,D=[],[],[],[]

for i in range(Q):
    a,b,c,d=list(map(int,input().split()))
    A.append(a)
    B.append(b)
    C.append(c)
    D.append(d)

Z=combinations_with_replacement(range(1,M+1),N)

M=0
for K in Z:
    X=0
    L=["*"]+list(K)
    for i in range(Q):
        if L[B[i]]-L[A[i]]==C[i]:
            X+=D[i]
    M=max(M,X)
print(M)


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


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

  vll dp(n + 1, vl(n + 1));
  dp[0][0] = 1;
  rep (i, n) {
    rep (j, n + 1) {
      if (j == n) continue;
      (dp[i + 1][j + 1] += dp[i][j]) %= MOD;
    }
    rep (j, n) {
      (dp[i + 1][j + 1] += dp[i + 1][j]) %= MOD;
    }
  }
  
  //DEBUG_MAT(dp);

  rep1 (i, k) {
    ll ans = 0;
    for (int j = -1; j <= 1; j++) {
      int b = i;
      int r = b + j;
      if (r > n - k) continue;
      (ans += dp[b][k] * dp[r][n - k] % MOD) %= MOD;
      if (j == 0) {
        (ans += dp[b][k] * dp[r][n - k] % MOD) %= MOD;
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 31616