akhauriyash/Code-Regression huggingface dataset:
using System;

class AOJ {
  static void Main(string[] args)
  {
    string s;
    int ans;
    int[] era = new int[1000000];

    while ((s = Console.ReadLine()) != null) {

      int n = int.Parse(s);

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

      ans = 0;

      for (int i = 2; i <= n; i++) {
        if (era[i] == 1) {
          ans++;
          for (int j = i; j <= n; j += i) era[j] = 0;
        }
      }

      Console.WriteLine(ans);
    }
  }
}

Measured memory_bytes: 12928
#include<stdio.h>
#include<stdlib.h>
int fibonacci(int,int*);

int main(){
  int n,i=0;
  int *num;
  scanf("%d",&n);

  num=malloc(sizeof(int)*(n+1));
  
  while(i!=n+1) num[i++]=0;
  
  printf("%d\n",fibonacci(n,num));
 
  return 0;

}

int fibonacci(int n,int *num){

  if(n==0 || n==1){ 
    num[n]=1;
    return 1; 
  }
  
  if(num[n]!=0) return num[n];

  return num[n]=fibonacci(n-2,num)+fibonacci(n-1,num);
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    ll v = 0;
    ll x = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < n; i++) {
        if (a[i] > b[i])v += a[i] - b[i];
        else x += (b[i] - a[i]) / 2;
    }
    if (v <= x)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

int main() {
  int N; cin >>N;
  string s; cin >>s;
  int a=count(s.begin(),s.end(),'R');
  int b=N-a;
  cout <<(a>b ? "Yes":"No") <<endl;
  return 0;
}


Measured memory_bytes: 3612
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  map<ll,ll> m;
  ll n;
  cin >> n;

  rep(i,n)
  {
    ll b;
    cin >> b;
    m[b]++;
  }

  ll ans = 0;
  for(auto itr = m.begin(); itr != m.end(); itr++)
  {
    ans += itr->second % 2;
  }

  cout << ans << endl;
  
  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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


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


	int n;
	cin>>n;
	if(n<3)
		cout<<"0";
	else
	{
		map<long long,long long>mp;
		set<long long>k;

		for(int i=0;i<n;i++)
		{
			long long x;
			cin>>x;
			mp[x]++;
			k.insert(x);
		}

		long long dup[k.size()];

		int i=0;
		for(auto x:k){
			
			dup[i]=x;
			i++;
		}
		int c= int(k.size());

		long long cnt=0;
		for(long long i=0;i<c;i++)
		{
			for(long long j=i+1;j<c;j++)
			{
				for(long long l=j+1;l<c;l++)
				{
					if(dup[i]+dup[j]>dup[l])
					{
						cnt += (mp[dup[i]]*mp[dup[j]]*mp[dup[l]]);
					}
				}
			}
		}
		cout<<cnt;

	}
    return 0;
}


Measured memory_bytes: 3664
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自动生成的方法存根
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int K=sc.nextInt();
        int X=sc.nextInt();
        int Y=sc.nextInt();
        int Total=0;
        if(N>K) {
        	Total=(K*X)+(N-K)*Y;
        	System.out.println(Total);
        }else {
        	Total=N*X;
        	System.out.println(Total);
        }
	}

}


Measured memory_bytes: 22732
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		int n = as.nextInt();
		long[] a;
		long[] b;
		a = new long[n];
		b = new long[n];
		for(int i=0;i<n;i++){
			b[i] = as.nextLong();
			a[i] = b[i];
		}
		Arrays.sort(a); 
		Arrays.sort(b);
		int l = 0;
		for(int i=0;i<n-1;i++){
			a[i+1]+=a[i];
		}
		for(int i=n-1;i>0;i--){
			if(a[i-1]*2<b[i]){
				l = i;
				break;
			}
		}
		System.out.println(n-l);
	}
}

Measured memory_bytes: 50964
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

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

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

const ll INF = 1LL << 60;
const ll MOD = 1000000007;



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

	ll ans = 0;
	ll reg = 0;

	for (ll i = 0; i < 5; ++i)
	{
		ll A;
		cin >> A;

		ll t = A % 10;

		if (t == 0)
		{
			ans += A;
		}
		else
		{
			ans += (A / 10) * 10 + 10;
			chmax(reg, 10-t);
		}

		//cout << ans << endl;
	}

	ans -= reg;

	cout << ans << endl;

	//system("pause");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int ans;
signed main(){
	int n;
	string a,b,c;
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++){
		if(a[i]==b[i]&&b[i]==c[i]){}
		else if(a[i]==b[i]||b[i]==c[i]||a[i]==c[i]){
			ans++;
		}
		else{
			ans+=2;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
typedef long long lld;
const lld INFN = 3e11+5;
const int MAXN = 305;
lld dp[MAXN][MAXN];
int  H[MAXN];
int K, N;

void init() {
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      dp[i][j] = INFN;
    }
  }
}

lld solve() {
  for (int i = 1; i <= N; ++i) {
    dp[i][1] = H[i];
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 2; j <= i; ++j) {
      lld val = INFN;
      for (int k = 1; k < i; ++k) {
        lld prev = dp[k][j-1];
        if (prev == INFN) continue;
        if (H[i] > H[k]) {
          prev += (H[i] - H[k]);
        }
        val = std::min(prev, val);
      }
      dp[i][j] = val;
    }
  }
  lld ret = INFN;
  for (int i = N-K; i <= N; ++i) {
    ret = std::min(dp[i][N-K], ret);
  }
  return ret;
}

int main() {
  scanf(" %d%d", &N, &K);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &H[i]);
  }
  H[0] = 0;
  init();
  printf("%lld\n", solve());
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main (void)
{
  int A,B,sum=0;
  
  scanf("%d %d", &A, &B);
  
  
  if(A<=B){
  sum += B;
  B -= 1;
    if(A<=B){
    sum += B;
    }
    else
    sum += A;
  }
  else{
  sum += A;
  A -= 1;
    if(A<=B){
    sum += B;
    }
    else
    sum += A;
  }
  
  printf("%d", sum);

  return 0;
}

Measured memory_bytes: 128
import sys
import numpy as np

MOD = 1000000007
S = np.frombuffer(sys.stdin.buffer.read(), dtype=np.int8)
S = S[:-1][::-1] - 48

a = 10 ** np.arange(6) % 13
b = np.tile(np.arange(10), (6, 1))
c = a * b.T % 13
c = c.T
f = np.zeros((6, 13, 13), dtype=np.int64)
for i in range(6):
    f[i, 0, c[i]] = 1
    for j in range(12):
        f[i, j + 1] = np.roll(f[i, j], 1)

dp = np.zeros(13, dtype=np.int64)
dp[0] = 1
digit = 0
count = 0

for i, c in enumerate(S):
    k = i % 6
    if c == 15:
        dp = np.dot(dp, f[k]) % MOD
    else:
        digit += a[k] * c

m = (5 - digit) % 13
print(dp[m])


Measured memory_bytes: 12620
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int a, b;

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

  int ans = 0;
  

  printf( "%d\n", a-(b<a?1:0) );
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%lli", &i);
    ll ans = 0;
    for (int w = 1; w < n; ++w) {
        ll x = 0;
        if((n-1)%w){
            for (int i = 0, j = n-1; i < n-1 && j > 0 && i != j; i += w, j -= w) {
                x += v[i];
                x += v[j];
                if(n-1-i > w) ans = max(ans, x);
            }
        }else {
            for (int i = 0, j = n-1; i < n-1 && j > 0 && i < j; i += w, j -= w) {
                x += v[i];
                x += v[j];
                if(n-1-i > w) ans = max(ans, x);
            }
        }

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

    return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a,b,c;
    cin >>a >> b >> c;
    if(a!=b||b!=c||c!=a){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3592
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int n,m,x;
bool a[27],b[27];
bool c[5][5][5],t[5][5][5];
string w;

int main(){
  int z = 1;
  while(cin >> n,n){
    if(z!=1)cout << endl;
    rep(i,5)rep(j,5){
      cin >> w;
      rep(k,5)c[i][j][k] = (w[k]=='1');
    }
    rep(i,27)a[i] = b[i] = false;
    cin >> m; rep(i,m){cin >> x; a[x] = true;}
    cin >> m; rep(i,m){cin >> x; b[x] = true;}

    rep(d,n){
      rep(i,5)rep(j,5)rep(k,5){
	int s = (c[i][j][k]?-1:0);
	rep(ii,3)rep(jj,3)rep(kk,3){
	  if(i+ii-1<0 || i+ii-1>4 || j+jj-1<0 || j+jj-1>4 ||
	     k+kk-1<0 || k+kk-1>4)continue;
	  if(c[i+ii-1][j+jj-1][k+kk-1])s++;
	}
	t[i][j][k] = c[i][j][k];
	if((!c[i][j][k] && a[s])||(c[i][j][k] && !b[s]))t[i][j][k] = !t[i][j][k];
      }
      swap(c,t);
    }
    cout << "Case " << z << ":\n";
    rep(i,5){ rep(j,5){ rep(k,5)cout << c[i][j][k]; cout << endl; } if(i<4)cout << endl; } 
    z++;
  }
}

Measured memory_bytes: 1208
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int dfs(vector<vector<bool>> way, vector<bool> visited, int dep) {
    int ret = 0;
    bool all_visited = true;
    for (int i = 0; i < visited.size(); i++) {
        if (visited[i] == false) all_visited = false;
    }

    if (all_visited) return 1;

    for (int i = 0; i < way.size(); i++) {
        if (way[dep][i] == false) continue;
        if (visited[i] == true) continue;
        visited[i] = true;
        ret += dfs(way, visited, i);
        visited[i] = false;
    }

    return ret;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<bool>> way(n, vector<bool>(n, false));
    vector<bool> visited(n, false);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        way[a - 1][b - 1] = way[b - 1][a - 1] = true;
    }
    visited[0] = true;
    cout << dfs(way, visited, 0) << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
using namespace std;
const int MAXN = 8;
vector <int> g[MAXN+1];
int n,m;
long long int res=0;
void dfs(int v, long long int mask){
	if(mask==((1LL<<n)-1)){
		res+=1;
	}
	else{
		for(int i=0; i<g[v].size(); i++){
			if(!((1LL<<g[v][i])&(mask))){
				dfs(g[v][i], mask|(1LL<<g[v][i]));
			}
		}
	}
}

int main(){
	cin>>n>>m;
	for(int i=0; i<m; i++){
		int u,v;
		cin>>u>>v;
		g[u-1].push_back(v-1);
		g[v-1].push_back(u-1);
	}

	dfs(0,1);

	cout<<res<<endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	ll n, k;
	cin >> n >> k;
	vector<ll> d(k);
	vector<ll> sunuke(n,0);
	ll ans = 0;
	rep(i, k)
	{
		cin >> d[i];
		ll tmp;
		rep(j, d[i])
		{
			cin >> tmp;
			sunuke[tmp - 1]++;
		}
	}

	rep(i, n)
	{
		if (sunuke[i] == 0)
			ans++;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE
Int N;
vector<vector<P> > G;

//posからNまでいく期待値
_int used[610];
Double mem[610];
Int ng;
Double dfs(Int pos){
  if(pos == N-1) return 0;
  if(used[pos]++) return mem[pos];
  Double sum = 0;
  Int n = 0;
  for(auto p:G[pos]){
    Int to, id; tie(to, id) = p;
    if(id == ng) continue;
    sum += 1 + dfs(to);
    n++;
  }
  Double E = sum / n;
  return mem[pos] = E;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int M;
  cin>>N>>M;
  G.resize(N);
  for(Int i=0;i<M;i++){
    Int s, t;
    cin>>s>>t; s--, t--;
    G[s].emplace_back(t, i);
  }

  ng = -1;
  Double ans = dfs(0);
  for(Int i=0;i<N;i++){
    if(G[i].size() <= 1) continue;
    Int idx = 0;
    ng = -1;
    memset(used, 0 , sizeof(used));
    for(Int j=0;j<(Int)G[i].size();j++)
      if(dfs(G[i][idx].first) < dfs(G[i][j].first)) idx = j;

    ng = G[i][idx].second;
    memset(used, 0 , sizeof(used));
    Min(ans, dfs(0));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;
    long long AB=A*X+B*Y;
    int ans=0;
    for(int i=0;i<100001;i++){
        ans = i*2*C+max(0,X-i)*A+max(Y-i,0)*B;
        if(ans<AB)AB=ans;
    }
    cout<<AB<<endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    S = input()
    while True:
        S = S[:-2]
        L = len(S)
        if S[:L//2] == S[L//2:]:
            print(L)
            break



if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
using namespace std;
int main(void){
    int A,B,C;
    cin >> A >>B >>C;
    int K;
    cin >>K;

    int M;
    if(A>=B){
        if(A>=C){
            M=A;
            for(int i=0;i<K;i++){
                M=M*2;
            }
            cout<<M+B+C<<endl;
        }else {
            M=C;
            for(int i=0;i<K;i++){
                M=M*2;
            }
            cout<<M+B+A<<endl;
        }
    }else{
        if(B>=C){
            M=B;
            for(int i=0;i<K;i++){
                M=M*2;
            }
            cout<<M+A+C<<endl;
        }else{
            M=C;
            for(int i=0;i<K;i++){
                M=M*2;
            }
            cout<<M+B+A<<endl;
        }
    }
   

    

    return 0;
}

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

#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define END(x) do{cout<<(x)<<endl;exit(0);}while(0)
#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 exp2(x)  (1LL<<(x))

using namespace std;
using ll=long long;


ll f(ll a, ll div) {
    return a / div;
}

ll gcd(ll a, ll b) {
    if (a==0) return b;
    return gcd(b%a, a);
}
int main() {
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
  ll A, B, C, D; cin >> A >> B >> C >> D;

  ll a1= (f(B, C) - f(A-1,C));
  ll a2= (f(B, D) - f(A-1,D));
  ll cd = C / gcd(C,D) * D;
  
  ll a3= (f(B, cd) - f(A-1,cd));

  END(  B-A+1 - ( a1+a2 -a3 ) );

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int A[1000000];
int n;
vector<int> G;

// 間隔gを指定した挿入ソート
void insertionSort(int a[], int n, int g) {
	for(int i=g; i<n; i++) {
		int v = a[i];
		int j = i-g;
		while(j>=0 && a[j] > v) {
			a[j + g] = a[j];
			j-=g;
			cnt++;
		}
		a[j+g] = v;
	}
}

void shellSort(int a[], int n) {
	// 数列G = {1,4,13,40,121,364,1093,....}を作成
	for(int h = 1; ; ) {
		if(h > n) break;
		G.push_back(h);
		h = 3*h + 1;
	}

	for ( int i = G.size()-1; i>=0; i--) { // 逆順にG[i] = gを指定
		insertionSort(a, n, G[i]);
	}
}

int main() {
	cin >> n;
	// より速い入力scanf関数を使用
	for ( int i = 0; i < n; i++ ) scanf("%d", &A[i]);
	cnt = 0;

	shellSort(A,n);

	cout << G.size() << endl;
	for(int i = G.size() -1; i>=0; i--) {
		printf("%d",G[i]);
		if ( i ) printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for(int i=0; i<n; i++ ) printf("%d\n",A[i]);

		return 0;

}





Measured memory_bytes: 7184
#include<bits/stdc++.h>
#define FOR(i,l,r) for(int i=l;i<=r;i++)
#define ll long long
#define inf 0x3f3f3f3f

using namespace std;

ll A,B,C,D;
ll gcd(ll a,ll b){return b == 0 ? a : gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    cin>>A>>B>>C>>D;
    ll tmp;
    //cout<<(-1)/2<<endl;
    tmp=B/C-(A-1)/C;
    tmp+=B/D-(A-1)/D;
    ll x=lcm(C,D);
    tmp-=B/x-(A-1)/x;
    cout<<B-A+1-tmp<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (long long i = j; i > 0; i--)
using namespace std;

int main() {
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	long long ans = 0;

	if (a >= k) {
		ans = k;
		k = 0;
		cout << ans << endl;
		return 0;
	}
	else {
		ans += a;
		k -= a;
	}

	if (b >= k) {
		cout << ans << endl;
		return 0;
	}
	else {
		k -= b;
	}

	if (c >= k) {
		ans -= k;
		cout << ans << endl;
	}
	else {
		ans -= c;
		cout << ans << endl;

	}

	return 0;
}

Measured memory_bytes: 3632
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int l(vector<int>&a,int m,int k,int q){
    vector<int> v;
    priority_queue<int,vector<int>,greater<int>> pq;
    for(auto&i:a){
        if(i<m){
            sort(v.begin(),v.end());
            fr(j,(int)v.size()-k+1) pq.push(v[j]);
            v.clear();
        }
        else v.emplace_back(i);
    }
    if(pq.size()<q) return INT_MAX;
    fr(i,q-1) pq.pop();
    return pq.top()-m;
}

class ERangeMinimumQueries {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,k,q;
        in>>n>>k>>q;
        vector<int> a(n);
        for(auto&i:a) in>>i;
        a.emplace_back(0);
        int ans=INT_MAX;
        fr(i,n) ans=min(l(a,a[i],k,q),ans);
        out<<ans<<endl;
    }
};

int main() {
    ERangeMinimumQueries solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

long long MOD=1000000007;
void solve(){
string s;
cin>>s;
long long n=s.size();
unordered_map<long long,unordered_map<long long,long long>> dp;
if(s[0]=='?'){
	for(long long i=0;i<10;i++){
		dp[0][i]=1;
	}
}
else{
dp[0][s[0]-'0']=1;

}
for(long long i=1;i<n;i++){
	long long c;
	if(s[i]=='?'){
		c=-1;
	}
	else{
	c=s[i]-'0';
	}
	for(long long j=0;j<10;j++){
		if(c!=-1&&c!=j){
			continue;
		}
		for(long long k=0;k<13;k++){
			dp[i][(10*k+j)%13]+=dp[i-1][k];
		}
	}
	for(long long j=0;j<13;j++){
		dp[i][j]=dp[i][j]%MOD;
	}
	
}
cout<<dp[n-1][5];
}



int main() {
solve();


}



Measured memory_bytes: 68516
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long int ll;

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll > A(N);

    //vector<ll >
    
    ll sum = 0;
    for(ll i = 0; i < N; i++){
        cin >> A[i];
    }

    //累積和
    vector<ll > ruiseki;
    ruiseki.push_back(0);
    for(ll i = 0; i < N; i++){
        sum += A[i];
        ruiseki.push_back(sum);
    }   
    //cout << ruiseki.size() << endl;
    //累積わにMOD
    ll ans = 0;
    //連想配列用意
    map<ll, ll> result;
    for(ll i = 0; i < ruiseki.size(); i++){
        //ruiseki[i] %= M;
        //cout << ruiseki[i] << " ";
        result[ruiseki[i] % M]++;
    }     
    //cout << endl;
    for(auto i = result.begin(); i != result.end() ; ++i){
        ll value = i->second;
        if(value == 1) continue;
        ans += value * (value - 1) / 2;
    }
    //ans = ans * (ans - 1) / 2;
    cout << ans << endl;


} 

Measured memory_bytes: 5748
import java.util.*;
  
class Main{
   public static void main(String[] args){
     Scanner stdId = new Scanner(System.in);
     int a = stdId.nextInt(); 
		 int b = stdId.nextInt();
		 int c = stdId.nextInt();
     int[] num = {a,b,c};
     Arrays.sort(num);
     System.out.println("" + num[0] + " " + num[1] + " " + num[2]);
  }
}

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

int a[555][555];
void f(int x, int y, int k) {
	if (y - x < 2) return;
	int m = (x + y) / 2;
	f(x, m, k + 1), f(m, y, k + 1);
	for (int i = x; i < m; i++)
		for (int j = m; j < y; j++)
			a[i][j] = k;
}
int main() {
	int n;
	cin >> n;
	f(0, n, 1);
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++)
			cout << a[i][j] << ' ';
		cout << '\n';
	}
	cout << flush;
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define lli long long int
#define ll long long 
#define dd double
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define limit 1000000000000000000
const double pi=3.14159265358;

using namespace std;

int main()
{
	fast
	lli x,n,min=110,pos=-1;
	cin>>x>>n;
	lli br[102];
	for(int i=0;i<102;i++)
	{
		br[i]=0;	
	}
	lli ar[n];
	for(int i=0;i<n;i++)cin>>ar[i];
	
	for(int i=0;i<n;i++)br[ar[i]]=1;
	
	for(int i=0;i<102;i++)
	{
		if(br[i]!=1)
		{
			//cout<<abs(x-i)<<endl;
			if(abs(x-i)<min)
			{
				min=abs(x-i);
				pos=i;
			}
		}
	}
	cout<<pos<<endl;
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
    val (n, w) = readLine()!!.split(' ').map { it.toInt() }
    val dp = Array(n + 1) { LongArray(w + 1) }

    for (i in 0 until n) {
        val (wi, vi) = readLine()!!.split(' ').let { it[0].toInt() to it[1].toLong() }

        for (j in 0 until wi) {
            dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j])
        }
        for (j in wi..w) {
            dp[i + 1][j] = Math.max(dp[i][j - wi] + vi, dp[i][j])
        }
    }

    println(dp[n][w])
}


Measured memory_bytes: 156192
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def func(x1, x2):
    r = 0
    for i in range(len(x1)):
        r += (x1[i] - x2[i]) ** 2

    a = int(sqrt(r))
    return a ** 2 == r or (a - 1) ** 2 == r or (a + 1) ** 2 == r


def main():
    N, D = map(int, input().split())

    dot = []
    for _ in range(N):
        x = list(map(int, input().split()))
        dot.append(x)

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            ans += func(dot[i], dot[j])
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3960
#!/usr/bin/env python3
n = int(input())
a = list(map(int,input().split()))

if n % 2:
    for i in a[-1::-2]:
        print(i,end=" ")
    for i in a[1::2]:
        print(i,end=" ")
else:
    for i in a[-1::-2]:
        print(i,end=" ")
    for i in a[0::2]:
        print(i,end=" ")
        

Measured memory_bytes: 26020
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			int m = sc.nextInt();/* 受験者数 */
			int n_min = sc.nextInt();/* 最低合格者数 */
			int n_max = sc.nextInt();/* 最高合格者数 */
			if(m == 0) break;
			
			int[] score = new int[m];
			for(int i = 0; i < m; i++) score[i] = sc.nextInt();
			
			int gap_max = 0;/* 差は最小より低く初期化 */
			int NoSC = n_min;/* number of successful candidates */
			for(int i = n_min; i <= n_max; i++) {
				int gap = score[i-1] - score[i];
				if(gap > gap_max) {
					gap_max = gap;
					NoSC = i;
				}else if(gap == gap_max) {
					NoSC = i;
				}
			}
			System.out.println(NoSC);
		}
	}

}



Measured memory_bytes: 55868
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
	map<string, int> m;
	
	cin>>N;
	
	for(int i = 0; i < N; i++){
		string s;
		
		cin>>s;
		
		m[s]++;
	}
	
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;
	
	return 0;
}

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

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

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

	vector<int> S(N), T(M);
	for (auto &x : S) cin >> x;
	for (auto &x : T) cin >> x;

	vector<vector<long long>> dp(N + 1, vector<long long>(M + 1, 0));

	for (int i = 0; i <= N; ++i) {
		dp[i][0] = 1;
	}
	for (int j = 0; j <= M; ++j) {
		dp[0][j] = 1;
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j]) % MOD;
			if (S[i] != T[j]) {
				dp[i + 1][j + 1] = (dp[i + 1][j + 1] + MOD - dp[i][j]) % MOD;
			}
		}
	}
	cout << dp[N][M] << endl;
}


Measured memory_bytes: 31616
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
  int n;
  double a[10010] = {};
  double av = 0;
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    av += a[i];
  }
  
  av /= n;
  double min = 100010;
  int sub;
  
  for (int i = 0; i < n; i++) {
    if (min > fabs(av - a[i])) {
      min = fabs(av - a[i]);
      sub = i;
    }
  }
  
  cout << sub << endl;
}
  
  

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
namespace mint {
  constexpr int md = 1'000'003;
  inline void add (int &a, int b) {
    a += b; if (a >= md) a -= md;
  }
  inline void sub (int &a, int b) {
    a -= b; if (a < 0) a += md;
  }
  inline int sum (int a, int b) {
    add(a, b); return a;
  }
  inline int dif (int a, int b) {
    sub(a, b); return a;
  }
  template<class... A>
  inline int prod (A... args) {
    long long ret = 1;
    for (int a : initializer_list<int>{args...}) {
      ret *= a;
    }
    return (int)(ret % md);
  }
  inline void mul (int &a, int b) {
    a = prod(a, b);
  }
  inline int inv (int a) {
    a %= md;
    if(a < 0) a += md;
    int b = md, u = 0, v = 1;
    while (a) {
      int t = b / a;
      b -= a * t; swap(a, b);
      u -= v * t; swap(u, v);
    }
    assert(b == 1);
    if(u < 0) u += md;
    return u;
  }
  inline int quat (int a, int b) {
    return prod(a, inv(b));
  }
  inline void div (int& a, int b) {
    a = quat(a, b);
  }
  inline int pow (int a, long long b) {
    int res = 1;
    for (; b; b >>= 1) {
      if (b & 1) mul(res, a);
      mul(a, a);
    }
    return res;
  }
}
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  const int pmx = 32;
  vector<vector<int>> dp(pmx, vector<int>(mint::md, 1));
  vector<int> iv(mint::md);
  for (int i = 1; i < mint::md; i++) {
    iv[i] = mint::inv(i);
  }
  for (int i = 1, p = 1; i < pmx; i++) {
    for (int y = 1; y < mint::md; y++) {
      dp[i][y] = ((1 << i) > mint::dif(0, iv[y])) ?
        0 :
        mint::prod(
          dp[i - 1][y],
          mint::pow(mint::sum(1, mint::prod(y, p)), p),
          dp[i - 1][mint::prod(y, iv[mint::sum(1, mint::prod(y, p))])]
        );
    }
    p *= 2;
  }
  auto dal = [&] (int x, int d, int i) -> int{
    return mint::prod(mint::pow(x, (1 << i)), dp[i][mint::prod(d, iv[x])]);
  };
  auto cal = [&] (int x, int d, int n) -> int {
    int ret = 1;
    for (int i = 0; i < pmx; i++) {
      if (n >> i & 1) {
        mint::mul(ret, dal(x, d, i));
        mint::add(x, mint::prod(d, 1 << i));
      }
    }
    return ret;
  };
  int q;
  cin >> q;
  while (q--) {
    int x, d, n;
    cin >> x >> d >> n;
    int ret;
    if (n == 0) ret = 1;
    else if (x == 0) ret = 0;
    else ret = cal(x, d, n);
    cout << ret << endl;
  }
  return 0;
}

Measured memory_bytes: 131644
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division, print_function
from math import factorial
import sys


def combinations(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)


def main():
    n, p = map(int, sys.stdin.readline().strip().split(" "))
    a = map(int, sys.stdin.readline().strip().split(" "))
    evens, odds = 0, 0
    for i in a:
        if i % 2 == 0:
            evens += 1
        else:
            odds += 1


    if p % 2 == 0:
        r = 0
        for j in range(0, odds + 1, 2):
            r += combinations(odds, j)
        print(2 ** evens * r)
    else:
        r = 0
        if odds == 0:
            print(0)
        else:
            for j in range(1, odds + 1, 2):
                r += combinations(odds, j)
            print(2 ** evens * r)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2820
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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 * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから



void solve(){
  int a,b,c;
  cin>>a>>b>>c;
  if(b-a==c-b)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: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int main()
{
    int d;
    int c[26];
    int s[365][26];
    cin >> d;
    rep(i, 26) cin >> c[i];
    rep(i, d) rep(j, 26) cin >> s[i][j];

    int last[26] = {};
    int t[365] = {1};
    rep(i, d) {
        int max_v = - INF;
        rep(j, 26) {
            int v = 0;
            v += s[i][j];
            rep(k, 26) {
                if (k == j) continue;
                v -= c[k] * (i + 1 - last[k]);
            }
            if (v > max_v) {
                max_v = v;
                t[i] = j + 1;
            }
        }
    }

    rep(i, d) {
        cout << t[i] << endl;
    }
    return 0;
}

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

void swap(int *x, int *y)
{
  if (*x < *y){
    int t = *x;
    *x = *y;
    *y = t;
  }

}

int main()
{
  int a, b, c, k;

  cin >> a >> b >> c >> k;

  swap(&b, &c);
  swap(&a, &b);

  while (k){
    a *= 2;
    k--;
  }

  cout << a + b + c << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n = int(input())
x = list(map(int, input().split()))

ans = 99999999999

for i in range(100):
    cnt = 0

    for j in range(n):
        cnt += (x[j] - (i + 1)) ** 2

    ans = min(ans, cnt)

print(ans)


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

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

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

  bool answer = false;
  for (size_t i = 0; i < 9; i++) {
    for (size_t j = 0; j < 9; j++) {
      if (N == (i+1)*(j+1)) {
        answer = true;
      }
    }
  }

  if (answer) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a,b,x;
int main()
{
    scanf("%lld%lld%lld",&a,&b,&x);
    printf("%lld\n",b/x-(a-1)/x+((a==0&&x!=1)?1:0));
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 1;										/* デバッグプリント 提出時は0 */
int main()
{
	double	ans = 0;
	int		yn ;
	int		W,H,x,y;
	double	Wf,Hf,xf,yf;

	scanf("%d %d %d %d", &W, &H, &x, &y);
	Wf = W; Hf = H;

	yn = ( (x*2==W)&&(y*2==H) ) ? 1 : 0;

	printf("%.6f %d\n",Wf*Hf/2,yn);

	return 0;
}


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

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

int main() {
  ll n;
  cin >>n;
  vector<ll>a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(a.rbegin(),a.rend());
  
  ll c=a[0];
  ll m=n-2;
 
  
  if(m%2==0){
    for (int i = 1; i < m/2+1 ;i++){
      c+=2*a[i];
    }
  }
  else if(m%2==1){
    for (int i = 1; i < m/2+1 ;i++){
      c+=2*a[i];
    }
    c+=a[m/2+1];
  }
  cout << c << endl;
  return 0;

}



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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

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

int main()
{
  ll n;
  vector<ll> x(5);
  cin >> n;
  rep(i, 5) cin >> x[i];
  ll min_x = *min_element(ALL(x));
  cout << 5 + (ll)ceil((double)n/min_x) - 1 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;


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();
		
		if(A<=C&C<=B){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
	}
	
}


Measured memory_bytes: 22612
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = tmp[0];
            int M = tmp[1];
            int[] A = ReadLine().Split(' ').Select(int.Parse).ToArray();

            Array.Sort(A);
            Array.Reverse(A);

            int sum = 0;
            for (int i = 0; i < N; i++) sum += A[i];

            bool ans = true;

            for(int i = 0;i < M; i ++)
            {
                if (A[i] * 4 * M < sum) ans = false;
            }
            WriteLine(ans ? "Yes": "No");
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dbl;
#define sqr(int) (int * int)
#define sqr3(int) (int * int * int)
#define pi M_PI
#define nl "\n"


void solve(){
	dbl a,b,c;
	cin >> a >> b >> c;
	if(a/c <= b){
		cout << "Yes";
		return;
	}
	cout << "No";



}


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




Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	while(cin>>a>>b>>c)
	{
		bool f=0;
		for(int i=1;i<=b;i++)
		{
			if(a*i%b==c){
				puts("YES");
				f=1;
				break;
			}
		}
		if(!f)puts("NO"); 
	}

	return 0;
}

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

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> P(n);
  vector<int> questions(3);
  for(int i=0;i<n;i++) {
    cin >> P[i];
    if(P[i] <= a) questions[0]++;
    else if(P[i] <= b) questions[1]++;
    else questions[2]++;
  }

  cout << *min_element(questions.begin(), questions.end()) << endl;

}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N;
  cin >> N;
  ll T[N], A[N];
  for (int i = 0; i < N; i++) cin >> T[i];
  for (int i = 0; i < N; i++) cin >> A[i];

  ll ans = 0;
  if (T[N-1] == A[0] && T[0] <= A[0]) {
    ans = 1;
    for (int i = 1; i < N - 1; i++) {
      if (T[i-1] < T[i]) {
        if (A[i] < T[i]) {
          ans = 0;
          break;
        }
      } else if (A[i] > A[i+1]) {
        if (T[i] < A[i]) {
          ans = 0;
          break;
        }
      } else {
        ans *= min(T[i], A[i]);
        ans %= MOD;
      }
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

int main()
{
    long x;
    cin >> x;
    long ans = 0;
    long amount = 100;
    // cout << x << " " << amount << endl;
    while (amount < x)
    {
        amount += amount / 100;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644