akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
 

int X,Y;


//cost==1の時両辺が同じ色
struct edge{
    int to,cost;
    edge(int to,int cost){
        this->to=to;this->cost=cost;
    }
};

vector<edge> vec[112345];

int ans=0;

int color[112345];



void init(){
    rep(i,112345)color[i]=-1;
}

void dfs(int now,int col){
    
    rep(i,vec[now].size()){
        edge next=vec[now][i];
        if(color[next.to]!=-1)continue;
        
        else if(next.cost==1){
            //前と同じ色
            color[next.to]=col;
            dfs(next.to,col);
        }else{
            color[next.to]=(col+1)%2;
            dfs(next.to,color[next.to]);


        }
           

    }
}
signed main(){
    int n,m;
    cin>>n>>m;
    rep(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        x--;y--;
        if(z%2==0){
            //axi+ayi は偶数　同じ色
            vec[x].push_back(edge(y,1));
            vec[y].push_back(edge(x,1));
        }else{
            //axi+ayi は奇数　ことなる色
            vec[x].push_back(edge(y,0));
            vec[y].push_back(edge(x,0));
        }
    }

    init();


    rep(st,n){
        if(color[st]==-1){
            //dump(st);
            color[st]=1;
            ans++;
            dfs(st,1);
        }
    }

    cout<<ans<<endl;





 
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,maxt=-1;
  cin >> n ;
  map<string,int> me;
  for(int i=0;i<n;i++){
    string a;
    cin >> a;
    me[a]+=1;
  }
  for(const auto x :me){
    int v=x.second;
    if(v>maxt)maxt=x.second;
  }
  for(auto it=me.begin();it!=me.end();it++){
    if(it->second == maxt){
      cout << it->first << endl;
    }
  }
}
  
    


Measured memory_bytes: 19236
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val x = readIntList()
    x.forEachIndexed { index, i -> 
        if (i == 0) {
            println(index + 1)
            return
        }
    }
}

Measured memory_bytes: 36344
let rec read l x = match x with
    0 -> l
  | i ->
     let n = read_int () in
     read (n::l) (i-1);;

let m = read [] 10 |> List.sort compare |> List.rev in
    for i=0 to 2 do
      List.nth m i |> print_int;
      print_newline ();
    done;;

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

double dp[3000][3000];

int main() {
	int n;
	cin>>n;
	double ar[n];
	for(int i=0;i<n;i++)
		cin>>ar[i];
	
	dp[0][0]=0,dp[0][1]=ar[0],dp[1][0]=1-ar[0];
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(i+j<n && i|j) dp[i+1][j]+=dp[i][j]*(1-ar[i+j]),dp[i][j+1]+=dp[i][j]*ar[i+j];
	
	double ans=0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=n;j++)
			/*cout<<i<<' '<<j<<' '<<dp[i][j]<<'\n';*/if(i+j==n && j>i) ans+=dp[i][j];
	printf("%.10f\n",ans);
}

Measured memory_bytes: 70016
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 200005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll n, p;
  cin >> n >> p;

  char arr[n + 5];
  cin >> (arr + 1);

  if (p == 2 or p == 5) {
    ll res = 0;
    for (ll i = 1; i <= n; i++) {
      if ((arr[i] - '0') % p == 0)
        res += i;
    }
    cout << res << en;
    return 0;
  }

  ll pre[n + 5];
  memset(pre, 0, sizeof(pre));

  map<ll, ll> cnt;

  cnt[0] = 1;
  ll res = 0;
  for (ll i = 1; i <= n; i++) {
    pre[i] = (pre[i - 1] * 10 + (arr[i] - '0')) % p;

    ll val = pre[i] * power(power(10, i, p), p - 2, p) % p;

    if (cnt.find(val) != cnt.end()) {
      res += cnt[val];
    }
    cnt[val]++;
  }
  cout << res << en;
  return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  string n;
  while (cin >> n, n != "0000") {
    int ans = 0;
    bool na = false;
    while (n != "6174") {
      sort(n.begin(), n.end());
      int s = stoi(n);
      sort(n.begin(), n.end(), greater<char>());
      int L = stoi(n);
      if (s == L) {
        cout << "NA\n";
        na = true;
        break;
      }
      ans++;
      ostringstream os;
      os << setfill('0') << setw(4) << L - s;
      n = os.str();
    }
    if (!na) cout << ans << "\n";
  }
}


Measured memory_bytes: 3244
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll x, a,b;
  cin >> x >> a >> b;
  string ans = "safe";
  if(b>x+a)ans = "dangerous";
  else if(a>=b)ans = "delicious";
  cout << ans;
  return 0;
}


Measured memory_bytes: 3632
cs=[list(map(int,input().split())) for _ in range(3)]
a=[i-j for i,j in zip(cs[0],cs[1])]
b=[i-j for i,j in zip(cs[1],cs[2])]
print('Yes'if a[0]==a[1]==a[2] and b[0]==b[1]==b[2]else'No')


Measured memory_bytes: 9192
// 1_3_D

#include <iostream>
using namespace std;

int main(){
  int a, b, c, i, count = 0;
  cin >> a; cin >> b; cin >> c;
  for(i = a; i <= b; i++){
    if(c%i == 0) count += 1;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <iomanip>
#include <math.h>
#include <map>
#include <list>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <string.h>
// #include <limits.h>

#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define INTMAX  99999999

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

ll x;



int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> x;

	ll ans = 0;
	ll q = x/11LL;
	ll r = x%11LL;
	// DOUT << "q="<<q<<endl;
	ans = q*2LL;
	// DOUT << "ans="<<ans<<endl;
	if(r==0) {
		// nop
	}
	else if(r<7) {
		ans += 1;
	}
	else if(r<12) {
		ans += 2;
	}

	cout << ans<< endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long


int32_t main(){
	fast;
	int a,ans;
	double b;
	cin>>a>>b;
	int c = b*100+ 0.001;
	ans = (int) (c*a)/100;
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 3744
a,b,c,d,e,f = map(int,input().split())
ans_per, ans_w, ans_s = -1,0,0
for i in range(f//(100*a) + 1):
  for j in range((f-100*i)//(100*b) + 1):
    if i == j == 0:
      continue
    w = i*a*100 + j*b*100
    r = min(f-w, w//100 * e)
    for x in range(r//c + 1):
      for y in range((r-x*c)//d + 1):
        s = x*c + y*d
        if s / w > ans_per:
          ans_per = s/w
          ans_w = w
          ans_s = s
print('{} {}'.format(ans_w+ans_s, ans_s))

Measured memory_bytes: 3064
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{

    ll n,ans=0,i,val,p=0,temp;

    cin>>n;

    rep(i,1,n+1)
    {
        cin>>val;

        ans += max(0LL,p-val);

        p = max(p,val);

    }

    cout<<ans;


    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

int main(void)
{
	int menu;
	int hour, min, order_time;
	int hantei;
	int l_ac, d_ac, m_ac;
	int l_ord, d_ord, m_ord;
	int i;
	
	while (1){
		scanf("%d", &menu);
		
		if (menu == 0){
			break;
		}
		
		l_ord = d_ord = m_ord = l_ac = d_ac = m_ac = 0;
		
		for (i = 0; i < menu; i++){
			scanf("%d%*c%d%d",&hour, &min, &order_time);
			
			if (11 <= hour && hour <= 14){
				l_ord++;
				
				if (min > order_time){
					hantei = order_time + 60 - min;
				}
				
				else {
					hantei = order_time - min;
				}
				
				if (hantei <= 8){
					l_ac++;
				}
			}
			
			if (18 <= hour && hour <= 20){
				d_ord++;
				
				if (min > order_time){
					hantei = order_time + 60 - min;
				}
				
				else {
					hantei = order_time - min;
				}
				
				if (hantei <= 8){
					d_ac++;
				}
			}
			
			if (21 <= hour && hour <= 23 || 0 <= hour && hour <= 1){
				m_ord++;
				
				if (min > order_time){
					hantei = order_time + 60 - min;
				}
				
				else {
					hantei = order_time - min;
				}
				
				if (hantei <= 8){
					m_ac++;
				}
			}
		}
		printf("lunch ");
		
		if (l_ord == 0){
			printf("no guest\n");
		}
		
		else {
			printf("%d\n", l_ac * 100 / l_ord);
		}
		
		printf("dinner ");
		
		if (d_ord == 0){
			printf("no guest\n");
		}
		
		else {
			printf("%d\n", d_ac * 100 / d_ord);
		}
		
		printf("midnight ");
		
		if (m_ord == 0){
			printf("no guest\n");
		}
		
		else {
			printf("%d\n", m_ac * 100 / m_ord);
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pdd = pair<double, double>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    string S;
    cin >> S;
    int cnt = 0, ma = 0;
    for (int i = 0; i < 3; ++i) {
        if (S[i] == 'R')
            cnt++;
        else
            cnt = 0;
        ma = max(ma, cnt);
    }

    cout << ma << endl;

    return 0;
}


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

public class Main
{
	public static void main(String[] Arguments) throws IOException
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));
		String S = BR.readLine(), T = BR.readLine();
		if (S.equals(T.subSequence(0, T.length() - 1))) System.out.println("Yes");
		else System.out.println("No");
	}
}


Measured memory_bytes: 25360
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        char[] S = new char[N];
        for (int i = 0; i < S.length; ++i) {
            S[i] = sc.next().charAt(0);
        }

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(char[] S) {
        return IntStream.range(0, S.length).anyMatch(i -> S[i] == 'Y') ? "Four" : "Three";
    }
}

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

int main() {
	int n;
	cin >> n;
	int mx = 0, res = 1;
	for (int i = 1; i <= n; i++) {
		int x = i;
		int cnt = 0;
		while (x % 2 == 0) {
			cnt++;
			x /= 2;
		}
		if (cnt >= mx) {
			mx = cnt;
			res = i;
		}
	}
	cout << res;
	return 0;
}

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

namespace AtCoder
{
    public class Prog
    {
        const int MOD = 1000000007;
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Prog().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var s = cin.Read;

            var ans = string.Empty;

            if (a < 3200)
            {
                ans = "red";
            }
            else
            {
                ans = s;
            }

            Console.WriteLine(ans);
        }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; } }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, a, b;
char s[105], s2[105], t;
long long ans, k;
int main(){
	scanf("%s\n%lld", s, &k);
	n = (int)strlen(s);
	rep(i,n) s2[i] = s[i];
	b++; s2[0] = '!';
	rep(i,n){
		if(s[i] == s[i+1]){
			s[i+1] = '!';
			a++;
		}
		if(s2[i] == s2[i+1]){
			s2[i+1] = '!';
			b++;
		}
	}
	if(s[0] != s[n-1]) ans = a * k;
	else if(s[0] != s2[n-1]) ans = a * (k - k/2) + b * (k/2);
	else ans = a + b * (k-1);
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <functional>
#include <iomanip>
using namespace std;

//??°?????????????????°

void function()
{
	//??¢??°
}

int main()
{
	char c;
	bool f = false;
	while (true)
	{
		scanf("%c", &c);
		if (isupper(c))
		{
			cout << (char)tolower(c);
		}
		else if (islower(c))
		{
			cout << (char)toupper(c);
		}
		else
		{
			cout << (char)c;
		}

		if (c == '\n') break;
	}
	return 0;
}

Measured memory_bytes: 1112
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <deque>
//#include <bits/stdc++.h>
typedef long long ll;

using namespace std;
char ch[10001];
int main()
{
    int n,m,len;
    while(cin>>len>>ch)
    {
        if(len%2==1)
        {
            cout<<"No"<<endl;
            continue;
        }
        int flag=1;
        for(int i=0;i<len/2;i++)
            if(ch[i]!=ch[i+len/2])
            {
                flag=0;
                break;
            }
        if(flag) cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
declare function require(x: string): any;

var input = require("fs").readFileSync("/dev/stdin", "utf8");
input = input.split("\n");
const [n, m, k] = input[0].split(" ").map((x: string): number => +x);

let flg_yes = false;
top:
for (let h = 0; h <= n; h++) {
	for (let w = 0; w <= m; w++) {
		const num = h*m+w*n-h*w*2;
		if(num == k) {
			flg_yes = true;
			break top;
		}
	}
}

if(flg_yes) console.log("Yes");
else console.log("No");


Measured memory_bytes: 7500
n = int(input())
x_list = [i for i in map(int, input().split())]

min_goukei = 2500 * 100

for i in range(100):
    goukei = 0
    for j in range(n):
        goukei += (x_list[j] - i)**2
    if goukei < min_goukei:
        min_goukei = goukei

print(min_goukei)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int h, w, n; cin >> h >> w >> n;
  int sr, sc; cin >> sr >> sc, --sr, --sc;
  string s, t; cin >> s >> t;
  auto fn = [](int a, int b, int c, int d) -> int {
    return max(min(b, d) - max(a, c), 0);
  };
  int p = 0;
  while (p < n and s[p] != 'L' and s[p] != 'R') ++p;
  int x = 0, l = 0, r = 0;
  for (int i = p; i < n; ++i) {
    x += s[i] == 'L';
    l = max(l, x);
    x -= t[i] == 'R';
  }
  x = 0;
  for (int i = p; i < n; ++i) {
    x += s[i] == 'R';
    r = max(r, x);
    x -= t[i] == 'L';
  }
  int cl = count(begin(t), begin(t) + p, 'L');
  int cr = count(begin(t), begin(t) + p, 'R');
  if (!fn(l, w - r, sc - cl, sc + cr + 1)) return cout << "NO" << '\n', 0;
  p = 0;
  while (p < n and s[p] != 'U' and s[p] != 'D') ++p;
  int u = 0, d = 0;
  x = 0;
  for (int i = p; i < n; ++i) {
    x += s[i] == 'U';
    u = max(u, x);
    x -= t[i] == 'D';
  }
  x = 0;
  for (int i = p; i < n; ++i) {
    x += s[i] == 'D';
    d = max(d, x);
    x -= t[i] == 'U';
  }
  int cu = count(begin(t), begin(t) + p, 'U');
  int cd = count(begin(t), begin(t) + p, 'D');
  if (!fn(u, h - d, sr - cu, sr + cd + 1)) return cout << "NO" << '\n', 0;
  cout << "YES" << '\n';
}

Measured memory_bytes: 920
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[100001];
    for (int i=0; i<100001; i++){
        a[i]=0;
    }
    for (int i=0; i<n; i++){
        int x;
        cin >>x;
        a[x]++;
    }
    int even=0;
    for (int i=1; i<100001; i++){
        if (a[i]>=1 && a[i]%2==0){
            even++;
        }
    }
    int num=0;
    for (int i=1; i<100001; i++){
        if (a[i]!=0){
            num++;
        }
    }
    if (even%2==0){
        cout << num <<endl;
    }
    else {
        cout << num-1 <<endl;
    }
}


Measured memory_bytes: 640
def resolve():
    import sys
    input = sys.stdin.readline
    # 整数 1 つ
    N = int(input())
    # 整数複数個
    # a, b = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    P = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])

        if temp != 1:
            arr.append([temp, 1])

        if arr == []:
            arr.append([n, 1])

        return arr

    List = factorization(N)
    #sosuList = [List[i][0] for i in range(len(List))]

    numList = []
    for x in List:
        for i in range(1, x[1]+1):
            numList.append(x[0]**i)

    numList = sorted(numList)
    num = N
    cnt = 0
    if N != 1:
        for i in numList:
            if num % i == 0:
                num = num // i
                cnt += 1
                if num == 1:
                    break

    print(cnt)

resolve()

Measured memory_bytes: 63448
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
#define ep 0.00001

int main()
{
	double a, b, c, d, p, q;
	double x1, y1, x2, y2, x3, y3;
	double x, y, r;
	double det;
	int n;
	
	/*
	(x - x1)^2 + (y - y1)^2 = (x - x3)^2 + (y - y3)^2
	(x - x2)^2 + (y - y2)^2 = (x - x3)^2 + (y - y3)^2
	
	2(x3 - x1)x + 2(y3 - y1)y = (x3)^2 + (y3)^2 - (x1)^2 - (y1)^2
	2(x3 - x2)x + 2(y3 - y2)y = (x3)^2 + (y3)^2 - (x2)^2 - (y2)^2
	*/
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a = 2 * (x3 - x1);
		b = 2 * (y3 - y1);
		c = 2 * (x3 - x2);
		d = 2 * (y3 - y2);
		p = x3 * x3 + y3 * y3 - x1 * x1 - y1 * y1;
		q = x3 * x3 + y3 * y3 - x2 * x2 - y2 * y2;
		
		det = a * d - b * c;
		x = (d * p - b * q) / det + ep;
		y = (a * q - c * p) / det + ep;
		
		r = hypot(x - x1, y - y1);
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <vector>

using namespace std;

void dfs(vector<vector<int>>& graph, int vertex, vector<bool>& marked, vector<int>& d, vector<int>& f, int& time) {
    if (marked[vertex])
        return;
    marked[vertex] = true;
    d[vertex] = ++time;
    for (int x: graph[vertex])
        if (!marked[x])
            dfs(graph, x, marked, d, f, time);
    f[vertex] = ++time;
}

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

    vector<vector<int>> graph;
    for (int i = 0; i < n; i++) {
        vector<int> t;
        int u;
        cin >> u;
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;
            t.push_back(v - 1);
        }
        graph.push_back(t);
    }

    vector<bool> marked(n);
    vector<int> d(n);
    vector<int> f(n);
    int time = 0;

    for (int i = 0; i < n; i++)
        dfs(graph, i, marked, d, f, time);
    for (int i = 0; i < n; i++)
        cout << i + 1 << " " << d[i] << " " << f[i] << endl;

    return 0;
}



Measured memory_bytes: 3164
/* Just_Do_It ___________ICARUS__________________*/
                 
#include <bits/stdc++.h>
using namespace std;
       
typedef long long ll;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define te ll t; std::cin >> t; while(t--)
#define SZ 100001
//# define M_PIl  3.141592653589793238462643383279502884L 
/*   Proceed with CAUTION   */
ll frec[30000000];
int main(){
	fastio;
	ll a,b;
  cin>>a>>b;
  ll c = a*b -a -b +1;
  cout<<c<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#include<limits.h>
#include<queue>
struct S{int x,y,c;S(int x,int y,int c):x(x),y(y),c(c){}bool operator<(const S&r)const{return c>r.c;}};
int main()
{
	int w,h,x,y,d[]={0,1,0,-1,0},i;
	char*p,m[102][105];
	while(scanf("%d%d",&w,&h),w)
	{
		int f[102][102]={0};
		for(y=1;y<=h;++y)scanf("%s",m[y]+1);
		h+=2,w+=2;
		for(y=0;y<h;++y)m[y][0]=m[y][w-1]='.';
		for(x=0;x<w;++x)m[0][x]=m[h-1][x]='.';
		std::priority_queue<S>q;
		q.push(S(0,0,0));
		while(!q.empty())
		{
			S p(q.top());q.pop();
			char c=m[p.y][p.x];
			if(c=='&')
			{
				printf("%d\n",p.c);
				break;
			}
			for(i=0;i<4;++i)
			{
				x=p.x+d[i];
				y=p.y+d[i+1];
				if(x<0||w<=x||y<0||h<=y||f[y][x])continue;
				f[y][x]=1;
				char d=m[y][x];
				if(d=='#'&&d-c)q.push(S(x,y,p.c+1));
				else q.push(S(x,y,p.c));
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int n;
ll a[3];
string S[MAXN];
vector<int> ans;

bool DEBUG=0;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n;
	forn(i,0,3) cin>>a[i];
	forn(i,0,n) cin>>S[i];
	
	for(int i=0;i<n;i++){
		string s=S[i];
		
		int x=s[0]-'A', y=s[1]-'A';
		if(a[x]+a[y]==0){
			cout<<"No\n"; return 0;
		}
		else if(a[x]*a[y]==0){
			ans.pb(!a[x]?x:y);
			if(a[x]){ a[x]--; a[y]++; }
			else { a[x]++; a[y]--; }
		}
		else{
			if(i==n-1){
				ans.pb(x);
				a[x]++; a[y]--;
				break;
			}
			else
			{
				int x1=S[i+1][0]-'A', y1=S[i+1][1]-'A';
				if(S[i+1]==S[i]){
					ans.pb(x1); ans.pb(y1);
				}
				else{
					//A
					if(x==x1){
						ans.pb(0); ans.pb(y1);
						a[y]--; a[y1]++;
					}
					//C
					else if(y==y1){
						ans.pb(2); ans.pb(x1);
						a[x]--; a[x1]++;
					}
					//B
					else{
						if(S[i][1]=='B'){
							ans.pb(1); ans.pb(2);
							a[0]--; a[2]++;
						}
						else{
							ans.pb(1); ans.pb(0);
							a[2]--; a[0]++;
						}
					}
				}
				i++;
			}
		}
		
		if(DEBUG){
			cout<<char('A'+ans.back())<<'\n';
			cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<'\n';
		}
	}
	
	cout<<"Yes\n";
	for(int x: ans){
		cout<<char('A'+x)<<'\n';
	}
	
	return 0;
}


Measured memory_bytes: 7004
import sys
stdin = sys.stdin
import numpy as np

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
x = na()
inf = 10**10
cnt = [0] * 100
for xi in x:
    for p in range(1, 101):
        cnt[p-1] = cnt[p-1] + (xi - p)**2
#print(cnt)
print(min(cnt))

Measured memory_bytes: 12488
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

ll inf=(ll)2e18;
const int mod=1000000007;
//const int mod=998244353;
int n,m;






int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,k,u,v;
    ll x,a,b,c,d,y,l,p;
    cin >> n;
    map<string,int> map;
    string s;
    for(int i=0; i<n; i++){
        cin >> s;
        map[s]++;
    }
    cout << "AC x " << map["AC"] << el;
    cout << "WA x " << map["WA"] << el;
    cout << "TLE x " << map["TLE"] << el;
    cout << "RE x " << map["RE"] << el;
    return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
#define inf (int)(1e9 + 1)

int ABS(int a){
	return a >= 0 ? a : -a;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int N, i;
	scanf("%d", &N);
	int *h = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &h[i]);
	}
	int *dp = (int *)malloc(sizeof(int) * (N + 1));
	for(i = 0; i <= N; i++){
		dp[i] = inf;
	}
	dp[0] = 0;
	for(i = 0; i < N - 1; i++){
		dp[i + 1] = min(dp[i + 1], dp[i] + ABS(h[i] - h[i + 1]));
		dp[i + 2] = min(dp[i + 2], dp[i] + ABS(h[i] - h[i + 2]));
	}
	printf("%d\n", dp[N - 1]);
	return 0;
}

Measured memory_bytes: 896
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


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)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;


int main() {
	string s;
	cin >> s;
	rep(i, 4) {
		cout << s[i];
	}
	cout << " ";
	for (int i = 4; i < 12; i++) cout << s[i];
	cout << endl;
	return 0;
}


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

int main(){
    int n, A[100];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> A[i];
    
    for(int i = n-1; i >= 0; i--){
        if(i != n-1) cout << " ";
        cout << A[i];
    }
    cout << endl;
    
    return 0;
}

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

using namespace std;

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

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int m, n;
vector<int> G[20];
int dp[20];
int res[20];

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    scanf("%d %d", &m, &n);
    rep(i, n){
      int2(x, y);
      --x; --y;
      G[y].pb(x);
    }

    rep(i, m)dp[i] = 100;
    dp[1] = m - 1;
    per(i, m){
      rep(j, m)if(dp[j] == i){
        int k;
        rep(k, G[j].size())dp[G[j][k]] = i - 1;
      }
    }
    //rep(i, m)debug(dp[i]);

    int hd = 0;
    per(i, m)rep(j, m)if(dp[j] == i)res[hd++] = j + 1;
    per(i, hd)pri(res[i]);

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3228
n = int(input())


def binary_search(n) -> int:
    target = n * 2
    left, right = 0, target
    while right - left != 1:
        mid = (left + right) // 2
        if mid * mid + mid < target:
            left = mid
        elif mid * mid + mid > target:
            right = mid
        elif mid * mid + mid == target:
            return mid
    return right


print(binary_search(n))


Measured memory_bytes: 61860
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}
ll xx[11][11];
int main() {
	ll d;
	cin >> n >> d;
	rep(i, n) {
		rep(j, d) {
			cin >> xx[i][j];
		}
	}
	ll cnt = 0;
	rep(i, n-1) {
		for(ll j=i+1;j<n;j++) {
			ll dis = 0;
			rep(k, d) {
				dis += abs((xx[i][k] - xx[j][k])*(xx[i][k] - xx[j][k]));
			}
			rep(l, 10000) {
				if (l == sqrt(dis)) {
					cnt++;
					break;
				}
			}
		}
	}
	cout << cnt << endl;
}



Measured memory_bytes: 256
max = []
max_num = 1
hash = {}
gets.to_i.times do
    word = gets.chomp 
    if hash[word]==nil
        hash[word] = 1
    else
        hash[word] += 1
    end
    if hash[word]>max_num
        max_num = hash[word]
        max = [word]
    elsif hash[word]==max_num
        max << word
    end
end
max.sort!{|a,b|a<=>b}
max.each do |m|
    puts m
end

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    string S; cin >> S;
    int K; cin >> K;
    int N = S.size();
    priority_queue<string, vector<string>, greater<string>> Q;
    set<string> done;
    for (int i=0; i<N; i++) {
        for (int j=i; j<N; j++) {
            if (j - i + 1 > K) break;
            string str = S.substr(i, j - i + 1);
            if (done.count(str)) continue;
            Q.push(str);
            done.insert(str);
        }
    }

    rep(i, K) {
        string str = Q.top(); Q.pop();
        // DUMP(str);
        if (i == K - 1) cout << str << endl;
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef unsigned long long ll;
const int maxn = 200005;

struct P{
  int x,y;
  P(){}
  bool operator<(const P&a)const{
    return y<a.y;
  }
}p[maxn];
int n;
bool solve() {
  int cur = 0;
  for(int i=0;i<n;i++){
    if(cur+p[i].x>p[i].y)return false;
    cur+=p[i].x;
  }
  return true;
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin>>n;
  for(int i=0;i<n;i++)cin>>p[i].x>>p[i].y;
  sort(p,p+n);
  if(solve())cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
ll dx[4] = {1,0,0,-1};
ll dy[4] = {0,1,-1,0};

#define ARRAY_MAX 1005


int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n,0);
    REP(i,n){
        cin >> a[i];
        if((a[i]-1)%2 == 1)b[i]++;
        if(a[i]%2 == 1)b[i]++;
        if((a[i]+1)%2 == 1)b[i]++;
    }

    int ans = 1;
    REP(i,n){
        ans *= b[i];
    }
    cout << int(pow(3,n))-ans << endl;






    return 0;
}

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

using namespace std;

int main(int argc, char const *argv[]) {
  string s;
  vector<char> alphabets;
  for (char i = 'a'; i <= 'z'; i++) alphabets.push_back(i);
  cin >> s;
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  for (size_t i = 0; i < s.size(); i++) alphabets.erase(remove(alphabets.begin(), alphabets.end(), s[i]), alphabets.end());

  if (alphabets.size() == 0) cout << "None" << endl;
  else cout << alphabets[0] << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
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 sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int n;

void dfs(string s, char c) {
    if(sz(s) == n) {
        cout << s << endl;
        return;
    }
    for(char i = 'a'; i <= c; i++) {
        string t = s + string(1,i);
        int nc = c;
        if(i == c) nc++;
        dfs(t,nc);
    }
}

int main(){
    cin >> n;
    dfs("",'a');
}

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

int main(){
int N;
cin>>N;
vector<int> h(N);
for(int i=0;i<N;i++){
   cin>>h[i];
}
reverse(h.begin(),h.end());
bool t=true;
for(int i=0;i<N-1;i++){
   if(h[i]+1==h[i+1]){
      h[i+1]-=1;
   }
   else if(h[i]+2<=h[i+1]){
   t=false;
   }
}
if(t){
   cout<<"Yes"<<endl;
}
else{
   cout<<"No"<<endl;
}
return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    ll ans = 0;
    rep(i, n){
        if (i < n - 1 && x >= a[i]){
            x -= a[i];
            ans ++;
        }
        else if (i == n - 1 && x == a[i]) ans++;
        else break;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define LINF (1ll<<60)
#define INF (1<<29)

typedef long long ll;

int h, w, n;
ll x[100000], y[100000];
ll sx[100000], sy[100000];

int main() {
	cin >> h >> w >> n;
	
	REP(i, n) {
		scanf("%d %d", &x[i], &y[i]);
		sx[i] = x[i];
		sy[i] = y[i];
	}
	sort(sx, sx + n);
	sort(sy, sy + n);
	
	ll ans = LINF;
	int ansx = INF, ansy = INF;
	
	REP(i, 2) REP(j, 2) {
		if ((i || j) && n & 1) continue;
		
		int nx = sx[n / 2 - j];
		int ny = sy[n / 2 - i];
		
		ll sum = 0, maxer = -1;
		REP(k, n) {
			ll d = abs(nx - x[k]) + abs(ny - y[k]);
			sum += 2 * d;
			maxer = max(maxer, d);
		}
		sum -= maxer;
		
		if (ans > sum || (ans == sum && ansx > nx) || (ans == sum && ansx == nx && ansy > ny)) {
			ansx = nx;
			ansy = ny;
			ans = sum;
		}
	}
	cout << ans << endl;
	printf("%d %d\n", ansx, ansy);
	return 0;
}

Measured memory_bytes: 6412
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int mod = 1000000007;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
#define PI (acos(-1))

struct BIT
{
    int n;
    vector<int> bit;
    BIT()
    {
        init();
    }
    BIT(int n) : n(n)
    {
        init();
    }
    void init()
    {
        bit.clear();
        bit.resize(n + 1, 0);
    }
    int sum(int i)
    {
        int s = 0;
        while (i > 0)
        {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    int sum(int x, int y)
    {
        return sum(y) - sum(x - 1);
    }
    void add(int i, int x)
    {
        while (i <= n)
        {
            bit[i] += x;
            i += i & -i;
        }
    }
 int lower_bound(int w)
    {
        if (w <= 0)
            return 0;
        int x = 0, r = 1;
        while (r < n)
            r <<= 1;
        for (int k = r; k > 0; k >>= 1)
        {
            if (x + k <= n && bit[x + k] < w)
            {
                w -= bit[x + k];
                x += k;
            }
        }
        return x + 1;
    }
};

ll a[202020];
ll r[202020];
int solve()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> v;
    set<ll> se;
    BIT bit(n);
    for(int i=0; i < n; i++){
        cin >> a[i];
        a[i] -= k;
    }
    r[0] = a[0];
    se.insert(r[0]);
    for(int i=1; i < n; i++){
        r[i] = r[i - 1] + a[i];
        se.insert(r[i]);
    }

    map<ll, ll> m;
    ll cnt = 1;
    for(auto t : se){
        m[t] = cnt;
        cnt++;
    }
    // ll ans = (n-1)*(n)/2 + n;
    ll ans = 0;
    for(int i=0; i < n; i++){
        if(r[i] >=0)
            ans++;
        r[i] = m[r[i]];
        //cout << r[i] << endl;
    }
    if(n == 1){
        cout << ans << endl;
        return 0;
    }


    for(int i=0; i < n; i++){
        ans += bit.sum(r[i]);
        bit.add(r[i], 1);
    }
    cout << ans << endl;

    return 0;
}

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

   solve();
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans=1000000;
  vector<int> flag(N);
  int sum=0;
  for(int i=0;i<N;i++){
    if(i==0){
      for(int j=1;j<N;j++){
        if(S.at(j)=='E'){
          flag.at(j)=1;
        }
      }
      for(int j=0;j<N;j++){
        if(flag.at(j)==1){
          sum++;
        }
      }
    }
    else{
      if(flag.at(i)==1){
        sum--;
      }
      if(S.at(i-1)=='W'){
        flag.at(i-1)=1;
        sum++;
      }
      flag.at(i)=0;
    }
    ans=min(ans,sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1796
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	num := 1
	for i := 0; i < n; i++ {
		if num*2 < num+k {
			num *= 2
		} else {
			num += k
		}
	}
	fmt.Println(num)
}


Measured memory_bytes: 512
K=int(input())
Array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(Array[K-1])

Measured memory_bytes: 3060