akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, r; cin >> n >> r;
    if (n>=10) cout << r << endl;
    else cout << r + 100*(10-n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = (int)1e5 + 7;
const ll MOD = (int)1e9 + 7;
int a[MAXN], b[MAXN];
ll pwr(ll b)
{
	ll ans = 1;
	for (int i = 1; i <= b; i++)
		ans = (ans * 2) % MOD;
	return ans;
}
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		b[a[i]]++;
	}
	if(n % 2)
	{
		bool c = false;
		for (int i = 2; i < n; i+=2)
			if(b[i] != 2)
				c = true;
		if(b[0] != 1)
			c = true;
		if(c)
			cout << 0;
		else
			cout << pwr((n / 2));
		return 0;
	}
	else
	{
		bool c = false;
		for (int i = 1; i < n; i+=2)
			if(b[i] != 2)
				c = true;
		if(c)
			cout << 0;
		else
		{
			cout << pwr((n / 2));
		}
	}
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, w, h;
  scanf("%d %d %d", &n, &w, &h);

  int mx[100010] = {}, my[100010] = {};
  REP(i,n){
    int x, y, wei;
    scanf("%d %d %d", &x, &y, &wei);
    int min_x, max_x, min_y, max_y;
    min_x = max(0, x - wei); max_x = min(w, x + wei);
    min_y = max(0, y - wei); max_y = min(h, y + wei);
    mx[min_x]++; my[min_y]++;
    mx[max_x]--; my[max_y]--;
  }

  REP(i,w){
    mx[i + 1] += mx[i];
  }

  REP(i,h){
    my[i + 1] += my[i];
  }

  bool f = true;
  REP(i,w){
    if(mx[i] <= 0){
      f = false;
    }
  }
  
  if(f){
    printf("Yes\n");
    return 0;
  }

  f = true;
  REP(i,h){
    if(my[i] <= 0){
      f = false;
    }
  }
  if(f)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}




Measured memory_bytes: 3944
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
int compare_char(const void* left, const void* right) 
{
    char *left_char = (char *)left;
    char *right_char = (char *)right;

    return strcmp( left_char, right_char );
}
int main(void)
{
    int n,count=1;
    char kigou;
    scanf("%d",&n);
    char s[n][11];
    scanf("%c",&kigou);
    for(int i=0;i<n;i++)
    {
        gets(s[i]);
    }
    qsort(s,n,sizeof(s[0]),compare_char);
    for(int i=1;i<n;i++)
    {
        if(strcmp(s[i],s[i-1])!=0)
        {
            count++;
        }
    }
    printf("%d",count);
}

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

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] x = new long[n];
        long[] y = new long[n];
        long[] z = new long[n];
        for (int i = 0 ; i < n ; i++) {
            x[i] = sc.nextLong();
            y[i] = sc.nextLong();
            z[i] = sc.nextLong();
        }

        long[] s_1 = new long[n];
        long[] s_2 = new long[n];
        long[] s_3 = new long[n];
        long[] s_4 = new long[n];
        long[] s_5 = new long[n];
        long[] s_6 = new long[n];
        long[] s_7 = new long[n];
        long[] s_8 = new long[n];

        for (int i = 0 ; i < n ; i++) {
            s_1[i] = x[i] + y[i] + z[i];
            s_2[i] = x[i] + y[i] - z[i];
            s_3[i] = x[i] - y[i] + z[i];
            s_4[i] = x[i] - y[i] - z[i];
            s_5[i] = -x[i] + y[i] + z[i];
            s_6[i] = -x[i] + y[i] - z[i];
            s_7[i] = -x[i] - y[i] + z[i];
            s_8[i] = -x[i] - y[i] - z[i];
        }
        Arrays.sort(s_1);
        Arrays.sort(s_2);
        Arrays.sort(s_3);
        Arrays.sort(s_4);
        Arrays.sort(s_5);
        Arrays.sort(s_6);
        Arrays.sort(s_7);
        Arrays.sort(s_8);
        long t1 = 0;
        long t2 = 0;
        long t3 = 0;
        long t4 = 0;
        long t5 = 0;
        long t6 = 0;
        long t7 = 0;
        long t8 = 0;

        for (int i = 0 ; i < m ; i++) {
            t1 += s_1[n - 1 - i];
            t2 += s_2[n - 1 - i];
            t3 += s_3[n - 1 - i];
            t4 += s_4[n - 1 - i];
            t5 += s_5[n - 1 - i];
            t6 += s_6[n - 1 - i];
            t7 += s_7[n - 1 - i];
            t8 += s_8[n - 1 - i];

        }
        long ans = Math.max(t1, t2);
        ans = Math.max(ans, t3);
        ans = Math.max(ans, t4);
        ans = Math.max(ans, t5);
        ans = Math.max(ans, t6);
        ans = Math.max(ans, t7);
        ans = Math.max(ans, t8);
        System.out.println(ans);
    }

}

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

int main()
{
	int n,m;
	cin>>n>>m;
	int ac[100000]{0},wa[100000]{0};
	int p;
	string s;
	for(size_t i = 0; i<m; i++)
	{
		cin>>p>>s;
		if(s=="AC")
		{
			ac[p-1] = 1;
		}
		else
		{
			if(ac[p-1]==0)
			{
				wa[p-1]++;
			}
		}
	}
	int aac = 0,awa = 0;
	for(size_t i = 0; i<n; i++)
	{
		if(ac[i]==1)
		{
			aac++;
			awa += wa[i];
		}
		
	}
	cout<<aac<<" "<<awa<<endl;
	return 0;
}

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

int main(void){
    int n; cin >> n;
    int p[n];
    for(int i=0;i<n;i++) cin >> p[i];
    int ans = 0;
    for(int i=1;i<n-1;i++){
        if(p[i-1] < p[i] && p[i] < p[i+1] || p[i-1] > p[i] && p[i] > p[i+1]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
main()
{
	int n;
	while(cin>>n,n)
	{
		int b[1<<17]={},w[1<<17]={};
		int pre,cb=0,cw=0;
		for(int i=1;i<=n;i++)
		{
			int c;cin>>c;
			if(i==1||c==pre)
			{
				if(c)b[cb]++;
				else w[cw]++;
			}
			else if(i%2==0)
			{
				if(c)
				{
					(b[cb]||!cb?b[cb]:b[--cb])+=w[cw]+1;
					w[cw]=0;
				}
				else
				{
					(w[cw]||!cw?w[cw]:w[--cw])+=b[cb]+1;
					b[cb]=0;
				}
			}
			else
			{
				if(c)b[(b[cb]?++cb:cb)]++;
				else w[(w[cw]?++cw:cw)]++;
			}
			pre=c;
		}
		int ans=0;
		for(int i=0;i<=cw;i++)
		{
			ans+=w[i];
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,v,b,w,t; cin >> a >> v >> b >> w >> t;
    bool ok = false;
    if(v > w && abs(a-b) <= abs(v-w)*t)ok = true;
    cout << (ok ? "YES" : "NO") << endl;
}

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

int main(){
    int a,b; cin >> a >> b;
    string A = "",B= "";
    for(int i = 0; i < b; i++){
        A += (char)(a+'0');
    }
    for(int i = 0; i < a; i++){
        B += (char)(b+'0');
    }
    cout << (A > B ? B : A) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Keep clam  Believe youself
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#include<set>
#include<cmath>
#define Xiaobo main
using namespace std;
const int maxn=2e5+7;
const int mod=1e9+7;
const double eps=1e-15;
const double pi=acos(-1);
const int INF=0x3f3f3f3f;
typedef long long ll;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}
//别急 dp找状态 问题看看本身的规律 贪心找方法
int Xiaobo()
{
	int n,r;
	cin>>n>>r;
	if(n>=10) cout<<r<<'\n';
	else cout<<(ll)100*(10-n)+r<<'\n';
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(ai) for ai in input().split()]
b = [int(bi) for bi in input().split()]
cnt, prev_cnt = 0, -1
while cnt != prev_cnt:
    prev_cnt = cnt
    for i in range(n):
        adj_sum = b[i - 1] + b[(i + 1) % n]
        k = (b[i] - a[i]) // adj_sum
        if k > 0:
            b[i] -= k * adj_sum
            cnt += k

print(cnt if a == b else -1)

Measured memory_bytes: 118904
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

int main()
{
    long long n,W;
    cin>>n>>W;
    long long w[n],v[n];
    for (int i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    long long arr[n+1][W+1];
    for (int i=0;i<=n;i++)
    {
        arr[i][0]=0;
    }
    for (int i=0;i<=W;i++)
    {
        arr[0][i]=0;
    }
    for (int i=1;i<=n;i++)
    {

        for (int j=1;j<=W;j++)
        {
            arr[i][j]=arr[i-1][j];
            if (w[i-1]<=j)
            {
                if (arr[i-1][j-w[i-1]]+v[i-1]>arr[i][j])
                    arr[i][j]=arr[i-1][j-w[i-1]]+v[i-1];
            }
        }
    }

    cout<<arr[n][W];
    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define UNIQUE(v) do{ (v).erase( unique(begin(v), end(v)), end(v) ); } while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using uomap = unordered_map<T, U>;
template<class T> using uoset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

//function<void(int,int)> tensi_no_3p=[&](int v,int d){
//};

int main() {
	ios_base::sync_with_stdio(false);
	int N; cin >> N;
	vi A(3); rep(i, 3) cin >> A[i];
	vi B(3); rep(i, 3) cin >> B[i];
	vll dp(N + 1);
	rep(i, 3) if (B[i] > A[i]) {
		repr(k, A[i], N) CHMAX(dp[k], dp[k - A[i]] + B[i] - A[i]);
	}
	int M = N + dp[N];
	dp = vll(M + 1);
	rep(i, 3) if (B[i] < A[i]) {
		repr(k, B[i], M) CHMAX(dp[k], dp[k - B[i]] + A[i] - B[i]);
	}
	cout << M + dp[M] << endl;
	return 0;
}


Measured memory_bytes: 195584
#include<bits/stdc++.h>
int main()
{
	int n ,m ,x ,ans ,sum ,j ,t ,i;
	scanf("%d%d%d",&n,&m,&x);
	bool visit[n+1];
	memset(visit,false,sizeof(visit));
	for(i = 0; i < m; i++)
	{
		scanf("%d",&t);
		visit[t] = true;
	}
	for(i = x-1 ,sum=0; i >= 0; i--)
		if(visit[i])
			sum++;
	ans = sum;
	for(i = x+1,sum=0; i <= n;i++)
		if(visit[i])
			sum++;
	printf("%d",ans>sum?sum:ans);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

Ad = [A[i] - A[i+1] for i in range(N-1)]

ans = 1
p = 0
for d in Ad:
    if d * p < 0:
        ans += 1
        p = 0
    elif d != 0:
        p = d

print(ans)

Measured memory_bytes: 14252
const
	num:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);
var
	a:array[-10..10] of longint;
	f:array[-1110..10010] of longint;
	i,j,n,m,t:longint;
begin
	readln(n,m);
	for i:=1 to m do read(a[i]);
	for i:=1 to m-1 do
		for j:=1 to m-i do
			if a[j]<a[j+1] then
			begin
				t:=a[j]; a[j]:=a[j+1]; a[j+1]:=t;
			end;
	for i:=-10 to n do f[i]:=-1000000000;
	f[0]:=0;
	for i:=1 to m do
		for j:=num[a[i]] to n do
			if f[j-num[a[i]]]+1>f[j] then
				f[j]:=f[j-num[a[i]]]+1;
	for i:=1 to m do
		while (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do
		begin
			n:=n-num[a[i]];
			write(a[i]);
		end;
	writeln;
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int a,b,t;
    cin >> a >> b >> t;
    int k=t/a;
    cout << k*b << endl;

    return 0;
}

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

long long ans = 10000000000000;

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

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

  for (int i = 1; i <= 100; i++)
  {
    long long tmp = 0;
    for (int j = 0; j < n; j++)
    {
      tmp += (i - x[j]) * (i - x[j]);
    }
    ans = min(ans, tmp);
  }

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC124D
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;
            var K = ReadInt;
            var S = Console.ReadLine();

            List<int> comb = new List<int>();
            comb.Add(0);

            for (int i = 0; i < N - 1; i++)
            {
                if (S[i + 1] != S[i]) comb.Add(i + 1);
            }
            comb.Add(N);

            Draw1D(comb.ToArray());

            if (K >= comb.Count / 2)
            {
                Console.WriteLine(N);
                return;
            }

            int ans = 0;
            for (int i = 0; i < comb.Count - 2 * K; i++)
            {
                int cand = 0;
                if (S[comb[i]] == '0')  // 0→1
                {
                    cand = comb[i + 2 * K] - comb[i];
                }
                else  // 1→1
                {
                    int index = i + 2 * K + 1;
                    if (index >= comb.Count) index = comb.Count - 1;
                    cand = comb[index] - comb[i];
                }
                ans = Math.Max(ans, cand);
            }

            Console.WriteLine(ans);
        }
    }
}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        static public void Draw2D(int[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            int[,] map2 = new int[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0;
                    else if (i == 0) map2[i, j] = j - 1;
                    else if (j == 0) map2[i, j] = i - 1;
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        static public void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

bool is_prime(int x)
{
	if (x == 2) {
		return true;
	}

	if (x % 2 == 0) {
		return false;
	}

	for (int i = 3; i * i <= x; i += 2) {
		if (x % i == 0) {
			return false;
		}
	}

	return true;
}

int num(int m, const unordered_map<int, int>& primes)
{
	return count_if(begin(primes), end(primes), [m](const auto & p) { return p.second >= m - 1; });
}


int main()
{
	FASTIO
	/*
	//double start_time = clock();
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
//*/
	int T;
	//cin >> T;
	T = 1;
	for (int cs = 1; cs <= T; cs++) {
		int n;
		cin >> n;
		//dbg(n);
		unordered_map<int, int> primes;
		for (int i = 2; i <= 100; i ++) {
			if (is_prime(i)){
				primes[i] = 0;
				//dbg(i);
			}
		}

		for (int i = 1; i <= n; i++) {
			int x = i;
			for (auto && p : primes) {
				while (x % p.first == 0) {
					p.second++;
					x /= p.first;
					//dbg3(x, p.first, p.second);
				}
			}
		}




		int ans = 0;

		ans += num(75, primes);
		//dbg(ans);
		ans += num(25, primes) * (num(3,primes) - 1);
		//dbg(ans);
		ans += num(15, primes) * (num(5, primes) - 1);
		//dbg(ans);
		ans += num(5, primes) * (num(5,primes) - 1) * (num(3, primes) - 2)/2;
		//dbg(ans);
		cout << ans << endl;
	}

	//double end_time = clock();
	//printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
p = []

for i in range(N):
    p.append(int(input()))

highest = None

for i in p:
    if highest is None:
        highest = i
        continue
    if highest < i:
        highest = i

for i in range(len(p)):
    if p[i] == highest:
        p[i] = highest / 2
        break
        
print(int(sum(p)))

Measured memory_bytes: 3064
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let mut v: Vec<i32> = (0..n).map(|_| read()).collect();

    v.sort();
    let mut ans = v[0] as f64;
    for &v_i in v.iter().skip(1) {
        ans = (ans + v_i as f64) / 2.0;
    }

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

using Graph = vector<vector<int>>;

int main()
{
    int N, M; cin >> N >> M;
    Graph G(N+1);  // [0]は未使用
    rep (i, 0, M) {
        int a, b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep (i, 1, G.size()) {
        cout << G[i].size() << endl;
    }
}

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

// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v = get<0>(item);
// long w = get<1>(item);
// long v, w;
//   for( int i = 0; i < N; i++ ){
//     cin >> v >> w;
//     items.push_back( make_tuple(v, w) ); // item : (value, weight)
//   }

int main(){
    int A,B;
    cin >> A >> B;
    
    if(A>=13) cout << B << endl;
    else if(A<13 && A>=6) cout << B/2 << endl;
    else cout << 0 << endl;

    return 0;
}

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

int main(void){
    ll sum = 0;
    ll ma = 0;
    ll n;
    cin >> n;

    rep(i, n){
        ll tmp;
        cin >> tmp;
        sum += tmp;
        ma = max(tmp, ma);
    }

    if(ma < sum - ma){
        puts("Yes\n");
    }else{
        puts("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


vector<int> v[101010];
int n,k,ans;

int solve(int x){
    int ret=0;
    for(auto to:v[x]){
        int res=solve(to);
        if(res>=k&&x!=0)ans++;
        else ret=max(res,ret);
    }
    return ret+1;
}

int main(){
    cin>>n>>k;
    int x;cin>>x;
    if(x!=1)ans++;
    rep(i,n-1){
        int x;cin>>x;
        v[x-1].push_back(i+1);
    }
    solve(0);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 10368
S = {}

A = input()
B = input()
C = input()

S['a'] = A
S['b'] = B
S['c'] = C

player = 'a'
for i in range(len(A) + len(B) + len(C)):
    # pass
    # print(S[player][0])
    next_player = S[player][0]
    S[player] = S[player][1:]
    
    player = next_player
    if len(S[player]) == 0:
        break
    

# print(A)
# print(B)
# print(C)

print(player.upper())

Measured memory_bytes: 3064
// ABC79-D      
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    
    vector<vector<int>> dp(10,vector<int>(10,0));
    int h,w;
    cin>>h>>w;
    vector<vector<int>> fi(h,vector<int>(w,0));
    rep(i,10){
        rep(j,10){
            cin>>dp[i][j];
        }
    }
    rep(i,h){
        rep(j,w){
            cin>>fi[i][j];
        }
    }
    for(int k=0;k<=9;k++){
        for(int i=0;i<=9;i++){
            for(int j=0;j<=9;j++){
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
            }
        }
    }
    ll ans=0;
    rep(i,h){
        rep(j,w){
            if(fi[i][j]==-1) continue;
            ans+=dp[fi[i][j]][1];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3724
N = int(input())
S = []
T = []
for _ in range(N):
    s,t = map(str, input().split())
    S.append(s)
    T.append(int(t))
X = input()

f = 0
ans = 0
for i in range(N):
    if f == 0 and S[i] == X:
        f = 1
    elif f == 1:
        ans += T[i]
        
print(ans)

Measured memory_bytes: 38384
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,m = map(int, input().split())
    a_list = list(map(int, input().split()))
    a_list.sort()
    sum_num = 0
    for i in range(m):
        sum_num += a_list[i]
    print(sum_num)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9692
import collections

n,x = map(int,input().split())
a = list(map(int,input().split()))

ans = 0
q = collections.deque()
if a[0] <= x:
    q.append(a[0])
else:
    ans += a[0]- x
    q.append(x)

for i in range(1,n):
    tmp = q[-1] + a[i] 
    if tmp <= x:
        q.append(a[i])
    else:
        ans += tmp-x
        q.append(x-q[-1])
    q.popleft()


print(ans)

Measured memory_bytes: 20384
i = list(map(int, input().split()))
K = int(input())
red=i[0]
green=i[1]
blue=i[2]
success=0
for num in range(K):
  if green <= red:
    green = green*2
  elif blue <= green:
    blue = blue*2
if (blue > green and  green > red):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9192
#include<stdio.h>
#include<stdlib.h>
void enqueue(int);
int dequeue(void);
int **array,*length,*queue,head,tail,*flag;
int main(){
  int i,j,k,l,n,m;
  scanf("%d",&n);
  array=malloc(sizeof(int*)*(n+1));
  flag=malloc(sizeof(int)*(n+1));
  for(i=0;i<n+1;i++)flag[i]=0;
  //for(i=0;i<n+1;i++)array[i]=malloc(sizeof(int)*(n+1));
  length=malloc(sizeof(int)*(n+1));
  for(i=0;i<n+1;i++)length[i]=-1;
  queue = malloc(sizeof(int)*n);
  //for(i=0;i<n+1;i++)for(j=0;j<n+1;j++)array[i][j]=-1;

  k=n;
  while(k--){
    scanf("%d %d",&i,&l);
    array[i]=malloc(sizeof(int)*(l+1));
    array[i][l]=-1;
    for(j=0;j<l;j++)scanf("%d",&array[i][j]);
  }
  k=1;
  flag[k]=1;
  length[1]=0;
  while(1){
    for(i=0;array[k][i]!=-1;i++){
      if(flag[array[k][i]] == 0){
	flag[array[k][i]]=1;
	length[array[k][i]] = length[k]+1;
	enqueue(array[k][i]);
      }
    }
    k=dequeue();
    if(k == -1)break;
  }

  for(i=1;i<n+1;i++)printf("%d %d\n",i,length[i]);
  
  for(i=0;i<n+1;i++)free(array[i]);
  free(array);
  free(length);
  free(flag);
  free(queue);
  return 0;
}

void enqueue(int n){
  queue[tail++]=n;
}
int dequeue(){
  int num;
  num=queue[head++];
  if(head>tail)return -1;
  return num;
}
  

    
		      



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
#define INF 1e9
#define MOD 1e9 + 7

using namespace std;
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
int N, M, S, T;
set<pair<int, int>> st;

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge() : src(0), dst(0), weight(0) {}
  Edge(int s, int d, Weight w = 0) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

vector<bool> seen, finished;

int pos = -1;
stack<int> hist;

void dfs(const Graph &g, int v, int p) {
  seen[v] = true;
  hist.push(v);
  for (auto e : g[v]) {
    if (e.dst == p) continue;
    if (finished[e.dst]) continue;

    if (seen[e.dst] && !finished[e.dst]) {
      pos = e.dst;
      return;
    }
    dfs(g, e.dst, v);
    if (pos != -1) return;
  }
  hist.pop();
  finished[v] = true;
}

signed main() {
  int n;
  cin >> n;

  Graph g(n);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].emplace_back(a, b);
    g[b].emplace_back(b, a);
  }
  seen.assign(n, false);
  finished.assign(n, false);
  pos = -1;
  dfs(g, 0, -1);

  set<int> cycle;
  while (!hist.empty()) {
    int t = hist.top();
    cycle.insert(t);
    hist.pop();
    if (t == pos) break;
  }

  int q;
  cin >> q;
  while (q--) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (cycle.count(a) && cycle.count(b))
      cout << 2 << endl;
    else
      cout << 1 << endl;
  }

  return 0;
}



Measured memory_bytes: 22416
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int n,m;
    map<LL,LL> d,t;
    Problem(LL n):n(n){};
    void no(){cout << "NO" <<"\n";exit(0);}
    void yes(){cout << "YES" <<"\n";exit(0);}
    void solve(){
        for(int i=0; i<n; ++i){
            LL a;
            cin >> a;
            d[a]++;
        }
        cin >> m;
        for(int i=0; i<m; ++i){
            LL a;
            cin >> a;
            t[a]++;
        }
        for(auto x:t){
            DBG(x)
            if(x.second>d[x.first])no();
        }
        yes();

    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}



Measured memory_bytes: 25216
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)



ll dp[2010][2010];
ll dp2[2010][2010];
ll dp3[2010][2010];
int main(){
    int n,m;
    cin >> n >> m;

    vector<int>a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    dp[0][0] = 1;
    rep(i,n+1){
        dp2[i][0] = 0;
        dp3[i][0] = 1;
    }
    rep(i,m+1){
        dp2[0][i] = 1;
        dp3[0][i] = 1;
    }
    rep(i,n){
        rep(j,m){
            if(a[i]==b[j]){
                dp[i+1][j+1]+=dp3[i][j];
                dp[i+1][j+1] %= mod;
            }
        }
        rep(j,m){
            dp2[i+1][j+1] = dp2[i+1][j]+dp[i+1][j+1];
            dp2[i+1][j+1] %= mod;
        }
        rep(j,m){
            dp3[i+1][j+1] = dp3[i][j+1]+dp2[i+1][j+1];
            dp3[i+1][j+1] %= mod;
        }
    }
    // rep(i,n+1){
    //     rep(j,m+1){
    //         cerr << dp[i][j] << " ";
    //     }
    //     cerr << endl;
    // }
    // rep(i,n+1){
    //     rep(j,m+1){
    //         cerr << dp2[i][j] << " ";
    //     }
    //     cerr << endl;
    // }
    // rep(i,n+1){
    //     rep(j,m+1){
    //         cerr << dp3[i][j] << " ";
    //     }
    //     cerr << endl;
    // }
    cout << dp3[n][m] << endl;
    return 0;
}

Measured memory_bytes: 94592
#include<bits/stdc++.h>
using namespace std;
double dp[4000][4000];
double p[4000];
int n;
double sol(int i, int h){
    if(i>=n)
    {
        if(h>=n-h)
            return 1;
        return 0;
    }
    if(dp[i][h]!=-1)
        return dp[i][h];
    double x = sol(i+1,h+1)*p[i];
    double y = sol(i+1,h)*(1-p[i]);
    return dp[i][h] =x+y;

}

int main(){
    cin>>n;


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

    for(int i=0;i<=n;i++)
        for(int j=0;j<=n;j++)
            dp[i][j]=-1;
            cout << fixed << setprecision(10);
    cout<<sol(0,0);
    return 0;

}


Measured memory_bytes: 94336
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
 
ll power(ll x, ll m){
    if(m == 0) return 1;
    if(m == 1) return x;
    if(m % 2 == 0){
        return power(x*x%MOD,m/2)%MOD;
    }else{
        return (power(x*x%MOD,m/2)%MOD)*x%MOD;
    }
}
 
int main(){
    ll n; cin >> n;
    map<ll, ll> mp;
    rep(i,n){
        ll a; cin >> a;
        mp[a]++;
    }
    if(n % 2 == 0){
        for(ll i=1; i<n; i+=2){
            if(mp[i] != 2){
                cout << 0 << endl;
                return 0;
            }
        }
        cout << power(2,mp.size()) << endl;
    }else{
        for(ll i=0; i<n; i+=2){
            if((i==0 && mp[i] != 1) || (i!=0 && mp[i]!=2)){
                cout << 0 << endl;
                return 0;
            }
        }
        cout << power(2,mp.size()-1) << endl;
    }
}

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

int main() {
  int n;cin>>n;
  vector<pair<int,int>> pr(n);
  rep(i,n){
    int a;cin>>a;
    pr[i]=make_pair(a,i+1);
  }
  sort(all(pr));
  rep(i,n)cout<<pr[i].second<<" ";
  cout<<endl;
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
#include<math.h>
typedef long long ll;
using namespace std;
vector<vector<int>>comp;
vector<int>onecycle;
vector<int>clength;
vector<int>v9;
vector<int>v8;
int cycle_start;
int cycle_end;
vector<int>vbip1;
vector<int>vbip2;
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main()
{
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    ll i;
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][W+1];
    for(i=0;i<n+1;i++)
    {
        for(int j=0;j<W+1;j++)
        {
            if(i==0 || j==0)
            {
                dp[i][j]=0;
            }
            else
            {
                dp[i][j]=INT_MIN;
                if(j-w[i-1]>=0)
                {
                    dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
                }
                else
                {
                    dp[i][j]=dp[i-1][j];
                }
            }
        }
    }
    ll max1=INT_MIN;
    for(i=0;i<=W;i++)
    {
        max1=max(max1,dp[n][i]);
    }
    cout<<max1;
}


Measured memory_bytes: 82452
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x,y,t,z;
    t=(ll)c/__gcd(c,d)*d;
    x=(b/c)-(a+c-1)/c+1;
    y=(b/d)-(a+d-1)/d+1;
    z=(b/t)-(a+t-1)/t+1;
    ll ans=b-a+1-x-y+z;
    OUT(ans);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class214
    {
        static void Main()
        {
            string S = Console.ReadLine();
            bool frag = true;
            for(int i = 0; i < S.Length; i++)
            {
                if (i % 2 == 0)//奇数
                {
                    if (S[i] == 'L') frag = false;
                }
                else//偶数
                {
                    if (S[i] == 'R') frag = false;
                }
            }
            Console.WriteLine(frag?"Yes":"No");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  	int a,b;
  	cin >> a >> b;
  	if(a == b){
    	for(int i = 0; i < a; i++) cout << a;
      	return 0;
    }
  	for(int i = 0; i < max(a,b); i++) cout << min(a,b);
	return 0;
}


Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
vector<int> edge[100001];
ll dp[100001];

ll dfs(int x){
  if(edge[x].size() == 0)return 0;
  if(dp[x] >= 0)return dp[x];
  ll res = 0;
  rep(i, edge[x].size()){
    res = max(res, 1 + dfs(edge[x][i]));
  }
  return dp[x] = res;
}

int main(int argc, char const* argv[])
{
  int n, m;
  cin >> n >> m;
  rep(i, m){
    int x, y;
    cin >> x >> y;
    x--; y--;
    edge[x].pb(y);
  }

  fill(dp, dp + n + 1, -1);

  ll res = 0;
  rep(i, n){
    res = max(res, dfs(i));
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 8576
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
}
int main()
{
    vok();
    ll n,k;
    IN n>>k;
    vll a(n);
    bitset<50> b[n];
    loop(i,0,n)
    {
        IN a[i];
        bitset<50> temp(a[i]);
        b[i]=temp;
    }
    bitset<50> ans(0);
    rloop(i,49,0)
    {
        int countt=0;
        loop(j,0,n)
        {
            if(b[j][i])
            {
                countt++;
            }
          	//cout<<"";
        }
        ans[i]=1;
        if((countt*2)<n && ans.to_ullong()<=k)
        {
            //Do Nothing
        }
        else
        {
            ans[i]=0;
        }
    }
    ll fans=0LL;
    ll X=ans.to_ullong();
    loop(i,0,n)
    {
      	//cout<<"";
        fans+=(X^a[i]);
    }
    OUT fans<<endl
    return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    int N;
    cin >> N;

    vector<ll> a(N);
    rep(i,N) cin >> a[i];

    sort(a.begin(),a.end(), greater<ll>());
    int n = N / 2;
    if(N % 2 == 0){
        ll ans = 0;
        for(int i = 0; i < n; i++) ans += 2 * a[i];
        for(int i = n; i < N; i++) ans -= 2 * a[i];
        ans -= a[n-1];
        ans += a[n];
        cout << ans << endl;
    } else {
        int n = N / 2;
        ll sum1 = 0;
        for(int i = 0; i < n - 1; i++) sum1 += 2 * a[i];
        for(int i = n + 1; i < N; i++) sum1 -= 2 * a[i];
        sum1 += a[n] + a[n-1];

        ll sum2 = 0;
        for(int i = 0; i < n; i++) sum2 += 2 * a[i];
        for(int i = n + 2; i < N; i++) sum2 -= 2 * a[i];
        sum2 -= a[n] + a[n+1];
        cout << max(sum1,sum2) << endl;
    }
}



Measured memory_bytes: 1024
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- readLn
  gs <- replicateM n $ fmap (map read . words) getLine :: IO [[Int]]
  solve gs

type Graph = [[Int]]

solve gs = printResult . count . reverse $ pathDFS (toAdjMatrix gs) [0] []

printResult :: ([Int], [Int]) -> IO ()
printResult (fv, ds) = forM_ [0..(length fv - 1)] $ \i -> do
  putStrLn   . unwords . map show $ [i + 1, fv !! i, ds !! i]

pathDFS :: Graph -> [Int] -> [Int] -> [Int]
pathDFS gs [] vs = if unReached == []
                   then vs
                   else pathDFS gs [head unReached] (-1:vs)
  where
    n = length gs
    unReached = [i | i <- [0..(n - 1)], not(elem i vs)]

pathDFS gs (s:ss) vs = if unfinished == []
                        then pathDFS gs ss (s:vs)
                        else pathDFS gs (v:s:ss) (s:vs)
  where
    n = length gs
    edges = gs !! s
    unfinished = [i | i <- [0..(n - 1)], edges !! i == 1, not(elem i (s:vs))]
    v = head unfinished

count :: [Int] -> ([Int], [Int])
count path = (firstVisit path, doneSearch path)
  where
    firstVisit :: [Int] -> [Int]
    firstVisit path = map findFirst [0..m]
      where
        m = maximum path
        findFirst :: Int -> Int
        findFirst i = let Just j = elemIndex i path
                      in j + 1

    doneSearch :: [Int] -> [Int]
    doneSearch path = map (length path + 2 - ) . firstVisit . reverse $ path

toAdjMatrix :: Graph -> Graph
toAdjMatrix gs = scanColumn gs $ length gs
  where
    scanColumn :: Graph -> Int -> Graph
    scanColumn [] _ = []
    scanColumn (x:xs) n = (makeRow x n) : (scanColumn xs n)

    makeRow :: [Int] -> Int -> [Int]
    makeRow (u:k:vs) n = [if x `elem` vs then 1 else 0 | x <- [1..n]]



Measured memory_bytes: 4656
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    A=list(map(int,input().split()))
    s=set(A)
    print('YES' if len(A)==len(s) else 'NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 94836
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int d[101010],ansd[101010];
int to[101010],to1[101010];
int p[101010];
int q[101010],qn;
bool vis[101010];
int main()
{
	int n,la=0,m,x;
	long long k;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		d[i]=x-la;
		la=x;
	}
	for(int i=1;i<=n;i++)
		p[i]=to[i]=i;
	scanf("%d%lld",&m,&k);
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&x);
		swap(p[x],p[x+1]);
		to[p[x]]=x;
		to[p[x+1]]=x+1;
	}
	qn=0;
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=n;i++)
		if(!vis[i])
		{
			qn=0;
			q[qn++]=i;
			vis[q[qn-1]]=true;
			while(!vis[to[q[qn-1]]])
			{
				q[qn]=to[q[qn-1]];
				vis[q[qn]]=true;
				qn++;
			}
			for(int j=0;j<qn;j++)
				to1[q[j]]=q[(j+k)%qn];
		}
	for(int i=1;i<=n;i++)
		ansd[to1[i]]=d[i];
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=ansd[i];
		printf("%lld\n",ans);
	}
	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT

using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;

template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }

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

int n;
int m;
string s;
bool was[300001][3][3][3];
int res[300001][3][3][3];
int cnt[300001];

int go (int i, int a, int b, int c) {
//	printf ("%d %d %d %d = cnt %d\n", i, a, b, c, cnt[i]);
	if (b == 1 && c == 1) re cnt[i];
	if (i == n) re int (c == 1);
	if (was[i][a][b][c]) re res[i][a][b][c];
	was[i][a][b][c] = 1;
	int cur = 0;
	for (int d = 0; d < 2; d++)
		if (s[i] == '?' || s[i] - '0' == d) {
			if (a == 2) {
				if (b == 2) {
					cur += go (i + 1, b, c, d);
				} else {
					if (b == 0) {
						cur += go (i + 1, 2, 2, (b + c + d) / 2);
					} else {
						if (b + c + d >= 2)
							cur += go (i + 1, 2, 2, 1);
						else
							cur += go (i + 1, b, c, d);	
					}
				}
			} else {	
				assert (a == 1);
				assert (a + b + c <= 1);
				cur += go (i + 1, 2, 1, (b + c + d) / 2);
			}
		}
//	printf ("%d %d %d %d = res %d\n", i, a, b, c, cur);
	re res[i][a][b][c] = cur % mod;
}

int main () {
	cin >> s;
	n = sz (s);
	cnt[n] = 1;
	for (int i = n - 1; i >= 0; i--) cnt[i] = ((ll)cnt[i + 1] * (1 + int (s[i] == '?'))) % mod;
	printf ("%d\n", go (0, 2, 2, 2));
	return 0;
}

Measured memory_bytes: 69508
import sys

points = [0, 0]

turns = int(sys.stdin.readline())
for _ in range(turns):
    w1, w2 = sys.stdin.readline().strip().split()
    if w1 > w2:
        points[0] += 3
    elif w2 > w1:
        points[1] += 3
    else:
        points[0] += 1
        points[1] += 1

print(' '.join(map(str, points)))



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

#define kLENGTH 2000000

int main()
{
  int leng, sum = 0;
  char S[kLENGTH], T[kLENGTH];
  scanf("%s",S);
  scanf("%s",T);
  leng = strlen(S);
  
for(int i=0;i<leng;i++)
{
  if(S[i] != T[i])
  {
    sum ++ ;
  }
}
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 2524