akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

/**
 * http://abc042.contest.atcoder.jp/tasks/arc058_b
 * 
 * @author Cummin
 */
public class Main {
    
    public static void main(String[] args) {
        int H, W, A, B ;
         // データの読み込み
        Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        A = sc.nextInt();
        B = sc.nextInt();
        
        routes5(H, W, A, B) ;
        
    }
    static void routes5(int H, int W, int A, int B){
        
        // 逆数の表を作成する
        int inv[] = new int[H] ;
        for (int i=1 ; i<=H ; i++) {
            inv[i-1] = Fermat_Inverse(1000000007, i) ;
        }
        
        // Grid (Cell(B,1),..., Cell(B,(H-A)) を求める　(差分を計算していく)
        int Cell1[] = new int [H-A] ;
        Cell1[0] = 1 ;
        for (int i = 2 ; i <= (H-A); i++) {
            Cell1[i-1] = (int) ((long)Cell1[i-2] * (B+i-2) % 1000000007 * inv[(i-1)-1] % 1000000007) ; 
            // 注: 途中に、" % 1000000007 " を入れないとオーバーフローする
       }
        // 同様に　Grid (Cell((W-B),H-A),..., Cell((W-B),1) を求める
        int Cell2[] = new int[H] ;
        Cell2[0] = 1 ;
        for (int i= 2 ; i <= H ; i++) {
            Cell2[i-1] = (int) ((long)Cell2[i-2] * ((W-B)+i-2) % 1000000007 * inv[(i-1)-1] % 1000000007) ;
        }
        // 最後に、隣通しのCell1とCell2を掛けて、総和を出す
        long ans = 0 ;
        for (int i= 1; i <= (H-A); i++) {
            ans = (ans +((long) Cell1[i-1] * Cell2[H-i])% 1000000007) % 1000000007 ;
    }
        System.out.println(ans) ;
    }
    static int Fermat_Inverse(int m, int x) { // 法 mにおける xの逆元
        return Exponential(x, m-2, m) ;
    }
    static int Exponential(int x, int y, int m) { // x^y % m
        long ans = 1 ;
        int  bit = 0x040000000 ;
        while (bit > 0) {
            if ((y & bit)!=0){
                ans = (ans * x) % m ;
            }
            if (bit > 1 ) {
                bit = bit >>1 ;
                ans = (ans * ans) % m ;
            } else {
                bit = bit >> 1 ;
            }
        }
        return (int) ans ;
    }
}
//////////////////////////////////////////////////////////////////////////////////    
        // 座標 (1,1)から(M,N)へのルートは、(M+N-2)!/((M-1)!(N-1)!)
        // a, b, c,..,xまでの数を求めて、各々からゴールGまでのルート数を計算する
        /*    1 2 3 4 5 6 ... B-B+1......W
            1 *               a-a'
            2                 b-b'
            3                 c-c'
            .
            .
          H-A                 x-x'
            .------------------
            .------------------
            H------------------          G
        */
//////////////////////////////////////////////////////////////////////////////////    


Measured memory_bytes: 10452
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
using namespace std;

typedef long long ll;

ll n, v[1010101], g;
ll a[1010101], b[1010101], c[1010101], d[1010101];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n; for(int i=1; i<=n; i++) cin >> v[i]; g = v[1];
    for(int i=2; i<=n; i++) g = __gcd(g, v[i]);
    
    for(int i=1; i<=n; i++) a[v[i]]++;
    for(int i=1; i<1010101; i++){
        for(int j=i; j<1010101; j+=i) b[i] += a[j];
    }
    for(int i=1; i<1010101; i++) c[i] = b[i] * (b[i] - 1) / 2;
    for(int i=1010101-1; i>=1; i--){
        d[i] = c[i];
        for(int j=2*i; j<1010101; j+=i) d[i] -= d[j];
    }
    
    if(d[1] == n * (n-1) / 2) cout << "pairwise coprime";
    else if(g == 1) cout << "setwise coprime";
    else cout << "not coprime";
}

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

int Max(int a, int b){
	return (a > b)?a:b;
}

int main(){
	/*input*/
	int a, b, c;	cin >> a >> b >> c;
	/*calculation*/
	int ans = 0;
	int max = Max(a, Max(b, c));
	ans = max*10;
	if(max == a){
		ans += b + c;
	}else if(max == b){
		ans += a + c;
	}else{
		ans += a + b;
	}

	/*output*/
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
	int w,h,x,y,r;
	scanf("%d %d %d %d %d", &w, &h, &x, &y ,&r);
	if (x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;

#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}



signed main(){
	//IOS();
	vector<int>ans;
	while(1){
		int T,D,L;
		cin>>T>>D>>L;
		if(!T&&!D&&!L)break;
		vector<int>imos(100010,0);
		rep(i,1,T+1){
			int t;
			cin>>t;
			if(t<L)continue;
			imos[i]++;
			imos[min(T,i+D)]--;
		}
		rep(i,0,100009)imos[i+1]+=imos[i];
		int sum=0;
		rep(i,1,T+1)if(imos[i])sum++;
		ans.push_back(sum);
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+100;
int a[maxn],b[maxn];
multiset<int> se;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,t;
	cin >> a>>b >>t;
	int num = t/a*b;
	cout << num <<endl;

} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int N = scanner.nextInt();

		int[] a = new int[N];

		for(int i = 0; i<N; i++) {
			a[i] = scanner.nextInt();
		}

		int count = 0;
		int current = 1;

		for(int i =0; i<N; i++) {
			if(a[i] == current) {
				current++;
			} else {
				count++;
			}
		}

		if(count == N) {
			System.out.println(-1);
		} else {
			System.out.println(count);	
		}

	}

}

Measured memory_bytes: 87064
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

int main() {
	char s[100001]; cin >> s;
	int azSize = 26;
	bool t[26];
	rep(i, 0, azSize) {
		t[i] = true;
	}

	rep(i, 0, 100001) {
		t[s[i] - 'a'] = false;
		if (s[i + 1] == '\0')break;
	}
	rep(i, 0, azSize) {
		if (t[i]) {
			cout << (char)(i + 'a') << endl;
			return 0;
		}
	}
	cout << "None" << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    size_t c = 0;
    for (size_t i = 0; i < 3; ++i) {
        if (s[i] == t[i])
            ++c;
    }
    cout << c << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
const ll inf = 0x3f3f3f3f;
#define case(i) "Case #" << i << ": "
 
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
    out << '(' << p.first << ", " << p.second << ')';
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
    ll l = v.size();
    for (ll i = 0; i < l - 1; i++) out << v[i] << ' ';
    if (l > 0) out << v[l - 1];
    return out;
}

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

    for(int i = 0; i < 5; ++i) {
        int x;
        cin >> x;
        if(x == 0) cout << i + 1 << endl;
    }
}

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

const int N=1e5+5;
int cache[N];
vector<int>adj[N];
int dfs(int n)
{
    int &ans=cache[n];
    if(ans!=-1)
    /*if previously find longest path for the node n 
    than from here it's compute value return*/
    return ans;
    ans=0;
    for(auto it:adj[n])
    ans=max(ans,1+dfs(it));
    return ans;
}
int32_t main() 
{
    int n,m,u,v;
    ///n->no of node
    //m-> no of edges
    cin>>n>>m;
    //initially decalared cache as -1
    memset(cache,-1,sizeof(cache));
    for(int i=0;i<m;++i)
    {
        //u,v-> directed edge from u to v
        cin>>u>>v;
        // adj[i] contain all the adjacent of thr=e node i
        adj[u].push_back(v);
    }
    int ans=0;
    // find the longest path from every node in the graph
    for(int i=1;i<=n;++i)
    ans=max(ans,dfs(i));
    cout<<ans;
}

Measured memory_bytes: 7424
#include<iostream>
#include<string>
#define mod 1000000007
using namespace std;
typedef long long LL;
int main(){
	int t;
	string s1,s2;
	cin>>t;
	cin>>s1>>s2;
	LL ans=1;
	for(int i=0;i<t;){
		if(i==0){
			if(s1[i]==s2[i]){
				ans*=3;i++;
			}else{
				ans*=6;i+=2;
			}
		}else{
			if(s1[i]==s2[i]){
				if(s1[i-1]==s2[i-1]){
					ans*=2;
				}
				i++;
			}else{
				if(s1[i-1]==s2[i-1]){
					ans*=2;
				}else{
					ans*=3;
				}
				i+=2;
			}
		}
		ans%=mod;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
	int h,w;
	cin >> h >> w;
	vector<string> a(h);
	for(int i=0;i<h;i++)	cin >> a[i];
	for(int i=-2;i<w;i++)	cout << "#";
	cout << endl;
	for(int i=0;i<h;i++)
		cout << "#" << a[i] << "#" << endl;
	for(int i=-2;i<w;i++)	cout << "#";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 300001
long long n, a[N], Max[N], Min[N];

/// Với mỗi i tính Min(i) và Max(i) : n số lớn nhất từ 1 -> i, và n số nhỏ nhất từ i + 1 >= n

priority_queue < long long, vector <long long>, greater <long long> > SuffixMin; /// min heap để tính  Max i
priority_queue < long long > PrefixMax;                                        /// max heap để tính Min in

void Init()
{
    cin >> n;
    for(long long i = 1; i <= n * 3; i++)
        cin >> a[i];
}


void Build_Pre_Min()
{
    for(long long i = 1; i <= n; i++)
    {
        SuffixMin.push(a[i]);
        Max[n] += a[i];
    }

    for(long long i = n + 1; i <= 2 * n; i++)
    {
        long long u = SuffixMin.top();

        if(u < a[i]) {
            SuffixMin.pop();
            Max[i] = Max[i - 1] - u + a[i];
            SuffixMin.push(a[i]);
        }
        else Max[i] = Max[i - 1];
    }
}

void Build_Suf_Max()
{
    for(long long i = 3 * n; i >= 2 * n + 1; i--)
    {
        PrefixMax.push(a[i]);
        Min[2 * n + 1] += a[i];
    }

    for(long long i = 2 * n; i >= n + 1; i--)
    {
        long long u = PrefixMax.top();

        if(u > a[i]) {
            PrefixMax.pop();
            Min[i] = Min[i + 1] - u + a[i];
            PrefixMax.push(a[i]);
        }
        else Min[i] = Min[i + 1];
    }
}

void Solve()
{
    long long res = -1000000000000000000;
    for (long long i = n; i <= 2 * n; i++)
        res = max (res, Max[i] - Min[i + 1]);
    cout << res;
}

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

 //   freopen("SOCIAL.INP", "r", stdin);
   // freopen("SOCIAL.OUT", "w", stdout);

    Init();
    Build_Suf_Max();
    Build_Pre_Min();
    Solve();
}





Measured memory_bytes: 8308
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>

#define INF 9999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int>pi;

/*---------------------------------------------------*/

int main(){
  char a[55][55],b[55][55];
  int n,m;
  cin>>n>>m;
  rep(i,n)rep(j,n)cin>>a[i][j];
  rep(i,m)rep(j,m)cin>>b[i][j];

  bool ok;
  for(int i=0;i<=n-m;i++){
    for(int j=0;j<=n-m;j++){
      ok=true;
      
      for(int k=0;k<m;k++){
	for(int l=0;l<m;l++){
	  if(a[i+k][j+l]!=b[k][l])ok=false;
	}
	if(!ok)break;
      }
      
      if(ok){
	cout<<"Yes"<<endl;
	return 0;
      }
      
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}

int main(){
    ll N,K;
    cin>>N>>K;
    v p(N);
    rep(i,0,N)cin>>p[i];
    sort(all(p));
    ll sum = 0;
    rep(i,0,K)sum+=p[i];
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main(void) {
	int num;
	scanf("%d", &num);
	int i, tmp;
	int cnt = 0;
	for (i = 0; i < num; i++) {
		cnt++;
		//3??§?????????????????°???134??????3???????????§????????°?????????
		tmp = cnt;
		//???????????????
		char threeJudge[1000];
		char *judge;
		sprintf(threeJudge, "%d", cnt);
		//????????¨??????3????????????????????????
		if ((judge=strstr(threeJudge,"3"))!=NULL) {
			printf(" %d", cnt);
		//3??§??????????????????
		}else if (tmp % 3 == 0) {
			printf(" %d", cnt);
		}

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

Measured memory_bytes: 616
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

const int M=1000000007;

using namespace std;

typedef long long ll;

ll pos(ll m, ll n){
  if(n == 0) return 1;
  ll res=pos((m*m) % M, n/2);
  if(n % 2 == 1){
    res=(res*m) % M;
  }
  return res;
}

int main(){
  ll m, n; cin >> m >> n;
  cout << pos(m, n) << endl;
}

Measured memory_bytes: 3072
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
//#define endl "\n"
#define inf 1e+15
int a[N];
signed main(){
  fast;
  int n ; cin>>n;
  int max1 = 0 , max2 = 0;
  for(int i = 0 ; i <n ; i++){
  	cin >> a[i];
  	if(a[i] >= max1)
  		max2 = max1 ,  max1 = a[i];
  	else if(a[i] > max2) max2 = a[i];

  }   

  for(int i = 0; i<n ; i++){
  	if(a[i]==max1) cout<<max2<<endl;
  	else cout << max1<<endl;
  }

}
  


Measured memory_bytes: 3200
import math

n = int(input())
alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
name = ''

while n > 0:
  n -= 1
  name = alp[n % 26] + name
  n = n // 26
  
print(name)

Measured memory_bytes: 9148
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N, K;
  string S;
  cin >> N >> K >> S;
  vector<Pair> ones;
  int64_t start_of_one = -1;
  for (int64_t i = 0; i < N; ++i) {
    if (S[i] == '0') {
      // zero
      if (i - 1 >= 0 && S[i - 1] == '1') {
        ones.emplace_back(start_of_one, i - 1);
        start_of_one = -1;
      }
    } else {
      // one
      if (start_of_one < 0) {
        start_of_one = i;
      }
    }
  }
  if (S[N - 1] == '1') {
    ones.emplace_back(start_of_one, N - 1);
  }
  if (ones.size() == 0) {
    std::cout << N << endl;
    return 0;
  }
  int64_t result = ones[min(K - 1, static_cast<int64_t>(ones.size()) - 1)].second + 1;
  result = max(result, N - ones[ones.size() - K].first);
  for (int64_t i = 0; i < static_cast<int64_t>(ones.size()); ++i) {
    const int64_t end = min(i + K, static_cast<int64_t>(ones.size()) - 1);
    result = max(result, ones[end].second - ones[i].first + 1);
  }
  std::cout << result << endl;
  return 0;
}


Measured memory_bytes: 4480
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

/*
 貪欲
 ①決定問題 必ず解に含まれる(含むように変換できる)ものから決めていく みんプロ本選B
 ②最適化問題 任意の解から評価を落とさず解に含められるようなものから決めていく 区間スケジューリングとか
 ③
 */

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	vector<ll> x(n);
	REP(i,n) cin>>x[i];
	if(m==1) {
		cout<<n/2<<endl;
		return 0;
	}
	vector<vector<ll>> s(m);
	REP(i,n) {
		s[x[i]%m].pb(x[i]);
	}
	ll ret=0;
	ret+=(ll)s[0].size()/2;
	for(ll i=1; m-i>=i; i++) {
		if(m-i==i) {
			ret+=(ll)s[i].size()/2;
			continue;
		}
		ll sml=i,bg=m-i;
		if((ll)s[sml].size()>(ll)s[bg].size()) swap(sml,bg);
		sort(ALL(s[bg]));
		ll cnt=0,buf=0;
		FOR(j,1,(ll)s[bg].size()) {
			if(s[bg][j]==s[bg][j-1]) {
				if(buf==0) buf=2;
				else buf++;
			}
			else {
				cnt+=buf/2;
				buf=0;
			}
		}
		cnt+=buf/2;
		ret+=(ll)s[sml].size();
		ret+=min(((ll)s[bg].size()-(ll)s[sml].size())/2,cnt);
	}
	cout<<ret<<endl;
}


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

int main()
{
    int N, counts = 0, counts8 = 0;
    cin >> N;

    for (int i = 1; i <= N; i++)
    {
        if ((i % 2) != 0)
        {
            for (int j = 1; j <= i; j++)
            {
                if ((i % j) == 0)
                    counts++;
            }
        }
        if (counts == 8)
            counts8++;
        counts = 0;
    }

    cout << counts8 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#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(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<' ';
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    vint b(m);
    rep(i,m)cin>>b[i];
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n)rep(j,m)cin>>a[i][j];

    int ans = 0;
    rep(i,n){
        int tmp = 0;
        rep(j,m){
            tmp += a[i][j]*b[j];
        }
        if((tmp+c)>0)ans++;
    }
    cout<<ans<<endl; return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 100000

int child[N][20];
int parent[N];
int depth[N];
int k[N];
int root;
 
void pr(int id,char str[][20]){
  int type,i;
  if(parent[id] == -1) type = 0;
  else if(k[id] > 0) type = 1;
  else if(k[id] == 0) type = 2;
 
   
  printf("node %d: parent = %d, depth = %d, %s, [", id, parent[id], depth[id], str[type]);
  for(i=0;i<k[id];i++){
    if(i)printf(", ");
    printf("%d",child[id][i]);
  }
  printf("]\n");
}
 
void dfs(int id,int dep){
  int i;
  depth[id] = dep;
  for( i=0;i<k[id];i++)dfs(child[id][i],dep+1);
}
 
int main(){
  int n,i,j,id;
  char str[3][20] = {"root","internal node","leaf"};
  scanf("%d",&n);
  memset(parent,-1,sizeof(parent));
  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&k[id]);
    for(j=0;j<k[id];j++){
      scanf("%d",&child[id][j]);
      parent[ child[id][j] ] = id;
    }
  }
   
  for(i=0;i<n;i++)
    if(parent[i] == -1) root = i;
  dfs(root,0);
  for(i=0;i<n;i++) pr(i,str);
 
  return 0;
}

Measured memory_bytes: 4248
import math

def isPrime(num):
    for i in range(int(math.sqrt(num)), 1, -1):
        if num % i == 0:
            return None
    return num

inputs = []

while True:
    try:
        inputs.append(input())
    except(EOFError):
        break

inputs.pop(0)

print(len([x for x in list(map(isPrime, map(int, inputs))) if x is not None]))



Measured memory_bytes: 6348
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = numeric_limits <int>::max())
{return uniform_int_distribution<int> (l, r)(rng);}

template <typename T, typename G>
ostream& operator << (ostream& out, const pair <T, G> &a) 
{return out << "( " << a.x << ", " << a.y << ")";}

template <typename T>
ostream& operator << (ostream& out, const vector <T> &a) 
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

template <typename T>
ostream& operator << (ostream& out, const set <T> &a) 
{out << "{ "; for(const auto &i: a) out << i << ", "; return out << "}" << endl;}

template <typename T, typename G>
ostream& operator << (ostream& out, const map <T, G> &a) 
{out << "< "; for(const auto &i: a) out << i << ", "; return out << ">" << endl;}

template <typename T, size_t N>
typename enable_if<!is_same <typename remove_cv <T>::type, char>::value,
ostream&>::type operator << (ostream& out, T (&a)[N])
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

void debug_out(){cerr << endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr << (H) << ' '; debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr << '#' << #__VA_ARGS__ << ":\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

int move(int x, int n, int d) {
	if (n & 1) {

	} 
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int x, d, k, ans;
	cin >> x >> k >> d;
	int q = abs(x) / d;
	if (q >= k) {
		ans = abs(x) - k * d;
	} else {
		k -= q;
		int r = x % d;
		if (k & 1ll) {
			ans = min(abs(r - d), abs(r + d));
		} else {
			ans = abs(r);
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3648
n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

import bisect
n_m = bisect.bisect_left(a, 0)
n_0 = bisect.bisect_left(a, 1) - n_m
n_p = n - (n_m + n_0)

nn_p = n - (n_m * n_p + n_0 * (n - n_0) + n_0*(n_0-1)//2)

if( n_m * n_p < k)&(k <= n - nn_p):
    print(0)
    exit()

def calc_m(a, b, len_a, len_b, x):
    i = len_a-1
    j = 0
    cnt = 0
    while(True):
        tmp = a[i] * b[j]
        if( tmp < x):
            cnt += i+1
            j += 1
        else:
            i -= 1

        if(i < 0)|(j >= len_b):
            break
    return cnt

def calc_p(a,len_a, x):
    if(len_a <= 1):
        return 0

    i = len_a - 1
    j = 0
    cnt = 0
    while(True):
        tmp = a[i] * a[j]
        if( tmp < x):
            cnt += i+1 - ( i >= j)
            j += 1
        else:
            i -= 1

        if(i < 0)|(j >= len_a):
            break
    return cnt//2

if( n_m * n_p >= k):
    a_m = tuple(a[:n_m])
    a_p = tuple(a[  :(n - n_p -1):-1])

    ul = [a_m[-1] * a_p[-1]+1, n_m*n_p]
    dl = [a_m[0] * a_p[0]-1, 0]

    while(True):
        if(ul[0] - dl[0] == 1):
            break
        mid = (dl[0] + ul[0])//2
        mid_cnt = calc_m(a_m,a_p,n_m,n_p, mid)

        if( mid_cnt < k):
            dl = [ mid, mid_cnt ]
        else:
            ul = [ mid, mid_cnt ]

    print(dl[0])

else:
    k = k - (n - nn_p)
    a_m = tuple(a[n_m - 1::-1])
    a_p = tuple(a[ (n - n_p) :])

    if(n_m <= 1):
        ul = [a_p[-1] * a_p[-2]+1, nn_p]
        dl = [a_p[0] * a_p[1]-1, 0]
    elif(n_p <= 1):
        ul = [a_m[-1] * a_m[-2]+1, nn_p]
        dl = [a_m[0] * a_m[1]-1, 0]
    else:
        ul = [max(a_m[-1] * a_m[-2]+1 ,a_p[-1] * a_p[-2]+1), nn_p]
        dl = [min(a_p[0] * a_p[1]-1 ,a_m[0] * a_m[1]-1), 0]

    while(True):
        if(ul[0] - dl[0] == 1):
            break
        mid = (dl[0] + ul[0])//2
        mid_cnt = calc_p(a_m,n_m, mid) + calc_p(a_p,n_p, mid)

        if( mid_cnt < k):
            dl = [ mid, mid_cnt ]
        else:
            ul = [ mid, mid_cnt ]

    print(dl[0])

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

int main() {
  int w,h,x,y;
  cin >> w >> h >> x >> y;
  double ans = (double)w*h/2;
  int num = (w==x*2 && h==y*2) ? 1 : 0;
  printf("%.10f %d\n", ans, num);
  return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    inputList = input[0].split(" ").map( str => parseInt(str, 10));
    total = inputList[1] + inputList[2];
    minCount = inputList[0] > total ? 0 : total - inputList[0];
	maxCount = inputList[1] > inputList[2] ? inputList[2] : inputList[1];
	console.log(maxCount + " " + minCount);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int mod = 1e9 + 7;

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

/*-------------------------------------------*/

int n, a, c[4];
double dp[301][301][301];

double DP(int c1, int c2, int c3) {
    if(c1 == 0 && c2 == 0 && c3 == 0) return 0;
    double &x = dp[c1][c2][c3];
    if(x == 0) {
        x = 1;
        if(c1) x += DP(c1 - 1, c2, c3) * c1 / n;
        if(c2) x += DP(c1 + 1, c2 - 1, c3) * c2 / n;
        if(c3) x += DP(c1, c2 + 1, c3 - 1) * c3 / n;
        x /= 1 - double(n - c1 - c2 - c3) / n;
    }
    return x;
}

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

    cin >> n;
    rep(i, n) {
        cin >> a;
        c[a]++;
    }

    printf("%.10f\n", DP(c[1], c[2], c[3]));

    return 0;
}

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

long long ans(string S){
  S.push_back('+');
  string l;
  long long sum = 0;
  for(int i = 0;i<S.size();i++){
    if(S[i] != '+'){
      l.push_back(S[i]);
    }
    else{
      sum += stoll(l);
      l = " ";
    }
  }
    return sum;
  }

int main() {
  string S;
  cin >>S;
  string c = S;
  long long ANS = 0;
 for(int bit =0;bit< (1<<S.size()-1);bit++){
   int d = 0;
   for(int i= 0;i<S.size()-1;i++){
     if(bit & (1<<i)){
       S.insert(i+1+d,"+");
       d++;
     }
   }
   ANS += ans(S);
   S = c;
 }
  cout << ANS << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let M: usize = sc.get();
    let K: usize = sc.get();
    let A: Vec<usize> = sc.vec(N);
    let B: Vec<usize> = sc.vec(M);
    let mut cuma = vec![0; N+1];
    let mut cumb = vec![0; M+1];
    for i in 0..N {
        cuma[i+1] = cuma[i] + A[i];
    }
    for i in 0..M {
        cumb[i+1] = cumb[i] + B[i];
    }
    let mut ans = 0;
    let mut j = M;
    for i in 0..N+1 {
        if cuma[i] > K {
            break;
        }
        while cuma[i] + cumb[j] > K {
            j -= 1;
        }
        ans = max(ans, i + j);
    }
    println!("{}", ans);
}


Measured memory_bytes: 8392
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;cin >> n;
	string s;cin >> s;
	int cnt=0;
	for(int i = 1;i<n;i++)if(s[i]=='E')cnt++;
	int ans = cnt;
	for(int i=1;i<n;i++)
	{
		if(s[i]=='E')cnt--;
		//if(s[i]=='W')cnt--;
		if(s[i-1]=='W')cnt++;
		//if(s[i-1]=='E')cnt--;
		//cout<<cnt<<endl;
		ans = min ( ans , cnt);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	vector<bool> a(n+10,true);
	rep(i,m){
		int x;cin >> x;
		a.at(x)=false;
	}
	vector<ll> dp(n+10);
	dp.at(0)=1;
	rep(i,n){
		if(a.at(i+1)){
			dp.at(i+1)+=dp.at(i);
			dp.at(i+1)%=mod;
		}
		if(a.at(i+2)){
			dp.at(i+2)+=dp.at(i);
			dp.at(i+2)%=mod;
		}
	}
	cout << dp.at(n) << endl;
}

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

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int main() {
    int N; cin >> N;
    vint A(N + 1);

    vector<set<int>> dat(N);
    set<int> rem;
    vint cnt(N+1, 0); 
    for (int i = 1; i <= N; i++) {
        int &v = A[i];
        dat[0].insert(i);
        rem.insert(i);

        cin >> v;
        cnt[v]++;
        dat[cnt[v] - 1].erase(v);
        dat[cnt[v]].insert(v);
    }
    if (N == 2) { cout << -1 << endl; return (0); }
    
    vint ans(N);
    for (int i = 0; i < N - 3; i++) {
        if (dat[N - i - 1].size() > 0) {
            int node = *begin(dat[N - i - 1]);
            rem.erase(node);
            ans[i] = node;
            continue;
        }
        for (auto v : rem) {
            if (i == 0 || A[ans[i - 1]] != v) {
                ans[i] = v;
                dat[cnt[v]].erase(v);
                dat[cnt[A[v]]].erase(A[v]);
                cnt[A[v]]--;
                dat[cnt[A[v]]].insert(A[v]);
                rem.erase(v);
                break;
            }
        }
    }
    
    vint vv;
    vv.push_back(*begin(rem)); rem.erase(vv.back());
    vv.push_back(*begin(rem)); rem.erase(vv.back());
    vv.push_back(*begin(rem)); rem.erase(vv.back());
    
    do {
        if ((N == 3 || A[ans[N - 4]] != vv[0]) && A[vv[0]] != vv[1] && A[vv[1]] != vv[2]) {
            ans[N - 3] = vv[0], ans[N - 2] = vv[1], ans[N - 1] = vv[2];
            break;
        }
    } while (next_permutation(begin(vv), end(vv)));
     
    cout << ans[0];
    for (int i = 1; i < N; i++) cout << " " << ans[i];
    cout << endl;


    return (0);
}

Measured memory_bytes: 20736
using System;

namespace AizuOnline
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split();
            int w = Int32.Parse(inp[0]);
            int h = Int32.Parse(inp[1]);
            int x = Int32.Parse(inp[2]);
            int y = Int32.Parse(inp[3]);
            int r = Int32.Parse(inp[4]);
            string arranged = "Yes";

            if (x-r < 0)
            {
               arranged = "No";
            }
            if (x+r > w)
            {
               arranged = "No";
            }
            if (y-r < 0)
            {
               arranged = "No";
            }
            if (y+r > h)
            {
               arranged = "No";
            }
            Console.WriteLine(arranged);
        }
    }
}


Measured memory_bytes: 8980
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

bool isAllVisit(const vector<bool>& visit) {
    for (auto&& v : visit) {
        if (!v)return false;
    }
    return true;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N;
    cin >> N;
    int ans = 0;
    FOR(i, 1, N + 1) {
        stringstream ss;
        ss << i;
        string S = ss.str();
        if (S.length() % 2 == 1)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int N;
    cin >> N;
    vs32 x(N);
    vs32 X(N);

    rep (i, N)
    {
        cin >> x[i];
        X[i] = x[i];
    }
    sort(x.begin(), x.end());

    rep (i, N)
    {
        if (X[i] >= x[N / 2])
        {
            cout << x[N / 2 - 1] << "\n";
        }
        else
        {
            cout << x[N / 2] << "\n";
        }
    }
    return 0;
}



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

#define int long long

using namespace std;

int a[200001];
vector <int> used[200001];
int n, x, ans = 1e18;
int inf = 1e18;

int calc (int k) {      	
	if (k > n) return inf;
	int cur = k * x + n * x;
    for (int i = 0;i < k;i ++) used[i].clear ();
	for (int i = n;i >= 1;i --) {
		used[i % k].push_back (a[i]);
	}
	for (int i = 0;i < k;i ++) sort (used[i].begin (), used[i].end ());
	for (int i = 0;i < k;i ++) {
		int len = used[i].size () - 1;
		cur += used[i][len];
		int id = 1;
		for (int j = used[i].size () - 1;j > 0;j --) {
			cur += (id + 1) * (id + 1) * (used[i][j] - used[i][j - 1]);
			id ++;
		}
		cur += (id + 1) * (id + 1) * used[i][0];
	}
	return cur;
}
											
 main () {
 	cin >> n;
 	cin >> x;
 	for (int i = 1;i <= n;i ++) {
 		cin >> a[i];
 	}
 	int l = 1, r = n;
 	while (l <= r) {
		int k = (l + r) / 2;
		if (calc (k) <= calc (k + 1)) {
			ans = min (ans, calc (k));
			r = k - 1;
		}
		else {
		    ans = min (ans, calc (k + 1));
			l = k + 1;
 		}
 	}
 	cout << ans;
	return 0; 
}

Measured memory_bytes: 14848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
  	cin>>a[i];
  }
  sort(a,a+n);
  if(n<3)
  {
      cout<<0;
      return 0;
  }
  vector<vector<int> > v;
  for(int i=0;i<n-2;i++)
  {
  	for(int j=i+1;j<n-1;j++)
  	{
  		for(int k=j+1;k<n;k++)
		  {
		  	if(a[i]!=a[j] && a[j]!=a[k] && a[k]<a[i]+a[j])
		  	{
		  		v.push_back({i,j,k});
		  		//cout<<i+1<<","<<j+1<<","<<k+1<<"\n";
			}
		  }	
	}
  }
  cout<<v.size();
  return 0;
}
    


Measured memory_bytes: 13500
import numpy as np
H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
ans = []
for i in range(H):
    if set(a[i]) != set("."):
        ans.append(a[i])
a = list(np.array(ans).T)
ans = []
for i in range(len(a)):
    if set(a[i]) != set("."):
        ans.append(a[i])
ans = list(np.array(ans).T)
for res in ans:
    print("".join(res))


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

#define MAX_N 100000

long long q[MAX_N];
long long x[MAX_N];
long long n, z;
vector<long long>p;

int main() {
	while (true) {
		for (int i = 0; i < MAX_N; i++)
		{
			q[i] = 0; x[i] = 0;
		}
		cin >> n;
		p.clear();
		if (n == 0) { break; }
		for (int i = 1; i < n; i++)
		{
			q[(i*i) % n] = 1;
		}
		for (int i = 0; i < MAX_N; i++)
		{
			if (q[i] == 1)
			{
				p.push_back(i);
			}
		}
		for (int i = 0; i < p.size(); i++)
		{
			for (int j = i + 1; j < p.size(); j++)
			{
				if (i != j)
				{
					z = p[i] - p[j];
					if (z < 0) { z += n; }
					if (z > (n - 1) / 2) { z = n - z; }
					x[z]++;
				}
			}
		}
		for (int i = 1; i <= (n - 1) / 2; i++)
		{
			cout << x[i] * 2 << endl;
		}
	}
}

Measured memory_bytes: 2868
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000000
#define MAX 200001
#define MOD 1000000007

void f(int N, vector<ll> &table){
    for(int i = 1; i < N + 1; i++){
        for(int j = i; j < N + 1; j+=i){
            table[j] += 1;
        }
    }
}

int main(){
    ll N;
    cin >> N;
    vector<ll> table(N + 1);
    f(N, table);
    ll ans = 0;
    for(int i = 1; i < N + 1; i++){
        ans += i * table[i];
    }
    cout << ans << endl;
}

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

class Solve {
private:
	using vi = std::vector<int>;
	using vvi = std::vector<vi>;

public:
	bool is_last_query{};
	Solve()
	{
		int n;
		scanf("%d", &n);
		if (n == 0)
		{
			is_last_query = true;
			return;
		}
		vi w(n);
		for (auto& e: w) scanf("%d", &e);

		vvi dp(n, vi(n + 1));
		// [left, right)
		for (int width{2}; width <= n; width++)
			for (int left{}; left + width <= n; left++)
			{
				int right{left + width};
				for (int mid{left + 1}; mid < right; mid++)
					dp[left][right] = std::max(dp[left][right], dp[left][mid] + dp[mid][right]);
				if (std::abs(w[left] - w[right - 1]) <= 1 && dp[left + 1][right - 1] + 2 == width)
					dp[left][right] = width;
			}
		printf("%d\n", dp[0][n]);
	}
};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}


Measured memory_bytes: 3376
import math

X = int(input())

def isprime(num):
    if(num==2):
        return True
    elif(num%2 == 0):
        return False
    
    for i in range(3, int(math.sqrt(num)+1), 2):
        if(num%i == 0):
            return False
        
    return True

def prime(n):
    ans = 2
    for i in range(n, 10**5+4):
        if(isprime(i)):
            ans = i        
            break
    return ans
 
print(prime(X))

Measured memory_bytes: 9180
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;


int main() {
	int K, S;
	cin >> K >> S;

	int x, y;
	int count = 0;
	for (x = 0;x<= K;x++) {
		for (y = 0;y <= K;y++) {
			int z = S - x - y;
			if (0 <= z && z <= K)count++;
		}
	}
	cout << count << endl;

}

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

int main() {
  int N; cin >> N;
  vector<int> cnt(10001);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        long long sum = x*x + y*y + z*z + x*y + y*z + z*x;
        if (sum > 10000) continue;
        cnt.at(sum)++;
      }
    }
  }
  for (int i = 1; i <= N; i++) cout << cnt.at(i) << endl;
}

Measured memory_bytes: 3632