akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 ll INF=(1LL<<60);
const int mod=1000000007;

int main(){
    int a,b,c; cin >> a >> b >> c;
    cout << a*b/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

ll raise(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}


ll n, ans=0; double a,b, d;

void solve()
{
    cin >> n >> d;
    for (int i=0; i<n; ++i) {
        cin >> a >> b;
        double t = sqrt(a*a+b*b);
        if (t<=d) ++ans;
    }nout(ans);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
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;}

int main() {
  ll n,k;
  cin >> n >> k;
  std::vector<int> vec(n);
  rep(i,n) cin >> vec.at(i);
  sort(vec.begin(), vec.end());
  ll total = 0;
  rep(i,k) {
    total += vec.at(i);
  }
  cout << total << endl;
}


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

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

using namespace std;

class mint{
	static const int MOD=998244353;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long y,const mint& m){ return m+y; }
mint operator*(long long y,const mint& m){ return m*y; }

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

mint fact(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		for(;k<=n;k++) memo[k]=memo[k-1]*k;
	}
	return memo[n];
}

mint fact_inverse(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		memo[n]=inverse(fact(n));
		for(int i=n;i>k;i--) memo[i-1]=memo[i]*i;
	}
	return memo[n];
}

mint choose(int n,int k,int type=0){
	if(k==0) return 1;
	if(n< k) return 0;
	if(type==0){
		return fact(n)*fact_inverse(k)*fact_inverse(n-k);
	}
	else{
		if(k>n-k) k=n-k;
		mint res=fact_inverse(k);
		rep(i,k) res*=n-i;
		return res;
	}
}

mint multichoose(int n,int k,int type=0){
	return choose(n+k-1,k,type);
}

mint f(int k,int n,int p){
	mint res=0;
	rep(i,min(p,n)+1){
		res+=multichoose(i+(k-2*p),n-i)*choose(p,i)*pow(mint(2),i);
	}
	return res;
}

int main(){
	int k,n; scanf("%d%d",&k,&n);

	for(int tar=2;tar<=2*k;tar++){
		int p=0;
		for(int i=1;2*i<tar;i++){
			if(i<=k && tar-i<=k) p++;
		}

		mint ans;
		if(tar%2==0) ans=f(k-1,n-1,p)+f(k-1,n,p);
		else         ans=f(k,n,p);
		cout<<ans<<'\n';
	}

	return 0;
}


Measured memory_bytes: 384
# 蟻本2-1-1相当
# 今回は再帰で解く

import sys
s = input()
def answer(value, formula, remain):
  if len(remain) == 1:
    if value + int(remain) == 7:
      print(formula + "+" + remain + "=7")
      sys.exit(0)
    elif value - int(remain) == 7:
      print(formula + "-" + remain + "=7")
      sys.exit(0)
  else:
    answer(value + int(remain[0]), formula + "+" + remain[0], remain[1:])
    answer(value - int(remain[0]), formula + "-" + remain[0], remain[1:])

answer(int(s[0]), s[0], s[1:])

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	class Node implements Comparable<Node> {
		int p, t;
		int j = 0;
		String s;

		Node(int p, int t) {
			this.p = p;
			this.t = t;
		}

		Node(int p, int t, String s) {
			this.p = p;
			this.t = t;
			this.s = s;
		}

		public int compareTo(Node tar) {
			return this.t - tar.t;
		}
	}

	class Arrow {
		int cap;
		int flow;
		int from;
		int to;

		Arrow(int from, int to) {
			this.from = from;
			this.to = to;
			this.cap = 1;
			this.flow = 0;
		}
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		for (;;) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int l = sc.nextInt();
			if ((n | m | l) == 0)
				break;
			int d[][] = new int[n][n];
			for (int i = 0; i < n; i++) {
				Arrays.fill(d[i], Integer.MAX_VALUE / 4);
			}
			for(int i = 0; i < n ; i++){
				d[i][i] = 0;
			}
			for (int i = 0; i < m; i++) {
				int u = sc.nextInt();
				int v = sc.nextInt();
				d[u][v] = d[v][u] = sc.nextInt();
			}
			Node[] req = new Node[l];
			for (int i = 0; i < l; i++) {
				req[i] = new Node(sc.nextInt(), sc.nextInt());
			}
			Arrays.sort(req);

			for (int k = 0; k < n; k++) {
				for (int i = 0; i < n; i++) {
					for (int j = 0; j < n; j++) {
						d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]);
					}
				}
			}

			boolean r[][] = new boolean[l][l];
			boolean e[][] = new boolean[l][l];

//			LinkedList<Arrow> A = new LinkedList<Arrow>();

			
			for (int i = 0; i < l; i++) {
				for (int j = i + 1; j < l; j++) {
					if (d[req[i].p][req[j].p] <= -req[i].t + req[j].t) {
						r[i][j] = true;
					} 
					// System.out.println(i+" "+j+" " + r[req[i].p][req[j].p]);
				}
			}

			boolean s[] = new boolean[l];
			boolean t[] = new boolean[l];

			int count = 0;

			for (;;) {
				boolean end = true;
				for (int i = 0; i < l; i++) {
					if (!s[i]) {
						if (dfs(s, t, r,e, i , new boolean[l],new boolean[l])) {
							s[i] = true;
							count++;
							end = false;
						}
					}
				}
				if(end){
					break;
				}
			}
			System.out.println(l-count);
		}

	}

	boolean dfs(boolean[] s, boolean[] t, boolean r[][], boolean e[][], int p , boolean[] passed , boolean[] p2) {
		if(passed[p]){
			return  false;
		}else{
			passed[p] = true;
		}
		for(int  i = 0; i < t.length;i++){
			if(!r[p][i]){
				continue;
			}
			if(e[p][i]){
				continue;
			}
			e[p][i] = true;
			if(!t[i]){
				t[i] = true;
				return true;
			} 
			if(bdfs(s,t,r,e,i , passed , p2)){
				return true;
			}else{
				e[p][i] = false;
			}
		}
		return false;
	}

	boolean bdfs(boolean[] s, boolean[] t, boolean r[][] , boolean[][] e, int p,boolean passed[] , boolean [] p2) {
		if(p2[p]){
			return false;
		}else{
			p2[p] = true;
		}
		for(int i = 0; i < t.length; i++){
			
			if(!e[i][p]){
				continue;
			}
			e[i][p] = false;
			
			if(dfs(s,t,r,e,i ,passed , p2)){
				return true;
			}else{
				e[i][p] = true;
			}
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 17000
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
#include<iostream>
#include<cmath>
int count_bit(int value) {
	int result = 0;
	while (value != 0) {
		result += value % 2;
		value >>= 1;
	}
	return result;
}
int max_score(const int current, const int state, const std::vector<int>& beats, const std::vector<int>& patterns, std::vector<std::unordered_map<int, int>>& memo) {
	if (current == beats.size()) return 0;
	if (memo[current].find(state) != memo[current].end()) return memo[current][state];
	const auto next_state = state | beats[current];
	int max = 0;
	for (const auto pattern : patterns) {
		max = std::max(max, max_score(current + 1, next_state & (~pattern), beats, patterns, memo) + count_bit(pattern & next_state));
	}
	return memo[current][state] = max;
}
int main() {
	while (true) {
		int n, c; std::cin >> n >> c; if (n == 0 && c == 0) break;
		std::vector<int> beats(n, 0), patterns(c, 0);
		for (auto& beat : beats) {
			int d;
			for (auto i = 0; i < 16; ++i) {
				std::cin >> d;
				beat <<= 1;
				beat += d;
			}
		}
		for (auto& pattern : patterns) {
			int d;
			for (auto i = 0; i < 16; ++i) {
				std::cin >> d;
				pattern <<= 1;
				pattern += d;
			}
		}
		std::vector<std::unordered_map<int, int>> memo(n);
		std::cout << max_score(0, 0, beats, patterns, memo) << '\n';
	}
}


Measured memory_bytes: 76712
#include<stdio.h>
#define MAX 1000

int main()
{
  int i, j, k, N, v;
  int A[MAX];

  scanf("%d",&N);

  for(i=0;i<=N-1;i++)
    {
      scanf("%d",&A[i]);
    }

  printf("%d",A[0]);
  for(k=1;k<=N-1;k++)
	{
	  printf(" %d",A[k]);
	}
  printf("\n");
  
  for(i=1;i<=N-1;i++)
    {
      v = A[i];
      j = i-1;
      while(j>=0&&A[j]>v)
      {
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      
      printf("%d",A[0]);
      for(k=1;k<=N-1;k++)
	{
	  printf(" %d",A[k]);
	}
      printf("\n");
      }
  return(0);
}

Measured memory_bytes: 608
import sys
input = sys.stdin.readline
from collections import deque
def main():
    S = list(input().rstrip())
    ans = deque()
    for c in S:
        if c == "B":
            if len(ans) == 0:
                continue
            else:
                ans.pop()
        elif c == "0":
            ans.append(c)
        else :
            ans.append(c)
    print("".join(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX1 100006
#define f first
#define s second
#define pi 2*acos(0.0)
void solve()
{
    string str;  cin>>str;
    map<ll,ll> mp;
    rep(i,0,4) mp[str[i]-'A']++;
    if(sl(mp)==2) cout<<"Yes";
    else cout<<"No";
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for getting error from error.txt
    freopen("error.txt", "w", stderr);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<"\n";
    cerr<<"My CLOCKS_PER_SEC= "<<CLOCKS_PER_SEC<<"\n";
    return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include<algorithm>
#include<vector>
#include<tuple>
using namespace std;
long double w[100000], v[100000], W; int n;
vector<tuple<long double, long double, long double>>p1, p2;
long double solve(vector<tuple<long double, long double, long double>>x, long double t, int q) {
	long double vl = 0;
	for (int i = x.size() - 1; i >= 0; i--) {
		if (q == 0 && get<0>(x[i]) < 0)break;
		if (t >= get<2>(x[i])) { t -= get<2>(x[i]); vl += get<1>(x[i]); }
		else { vl += get<1>(x[i])*t / get<2>(x[i]); t = 0; }
	}
	return vl;
}
int main() {
	cin >> n >> W; long double r = 0, f = 0, e = 0;
	for (int i = 0; i < n; i++) {
		cin >> w[i] >> v[i];
		if (fabs(w[i]) < 1e-14) { r += max(0.0l, v[i]); }
		else if (w[i] > 0) { p1.push_back(make_tuple(v[i] / w[i], v[i], w[i])); }
		else if (w[i] < 0) { p2.push_back(make_tuple(-v[i] / w[i], v[i], -w[i])); e += -w[i]; }
	}
	sort(p1.begin(), p1.end()); sort(p2.begin(), p2.end());
	long double L = 0, R = e, c1, c2;
	for (int i = 0; i < 100; i++) {
		c1 = (L + L + R) / 3.0l; c2 = (L + R + R) / 3.0l;
		long double ret1 = solve(p1, c1 + W, 0) + solve(p2, c1, 1);
		long double ret2 = solve(p1, c2 + W, 0) + solve(p2, c2, 1);
		if (ret1 >= ret2)R = c2;
		else L = c1;
		f = max(f, max(ret1, ret2));
	}
	printf("%.12Lf\n", r + f);
	return 0;
}

Measured memory_bytes: 4376
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    LL N, M;
    cin >> N >> M;
    string S, T;
    cin >> S >> T;
    if (S[0] != T[0]) {
        cout << -1 << endl;
        return 0;
    }
    LL len = N;
    LL cnt = 1;
    LL ma = N / __gcd(N, M) * M;
    while (len <= ma) {
        if (len % M == 0) {
            bool ok = true;
            REP(i, N) {
                LL s_idx = i * cnt;
                if (s_idx % (len / M) == 0 && S[i] != T[s_idx / (len / M)]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                cout << len << endl;
                return 0;
            }
        }
        len += N;
        cnt++;
    }

    cout << -1 << endl;
}


Measured memory_bytes: 512
N = int(input())
X = list(map(int, input().split()))
Y = X[:]
Y.sort()
p = int(N/2)

if Y[p-1] == Y[p]:
    flag = 1
else:
    flag = 0



for i in range(N):
    if flag == 1:
        print(Y[p])
    else:
        if X[i]<=Y[p-1]:
            print(Y[p])
        else:
            print(Y[p-1])

Measured memory_bytes: 25220
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

    ll ans = 0;
    // C = A - B
    for(int C=1; C<=n-1; C++){
        ll max_score = 0;
        ll score = 0;
        if((n - 1) % C == 0){
            int i = 0, j = n - 1;
            for(; i < j; i += C, j -= C){
                score += s[i] + s[j];
                chmax(max_score, score);
            }
        }
        else{
            int i = 0, j = n - 1;
            for(; i < n - 1 && C < j; i += C, j -= C){
                score += s[i] + s[j];
                chmax(max_score, score); 
            }
        }

        chmax(ans, max_score);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<int> x(N), y(N);
	for(int i=0;i<N;i++){
		cin >> x[i] >> y[i];
	}
	int MAX = 0;
	for(int i=0;i<N-1;i++){
		for(int j=i+1;j<N;j++){
			int count = 0;
			int p = x[i] - x[j];
			int q = y[i] - y[j];
			for(int k=0;k<N-1;k++){
				for(int l=k;l<N;l++){
					if(x[k] - x[l] == p && y[k] - y[l] == q)count++;
					if(x[k] - x[l] == -1 * p && y[k] - y[l] == -1 * q)count++;
				}
			}
			MAX = max(MAX, count);
		}
	}
	cout << N - MAX << endl;
}

Measured memory_bytes: 256
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce
from itertools import groupby, combinations, permutations
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return map(lambda x: x + d, A)
def ldec(A, d=1): return map(lambda x: x - d, A)

H, W, K = nn()
C = sl(H)
D = array2(H, W)

for i in range(H):
    for j in range(W):
        D[i][j] = 1 if C[i][j] == "#" else 0

ans = 0
for n in range(2**H):
    for m in range(2**W):
        E = deepcopy(D)
        for i in range(H):
            if (n>>i) & 1 == 1:
                for k in range(W):
                    E[i][k] = 0

        for j in range(W):
            if (m>>j) & 1 == 1:
                for k in range(H):
                    E[k][j] = 0

        #print(n, m, E),

        count = 0
        for i in range(H):
            for j in range(W):
                if E[i][j] == 1:
                    count += 1

        #print(count)
        if count == K:
            #print("o"),
            ans += 1

        #print("")

print(ans)


Measured memory_bytes: 78056
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int K = line[1];
            char[] S = Console.ReadLine().ToCharArray();
            S[K - 1] = char.ToLower(S[K - 1]);
            Console.WriteLine(S);
        }
    }
}

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

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

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

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

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

    int N;
    cin >> N;

    int n;
    for (n = 1; n * (n + 1) / 2 < N; ++n);

    for (int i = 1; i <= n; ++i)
    {
        if (i != n * (n + 1) / 2 - N)
        {
            cout << i << "\n";
        }
    }

    return 0;
}



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

int main(){
    int n;cin>>n;
    vl a(n);rep(i,n)cin>>a.at(i);

    ll ans;
    ll x=a.at(0);
rep(i,n){
    x=min(x,a.at(i));
    if(x==a.at(i))ans++;
}

cout<<ans<<endl;

}

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

class Dice {
private:
    vector<int> num;
    int top;
    int side_n;
    int side_e;

public:
    Dice(vector<int> num);
    void Roll(char dir);
    int getNum(char dir);
};

Dice::Dice(vector<int> num)
{
    for (int i = 0; i < 6; i++) this->num.push_back(num.at(i));
    top = 1;
    side_n = 5;
    side_e = 3;
}
int Dice::getNum(char dir)
{
    int pos;
    
    switch (dir) {
        case 'T': pos = top; break;
        case 'B': pos = 7 - top; break;
        case 'N': pos = side_n; break;
        case 'E': pos = side_e; break;
        case 'W': pos = 7 - side_e; break;
        case 'S': pos = 7 - side_n; break;
        default : pos = top; break;
    }
    return num[pos-1];
}
void Dice::Roll(char dir)
{
    int tmp;
    
    switch (dir) {
        case 'N': tmp = top; top = 7-side_n; side_n = tmp; break;
        case 'E': tmp = top; top = 7-side_e; side_e = tmp; break;
        case 'W': tmp = top; top = side_e; side_e = 7-tmp; break;
        case 'S': tmp = top; top = side_n; side_n = 7-tmp; break;
        case 'R': tmp = side_n; side_n = 7-side_e; side_e = tmp; break;
        case 'L': tmp = side_e; side_e = 7-side_n; side_n = tmp; break;
        default : break;
    }
}

int main()
{
  vector< vector<int> > dices;
  string allDir = "TBNEWS";
  int n;

  cin >> n;
  for (int i = 0; i < n; i++) {
      vector<int> tmp_v;
      int tmp;
      for (int i = 0; i < 6; i++) { cin >> tmp; tmp_v.push_back(tmp); }
      dices.push_back(tmp_v);
  }
    
  for (int i = 0; i < n; i++)
    for (int j = i+1; j < n; j++) {
      Dice diceA(dices.at(i));
      Dice diceB(dices.at(j));
      for (int i = 0; diceA.getNum('T') != diceB.getNum('T') && i < 6; i++) diceB.Roll(i % 2 == 0 ? 'N' : 'E');
      for (int i = 0; diceA.getNum('S') != diceB.getNum('S') && i < 4; i++) diceB.Roll('R');
      
      string::iterator itr;
      for (itr = allDir.begin(); itr != allDir.end(); itr++)
        if (diceA.getNum(*itr) != diceB.getNum(*itr)) break;
        
      if (itr == allDir.end()) { cout << "No" << endl; return 0; }
    }

  cout << "Yes" << endl;

  return 0;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n){
		int tmp;
		cin >> tmp;
		a[i] = --tmp;
	}
	
	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(i == a[a[i]]){
			ans++;
		}
	}
	
	cout << ans / 2 << endl;
	return 0;
}



Measured memory_bytes: 640
#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() {
	ll h, n;
	cin >> h >> n;
	vector<ll> a(n,0);
	ll sum = 0;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum >= h) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
 
using namespace std;
 
int main(){
 
    int DataSetNum = 0;
    int HouseNum = 0;
    int GeneNum = 0;
    int* HousePos;
    int* CableLength;
    int AllCableLength = 0;
 
    cin >> DataSetNum;
    for (int datanum = 0; datanum < DataSetNum; ++datanum){

        cin >> HouseNum;
        cin >> GeneNum;
        HousePos = new int[HouseNum];
        for (int i = 0; i < HouseNum; ++i){
            cin >> HousePos[i];
        }
        if (HouseNum <= GeneNum){
            cout << 0 << endl;
            continue;
        }
        CableLength = new int[HouseNum - 1];
        for (int i = 0; i < HouseNum - 1; ++i){
            CableLength[i] = HousePos[i + 1] - HousePos[i];
        }
        AllCableLength = HousePos[HouseNum - 1] - HousePos[0];

        sort(&CableLength[0], &CableLength[0]+HouseNum-1);
        for (int i = 0; i < GeneNum - 1; ++i){
            AllCableLength -= CableLength[HouseNum - i - 2];
            CableLength[HouseNum - i - 2] = 0;
        }

        cout << AllCableLength << endl;
 
    }
 
    return 0;
}

Measured memory_bytes: 4168
#include<bits/stdc++.h>
#define N 100005
using namespace std;
bool DEBUG;
int n,q,now;
int sze[N],top[N],son[N],dep[N],fa[N][20],dis[N];
int head[N],id;
struct edge{
	int to,clo,len,nxt;
}E[N<<1];
inline void add_edge(int a,int b,int c,int d){
	E[++id]=(edge){b,c,d,head[a]};
	head[a]=id;
}
struct Query{
	int x,y,u,v;
}Q[N];
inline void Rd(int &res){
	char c;res=0;
	while(c=getchar(),c<48);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
	return;
}
struct Tree{
	#define M 10000000
	int nw;
	int rt[M],ls[M],rs[M],cnt[M],sum[M];
	void update(int l,int r,int x,int v,int &p,int od){
		p=++nw;
		if(l==r){
			cnt[p]=cnt[od]+1;
			sum[p]=sum[od]+v;
			return;
		}
		ls[p]=ls[od];rs[p]=rs[od];
		int mid=(l+r)>>1;
		if(mid>=x)update(l,mid,x,v,ls[p],ls[od]);
		else update(mid+1,r,x,v,rs[p],rs[od]);
	}
	int query(int l,int r,int x,int p,int od){
//		if(DEBUG&&l==r)printf("!!%d\n",cnt[p]);
		if(l==r)return now*(cnt[p]-cnt[od])-sum[p]+sum[od];
		int mid=(l+r)>>1;
		if(mid>=x)return query(l,mid,x,ls[p],ls[od]);
		return query(mid+1,r,x,rs[p],rs[od]);
	}
}tree;
void dfs(int x,int f,int d){
	dep[x]=d;sze[x]=1;
	for(int i=head[x];i;i=E[i].nxt){
		int v=E[i].to;
		if(v==f)continue;
		fa[v][0]=x;
		dis[v]=dis[x]+E[i].len;
		dfs(v,x,d+1);
		if(sze[v]>sze[son[x]])son[x]=v;
		sze[x]+=sze[v];
	}
}
void re_dfs(int x,int f,int tp){
	top[x]=tp;
	if(son[x])re_dfs(son[x],x,tp);
	for(int i=head[x];i;i=E[i].nxt){
		int v=E[i].to;
		if(v==f||v==son[x])continue;
		re_dfs(v,x,v);
	}
}
void dfs_init(int x,int f){
	for(int i=head[x];i;i=E[i].nxt){
		int v=E[i].to;
		if(v==f)continue;
		tree.update(1,n-1,E[i].clo,E[i].len,tree.rt[v],tree.rt[x]);
		dfs_init(v,x);
	}
}
inline int LCA(int a,int b){
	while(top[a]!=top[b]){
		if(dep[top[a]]>dep[top[b]])a=fa[top[a]][0];
		else b=fa[top[b]][0];
	}
	return dep[a]<dep[b]?a:b;
}
int main(){
	Rd(n);Rd(q);
	for(int i=1,a,b,c,d;i<n;i++){
		Rd(a);Rd(b);Rd(c);Rd(d);
		add_edge(a,b,c,d);
		add_edge(b,a,c,d);
	}
	dfs(1,0,1);
	re_dfs(1,0,1);
	dfs_init(1,0);
	for(int i=1,x,y,u,v;i<=q;i++){
		Rd(x);Rd(y);Rd(u);Rd(v);
		int ans=0,lca=LCA(u,v);now=y;
		ans=dis[u]-dis[lca]+dis[v]-dis[lca];
		ans+=tree.query(1,n-1,x,tree.rt[u],tree.rt[lca]);
//		if(i==1)DEBUG=1;
		ans+=tree.query(1,n-1,x,tree.rt[v],tree.rt[lca]);
//		if(i==1)DEBUG=0;
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 53248
def third_root(q):
    x=q/2.0
    while abs(x**3-q)>=q*10**(-5):
        x=x-(x**3-q)/(3*x**2)
    return x
while 1:
    q=int(raw_input())
    if q==-1:break
    ans=third_root(q)
    print(ans)

Measured memory_bytes: 6616
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, x[102] = {}, y[102] = {}, h[102] = {};
    cin >> n;
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> h[i];
    for (int i = 0; i < n; i++) if (h[i]) {
        swap(x[0], x[i]); swap(y[0], y[i]); swap(h[0], h[i]);
    }
    for (int i = 0; i <= 100; i++) for (int j = 0; j <= 100; j++) {
        int z = h[0] + abs(x[0] - i) + abs(y[0] - j);
        bool w = 0;
        for (int k = 1; k < n; k++) {
            if (h[k]) {if (h[k] + abs(x[k] - i) + abs(y[k] - j) != z) w = 1;}
            else if (abs(x[k] - i) + abs(y[k] - j) < z) w = 1;
        }
        if (!w) {
            cout << i << ' ' << j << ' ' << z;
            return 0;
        }
    }
    return 1;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        const int MaxQ = 100000 + 10;

        static void Main(string[] args)
        {
            int[] count = new int[MaxQ];
            bool[] isPrime = Enumerable.Repeat(true, MaxQ).ToArray();
            isPrime[0] = isPrime[1] = false;

            for (int i = 2; i * i < isPrime.Length; i++)
            {
                if (isPrime[i])
                {
                    int value = i + i;
                    while (value < isPrime.Length)
                    {
                        isPrime[value] = false;
                        value += i;
                    }
                }
            }

            for (int i = 1; i < count.Length; i++)
            {
                count[i] = count[i - 1];
                if (i % 2 == 1 && isPrime[i] && isPrime[(i + 1) / 2])
                {
                    count[i]++;
                }
            }

            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int l = array[0], r = array[1];
                int ans = count[r] - count[l - 1];
                Console.WriteLine(ans);
            }
        }
    }
}

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

int main () {
    int n;
    cin >> n;
    long long s = 0;
    for (int i = 1; i <= n; i++) {
        s += i % 3 && i % 5 ? i : 0;
    }
    cout << s << "\n";
}



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

int cnt[200200];

int main(){
	int n;
	scanf("%d", &n);
	rep(i, n-1){
		int p;
		scanf("%d", &p);
		p--;
		cnt[p]++;
	}
	rep(i, n) printf("%d\n", cnt[i]);
	return 0;
} 

Measured memory_bytes: 4496
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
typedef long long ll;
typedef unsigned long long int llt;
const int N = 2e5 + 10;

ll co[N] = {0};

vector<int> g[N];

void dfs(int curr, int par, int cc)
{
    co[curr] = cc;
    //cout<<curr<<" "<<par<<" "<<cc<<endl;
    for(auto x: g[curr])
    {
        if(x != par)
        {
            dfs(x, curr, co[x] + cc);
        }
    }
}

int main()
{
    int n, q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++)
    {
        int u, v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for(int i=0;i<q;i++)
    {
        int u;
        ll c;
        cin>>u>>c;
        co[u] += c;
    }
    dfs(1 , -1, co[1]);
    for(int i=1;i<=n;i++)
        cout<<co[i]<<" ";
    cout<<endl;
    return 0;
}


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

int main(){

  int a,b,c;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  if(c>(a-b)){
    printf("%d", c-(a-b));
  }else{
    printf("0");
  }
    




}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair

using namespace std;
const int N=1e5+5;
int a[N];

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    int dem=0,tot=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        tot+=a[i];
    }
    for(int i=1;i<=n;i++) if(a[i]*4*m>=tot) dem++;
    if(dem>=m) cout<<"Yes";
    else cout<<"No";
}


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

// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        n: usize, m: usize,
        towns: [(usize, usize); m],
    }
    let mut towns: Vec<(usize, usize, usize)> = towns.into_iter().enumerate().map(|(i, t)| (i, t.0, t.1)).collect();
    towns.sort_by_key(|t| (t.1, t.2));
    let mut out = vec![String::new(); m];
    let mut now_pre = towns[0].1;
    let mut order = 0;
    for &mut (i, p, y) in &mut towns {
        if p != now_pre { order = 1; now_pre = p; }
        else { order += 1 }
        out[i] = format!("{:06}{:06}", p, order);
    }

    for l in out {
        println!("{}", l);
    }
}

Measured memory_bytes: 15868
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var S = ReadLine();
            var K = Sarray()[0];
            long cnt = S.Length;
            for (var i = 0; i < S.Length; ++i)
            {
                if (S[i] != '1' || K - 1 == i)
                {
                    WriteLine(S[i]);
                    return;
                }
            }

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13652
#include <iostream>

int main(int argc, char const *argv[]) {
  int W=0,H=0,x=0,y=0,r=0;
  std::cin >> W >> H >> x >> y >> r;

  if(x-r < 0 || x+r > W || y-r < 0 || y+r > H){
    std::cout << "No" << std::endl;
  }else std::cout << "Yes" << std::endl;
  return 0;
}

Measured memory_bytes: 3096
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N 100005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
#define endl "\n"
#define mid  (l + r + 1)/2
#define s3   1.73205080757
const int inf = (int)1e18 + 10;

int dp[110][10];
signed main(){
  fast;
  int h , w , k;
  cin >> h >> w >> k;
  memset(dp , 0 , sizeof(dp));
  dp[0][0] = 1;
  for(int i = 0 ; i < h ; i++){
  	  for(int j = 0 ; j < w ; j++){
  	  	 for(int k = 0 ; k<(1 << (w-1)) ; k++){
  	  	 	int f = 1;
  	  	 	  for(int t = 0 ; t< w-1 ; t++){
  	  	 	  	   if(((k>>t) & 1) && ((k>>(t+1))&1)){
  	  	 	  	   	    f = 0;
  	  	 	  	   	    break;
  	  	 	  	   }
  	  	 	  }

  	  	 	  if(f){
  	  	 	  	   if(j>=1 && (k >>(j-1) & 1))
  	  	 	  	   	   dp[i+1][j-1] += dp[i][j] , dp[i+1][j-1] %= mod;
  	  	 	  	   else if(j< w-1 && (k>>j & 1))
  	  	 	  	   	    dp[i+1][j+1] += dp[i][j] , dp[i+1][j+1] %= mod;
  	  	 	  	   else
  	  	 	  	   	dp[i+1][j] += dp[i][j] , dp[i+1][j] %= mod;

  	  	 	  }
  	  	 }
  	  }
  }

  cout << dp[h][k-1] << endl;


}	


Measured memory_bytes: 256
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/7/ALDS1_7_C

import sys
sys.setrecursionlimit(2**20)  # 再帰回数上限の向上 かなり多くしないとREになる


class Node:
    def __init__(self,
                 parent,
                 left,
                 right):
        self.parent = parent
        self.left = left  # 左の子ノード
        self.right = right  # 右の**子**


def pre_parse(T: dict, u: int, pre_ls: list):
    # 深さ優先探索特有の即時終了条件
    if u == None:
        return
    pre_ls.append(u)
    pre_parse(T, T[u].left, pre_ls)  # より左の方から深さ優先探索
    pre_parse(T, T[u].right, pre_ls)


def in_parse(T, u, in_ls):
    if u == None:
        return
    # 左→中→右っていうちょっと気持ち悪い順番
    in_parse(T, T[u].left, in_ls)
    in_ls.append(u)
    in_parse(T, T[u].right, in_ls)


def post_parse(T, u, post_ls):
    if u == None:
        return
    post_parse(T, T[u].left, post_ls)
    post_parse(T, T[u].right, post_ls)
    post_ls.append(u)


# データの読み込み
n = int(input())
T = {key: Node(None, None, None) for key in range(n)}
for _ in range(n):
    tmp = [x if x != -1 else None for x in map(int, input().split())]
    T[tmp[0]].left = tmp[1]
    T[tmp[0]].right = tmp[2]
    if tmp[1] is not None:
        T[tmp[1]].parent = tmp[0]
    if tmp[2] is not None:
        T[tmp[2]].parent = tmp[0]

# parentがないのが特徴のROOTを探す
for id, node in T.items():
    if node.parent is None:
        ROOT = id

# リストに答えを格納していく
pre_ls, in_ls, post_ls = [], [], []
pre_parse(T, ROOT, pre_ls)
in_parse(T, ROOT, in_ls)
post_parse(T, ROOT, post_ls)

print('Preorder')
print('', *pre_ls)
print('Inorder')
print('', *in_ls)
print('Postorder')
print('', *post_ls)



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

int main()
{
   int n;cin >> n;
   vector<int> a(n);
   map<int,int>  mp;
   rep(i,n)
   {
      cin >> a[i];
   }
   sort(ALL(a));
   int ans=0;

   int l=1;
   rep(i,n-1)
   {
      if(a[i]==a[i+1])
      l++;
      else
      {
       
         ans+=l%2;
         l=1;
      }
   }
   ans+=l%2;
   cout<<ans<<endl;

   return 0;
}

Measured memory_bytes: 640
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


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

    s_t_c = []
    for i in range(N):
        s, t, c = list(map(int, input().split()))
        s_t_c.append((s, t, c))

    ans = [0] * (2 * 10 ** 5 + 2)
    for i in range(1, C + 1):
        dp = [0] * (2 * 10 ** 5 + 2)

        for s, t, c in s_t_c:
            if c == i:
                dp[s * 2 - 1] += 1
                dp[t * 2] -= 1
        for j in range(1, len(dp)):
            dp[j] += dp[j - 1]

        for j in range(len(dp)):
            ans[j] += dp[j] > 0

    print(max(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 24648
n, m = map(int, input().split())
kk = []
ss = []
for i in range(m):
    ks = list(map(int, input().split()))
    k = ks[0]
    s = ks[1:]
    kk.append(k)
    ss.append(s)
p = list(map(int, input().split()))
ans = 0

for i in range(2 ** (n)):
    check = [0 for i in range(m)]
    for j in range(n):
        if i >> j & 1:
            for l in range(m):
                if (j + 1) in ss[l]:
                    check[l] = (check[l] + 1) % 2
    if check == p:
        ans += 1
print(ans)


Measured memory_bytes: 73664
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) x.begin(),x.end()
#define len(x) (int)(x).size()
//#define endl "\n"
#define m_p make_pair
#define int long long


using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pari;

ld PI = 3.14159265358979323846;


struct Circle{
    int x,y,r;
};

typedef tree<int, null_type, less<int >,
    rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void volodya22(){
    #ifdef THERE
        freopen("input.txt", "r", stdin);
    //    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
    cout << fixed;
}


int n,k;
const int N = 1e6+7;
const int alphabet = 256;
const int INF = 1e18;
const ll MOD = 1e9+7;
const ld eps = 1e-19;
const int L = 30;

int m1 = 137*137*137*137*13;
int m2 = 1e9+9;
//int p = 347;


void input(){
    cin >> n >> k;
}


void solve(){
    ld sum = 0;
    for(int i = 1;i <= n;i++){
        ld x = (ld)1/n;
        int c = i;
        while(c < k){
            c *= 2;
            x /= 2;
        }
        sum += x;
    }
    cout << sum;
}

signed main(){
    volodya22();
    input();
    solve();
}


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

#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)


using namespace std;
using ll = long long;

void solve() {
    ll k;
    cin >> k;
    if (k < 10) {
        cout << k << endl;
        return;
    }
    k -= 9;
    deque<ll> deq;
    for (int i = 1; i < 10; ++i) {
        deq.push_back(i);
    }
    while (k > 0) {
        ll now = deq.front();
        deq.pop_front();
        ll next = now * 10 + now % 10;
        if (next % 10 != 0) {
            deq.push_back(next-1);
            k--;
        }
        deq.push_back(next);
        k--;
        if (next % 10 != 9) {
            deq.push_back(next+1);
            k--;
        }
    }
    for (; k ; ++k) {
        deq.pop_back();
    }
    cout << deq.back() << endl;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 768
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    a, b = input_nums()
    if abs(a-b) > 1: print(max(2*a-1, 2*b-1))
    else: print(a+b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int i,j=0,k=0;
    string s;
    cin>>s;
    for(i=0;i<3;i++)
    {
        if(s[i]=='B')
            j++;
        else
            k++;
    }
    if(j>2||k>2)
      cout<<"No";
    else
        cout<<"Yes";

}


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

int main(){
 int N,count=0;
  cin >> N;
 vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
    if((i+1)%2==1 && a.at(i)%2==1) count++;
  }
  cout << count << endl;
}

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

int main()
{

  int a, b, c, x;
  int ans = 0;
  cin >> a >> b >> c >> x;
  rep(i, a + 1){
    rep(j, b + 1){
      rep(k, c + 1){
        if(i * 500 + j * 100 + k * 50 == x) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define sz 300005
#define faster_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;

int main()
{
    faster_io;
    int n,cnt=0;
    cin>>n;
    int a[n+5];
    for(int i=0;i<n;i++) cin>>a[i];

    sort(a,a+n);
//    for(int i=0;i<n;i++) cout<<a[i]<<" ";

    int ans = a[(n/2)]-a[n/2-1];
    cout<<ans<<endl;

    return 0;
}






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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
#define m_p make_pair

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll r;
  cin >> r;
  cout << 3*r*r << endl;
  return 0;
}

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

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int x;
    cin >> x;
    for(int i=x;i<1000000;i++){
        if(IsPrime(i)){
            cout << i;
            return 0;
        }
    }


}

Measured memory_bytes: 256