akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;

public class HelloWorld
{
    static public void Main ()
    {
        var AB = Console.ReadLine().Split().Select(a => long.Parse(a)).ToArray();
        var A = AB[0];
        var B = AB[1];

        Console.WriteLine(A*B/(Gcd(A,B)));
     }
     
     public static long Gcd(long a, long b) { if (a < b) // 引数を入替えて自分を呼び出す
      return Gcd(b, a); while (b != 0) { var remainder = a % b; a = b; b = remainder; } return a; }
            
}


Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

bool dp[85][85][30000] = {false};

int main(){
    int h, w; cin >> h >> w;
    vector<vector<int>> a(h+1, vector<int>(w+1)), b(h+1, vector<int>(w+1));
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> a[i][j];
        }
    }

    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> b[i][j];
        }
    }

    int mid = 15000;
    dp[1][0][mid] = true;
    dp[0][1][mid] = true;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            int sa = abs(a[i][j] - b[i][j]);
            for (int k = 0; k <= 30000; k++) {
                if (dp[i][j-1][k]) {
                    dp[i][j][k+sa] = true;
                    dp[i][j][k-sa] = true;
                }
                if (dp[i-1][j][k]) {
                    dp[i][j][k+sa] = true;
                    dp[i][j][k-sa] = true;
                }
            }
        }
    }

    int ans = 30000;
    for (int i = 0; i <= 30000; i++) {
        if (dp[h][w][i]) {
            if (dp[h][w][i]) {
                ans = min(ans, abs(i-mid));
            }
        }
    }

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

Measured memory_bytes: 200960
from collections import defaultdict
N,K=map(int,input().split())
V=list(map(int,input().split()))
left=[defaultdict(int) for i in range(N+1)]
left[0][0]=0
for i in range(1,1+N):
    for j in range(i,2*i+1):
        if j==i:
            left[i][j]=left[i-1][j-1]+V[i-1]
        elif j==2*i:
            left[i][j]=left[i-1][j-2]
        else:
            left[i][j]=max(left[i-1][j-2],left[i-1][j-1]+V[i-1])
right=[defaultdict(int) for i in range(N+1)]
right[0][0]=0
for i in range(1,1+N):
    for j in range(i,2*i+1):
        if j==i:
            right[i][j]=right[i-1][j-1]+V[N-i]
        elif j==2*i:
            right[i][j]=right[i-1][j-2]
        else:
            right[i][j]=max(right[i-1][j-2],right[i-1][j-1]+V[N-i])
L=[[0]*(K+1) for i in range(N+1)]
R=[[0]*(K+1) for i in range(N+1)]

for i in range(N+1):
    L[i][0]=left[i][0]
    R[i][0]=right[i][0]
    for k in range(1,K+1):
        L[i][k]=max(L[i][k-1],left[i][k])
        R[i][k]=max(R[i][k-1],right[i][k])
ans=0
for l in range(N+1):
    for r in range(N-l+1):
        for k in range(K+1):
            ans=max(ans,L[l][k]+R[r][K-k])
print(ans)

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

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i,s.size()) {
    // ans += s[i]!=t[i];
    if (s[i] != t[i]) ++ans;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3816
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int s = sc.nextInt();
        int count = 0;
        for (int x = 0; x <= k; ++x) {
            for (int y = 0; y <= k; ++y) {
                int z = s - x - y;
                if (0 <= z && z <= k) {
                    count++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    }
}


Measured memory_bytes: 22356
#include<stdio.h>
#include<algorithm>

#include<iostream>

using namespace std;


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

  while (scanf ("%d%d%d%d",&a,&b,&c,&d)!=EOF)
  {
     int sum1 =a+c;
     int sum2 = a+d;
     int sum3 =b+c;
     int sum4 = b+d;

     int ans;
     ans =min (sum1,sum2) ;
     ans = min (ans , sum3) ;
     ans =min (ans , sum4) ;
     printf ("%d\n",ans );

  }
 return 0;

}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{

  int A,B,C,D,E,c,d,e;
  c = 0;
  d = 0;
  e = 0;

  scanf("%d%d%d%d%d",&A,&B,&C,&D,&E);

  if(A < 0){
    if(B > 0)
      c = (0 - A) * C;

    if(B < 0)
      c = (B - A) * C;
  }

  if(A < 0 && B > 0){
    d = D;
  }

  if(B > 0){
    if(A < 0)
      e = B * E;

    if(A > 0)
      e = (B - A) * E;
  }
  printf("%d\n",c+d+e);
  return 0;
}





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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(ll i = 0; i<n; i++)
#define rep_s(i, start, n) for(ll i= start;  i<n; i++)
#define rep_down(i, n) for(ll i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(ll i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()
#define print(ans) cout << ans << endl;
#define MOD 1000000007
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll keta_num(ll num){
  ll total = 0;
  while(num){
    num /= 10;
    total++;
  }
}


ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll fibonacchi(ll num){
  ll f0 = 0, f1 = 1, f2;
  ll count = 0;
  while(count<num){
    f2 = f0+f1;
    f0 = f1;
    f1 = f2;
    count++;
  }
  return f2;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, G, K,L, W, H, P, Q, R, V, X, Y;
  string S, T;
  cin >> N;
  ll total = 0;
  while(total<N){
  	total += 1000;
  }
  cout << total - N << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
using namespace std;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef long long ll;
#define range(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) range(i,0,n)
#define INF 10000000000 //10^10
#define PI 3.141592
#define pb push_back

int main(){
    //内部処理は0indexで行う

    //入力
    int n;
    cin >> n;
    vector<vint> adj(n);
    rep(i,n){
        int u,k;
        cin >> u >> k;
        rep(j,k){
            int v;
            cin >> v;
            adj[u-1].pb(v-1);
        }
    }

    //計算
    vint d(n,-1);
    d[0]=0;
    queue<int> Q;
    Q.push(0);
    while(!Q.empty()){
        int cur=Q.front(); Q.pop();
        rep(i,adj[cur].size()){
            int dst=adj[cur][i];
            if(d[dst]==-1){
                d[dst]=d[cur]+1;
                Q.push(dst);
            }
        }
    }

    //出力
    rep(i,n){
        cout << i+1 << ' ' << d[i] << endl;
    }
}



Measured memory_bytes: 3152
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

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

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<int> a(n); rep(i, n)cin >> a[i];
	vector<int> p(1001001);
	for (int i = 2; i <= 1000000; ++i)
	{
		if (p[i])continue;
		for (int j = i; j <= 1000000; j += i)
		{
			if (p[j])continue;
			p[j] = i;
		}
	}
	vector<bool> used(1001001);
	bool pairwise = true;
	rep(i, n)
	{
		int now = a[i];
		while (now > 1)
		{
			int d = p[now];
			if (used[d])pairwise = false;
			used[d] = true;
			while (p[now] == d)
			{
				now /= d;
			}
		}
	}
	if (pairwise)
	{
		cout << "pairwise coprime" << endl;
		return 0;
	}
	int g = 0;
	rep(i, n)g = gcd(a[i], g);
	if (g == 1)cout << "setwise coprime" << endl;
	else cout << "not coprime" << endl;
}

Measured memory_bytes: 11176
#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 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;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

bool DEBUG = 0;
const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int l,r,d; cin>>l>>r>>d;
	int cnt=0;
	for(int i=l;i<=r;i++){
		if(i%d==0) cnt++;
	}
	cout<<cnt<<'\n';
	
	return 0;
}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<char>> p(h + 2, vector<char>(w + 2, '.'));
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> p[i][j];
        }
    }
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (p[i][j] == '#' && p[i - 1][j] == '.' && p[i + 1][j] == '.' && p[i][j - 1] == '.' && p[i][j + 1] == '.') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}


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

using namespace std;

int main(){
  int n;
  int temp_max=0;
  int num_ocean_view=0;
  
  cin >> n;
  
  vector<int> v(n);
  for (int i=0; i < n; i++){
    cin >> v[i];
  }
  
  
  for (int i=0; i < n; i++){
  	if (temp_max <= v[i]){
      num_ocean_view += 1;
      temp_max = v[i];
    }
  }

  cout << num_ocean_view << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL KK;
string K;
LL AA[100001];
string A[100001];
LL B[100001];
LL dfs(vector<int>v,int digit){
   //cout<<"size"<<v.size()<<" "<<digit<<endl;
   if(digit==31){
      LL a=0;
      REP(i,v.size()){
          //if(A[v[i]]="000000000000000000000000000000"){
          a+=B[v[i]];
          //}
      }
      return a;
   }
   vector<int>vv;
   //vector<LL>vv2;
   REP(i,v.size()){
       if(A[v[i]][digit]=='0'){
          vv.push_back(v[i]);
       }
   }
   if(K[digit]=='0'){
      return dfs(vv,digit+1);
   }
   LL ans=0;
   REP(i,vv.size()){
       ans+=B[vv[i]];
   }
   return max(ans,dfs(v,digit+1));
}

int main(){
    cin>>N;
    cin>>KK;
    K="";
    while(KK!=0){
       int aa=(KK%2);
       KK/=2;
       if(aa==0){
          K="0"+K;
       }else{
          K="1"+K;
       }
    }
    while(K.size()!=30){
        K="0"+K;
    }
    vector<int>v;
    REP(i,N){
        cin>>AA[i]>>B[i];
        while(AA[i]!=0){
           int aa=AA[i]%2;
           AA[i]/=2;
           if(aa==0){
              A[i]="0"+A[i];
           }else{
              A[i]="1"+A[i];
           }
           //A[i]=""+aa+A[i];
        }
        while(A[i].size()!=30){
           A[i]="0"+A[i];
        }
        v.push_back(i);
    }
   /* REP(i,N){
        cout<<A[i]<<endl;
    }*/
    cout<<dfs(v,0)<<endl;
    return(0);
}

Measured memory_bytes: 31480
n = gets.chomp.to_i

# 証言をhashでもたせる
hash = {}
1.upto(n) do |i|
  hash[i] = []
  a = gets.chomp.to_i
  a.times do
    x,y = gets.chomp.split(" ")
    hash[i] << [x.to_i, y]
  end
end

max = 0
0.upto(2**n-1).each do |i|
  # 正直者であれば1, 不親切な人であれば0が入る
  # 添字を揃えるために先頭はxにしている
  check_arr = ("x" + "%0#{n}d" % i.to_s(2)).split("")

  flag = false
  hash.each do |h_num, arr|
    # 不親切な人の言うことは無視
    next if check_arr[h_num] == "0"
    arr.each do |(x, y)|
      # 異なる値であれば矛盾
      if check_arr[x] != y
        flag = true
        break
      end
    end
    break if flag
  end

  next if flag

  tmp = check_arr.count("1")
  max = tmp if tmp > max
end

puts max


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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;

int main (){
    
    char A[4];
    int a[4];
    REP(i,4){
        cin >> A[i];
        a[i] = A[i] - '0';
    }
        string str;
    for(int bit = 0; bit < (1<<3); bit++){
		str = "";
        int sum = a[0];
        str.push_back(A[0]);
        for(int i = 0; i < 3; i++){
            if(bit & (1<<i)){  //+-における+の撮り方の部分集合を考えている。 3やらなんやらはその数
                sum += a[i+1];
                str += "+";
                str.push_back(A[i+1]);
            }else{
                sum -= a[i+1];
                str += "-";
                str.push_back(A[i+1]);
            }
        }
        if(sum == 7) break;
    }
    str += "=7";
    cout << str << endl;
    

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	A--;
	B--;
	C--;
	D--;

	string s;
	cin >> s;

	bool AtoC = true;
	int cnt = 0;
	for (int ii = A + 1; ii <= C; ++ii){
		if (s[ii] == '#'){
			cnt++;
		} else {
			cnt = 0;
		}
		if (cnt == 2){
			AtoC = false;
			break;
		}
	}

	bool BtoD = true;
	cnt = 0;
	for (int ii = B + 1; ii <= D; ++ii){
		if (s[ii] == '#'){
			cnt++;
		} else {
			cnt = 0;
		}
		if (cnt == 2){
			BtoD = false;
			break;
		}
	}

	bool BtoD2 = false;
	for (int ii = B; ii <= D; ++ii){
		if ( (s[ii-1] == '.') && (s[ii] == '.') && (s[ii+1] == '.') ){
			BtoD2 = true;
			break;
		}
	}

	bool OK = AtoC && BtoD;
	if (D < C){
		OK = OK && BtoD2;
	}

	if (OK){
		cout << "Yes" << "\n";
	} else {
		cout << "No" << "\n";
	}


	return 0;
}


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

int main(){
  char a ;
  cin >> a;
  a++ ;
  cout <<a<<endl;
}

Measured memory_bytes: 256
// D - Crossing

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	// まず集合の数を決定
	int K=1;
	while (K*(K-1) / 2 < N) {
		K++;
	}

	if (K*(K-1) / 2 != N) {
		cout << "No" << endl;
		return 0;
	}

	// 部分集合の情報を作成
	vector<vector<int>> subsets(K);

	int s=1;
	for (int i=0; i<K; i++) {
		for (int j=i+1; j<K; j++) {
			subsets[i].push_back(s);
			subsets[j].push_back(s);
			s++;
		}
	}

	// 答えを出力
	cout << "Yes" << endl;
	cout << K << endl;
	for (auto subset : subsets) {
		cout << subset.size();
		for (int s : subset) {
			cout << " " << s;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int A,B,Q;
    cin>>A>>B>>Q;
    long long s[A+2],t[B+2],x;
    s[0]=t[0]=-20000000001;s[A+1]=t[B+1]=20000000001;
    for(int i=1;i<=A;i++)cin>>s[i];
    for(int i=1;i<=B;i++)cin>>t[i];
    for(int i=1;i<=Q;i++){
        cin>>x;
        int s2=lower_bound(s,s+A+2,x)-s,t2=lower_bound(t,t+B+2,x)-t;
        cout<<min({ x-min(s[s2-1],t[t2-1]),s[s2]-t[t2-1]+min(s[s2]-x,x-t[t2-1]),t[t2]-s[s2-1]+min(t[t2]-x,x-s[s2-1]),max(s[s2],t[t2])-x})<<endl;
    }
    return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,n,i;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a;
        if(a%2==0)
        {
            if(a%3==0 || a%5==0);
            else
                break;
        }
    }
    if(i==n)
        cout<<"APPROVED";
    else
        cout<<"DENIED";
    return 0;
}


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

data = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    data.append((s,-p,i))

sorted_data = sorted(data, key=lambda x:(x[0], x[1]), reverse=False)

for i in range(n):
    print(sorted_data[i][2] + 1)

Measured memory_bytes: 9176
#include <bits/stdc++.h> // Replace needed headers for speed up

// -------------8<------- start of library -------8<------------------------
template<typename T>
struct RangeMinimumQuery {
    const T INF;
    int n;
    std::vector<T> val;

    RangeMinimumQuery(int size, T inf = std::numeric_limits<T>::max()) : INF(inf) {
        for (n = 1; n < size; ) n <<= 1;
        val.assign(2 * n + 1, INF);
    }
    void update(int idx, T v) {
        idx += n - 1;
        val[idx] = v;
        while (idx > 0) {
            idx = (idx - 1) >> 1;
            val[idx] = std::min(val[idx * 2 + 1], val[idx * 2 + 2]);
        }
    }
    T find(int l, int r) {
        T res = INF;
        l += n - 1; r += n - 1;
        while (l < r) {
            if (!(l & 1)) res = std::min(res, val[l]);
            if (!(r & 1)) res = std::min(res, val[r - 1]);
            l >>= 1;
            r = (r - 1) >> 1;
        }
        return res;
    }
};

// -------------8<------- end of library ---------8-------------------------
int main() {
    int n, q;
    std::cin >> n >> q;

    RangeMinimumQuery<int> rmq(n);
    for (int i = 0, com, x, y; i < q; ++i) {
        std::cin >> com >> x >> y;
        if (com == 0) rmq.update(x, y);
        else std::cout << rmq.find(x, y + 1) << '\n';
    }

    return 0;
}



Measured memory_bytes: 3880
# -*- coding: utf-8 -*-

from fractions import gcd
from math import ceil,floor
import collections

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# list = list(map(int, input().split()))


A,B,C=map(int, input().split())

ans = "No"


if A==B and A!=C:
    ans = "Yes"
if A==C and A!=B:
    ans = "Yes"
if B==C and A!=B:
    ans = "Yes"

print(ans)


Measured memory_bytes: 66028
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int M=100009;
const int N = 2e6 + 100;
int mod = 998244353;
namespace Combi {
    int fact[N], inv[N];

    int bm(int b, int p, int m) {
        if(p == 0) return 1%m;
        int t = bm(b,p/2,m);
        t = (1ll*t*t)%m;
        if(p&1) return 1ll*t*b%m;
        return t;
    }

    int C(int n, int r) {
        if(n < 0 or r < 0 or r > n) return 0;
        int ret = 1ll*fact[n]*inv[r]%mod;
        ret = 1ll*ret*inv[n-r]%mod;
        return ret;
    }
    // X1 + X2 + ... + Xvar = Sum
    int no_of_eqns(int sum, int var) {
        return C(sum+var-1,var-1); // Xi >= 0
        // return C(sum-1,var-1); // Xi > 0
    }
    void init() {
        fact[0] = 1;
        for(int i = 1; i < N; i++) {
            fact[i] = 1ll*fact[i-1]*i%mod;
        }
        inv[N-1] = bm(fact[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--) {
            inv[i] = 1ll*inv[i+1]*(i+1)%mod;
        }
    }
}
inline int gun(int x,int y)
{
    int ret=(x*y)%mod;
    if(ret<0)ret+=mod,ret=ret%mod;
    return ret;
}
inline int sub(int x,int y)
{
    int ret=(x-y+mod)%mod;
    if(ret<0)ret+=mod,ret=ret%mod;
    return ret;
}
int yo(int sum,int n,int mx)
{
    int ret=0;
    for(int od=0;od<=mx && od<=n && od<=sum;od++)
    {
        if((od&1)!=(sum&1))continue;
        int x=gun(Combi::C(n,od),Combi::no_of_eqns((sum-od)/2,n));
        ret=(ret+x)%mod;
    }
    return ret;
}
 main()

{
    fast
    Combi::init();
    int n,m;
    cin>>n>>m;
    int ses=yo(3*m,n,m);
    int bad=yo(m,n,m);
    bad=sub(bad,Combi::no_of_eqns(m,n-1));
    bad=gun(bad,n);
    ses=sub(ses,bad);
    cout<<ses<<endl;
    return 0;

}













Measured memory_bytes: 31488
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        char a = in.nextToken().charAt(0);
        char b = in.nextToken().charAt(0);
        System.out.println(a == b ? "H" : "D");
    }
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Integer>{
    @Override public Integer get(Object key){return containsKey(key)?super.get(key):0;}
    public void add(T key,int v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 21460
def main():
    N  = int(input())
    V  = list(map(int, input().split())) 
    V.sort()
    ans = (V[0] + V[1]) /2
    for i in range(N-2):
        ans = (ans + V[i+2]) /2
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int n,a[25],num; 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=2;i<n;i++) 
	    if((a[i]>=a[i-1]&&a[i]<=a[i+1])||(a[i]>=a[i+1]&&a[i]<=a[i-1])) num++;
	cout<<num;
	return 0;
}

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

std::vector<std::vector<long long>>  ncr;

std::vector<std::vector<long long>> comb(int n, int r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}


ll solver(string&N,ll K){
    if (N.size() == 1){
        if (K ==1) return atoi(N.substr(0,1).c_str());
        else return 0;
    }else if (K == 0){
        return 1;
    }
    else{
        int n = atoi(N.substr(0,1).c_str());
        int keta = N.size();
        if (n == 0){
            string new_str = N.substr(1);
            return solver(new_str,K);
        }else{
            ll kjou = 1;
            for (int i=0;i<K;i++){
                kjou *= 9;
            }
            string new_str = N.substr(1);
            return (n-1) * ncr[keta-1][K-1] * kjou/9  + solver(new_str,K-1) + ncr[keta-1][K] *kjou ;
        }
    }
     
}

void solve(string N, long long K){
    ll ans = solver(N,K);
    printf("%lld\n",ans);

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    string N;
    cin >> N;
    long long K;
    ncr = comb(N.size(),K);

    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 384
// ABC158-E 
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

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

    int h,n;
    cin>>h>>n;
    vector<int> a(n+1);
    vector<int> b(n+1);

    int max_=0;
    rep(i,n){
        cin>>a[i+1]>>b[i+1];
        if(a[i+1]>max_) max_=a[i+1];
    }
    vector<vector<int>> dp(n+1,vector<int>(h+max_,pow(10,9)));

    for(int i=1;i<=n;i++){
        for(int j=1;j<=h+max_-1;j++){
            if(a[i]<=j){
                if(dp[i][j-a[i]]==pow(10,9)){
                    if(j==a[i]) dp[i][j]=min(b[i],dp[i-1][j]);
                    else dp[i][j]=min(dp[i][j],dp[i-1][j]);
                }else{
                    dp[i][j]=min(dp[i-1][j],dp[i][j-a[i]]+b[i]);
                }
            }else dp[i][j]=min(dp[i-1][j],dp[i][j]);
            //cout<<dp[i][j]<<endl;
        }
    }
    int ans=pow(10,9);
    for(int i=1;i<=n;i++){
        for(int j=h;j<h+max_;j++){
            if(dp[i][j]<ans) ans=dp[i][j];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 44160
import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21584
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a==b&&b==c?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

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

ll K,N,T;
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
	cin>>N>>K;
    ll ans = 0;
	ll a[N];
	for(ll i = 0 ; i<N ; i++){
		cin>>a[i];
		if(a[i] >= K)
			ans++;
	}

	cout<<ans<<'\n';


}



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

	return 0;
}	

Measured memory_bytes: 4316
import java.util.Scanner;
import java.util.Vector;

public class Main {
	static double dp[][][];
	static int n;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int t[] = new int[3];
		for (int i=0;i<n;i++) 
			t[sc.nextInt()-1]+=1;	
		
		dp = new double[n+1][n+1][n+1];
		
		
		double ans = f(t[2],t[1],t[0]);
		System.out.println(ans);
		

	}
	private static double f(int t3, int t2, int t1) {
		if (t3 ==0 && t2 ==0&& t1 ==0) return 0;
		if (dp[t3][t2][t1] > 0) return dp[t3][t2][t1];
		double r = 0;
		if (t3>0) r += t3*f(t3-1,t2+1,t1);
		if (t2>0) r += t2*f(t3,t2-1,t1+1);
		if (t1>0) r += t1*f(t3,t2,t1-1);
		r +=n;
		r /=(t1+t2+t3);
		dp[t3][t2][t1] = r;
		return r;
	}
}


Measured memory_bytes: 308308
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

alias Cake = Tuple!(long, "x", long, "y", long, "z");

void main() {
    int n, m;
    scan(n, m);

    auto cs = new Cake[](n);

    foreach (i ; 0 .. n) {
        long xi, yi, zi;
        scan(xi, yi, zi);
        cs[i] = Cake(xi, yi, zi);
    }

    long ans;

    foreach (i ; 0 .. 2) {
        foreach (j ; 0 .. 2) {
            foreach (k ; 0 .. 2) {
                cs.sort!((a, b) => (-1)^^i * a.x + (-1)^^j * a.y + (-1)^^k * a.z
                                    > (-1)^^i * b.x + (-1)^^j * b.y + (-1)^^k * b.z);

                long xs, ys, zs;

                foreach (ii ; 0 .. m) {
                    xs += cs[ii].x;
                    ys += cs[ii].y;
                    zs += cs[ii].z;
                }

                ans = max(ans, abs(xs) + abs(ys) + abs(zs));
            }
        }
    }

    writeln(ans);
}







































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 380
N = int(input())
s = [0]*N
l = [0]*N
for i in range(N):
    a, b = map(int, input().split())
    s[i] = (a, b)
 
for i in range(N):
    c, d = map(int, input().split())
    l[i] = (c, d)




V = N*2 # 頂点数
MAX_V = V

G = [0]*MAX_V # グラフの隣接リスト表現
for i in range(MAX_V):
    G[i] = []
match = [-1]*MAX_V # マッチングのペア
used = [False]*MAX_V # DFSで既に調べたかのフラグ

# uとvを結ぶ辺をグラフに追加する
def addEdge(u, v):
    G[u].append(v)
    G[v].append(u)


##
for a in range(N):
    (rx, ry) = s[a]
    for b in range(N):
        (bx, by) = l[b]
        if rx < bx and ry < by:
            addEdge(a, b+N)


# 増加パスをDFSで探す
def dfs(v):
    used[v] = True
    for i in range(len(G[v])):
        u = G[v][i]
        w = match[u]
        if w < 0 or not used[w] and dfs(w):
            match[v] = u
            match[u] = v
            return True
    return False

# 二部グラフの最大マッチングを求める
def bipartiteMatching():
    res = 0
    for v in range(V):
        if match[v] < 0:
            for i in range(len(used)):
                used[i] = False
            if dfs(v):
                res += 1
    return res

print(bipartiteMatching())



Measured memory_bytes: 42716
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String s = sc.next();
		int Rcnt = 0;
		int Bcnt = 0;
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'R') {
				Rcnt++;
			} else {
				Bcnt++;
			}
		}
		if(Rcnt > Bcnt) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
import numpy as np

def main(n, xs):
    minx = min(xs)
    maxx = max(xs)
    ress = []

    for x in range(minx, maxx+1):
        res = sum((xs - x) ** 2)
        ress.append(res)

    res = min(ress)
    return res

if __name__ == "__main__":
    cin = input()
    n = int(cin.split(" ")[0])
    cin = input()
    xs = np.array([], dtype="int")

    for i in range(n):
        xs = np.append(xs, int(cin.split(" ")[i]))
    cout = main(n, xs)
    print(cout)

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

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

void Main(){
	string s; cin >> s;
	int t = 0;
	for(char a: s){
		t += (a - '0');
		t %= 9;
	}
	cout << (t ? "No\n": "Yes\n");
}


Measured memory_bytes: 3740
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] p = new int[N];
        for (int i = 0; i < N; ++i) {
            p[i] = sc.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N - 1; ++i) {
            if (p[i] == i + 1) {
                int t = p[i];
                p[i] = p[i + 1];
                p[i + 1] = t;
                ++cnt;
            }
        }
        if (p[N - 1] == N) {
            int t = p[N - 2];
            p[N - 2] = p[N - 1];
            p[N - 1] = t;
            ++cnt;
        }
        _out.println(cnt);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 50656
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
from itertools import product
S = input().rstrip()

ans = 0
ops = list(product("+ ", repeat=len(S)-1))

for op in ops:
    s = S[0] + "".join(x+y for (x,y) in zip(op,S[1::])).replace(" ","")
    ans += eval(s)

print(ans)



Measured memory_bytes: 3060
n = int(input())
x = list(map(int,input().split()))

y = sorted(x)

m = (y[len(y)//2]+y[len(y)//2-1])/2



for i in range(len(x)):
    if x[i] > m:
        print(y[len(y)//2-1])
    else:
        print(y[len(y)//2])



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

int32_t main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while (a > 0 && c > 0) {
		c -= b;
		if (c <= 0) break;
		a -= d;
	}

	if (a <= 0) {
		cout << "No";
	}
	else cout << "Yes";

}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
vector<vector<ll>> adj;
vector<ll> q,val;
void dfs(ll node,ll pere,ll cumul){
  cumul += q[node];
  val[node] = cumul;
  for(ll i : adj[node]){
    if(i == pere) continue;
    dfs(i,node,cumul);
  }
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,Q,a,b,p,x;
  cin >> n >> Q;
  adj = vector<vector<ll>>(n+1);
  for(ll i = 1; i < n; ++i){
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  q = vector<ll>(n+1);
  val = vector<ll>(n+1);
  while(Q--){
    cin >> p >> x;
    q[p] += x;
  }
  dfs(1,-1,0);
  for(ll i = 1; i <= n; ++i) cout << val[i] << ' ';
  return 0;
}

Measured memory_bytes: 25856
def main():
    n, s = int(input()), input()
    r, g, b = s.count('R'), s.count('G'), s.count('B')
    ans = r * g * b
    s = tuple(s)
    v = {'R', 'G', 'B'}
    for i in range(n - 2):
        for j in range(n // 2 + 1):
            if i + j + j < n:
                if v == {s[i], s[i + j], s[i + j + j]}:
                    ans -= 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9156
import math
a, b, C = list(map(float, input().split()))
sinC = math.sin(math.radians(C))
S = a * b * sinC /2 
h = (S * 2) / a
c2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(C))
c = math.sqrt(c2)
L = a + b + c
print(S)
print(L)
print(h)


Measured memory_bytes: 5688
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define pq priority_queue
using namespace std;
ll ini[100005];
map<ll, ll> hsh;
set<ll> help;
ll fin[100005];
ll bit1[100005];
ll bit2[100005];
ll freq[100005];
void update (ll *a, ll i, ll v) {
	if (i > 100000) return;
	a[i] += v;
	update(a, i + (i & (-i)), v);
}
ll query (ll *a, ll i) {
	return ((i == 0) ? 0 : a[i] + query(a, i - (i & (-i))));
}
int main () {
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	scanf("%lld", &a);
	for (i = 1; i <= a; i++) {
		scanf("%lld", &ini[i]);
		help.insert(ini[i]);
	}
	e = 0;
	for (auto r : help) {
		hsh[r] = ++e;
	}
	b = 0;
	vector<ll> app;
	app.pb(0);
	for (i = 1; i <= a; i++) {
		fin[i] = hsh[ini[i]];
		if (fin[i] > b) {
			b = fin[i];
			app.pb(i);
		}
	}
	ini[0] = fin[0] = 0;
	SET(bit1, 0); SET(bit2, 0); m = 0; SET(freq, 0);
	for (i = app.size() - 1, j = a; i >= 1; i--) {
		c = app[i]; d = app[i - 1];
		for (; j >= c; j--) {
			update(bit1, fin[j], ini[j]);
			update(bit2, fin[j], 1);
		}
		f = query(bit1, e) - query(bit1, fin[d]);
		g = query(bit2, e) - query(bit2, fin[d]);
		h = f - g * ini[d] - m;
		freq[c] = h; m += h;
	}
	for (i = 1; i <= a; i++) {
		printf("%lld\n", freq[i]);
	}
	return 0;
}

Measured memory_bytes: 16756
#include <bits/stdc++.h>
#define N 600010
#define int long long 
using namespace std;

int n,A[N],mx[N],mi[N],sum=0;
priority_queue <int> Q;  
signed main()
{
	scanf("%lld",&n); for(int i=1;i<=3*n;i++) scanf("%lld",&A[i]);
	for(int i=1;i<=n;i++) Q.push(-A[i]),sum+=A[i],mx[i]=sum;
	//		for(int i=n;i<=3*n;i++) printf("%lld ",mx[i]); printf("\n");
	for(int i=n+1;i<=3*n;i++) 
	{
		Q.push(-A[i]); sum+=A[i]; sum+=Q.top(); Q.pop(); mx[i]=sum;
	} sum=0;
	for(int i=3*n;i>2*n;i--) Q.push(A[i]),sum+=A[i],mi[i]=sum;
	for(int i=2*n;i>0;i--) 
	{
		Q.push(A[i]); sum+=A[i]; sum-=(Q.top()); Q.pop(); mi[i]=sum;
	}
	//for(int i=n;i<=3*n;i++) printf("%lld ",mx[i]); printf("\n");
	//for(int i=1;i<=2*n;i++) printf("%lld ",mi[i]); printf("\n");


	int ans=-1000000000000000ll;
	for(int i=n;i<=2*n;i++)
		ans=max(ans,mx[i]-mi[i+1]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14320
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;
bool sortBYsec(pii &a,pii &b){
    return a.s>b.s;
}
void solve(){
    int n;
    cin>>n;
    loop(mxN,i,n){
        int t=i;
        int x=(t%10);
        bool flag=0;
        while(t){
            if(t%10!=x)
                flag=true;
            t/=10;
        }
        if(!flag){
            cout<<i<<endl;
            return;
        }
    }
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3616