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

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        public static List<long> GeneratePrime(long max)
        {
            long prime;
            double sqrtMax = Math.Sqrt(max);
            var primeList = new List<long>();

            List<long> searchList = new List<long>();
            for (long i = 2; i <= max - 1; i++)
            {
                searchList.Add(i);
            }

            do
            {
                prime = searchList.First();
                primeList.Add(prime);
                searchList.RemoveAll(n => n % prime == 0);
            } while (prime < sqrtMax);

            primeList.AddRange(searchList);

            return primeList;
        }

        void Omame()
        {
            cin = new Scanner();
            int A = cin.nextInt();
            int B = cin.nextInt();

            if(A >= 9 || B>= 9)
            {
                Console.WriteLine(":(");
            }
            else
            {
                Console.WriteLine("Yay!");
            }
        }
    }
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    ll n;cin>>n;
    map<int,int> mp;
    ll red = 0;
    rep(i,n){
        int a;cin>>a;
        if(a<3200)mp[a/400]++;
        else red++;
    }
    int nored = mp.size();
    cout << max(1,nored) << " " << nored + red << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

int x[10], y[10];

int main(void) {

	int n,count = 0;
	cin >> n;

	vector<int> perm(n);

	for (int i = 0; i < n; i++)
		perm[i] = i;

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

	double sum = 0;

	do {

		count++;

		for (int i = 0; i < n - 1; i++) {
			double a = pow(x[perm[i]] - x[perm[i + 1]], 2) + pow(y[perm[i]] - y[perm[i + 1]], 2);
			sum += sqrt(a);
		}
	} while (next_permutation(perm.begin(),perm.end()));

	cout << setprecision(10) << sum / count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, Q, W, H, T, X, Y;

int main()
{
    cin >> H >> W;
    vector<string> in(H);
    for (auto& i : in) cin >> i;
    for (int i = 0; i < W+2; ++i) cout << "#"; cout << endl;
    for (auto i : in) cout << string("#") + i + string("#") << endl;
    for (int i = 0; i < W+2; ++i) cout << "#"; cout << endl;

    return 0;
}

Measured memory_bytes: 256
s =str(input())
ans = 0
aa = []
if s[0] in ['A', 'C', 'G', 'T']:
    ans =1
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
aa.append(ans)
print(max(aa))

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

alice = 0
bob = 0

for n in range(N):
    if len(a) == 0:
        break
    card = max(a)
    alice += card
    a.remove(card)
    if len(a) == 0:
        break
    card = max(a)
    bob += card
    a.remove(card)

print(alice - bob)

Measured memory_bytes: 9148
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;


int main(){
    long long a, b, c, k, v = 0;
    scan(a, b, c, k);
    
    int sub = min(a, k);
    v += sub;
    k -= sub;
    
    sub = min(b, k);
    k -= sub;
    
    sub = min(c, k);
    v -= sub;
    
    print(v);
    
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  string s;
  cin >> s;
  int k;
  cin >> k;

  REP(i,s.size()){
    int idx = s[i] - 'a';
    if(idx==0)continue;

    if(26 - idx <= k){
      k -= (26-idx);
      s[i] = 'a';
    }
  }
  if(k > 0){
    k %= 26;
    s[s.size()-1] = char(s[s.size()-1] + k);
  }
  cout << s << endl;
}



Measured memory_bytes: 3736
#include <iostream>                                             
using namespace std;                                            
                                                                
int main(void) {                                                
  int n, x;                                                     
  while (true) {                                                
    cin >> n >> x;                                              
    if (n==0 && x==0) {                                         
      break;                                                    
    }                                                           
    int ans = 0;                                                
    for (int i=1; i<=n; i++) {                                  
      for (int j=i+1; j<=n; j++) {                              
        for (int k=j+1; k<=n; k++) {                            
          if (i+j+k==x) {                                       
            ans++;                                              
          }                                                     
        }                                                       
      }                                                         
    }                                                           
    cout << ans << endl;                                        
  }                                                             
  return 0;                                                     
}                                                               
                             

Measured memory_bytes: 3092
#include <bits/stdc++.h>
 
using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;
 
#define ALL(x) x.begin(), x.end()
 
constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;
 
int main() {
  llong x;
  cin >> x;
 
  cout << (x^1) << endl;
 
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#include <stdio.h>
#include <sstream>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;

	string ans = "Yay!";
	if (e - a > k) {
		ans = ":(";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
S = raw_input()

N = len(S)

is_flag = True
for i in range(N):
    if S[i] != S[N-1-i]:
        is_flag = False

M = (N-1)/2
for i in range(M/2):
    if S[i] != S[M-1-i]:
        is_flag = False


for i in range(M/2):
    if S[i+(N+1)/2] != S[N-1-i]:
        is_flag = False


if is_flag:
    print "Yes"
else:
    print "No"




Measured memory_bytes: 2696
#include <bits/stdc++.h>
	using namespace std;
	#include <ext/pb_ds/assoc_container.hpp> 
	#include <ext/pb_ds/tree_policy.hpp> 
	using namespace __gnu_pbds; 
	#define ordered_set tree<int,int_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
	#define ordered_set_pair tree<pair<int,int>,int_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
	 
	typedef long long int ll;
	typedef long double ld;
	typedef unsigned long long int ull;
	typedef pair<int,int> pi; 
	#define PI 3.1415926535897932384
	#define FOR(i,vv,n) for(int i=vv;i<n;i++)
	#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
	#define ve vector 
	#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
	#define minind(v) (min_element(v.begin(),v.end())-v.begin())
	#define maxe(v) *max_element(v.begin(),v.end())
	#define mine(v) *min_element(v.begin(),v.end())
	#define pb push_back
	#define pf push_front
	#define ppb pop_back
	#define ppf pop_front
	#define eb emplace_back
	#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#define mp make_pair
	#define M 1000000007ll
	#define M1 100000000000000000ll
	#define PRECISE cout.precision(18);
	#define BS(v,n) binary_search(v.begin(),v.end(),n)
	#define srt(v) sort(v.begin(),v.end())
	#define rsrt(v) sort(v.begin(),v.end(),greater <int>())
	#define F first
	#define S second
	#define GET(i,p) get<i>(p)


	ve <ll> parent(100000);
	ve <ll> sz(100000,1);
	void make_set(){
		FOR(i,0,100000)
		parent[i]=i;
	}
	ll find_set(ll u){
	if(u==parent[u])
	return u;
	else return parent[u]=find_set(parent[u]);
	}
	void combine(ll u,ll v){
		ll a1=find_set(u);
		ll a2=find_set(v);
		if(sz[a1]>sz[a2])
		swap(a1,a2);
		parent[a1]=a2;
		sz[a2]+=a1;
	}



	int main(){

	    FAST
	//	PRECISE

	make_set();
	ll n;
	cin>>n;
	ve <pair<pair<ll,ll>,ll>> v[2];
	FOR(i,0,n){
		ll x,y;
		cin>>x>>y;
		v[0].pb({{x,y},i});
		v[1].pb({{y,x},i});
	}
	ve <tuple<ll,ll,ll> > edges;
	srt(v[1]);srt(v[0]);
	FOR(j,0,2)
	FOR(i,1,v[j].size()){

		edges.pb(make_tuple(v[j][i].F.F-v[j][i-1].F.F,v[j][i].S,v[j][i-1].S));
	}
	srt(edges);
	ll ans=0;
	FOR(i,0,edges.size()){
	ll d1=GET(0,edges[i]);
	ll a1=GET(1,edges[i]);
	ll a2=GET(2,edges[i]);

	if(find_set(a1)!=find_set(a2)){
		ans+=d1;
		combine(a1,a2);
	}



	}

	cout<<ans;






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

Measured memory_bytes: 15268
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

#define repp(i,a,b) for(int i = (int)(a); i < (int)(b); ++i)

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N; cin >> N;
    vector<pair<int,int>> R;
    repp(i,0,N) {
        int x, y; cin >> x >> y;
        R.emplace_back(x, y);
    }
    vector<pair<int,int>> B;
    repp(i,0,N) {
        int x, y; cin >> x >> y;
        B.emplace_back(x, y);
    }
    sort(B.begin(), B.end());
    int res = 0;

    vector<bool> used(N); repp(i,0,N) used[i] = false;
    repp(i, 0, N) {
        pair<int, int> b = B[i];
        int max_y = -1;
        int tmp_i = -1;
        repp(j, 0, N) {
            if (used[j]) continue;
            if (R[j].first >= b.first) continue;
            if (R[j].second >= b.second) continue;
            if (R[j].second > max_y) {
                tmp_i = j;
                max_y = R[j].second;
            } 
        }
        if (tmp_i < 0) continue;
        ++res;
        used[tmp_i] = true;
    }
    cout << res << endl;

}


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

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int ans=n;
    for(int i=0;i<n-1;i++){
        if(s[i]!=s[i+1]){
            ans=min(ans,max(i+1,n-1-i));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
 
using namespace std;
 
const int INF = 1 << 30;
 
int main()
{
  int N, M;
  vector< int > g[100000];
 
  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
 
  int v[100000][2];
  fill_n(*v, 100000 * 2, INF);
  queue< pair< int, int > > que;
  que.emplace(0, 0);
  v[0][0] = 0;
  while(!que.empty()) {
    int p, q;
    tie(p, q) = que.front();
    que.pop();
    for(auto &to : g[p]) {
      if(v[to][q ^ 1] == INF) {
        v[to][q ^ 1] = v[p][q] + 1;
        que.emplace(to, q ^ 1);
      }
    }
  }
 
  int ret = INF;
  for(int i = 0; i < 2; i++) {
    int beet = 0;
    for(int j = 0; j < N; j++) beet = max(beet, v[j][i]);
    ret = min(ret, beet);
  }
 
  if(ret == INF) cout << -1 << endl;
  else cout << ret << endl;
}

Measured memory_bytes: 10300
import itertools

n, m, q = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(q)]

mx = 0
for case in itertools.combinations_with_replacement(range(1, m+1), n):
    total = 0
    for i in range(q):
        if case[l[i][1]-1] - case[l[i][0]-1] == l[i][2]:
            total += l[i][3]
    mx = max(mx, total)
print(mx)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define min(a, b) ((a<b)?a:b)
#define max(a, b) ((a<b)?b:a)
#define pb push_back
#define endl "\n"
typedef long long ll;

#define max_element mmmmm
#define min_element nnnnn

template<class T>
class BIT {
	public:
		int BIT_size;
		vector<T> BIT_array;
		BIT(int BIT_size) {
			this->BIT_size = BIT_size;
			BIT_array = vector<T>(BIT_size+1);
			fill(BIT_array.begin(), BIT_array.end(), 0);
		}
		void BIT_update(int i, T d) {
			for(; i<=BIT_size; i+=(i&-i)) {
				BIT_array[i] += d;
			}
		}
		T BIT_sum(int i) {
			T BIT_sum_result = 0;
			for(; i>0; i-=(i&-i)) {
				BIT_sum_result += BIT_array[i];
			}
			return BIT_sum_result;
		}				
};

ll pow(ll a, ll b, ll m) {
	a %= m;
	ll result = 1;
	while(b > 0) {
		if(b & 1) {
			result = result*a%m;
		}
		a = a*a%m;
		b /= 2;		
	}
	return result;
}

 
int main() {
	int n; cin >> n;
	int f[n+1];
	memset(f, 0, sizeof(f));
	n--;
	int m = n+1;
	while(n--) {
		int t; cin >> t; f[t]++;
	}
	for(int i=1; i<=m; i++) cout << f[i] << " ";
	cout << endl;
}







































































Measured memory_bytes: 4360
#include<stdio.h>

int main()
{
	unsigned int height[10];
	unsigned int min,temp;
	char i,j,k;

	for(i=0;i<=9;i++)
	{
		scanf("%d",&height[i]);
	}

	for(i=0;i<9;i++)
	{
		min=height[i];
		k=i;

		for(j=i+1;j<10;j++)
		{
			if(height[j]<min)
			{
				min=height[j];
				k=j;
			}
		}
		temp=height[i];
		height[i]=height[k];
		height[k]=temp;
	}

	for(i=9;i>=7;i--)
		printf("%d\n",height[i] );
	return 0;
}

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

int main(int argc, char **argv)
{
  double x;
  std::cin >> x;
  int year = 0;
  long double money = 100;
  while (true)
  {
    money = money * 1.01;
    money = std::floor(money);
    if (money >= x)
    {
      year++;
      break;
    }
    year++;
  }
  std::cout << year << std::endl;
  return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll k,n;
	cin>>k>>n;
	vector<ll> a(n);
	ll dif = 0;
	rep(i,n)cin>>a[i];
	rep(i,n-1){
		dif = max(dif, abs(a[i]-a[i+1]));
	}
	dif = max(dif, abs(a[0] + k - a[n-1]));
	cout<<k-dif<<endl;
	return 0;
}

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


int main() {
    int N, K;
    vector<int> P;
    cin >> N >> K;
    rep(i, N) {
        int p;
        cin >> p;
        P.push_back(p);
    }
    sort(P.begin(), P.end());
    int price = 0;
    rep(i, K) {
        price += P[i];
    }

    cout << price << endl;



    return 0;
}

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

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

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	bool f(false);
	for (int i = 0; i + 1 < s.size(); i++) {
		if (s.substr(i, 2) == "AC")f = true;
	}
	cout << (f ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,sum=0,i,a[3000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d ",&a[i]);
		sum = sum + a[i];
	}
	printf("%d",sum-n);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
 
int main(){
    int n,c;
 
    while(cin >> n ,n){
	int total = 0;
	for(int i = 0 ; i < n*(n-1)/2 ; i++){
	    cin >> c;
	    total += c;
	}
	cout << total / (n-1) << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,q,ans;
  cin>>n>>k>>q;
  vector<int>p(n,k-q);
  for(int i=0;i<q;i++){
    int ai;
    cin>>ai;
    ai--;
    p[ai]++;
  }
  for(int i=0;i<n;i++)p[i]>0?cout<<"Yes":cout<<"No",cout<<endl;
  return 0;
}


Measured memory_bytes: 3784
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (_n, m) = get!(i64, i64);
    let mut heap = BinaryHeap::new();
    let v = get!([i64]);
    // eprintln!("n: {}, m: {}", n, m);
    // eprintln!("v: {:?}", v);
    for i in v.iter() {
        heap.push(*i);
    }
    // eprintln!("heap1: {:?}", heap);
    for _ in 0..m as usize {
        let mut t = heap.pop().unwrap();
        t /= 2;
        heap.push(t);
    }
    // eprintln!("heap2: {:?}", heap);
    let mut ans = 0;
    for i in &heap {
        ans += *i;
    }
    println!("{}", ans);
}


Measured memory_bytes: 9464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;

int main(){
  int N;
  cin >> N;
  int P[N];
  FOR(i,0,N){
    cin >> P[i];
  }
  int flag=0;
  int counter=0;
  int min=P[0];
  FOR(i,0,N){
    if(P[i]<=min){
      counter++;
      min = P[i];
    }
  }

  cout << counter<<endl;
  return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

from bisect import bisect_left

mids = []
for b in B:
    ind = bisect_left(A, b)
    mids.append(ind)
cs = [0]
for i in range(N):
    cs.append(cs[i]+mids[i])
ans = 0
for c in C:
    ind = bisect_left(B, c)
    ans += cs[ind]
print(ans)


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n;
    cin>> n;

    int a[n];

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

        int *mx= max_element (a, a+n);
        int d= distance (a, mx);

        sort(a, a+n);


    for(int i=0; i<n; i++)
            cout << (i== d? a[n-2] : a[n-1]) << '\n';


    return 0;
}




Measured memory_bytes: 4420
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	ll a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	ll x=abs(b-a);
	ll y=t*(v-w);
	if(x<=y)cout<<"YES";
	else cout<<"NO";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int ind1=0;
  int ar[n];
  for(int i=0;i<n;++i)
  {cin>>ar[i];if(ar[i]!=i+1){ind1++;}}
  if(ind1<=2){cout<<"YES";return 0;}
  cout<<"NO";
}
  


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>
#include<cassert>
using namespace std;

struct Graph {
	struct Vertex { int n, d[2]; };
	struct Edge { int i, n; };
	Graph(int n, int m) : v(n, { -1, {-1, -1} }), e(m), n(n), m(0) {}
	void add_edge(int i, int j) {
		e[m] = { j, v[i].n };
		v[i].n = m;
		m++;
	}
	void dfs(int i, int d, int t) {
		//訪問済か
		if (v[i].d[t] >= 0) return;

		//距離を書き込む
		v[i].d[t] = d;

		for (int j = v[i].n; j >= 0; j = e[j].n) {
			Edge& o = e[j];
			dfs(o.i, d + 1, t);
		}
	}
	bool solve() {
		int k = 0;
		for (int i = 0; i < n; i++) {
			k += v[i].d[0] <= v[i].d[1];
		}
		return k > n - k;
	}
	vector<Vertex> v;
	vector<Edge> e;
	int n, m;
};

int main()
{
	int N;
	std::cin >> N;

	Graph g(N, (N - 1) * 2);

	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;

		g.add_edge(a, b);
		g.add_edge(b, a);
	}

	g.dfs(0, 0, 0);
	g.dfs(N - 1, 0, 1);

	cout << (g.solve() ? "Fennec" : "Snuke") << endl;
}


Measured memory_bytes: 4736
#include<algorithm>
#include<vector>
#include<iostream>
 
using namespace std;
 
int main(void){
  int a,b,m;
  vector<int> oven,fridge;
  vector<vector<int>> ticket;
  
  cin >> a >> b >> m;
  
  oven.resize(a);
  fridge.resize(b);
  ticket.resize(m);
  
  for(int i=0;i<oven.size();i++) cin >> oven[i];
  for(int i=0;i<fridge.size();i++) cin >> fridge[i];
  for(int i=0;i<ticket.size();i++){
    vector<int> t(3);
    cin >> t[0];
    cin >> t[1];
    cin >> t[2];
    ticket[i]=t;
  }
  
  int money=-1;
  for(int i=0;i<ticket.size();i++){
    int tmp_money=oven[ticket[i][0]-1]+fridge[ticket[i][1]-1]-ticket[i][2];
    if(money<0||tmp_money<money) money=tmp_money;
  }
  
  sort(oven.begin(),oven.end());
  sort(fridge.begin(),fridge.end());
  
  int no_ticket_money=oven[0]+fridge[0];
  
  if(no_ticket_money<money) money=no_ticket_money;
  
  std::cout << money;
  
  return 0;
}


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

int main() {
  int n,k;cin>>n>>k;
  vector<int> a(n),b(n-k+1),c(n-k+1);
  rep(i,n)cin>>a[i];
  rep(i,n-k){
    b[i]=a[i];
    c[i]=a[i+k];
  }
  rep(i,n-k){
    if(b[i]<c[i])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 5408
import static java.lang.System.out;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int counter = 1;
        while (scan.hasNext()) {
            int num = scan.nextInt();
            if (num == 0) {
                break;
            }
            out.printf("Case %d: %d%n", counter, num);
            counter += 1;
        }
    }                                                                  
}

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

vector<string> c;
const int p = 3;

void dfs(string s) {
    if (s.size() == p) {
        c.push_back(s);
        return;
    }
    else {
        for (int i = 0; i < 10; i++) {
            s += to_string(i);
            dfs(s);
            s.pop_back();
        }
    }
}


int main() {

    int N; cin >> N;
    string s; cin >> s;
    string t;
    dfs(t);
    ll ans = 0;    
    for (int i = 0; i < c.size(); i++) {
        string tmp = c[i];
        int index = 0;
        bool ok = false;
        for (int j = 0; j < s.size(); j++) {
            if (tmp[index] == s[j]) {
                index++;
            }
        }
        if (index == 3) ok = true;
        if (ok) {
            ans++;
        }
    }
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3776
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    int s = Math.max(A,C);
    int e = Math.min(B,D);
    System.out.println(Math.max(0,e-s));
  }
  

  
}

Measured memory_bytes: 22736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] strlist = str.split(" ");
		int a = Integer.parseInt(strlist[0]);
		int b = Integer.parseInt(strlist[1]);
		int c = Integer.parseInt(strlist[2]);
		int d = Integer.parseInt(strlist[3]);

		if(a*b > c*d){
			System.out.println(a*b);
		}else{
			System.out.println(c*d);
		}

	}

}


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

using namespace std;

int main() {
  int N, D, X;
  cin >> N >> D >> X;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int input;
    cin >> input;
    for (int j = 0; j * input < D; j++) ans++;
  }
  ans += X;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    std::int64_t a, b, c, k;
    std::cin >> a >> b >> c >> k;

    if (k <= a)
    {
        std::cout << k;
    }
    else if (k - a <= b)
    {
        std::cout << a;
    }
    else
    {
        std::cout << a - (k - a - b);
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
 int a,b,c;

for(int n=N;n !=0;n/=10){
a+=n%10;
}
  
  if(N%a==0){
  cout<<"Yes";
  }
  else{
  cout<<"No";
  }
}

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

candidate = []


def gen(cur):
    if len(cur) == n:
        candidate.append(cur)
    else:
        t = cur[-1]
        for tv in range(t, m + 1):
            nex = cur[:]
            nex.append(tv)
            gen(nex)


for i in range(1, 10):
    arr = [i]
    gen(arr)

ask = []
for _ in range(q):
    ask.append(list(map(int, input().split())))

ans = 0
for cv in candidate:
    tmp = 0
    for av in ask:
        if cv[av[1] - 1] - cv[av[0] - 1] == av[2]:
            tmp += av[3]
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 28604
N,M = list(map(int,input().split()))

edge_1toANY = [0 for n in range(N+1)]
edge_ANYtoN = [0 for n in range(N+1)]

for m in range(M):
    a,b = list(map(int,input().split()))
    if a == 1:
        edge_1toANY[b] = 1
    if b == N:
        edge_ANYtoN[a] = 1

flag = False
for n in range(N+1):
    if edge_1toANY[n] == 1:
        if edge_ANYtoN[n] == 1:
            flag = True
            break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 6320
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<double,int> dat[24];
int main(){
	for(int i=0;i<24;i++)scanf("%d%lf",&dat[i].second,&dat[i].first);
	sort(dat,dat+8);
	printf("%d %.2lf\n%d %.2lf\n",dat[0].second,dat[0].first,dat[1].second,dat[1].first);
	sort(dat+8,dat+16);
	printf("%d %.2lf\n%d %.2lf\n",dat[8].second,dat[8].first,dat[9].second,dat[9].first);
	sort(dat+16,dat+24);
	printf("%d %.2lf\n%d %.2lf\n",dat[16].second,dat[16].first,dat[17].second,dat[17].first);
	dat[0]=dat[18];
	dat[1]=dat[19];
	dat[8]=dat[20];
	dat[9]=dat[21];
	dat[16]=dat[22];
	dat[17]=dat[23];
	sort(dat,dat+18);
	printf("%d %.2lf\n%d %.2lf\n",dat[0].second,dat[0].first,dat[1].second,dat[1].first);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
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;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int n;
    string s; cin>>n>>s;
    int rc=0;
    int lc=0;
    rep(i,0,n){
        if(s[i]=='(')rc++;
        else {
            if(rc)rc--;
            else {
                lc++;
            }
        }
    }
    while(rc--)s+=')';
    while(lc--)s='('+s;
    cout<<s<<endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		long[] a = new long[4];
		for(int i = 0 ; i < 4 ; i++) a[i] = Long.MAX_VALUE;
		for(int i = 1 ; i <= h - 1 ; i++) {
			long s1 = 1L * i * w;
			long ww = w / 2;
			long s2 = 1L * (h - i) * ww;
			long s3 = 1L * (h - i) * (w - ww);
			long max = Math.max(s1, Math.max(s2, s3));
			long min = Math.min(s1, Math.min(s2, s3));
			a[0] = Math.min(a[0], max - min);
		}
		for(int i = 1 ; i <= w - 1 ; i++) {
			long s1 = 1L * i * h;
			long hh = h / 2;
			long s2 = 1L * (w - i) * hh;
			long s3 = 1L * (w - i) * (h - hh);
			long max = Math.max(s1, Math.max(s2, s3));
			long min = Math.min(s1, Math.min(s2, s3));
			a[1] = Math.min(a[1], max - min);
		}
		for(int i = 1 ; i <= h - 1 ; i++) {
			long s1 = 1L * i * w;
			long half = (h - i) / 2;
			long s2 = 1L * half * w;
			long s3 = 1L * ((h - i) - half) * w;
			long max = Math.max(s1, Math.max(s2, s3));
			long min = Math.min(s1, Math.min(s2, s3));
			a[2] = Math.min(a[2], max - min);
		}
		for(int i = 1 ; i <= w - 1 ; i++) {
			long s1 = 1L * i * h;
			long half = (w - i) / 2;
			long s2 = 1L * half * h;
			long s3 = 1L * ((w - i) - half) * h;
			long max = Math.max(s1, Math.max(s2, s3));
			long min = Math.min(s1, Math.min(s2, s3));
			a[3] = Math.min(a[3], max - min);
		}
		Arrays.sort(a);
		System.out.println(a[0]);
	}
}


Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);

		int A = stdIn.nextInt();
		int B = stdIn.nextInt();

		if(A%2 == 1 && B%2 == 1)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}



	}

}


Measured memory_bytes: 35668
#include <iostream> 
using namespace std;
int main() {
int d[101]={0},a,m=0; 
while(cin>>a){
 d[a]++;
        m=max(m,d[a]);
 } 
for(int i=1;i<=100;i++){ 
if(m==d[i])cout<<i<<endl; 
 }
return 0; 
}

Measured memory_bytes: 2968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(b-a>k||c-a>k||d-a>k||e-a>k||c-b>k||d-b>k||e-b>k||d-c>k||e-c>k||e-d>k){
      cout<<":("<<endl;
    }else{
      cout<<"Yay!"<<endl;
    }
}

Measured memory_bytes: 256
@n = gets.split(' ').map(&:to_i)
s = gets.chomp.split('')

def throw(a, b)
	temp = @n[0]
	@n[0] = @n[a]
	@n[a] = @n[5]
	@n[5] = @n[b]
	@n[b] = temp
end

s.size.times{|i|
	case s[i]
	when 'E'
		throw(3, 2)
	when 'N'
		throw(1, 4)
	when 'S'
		throw(4, 1)
	else
		throw(2, 3)
	end
}

puts @n[0]

Measured memory_bytes: 8632
import numpy as np

D = int(input())
Cs = np.array(list(map(int, input().split())))
Ss = []
for d in range(D):
    s = list(map(int, input().split()))
    Ss.append(s)

Ss = np.array(Ss)


def scoring(solution):
    sat = 0
    last = [0] * 26
    for d in range(D):
        assert 1 <= solution[d] <= 26
        j = solution[d] - 1
        last[j] = d + 1
        for i in range(26):
            sat -= (d + 1 - last[i]) * Cs[i]
        sat += Ss[d][j]
    return sat


def update_days_till_next(days_till_next, solution, d, erase=False):
    contest = solution[d]
    delta = days_till_next[d + 1, contest] + 1 if d < D - 1 else 0
    days_till_next[d, contest] = delta
    for _d in range(d - 1, -1, -1):
        if solution[_d] == contest or _d == 0:
            days_till_next[_d:d, contest] = (d - _d) - np.arange(d - _d) + (delta if erase else 0)
            break


def get_solution(seed):
    solution = np.array(seed)
    days_till_next = np.ones_like(Ss) * (D - 1) - np.arange(D).reshape((D, 1))
    for d in range(D - 1, -1, -1):
        update_days_till_next(days_till_next, solution, d)

    for _ in range(150):
        n_contests = len(Ss[0])
        days_since_last = np.zeros(n_contests)
        for d, i in enumerate(solution):
            days_since_last += 1
            new_scores = days_till_next[d] * days_since_last * Cs + Ss[d]
            new_i = new_scores.argmax()
            days_since_last[new_i] = 0
            if new_i != i:
                update_days_till_next(days_till_next, solution, d, erase=True)
                solution[d] = new_i
                update_days_till_next(days_till_next, solution, d)

    return solution


def get_best_solution():
    seeds = [np.argmax(Ss + Cs.reshape(1, -1) * e, axis=1) for e in [100, 400, 1600, 6400, 25600]]
    best_sol = None
    best_score = -np.inf
    for seed in seeds:
        sol = get_solution(seed) + 1
        score = scoring(sol)
        if score > best_score:
            best_sol = sol

    return best_sol


solution = get_best_solution()


for s in solution:
    print(s)

# with open("test.out", "w") as f:
#     f.writelines("\n".join(list(map(str, solution))))


Measured memory_bytes: 27776
n=int(input())
c=[0 for _ in range(n+1)]
flag=[False for _ in range(n+1)]

for x in range(1,n+1):
    for y in range(1,n+1):
        for z in range(1,n+1):
            i=x*x + y*y + z*z + x*y + y*z + z*x
            if(i>n):
                break
            elif(x==y and y==z and z==x):
#                print(x,y,z,i)
                if(flag[i]):
                    pass
                else:
                    c[i]+=1
                    flag[i]=True
            else:
#                print(x,y,z,i)
                c[i]+=1
        j=x*x + y*y + 1 + x*y + y + x
        if(j>n):
            break
    k=x*x + 1 + 1 + x + 1 + x
    if(k>n):
        break

for i in range(1,n+1):
    print(c[i])

Measured memory_bytes: 9172
a, b, c = map(int,input().split())
P = [0, 0, 0]
ans = 0

if a % 2 == 1:
    P[0] = 1
if b % 2 == 1:
    P[1] = 1
if c % 2 == 1:
    P[2] = 1

s = P.count(1)

if s == 1:
    ans += 1
    if P[0] == 0:
        a += 1
    if P[1] == 0:
        b += 1
    if P[2] == 0:
        c += 1
elif s == 2:
    ans += 1
    if P[0] == 1:
        a += 1
    if P[1] == 1:
        b += 1
    if P[2] == 1:
        c += 1

ans += (max(a, b, c) - a) // 2
ans += (max(a, b, c) - b) // 2
ans += (max(a, b, c) - c) // 2

print(ans)

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

#define int long long 

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int fa[maxn],n,m,t;
vector<pii > a;

int find(int x) {return fa[x]==x?x:fa[x]=find(fa[x]);}

signed main() {
    read(n),read(m),read(t);int c=0;
    for(int i=1;i<=n;i++) fa[i]=i;
    for(int i=1;i<=t;i++) {
        int x,y,z;read(x),read(y),read(z);
        if(z) a.pb(mp(x,y));
        else {
            x=find(x),y=find(y);
            if(x!=y) fa[x]=y,c++;
        }
    }c=n-c;
    for(auto x:a) if(find(x.fr)==find(x.sc)) return puts("No"),0;
    int l=a.size()?max(3ll,c):c-1,r=c*(c-1)/2;
    if(m-n+c>=l&&m-n+c<=r) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int nwd(int a, int b)
{
    int c;
    while (b != 0)
    {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    int d = -1;
    int maxi = 0;
    bool jest = false;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        if (x == k)
            jest = true;
        maxi = max(maxi, x);
        if (d == -1)
            d = x;
        else
            d = nwd(d, x);
    }
    if (jest)
    {
        cout << "POSSIBLE";
        return 0;
    }
    if (k > maxi)
    {
        cout << "IMPOSSIBLE";
        return 0;
    }
    if (d == 1)
    {
        cout << "POSSIBLE";
        return 0;
    }
    if (k % d == 0)
        cout << "POSSIBLE";
    else
        cout << "IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 256
#include <limits.h>
#include <stdio.h>
int a[200][200], c[10][10], dist[10][10], h, w;
void dijkstra(int start) {
    int i, prev[10], queue[10], u, v;
    for (i = 0; i <= 9; ++i) {
        if (i == start) {
            dist[start][i] = 0;
        } else {
            dist[start][i] = INT_MAX;
        }
        prev[i] = -1;
        queue[i] = 1;
    }
    while (1) {
        for (i = 0; i <= 9; ++i) {
            if (queue[i]) {
                break;
            }
        }
        if (i == 10) {  /* queue is empty. */
            break;
        }
        u = i;
        for (i = 0; i <= 9; ++i) {
            if (queue[i]) {
                if (dist[start][i] < dist[start][u]) {
                    u = i;
                }
            }
        }
        queue[u] = 0;
        for (v = 0; v <= 9; ++v) {
            if (dist[start][v] > dist[start][u] + c[u][v]) {
                dist[start][v] = dist[start][u] + c[u][v];
                prev[v] = u;
            }
        }
    }
}
int main(void) {
    int i, j, sum = 0;
    scanf("%d%d", &h, &w);
    for (i = 0; i <= 9; ++i) {
        for (j = 0; j <= 9; ++j) {
            scanf("%d", &c[i][j]);
        }
    }
    for (i = 0; i <= 9; ++i) {
        dijkstra(i);
    }
    for (i = 0; i < w; ++i) {
        for (j = 0; j < h; ++j) {
            scanf("%d", &a[i][j]);
            if (a[i][j] != -1) {
                sum += dist[a[i][j]][1];
            }
        }
    }
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys

n= int(input())
#tmp= float(input())

data=[]


for i in range(12):
    tmp=[]
    for j in range(10):
        tmp.append(0)
    data.append(tmp)

for i in range(n):
    tmp = input().split()
    b,f,r,v = list(map(lambda a: int(a), tmp))
    data[(b-1)*3+f-1][r-1]+=v




for i in range(4):
    for j in range(3):
        tmp=""
        for k in range(10):
            tmp+=" "
            tmp+=str(data[i*3+j][k])
#            if(k!=9):
#                tmp+=" "
        print(tmp)
    if(i!=3):
        print("####################")



Measured memory_bytes: 5616
/*
 * main.cpp
 *
 *  Created on: 2020/04/04
 *      Author: SkAaO
 */

#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main(){
	long long k;
	cin >> k;

	vector<long long> a;
	for(int i = 1; i < 10; i++){
		a.push_back(i);
	}

	while(1){
		if(k <= (int)a.size()){
			cout << a.at(k-1) << endl;
			return 0;
		}
		k -= a.size();
		vector<long long> old;
		swap(a, old);
		for(int i = 0; i < (int)old.size(); i++){
			for(int j = -1; j <= 1; j++){
				long long d = old.at(i) % 10 + j;
				if(d > 9 || d < 0){
					continue;
				}
				a.push_back(old.at(i) * 10 + d);
			}
		}
	}
	return 0;
}




Measured memory_bytes: 1712