akhauriyash/Code-Regression huggingface dataset:
/*
Author : N_o_o_B
Created : December 04 2019 01:13:45 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    string s;
    cin >> s;
    vi cnt(26);
    trav(c,s){
        cnt[c-'a']++;
    }
    bool ok=1;
    fori(i,26){
        ok &= (cnt[i]%2==0);
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 256
// AOJ 0352: Forecast of Forces
// 2017.10.26 bal4u@uu
// 2017.11.14

#include <stdio.h>

#define ABS(a) ((a)>=0?(a):-(a))
#define MAX(a,b) ((a)>=(b)?(a):(b))

int w, h;
long long map[1002][1002];
long long dp[1002][1002];

long long score(int r, int c)
{
	long long x = map[r+1][w] - (map[r+1][c] << 1);
	if ((r+c) & 1) return -x;
	return x;
}

char buf[6500], *p;
int getint()
{
	int n = 0;
	if (*p == '-') {
		p++; while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
		return -n;
	}
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int r, c;

	fgets(p=buf, 20, stdin), w = getint(), p++, h = getint();
	for (r = 1; r <= h; r++) {
		fgets(p=buf, 6500, stdin);
		for (c = 1; c <= w; c++) {
			map[r][c] = map[r][c-1] + getint(); p++;
		}
	}
	for (r = h; r >= 0; r--) for (c = w; c >= 0; c--) {
		if (r == h); // dp[r][c] = 0;
		else if (c == w) dp[r][c] = score(r, c) - dp[r+1][c];
		else             dp[r][c] = MAX(-dp[r][c+1], score(r, c) - dp[r+1][c]);
	}
	printf("%lld\n", ABS(dp[0][0]));
	return 0;
}

Measured memory_bytes: 17444
function main() {
  var
  i = 0, j,
  wh, startXY, goalXY, n,
  board;
  for (;;) {
    wh = input[i++].split(' ').map(Number);
    if (!wh[0] && !wh[1]) break;
    
    board = initBoard(wh[0], wh[1]);
    
    startXY = input[i++].split(' ').map(Number);
    goalXY  = input[i++].split(' ').map(Number);
    n = Number(input[i++]);
    for (j = 0; j < n; j++) {
      putBlock.bind(null, board).apply(null, input[i++].split(' ').map(Number));
    }
    
    console.log(canGoToGoal(board, startXY, goalXY) ? 'OK' : 'NG');
  }
}

function initBoard(w, h) {
  var
  i, j,
  board = [];
  for (i = 0; i < w; i++) {
    board.push([]);
    for (j = 0; j < h; j++) {
      board[i][j] = 0;
    }
  }
  return board;
}

function putBlock(board, c, d, x, y) {
  var
  i, j,
  b = [[4,2], [2,4]][d];
  for (i = 0; i < b[0]; i++) {
    for (j = 0; j < b[1]; j++) {
      board[x - 1 + i][y - 1 + j] = c;
    }
  }
}

function canGoToGoal(board, startXY, goalXY) {
  var
  to = [[-1,-1], [ 0,-1], [ 1, -1],
        [-1, 0],          [ 1,  0],
        [-1, 1], [ 0, 1], [ 1,  1]],
  sx = startXY[0] - 1, sy = startXY[1] - 1,
  gx = goalXY[0] - 1, gy = goalXY[1] - 1,
  m = {}, c = board[sx][sy];
  
  if (c === 0) return false;
  
  return (function search(x, y) {
    var
    i;
    if ([x, y] in m) return m[[x, y]];
    if (x < 0 || board.length <= x || board[x][y] !== c) return m[[x, y]] = false;
    if (x === gx && y === gy) return m[[x, y]] = true;
    
    m[[x, y]] = false;
    
    for (i = 0; i < 8; i++) {
      if (!([x + to[i][0], y + to[i][1]] in m)) {
        if (search(x + to[i][0], y + to[i][1])) return m[[x, y]] = true;
      }
    }
    
    return m[[x, y]] = false;
  })(sx, sy);
}

/*
function canGoToGoal(board, startXY, goalXY) {
  var
  queue = [],
  to = [[-1,-1], [ 0,-1], [ 1, -1],
        [-1, 0],          [ 1,  0],
        [-1, 1], [ 0, 1], [ 1,  1]],
  sx = startXY[0] - 1, sy = startXY[1] - 1,
  gx = goalXY[0] - 1, gy = goalXY[1] - 1,
  xym, x, y,
  m = {},
  c = board[sx][sy];
  
  if (c === 0) return false;
  
  queue.push([sx, sy, {}]);
  
  for (;queue.length >= 1;) {
    xy = queue.shift();
    x = xy[0]; y = xy[1];
    m[[x, y]] = true;
    
    if (x < 0 || board.length <= x || c !== board[x][y]) continue;
    if (x === gx && y === gy) return true;
    
    for (i = 0; i < 8; i++) {
      if (!m[[x + to[i][0], y + to[i][1]]]) {
        queue.push([x + to[i][0], y + to[i][1]]);
      }
    }
  }
  
  return false;
}
*/

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

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

int main(){
    int n;
    scanf("%d", &n);
    std::vector<int> a(n);
    for(int i=0; i<n; i++) scanf("%d", &a[i]);
    std::vector<int> srtd(a);
    sort(srtd.begin(), srtd.end());

    bool can = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            std::vector<int> b(a);
            std::swap(b[i], b[j]);
            for(int k=0; k<n; k++){
                if(srtd[k]!=b[k]) break;
                else if (k==n-1) can = 1;
            }
        }
    }
    
    if(can) puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 256
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/21 8:23:51
File Name     :TEST.cpp
************************************************ */

#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define bug puts("--------------")
const int N = 1e5 + 10;
const ll mod = 1e9 + 7 ;
using namespace std;
int a[N];
int main(){
    int n;
    cin >> n;
    for(int i = 1;i <= n;++i) cin >> a[i];
    ll M = INF;
    for(int i = 1;i <= 100;++i){
        ll ans = 0;
        for(int j = 1;j <= n;++j){
            ans += (i - a[j])*(i - a[j]);
        }

        M = min(M,ans);
    }
    cout << M;
}

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

int main () {
  vector<string> day={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  string s;
  cin >> s;

  for (int i=0;i<7;++i) {
    if(s==day[i]) cout << 7-i << endl;
  }
  return 0;
}


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

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

void solve(long long A, long long B) {
  LL x, r;

  x = A * B;
  r = A % B;

  while (r != 0) {
    A = B;
    B = r;
    r = A % B;
  }

  cout << x / B << endl;
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
n, q = map(int,input().split())
s = input()
A = [list(map(int,input().split())) for i in range(q)]

ANS = [0, 0]
for i in range(2,n+1) :
    if s[i-2:i] == 'AC' :
        ANS.append(ANS[-1]+1)
    else :
        ANS.append(ANS[-1])

for i in range(q) :
    print(ANS[A[i][1]] - ANS[A[i][0]])


Measured memory_bytes: 30692
#include <bits/stdc++.h>
using namespace std;
const int maxn=100010;
int n,m,p[maxn];
vector<int> g[maxn];
int id[maxn],cnt,ans;
void dfs(int v) {
	if (id[v]) return;
	id[v]=cnt;
	for (int i=0;i<g[v].size();i++)
		dfs(g[v][i]);
}
int main() {
//	freopen("1.txt","r",stdin);
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d",&p[i]);
	for (int i=1;i<=m;i++) {
		int x,y; scanf("%d %d",&x,&y);
		g[x].push_back(y);
		g[y].push_back(x);
	}
	for (int i=1;i<=n;i++)
		if (!id[i]) cnt++,dfs(i);
	for (int i=1;i<=n;i++)
		if (id[i]==id[p[i]]) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 8576
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();
        int M=sc.nextInt();
        int[] a=new int[A];
        int[] b=new int[B];
        
        int amin=1000000007;
        int bmin=1000000007;
        for(int i=0;i<A;i++){
            a[i]=sc.nextInt();
            if(a[i]<amin) amin=a[i];
        }
        
        for(int i=0;i<B;i++){
            b[i]=sc.nextInt();
            if(b[i]<bmin) bmin=b[i];
        }
        
        int ans=amin+bmin;
        
        for(int i=0;i<M;i++){
            int x=sc.nextInt();
            int y=sc.nextInt();
            int z=sc.nextInt();
            int s=a[x-1]+b[y-1]-z;
            if(s<ans){
                ans=s;
            }
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 132644
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
#define TIME ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

    const ll N = 1e5 + 7;
    const ll mod = 1e9 + 7;
    const ll inf = 1e9;

int n , m;
int x , y;
int a[N] , g[N];
void solve(){
    cin >> n >> m;
    for(int i = 1; i <= n; ++ i)
        cin >> a[i];
    for(int i = 1; i <= m; ++ i){
        cin >> x >> y;
        g[x] = max(g[x] , a[y]);
        g[y] = max(g[y] , a[x]);
    }
    int ans = 0;
    for(int i = 1; i <= n; ++ i){
        if(g[i] < a[i]){
            ans ++;
            //cout << i << " ";
        }
    }
    cout << ans;
}

int main(){
    TIME
    int tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**



**/


Measured memory_bytes: 4428
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
    int a[35]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin>>n;
    cout<<a[n];
}


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

int main()
{
    ll n, k, a[300000];
    cin >> n >> k;
    rep(i, n) cin >> a[i];

    for (int i = k; i < n; i++)
    {
        if (a[i] > a[i - k])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 5204
/* Author: shivangi0802 */

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define pb push_back
#define ll long long int
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)

using namespace std;

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b);
 ll gcd(ll a, ll b) ;
 int prime(int n);

/*string dp(int x,int y,string a,string b,string c,vector <string> &ans){
if(x==a.size()||y==b.size())
    {
    ans.pb(c);
    }
else{
    if(a[x]==b[y])
    {
        c.pb(a[x]);
       if(d[x][y]!="") return c+dp(x+1,y+1,a,b,c,ans);
    }
    else
    {
        dp(x,y+1,a,b,c,ans);
         dp(x+1,y,a,b,c,ans);
    }
}
}*/

int main(){
       ios_base::sync_with_stdio(false);
       cin.tie(NULL);
     string a,b,c="";
    cin>>a>>b;
    int n=a.size(),m=b.size();
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++){//int flag=1;
        for(int j=1;j<=m;j++){

            if(a[i-1]==b[j-1]){dp[i][j]=dp[i-1][j-1]+1;}
            else{dp[i][j]=max(dp[i-1][j],dp[i][j-1]);}
           // cout<<dp[i][j]<<" ";
        }//cout<<endl;
    }int i=n,j=m;
    while(dp[i][j]!=0&&i>0&&j>0){
        if(dp[i][j]!=dp[i-1][j]&&dp[i][j]!=dp[i][j-1]){
            c.pb(a[i-1]);
            i--;j--;
        }
        else if(dp[i][j]==dp[i-1][j]){i--;}
        else {j--;}
    }
    reverse(c.begin(),c.end());
    cout<<c;
}




bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int prime(int n){
    int flag=1;
for(int i=2;i<=sqrt(n);i++){
    if(n%i==0){flag=0;break;}
}
  return flag;
}


Measured memory_bytes: 70656
package main

import(
    "fmt"
)



func main() {
    var k,s int
    fmt.Scan(&k,&s)
    ans := 0
    for i:=0; i<=k; i++{
        for j:=0; j<=k; j++{
            var l=s-i-j
            if l >= 0 && l <= k{
                ans++
            }
        }
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


Measured memory_bytes: 512
#include <cstdio>
#define max_n 200000
using namespace std;
int a[max_n+1];
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0; ++i<=n; scanf("%d",a+i));
	for(int i=k; ++i<=n; puts(a[i]>a[i-k]?"Yes":"No"));
	return 0;
}

Measured memory_bytes: 2428
#include<iostream>
using namespace std;
int prime[1200000];
int main(){
	for(int i=2;i<1200000;i++)prime[i]=1;
	for(int i=2;i*i<1200000;i++){
		for(int j=i*i;j<1200000;j+=i){
			prime[j]=0;
		}
	}
	for(int i=2;i<1200000;i++)prime[i]+=prime[i-1];
	int n;
	while(cin>>n){
		cout<<prime[n]<<endl;
	}
}

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

#define fi first
#define se second

const int N = 550;
const long long mod = 1e9 + 7;

using namespace std;

int res[N][N];

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        int n;
        cin >> n;
        int L = 0;
        while((1 << L) < n){
                L += 1;
        }
        for(int i = 0; i < L; i++){
                vector < int > A, B;
                for(int j = 0; j < n; j++){
                        if(j & (1 << i)){
                                A.push_back(j);
                        } else{
                                B.push_back(j);
                        }
                }
                for(int x: A){
                        for(int y: B){
                                if(!res[x][y]){
                                        res[x][y] = res[y][x] = i + 1;
                                }
                        }
                }
        }
        for(int i = 0; i < n; i++){
                for(int j = i + 1; j < n; j++){
                        cout << res[i][j] << " \n"[j == n - 1];
                }
        }
}


Measured memory_bytes: 1536
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int cnt[MAXN];

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    int mx = 0;
    int mn = MOD;
    for (int i = 1; i <= n; i++) {
    	int x;
    	cnt[x = readInt()]++;
    	mx = max(mx, x);
    	mn = min(mn, x);
    }
    if (mx - mn > 1) {
    	cout << "No";
    	return 0;
    }
    if (mx == mn) {
    	if (mn == n - 1) {
    		cout << "Yes";
    		return 0;
    	}

		if (mn * 2 <= n) {
			cout << "Yes";
		} else {
			cout << "No";
		}
    	return 0;
    }
    if (cnt[mn] > mn) {
    	cout << "No";
    	return 0;
    }
   		if ((mn - cnt[mn] + 1) * 2 <= cnt[mx]) {
   			cout << "Yes";
	   	} else {
   			cout << "No";
	   	}
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main() {
	char s1[4];
	int goukei =700,i;
	scanf("%s", s1);
	for (i = 0; i < 3; i++) {
		if (s1[i] == 'o') goukei =goukei+ 100;
	}
	printf("%d\n", goukei);
	return 0;
}

Measured memory_bytes: 128
//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define INF (lint )(1e9)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
#define ll long long int
using namespace std;



ll n,weight;
ll w[100002];
ll v[100002];
ll dp[102][100002];

void init()
{
    for(int i=0;i<102;i++)
    {
        for(int j=0;j<100002;j++)
        dp[i][j]=0;
    }
}

ll solve(ll index,ll weight)
{
    if(index == 0)
    return 0;
    if(weight <0)
    return INT_MIN;
    
    if(dp[index][weight]!=0)
    return dp[index][weight];
    
    if(w[index-1]>weight)
    dp[index][weight] = solve(index-1,weight);
    else
    dp[index][weight] = max(solve(index-1,weight),solve(index-1,weight-w[index-1]) + v[index-1]);
    
    return dp[index][weight];
    
}
int main()
{
    
    init();
    cin>>n>>weight;
    
    int i,j;
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    
    ll ans = solve(n,weight);
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 80128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;string s;cin>>n>>k>>s;
    if (s[k-1]=='A')
    {
        /* code */
        s[k-1]='a';
    }
    else if(s[k-1]=='B')
    {
         s[k-1]='b';
    }
    else if (s[k-1]=='C')
    {
        /* code */
        s[k-1]='c';
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
m=int(input())
dc=[list(map(int,input().split())) for i in range(m)]
tmp=0
ans=0
for i in range(m):
    tmp+=dc[i][0]*dc[i][1]
    ans+=dc[i][1]
# print(tmp)
ans-=1
ans+=(tmp-1)//9
print(ans)

Measured memory_bytes: 73180
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {
  string str;
  cin >> str;

  int q;
  cin >> q;

  string ord, p;
  int a = 0, b = 0;
  for (int i = 0; i < q; i++) {
    cin >> ord >> a >> b;

    if (ord == "print") {
      for (int j = a; j <= b; j++) {
	cout << str[j];
      }

      cout << endl;
    }

    if (ord == "reverse") {
      string tmp = str.substr(a, b-a+1);
      int n = tmp.size();
      for ( int j = 0; j < n; j++) {
	str[j+a] = tmp[n-j-1];
      }
    }

    if (ord == "replace") {
      cin >> p;
      str.replace(a,b-a+1,p);
    }
    
  }

  return 0;
}



Measured memory_bytes: 3192
#include<stdio.h>
int main(void){
	int a,b;
	char op;
	for(int i=0;;i++){
   scanf("%d %c %d", &a, &op, &b);
   if ( op == '+' )printf("%d\n",a+b);
   else if ( op == '-' )printf("%d\n",a-b);
   else if ( op == '*' )printf("%d\n",a*b);
   else if ( op == '/' )printf("%d\n",a/b);
   else if(op=='?') return 0;
	}

}

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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    int cnt = 0;
    int now = -1;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        if (i > 0) {
            if (now >= tmp)
                cnt++;
            else {
                ans = max(ans, cnt);
                cnt = 0;
            }
        }
        now = tmp;
    }
    cout << max(ans, cnt) << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<time.h>
#include<string>
#include<cmath>
#include<stack>
#include<map>
#include<set>
#define int long long
//#define double long double
using namespace std;
#define PI  3.1415926535898
#define eqs 1e-10
const long long max_ = 3e5 + 7;
int mod = 998244353;
const int inf = 1e9;
const long long INF = 1e18;
int read() {
	int s = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0'&&ch <= '9') {
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * f;
}
inline int min(int a, int b) {
	return a < b ? a : b;
}
inline int max(int a, int b) {
	return a > b ? a : b;
}
signed main() {
	int n = read(), m = read();
	if (n == 1||m == 1) {
		cout << "1"; return 0;
	}
	int num = (int)ceil(n*1.0 / 2);
	int ans = 0;
	ans += num * (int)ceil(m*1.0 / 2);
	num = n - num;
	ans += num * (m / 2);
	cout << ans;
	return 0;
}

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

using namespace std;

int main() {
  string A, B;
  cin >> A >> B;
  if (A == B) {
    cout << "EQUAL" << endl;
    return 0;
  }
  
  if (A.size() > B.size()) {
    cout << "GREATER" << endl;
  } else if (A.size() < B.size()) {
    cout << "LESS" << endl;
  } else {
    if (A > B) {
      cout << "GREATER" << endl;
    } else if (A < B) {
      cout << "LESS" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll ans=INF;
  ll n;cin>>n;
  ll a;
  rep(i,n){
    cin>>a;
    ll temp=0;
    while(a%2==0){
      a/=2;
      temp++;
    }
    ans=min(ans,temp);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
l1 = [li for i, li in enumerate(l) if i % 2 == 0]
l2 = [li for i, li in enumerate(l) if i % 2 == 1]
def cnt(l):
    d = {}
    for li in l:
        if li in d:
            d[li] += 1
        else:
            d[li] = 1
    d = [(li, cnt) for li, cnt in d.items()]
    return sorted(d, key=lambda di: di[1], reverse=True)

k1 = cnt(l1)[:2]
k2 = cnt(l2)[:2]
ans = 10000000
if k1[0][0] != k2[0][0]:
    ans = n - k1[0][1] - k2[0][1]
if len(k1) == 2:
    ans = min(ans, n - k1[1][1] - k2[0][1])
if len(k2) == 2:
    ans = min(ans, n - k1[0][1] - k2[1][1])
if ans == 10000000:
    ans = n - max(k1[0][1], k2[0][1])
print(ans)




Measured memory_bytes: 17116
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 1; i <= n; i++){
            if(i % 3 == 0){
                System.out.print(" " + i);
            }else{
                int temp = i;
                while(temp > 0){
                    if(temp % 10 == 3){
                        System.out.print(" " + i);
                        break;
                    }else{
                        temp /= 10;
                    }
                }
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 28744
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N,K;
    cin >> N >> K;
    vector<int> p(N);
    for (int i = 0; i < N; i++)
    {
        cin >> p.at(i);
    }
    sort(p.begin(),p.end());
    int po = 0;
    for (int i = 0; i < K; i++)
    {
        po += p.at(i);
    }
    cout << po;
}

Measured memory_bytes: 3628
def main():
    H, W = map(int, input().split())
    S = [list(input()) for i in range(H)]

    dy = [1,0,-1,0]
    dx = [0,1,0,-1]
    for h in range(H):
        for w in range(W):
            if S[h][w] == '#':
                flag = False
                for i in range(4):
                    ny = h + dy[i]
                    nx = w + dx[i]

                    if 0 <= ny < H and 0 <= nx < W:
                        if S[ny][nx] == '#':
                            flag = True
                if flag == False:
                    print('No')
                    exit()

    print('Yes')
    

main()

Measured memory_bytes: 39920
N = 3
#f = [input().split() for _ in range(3)]
f = input().split()
f += input().split()
f += input().split()
dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]

Q = [[f, f.index("0"), 0]]
#T = {f: True}
T = set(f)

while len(Q) > 0:
    board = Q.pop(0)
    if board[0] == ["1", "2", "3", "4", "5", "6", "7", "8", "0"]:
        break
    # int//int = int
    # location of zero
    x, y = board[1]//N, board[1]%N
    for dx, dy in dd:
        tx, ty = x+dx, y+dy
        # 0とswap後boardの範囲外に出たら除外
        if tx<0 or ty<0 or tx>=N or ty>=N:
            continue
        new = board[:]
        # n1 is location of zero on string
        # n2 is location of zero after moving on string
        n1, n2 = board[1], tx*N+ty
        new[1] = n2
        # swap
        if n1 > n2:
            n1, n2 = n2, n1
        # swaped string
        new[0] = new[0][0:n1] + list(new[0][n2]) + new[0][n1+1:n2] + list(new[0][n1]) + new[0][n2+1:]
        hashstr = "".join(new[0])
        if hashstr not in T:
        #if new[0] not in T.keys():
        #if not T.get(new[0], False):
            #T[new[0]] = True
            T.add(hashstr)
            new[2] += 1
            Q.append(new)

print(board[2])



Measured memory_bytes: 32420
#include <bits/stdc++.h>
using namespace std;
#define array_input int n;cin>>n;int a[n+1],i;for(i=1;i<=n;i++){cin>>a[i];}
#define array_output for(i=1;i<=n;i++){cout<<a[i]<<" ";}cout<<endl;
#define INF 2147483647
#define long_INF 18446744073709551615
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
const double pi=acos(-1);
const double eps=1e-6;

void read(int &x)
{
    x=0;
	char c=getchar();
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9')
	{
        x=x*10+c-'0';
        c=getchar();
    }
}

void write(int x)
{
    if(x==0)
	{
		putchar(48);
		return;
	}
    int len=0,dg[20];
    while(x>0)
	{
		dg[++len]=x%10;
		x/=10;
	}
    for(int i=len;i>=1;i--)
	{
		putchar(dg[i]+48);
	}
}

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int ans;
	ans=0;
	if (a<b)
	{
		ans+=a;
	}
	else
	{
		ans+=b;
	}
	if (c<d)
	{
		ans+=c;
	}
	else
	{
		ans+=d;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 768
n = int(input())
a = list(map(int,input().split()))
l = list(set(a))
n = len(l)
if n == 3:
    if l[0] ^ l[1] ^ l[2] == 0:
        x = a.count(l[0])
        y = a.count(l[1])
        z = a.count(l[2])
        if x == y == z:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif n == 2:
    z = -1
    if l[0] == 0:
        x = 1
        z = 0
    if l[1] == 0:
        x = 0
        z = 1
    if z != -1:
        x = a.count(l[x])
        z = a.count(l[z])
        if x == z + z:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif n == 1:
    if l[0] == 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 20532
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstdlib>
#define _A_ true
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define MAX 10
#define INF 1<<30
using namespace std;
typedef pair<int,int> P;
int h,w,c;
int p[MAX][MAX];
int Ans;

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

void Display(){
  rep(i,h){
    rep(j,w){
      printf("%d ",p[i][j]);
    }
    printf("\n");
  }
  printf("\n");
}


void ColorCount(){
  queue<P> CQ;
  CQ.push(P(0,0));
  bool used[h][w];
  rep(i,h)rep(j,w)used[i][j] = false;
  used[0][0] = true;
  int count = 1;
  //Display();

  while(CQ.size()){
    P pi = CQ.front(); CQ.pop();

    rep(i,4){
      int nx = pi.first + dx[i], ny = pi.second + dy[i];
      if(0<= nx && nx < w && 0<= ny && ny < h && !used[ny][nx] && p[ny][nx] == c){
      count++;	
      CQ.push(P(nx,ny));
      used[ny][nx] = true;    
      }
      
    }
    
  }
  //cout << "Color = " << count << endl;
  Ans = max(Ans,count);

}



void FiveRec(){
  //cout << "In" << endl;
  queue<P> que;
  bool used[h][w];
  rep(i,h)rep(j,w)used[i][j] = false;
  //bool pre
  que.push(P(0,0));
  used[0][0] = true;
  int ThisColor = p[0][0];
  p[0][0] = c;

  while(que.size()){
    P pi = que.front(); que.pop();
    //cout << "pi.first = " << pi.first << ", pi.second = " << pi.second << endl;
    rep(i,4){
      int nx = pi.first + dx[i],ny = pi.second + dy[i];   
      if(0<= nx && nx < w && 0<= ny && ny < h && !used[ny][nx] &&  p[ny][nx] == ThisColor){       
	//cout << "In " << endl; 
	que.push(P(nx,ny));
	//cout << "w = " << w << ", h = " << h << endl;
	p[ny][nx] = c;
	used[ny][nx] = true;
      }
    }
  }
  //cout << "Five Fin " << endl;
}


void rec(int color,int count){
  //cout << "count = " << count << endl;
  if(count == 5){
    //printf("Five Count --------------\n");
    FiveRec();
    //Display();
    ColorCount();
    //printf("Fin Five Count ---------- %d\n",Ans);
    return;
  }

  //cout << "normal disp --------" << endl;
  //Display();
  //cout << "FF----------------FF" << endl;
  queue<P> que;
  bool used[h][w];
  rep(i,h)rep(j,w)used[i][j] = false;
 
  int ThisColor = p[0][0];
  int pb[h][w];
  rep(i,h)rep(j,w)pb[i][j] = p[i][j];
  que.push(P(0,0));
  used[0][0] = true;
  p[0][0] = color;


  while(que.size()){
    P pi = que.front(); que.pop();

    rep(i,4){
      int nx = pi.first + dx[i],ny = pi.second + dy[i];   
      if(0<= nx && nx < w && 0<= ny && ny < h && !used[ny][nx] &&  p[ny][nx] == ThisColor){ 
	que.push(P(nx,ny));
	p[ny][nx] = color;
	used[ny][nx] = true;
      }
    }
  }


  //koko ra hennde syuukei siteha douda roka
  REP(i,1,7){
    //if(i != color)
    rec(i,count+1);
  }
  //printf("-----------------------\n");
  rep(i,h)rep(j,w)p[i][j] = pb[i][j];
  
}



int main(){
  while(_A_){
    scanf("%d %d %d",&h,&w,&c);
    if(!(h|w|c))break;
    Ans = -1;
    rep(i,h)rep(j,w)scanf("%d",&p[i][j]);
    REP(i,1,7){
      //if(i != p[0][0])
	rec(i,1);
    }
    printf("%d\n",Ans);
  }
  return 0;
}

Measured memory_bytes: 1196
import java.util.*;

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

        String e = scan.next();
        char a = e.charAt(0);
        char b = e.charAt(1);
        char c = e.charAt(2);
        char d = e.charAt(3);
        if(!(a==b||b==c||c==d)){
            System.out.println("Good");
        }else{
            System.out.println("Bad");
        }
    }
}

Measured memory_bytes: 21844
function Main(input) {
    input = input.split("\n")[0]
    if(input === 'A') console.log('T')
    if(input === 'T') console.log('A')
    if(input === 'C') console.log('G')
    if(input === 'G') console.log('C')
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define vec vector
#define ref(a) &(a)

typedef long long ll;

using namespace std;

vec<string> y;
string s;

int solve() {
  rep(i, 7) {
    if (y[i] == s) {
      return 7 - i;
    }
  }

  return 0;
}

int main() {
  // SUN,MON,TUE,WED,THU,FRI,SAT
  y.pb("SUN");
  y.pb("MON");
  y.pb("TUE");
  y.pb("WED");
  y.pb("THU");
  y.pb("FRI");
  y.pb("SAT");
  cin >> s;
  cout << solve() << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int n, a[100], _min, cnt=0;
    cin>>n;
    for (int i=0; i<n; i++) cin>>a[i];
    for (int i=0; i<n; i++)
    {
        _min=i;
        for (int j=i; j<n; j++)
        {
            if (a[j]<a[_min]) _min=j;
        }
        if (_min!=i)
        {
            swap(a[i], a[_min]);
            cnt++;
        }
    }
    for (int i=0; i<n; i++)
    {
        if (i!=n-1) cout<<a[i]<<' ';
        else cout<<a[i]<<'\n';
    }
    cout<<cnt<<'\n';
    return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int a[222222],n;
int main(){
	scanf("%d",&n); n *= 2;
	for(int i=0; i<n; i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	double res = 0;
	for(int i=n-1; i>=0; i--){
		res += a[i] /(n-1.0) * i;
	}
	printf("%.12lf\n",res);
	return 0;
}


Measured memory_bytes: 1024
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	//input = input.split("\n");
	tmp = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	//var a = parseInt(input[0], 10);
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
	//var s = input[2];
	//出力
	console.log('%d',a*b);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29628
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = getInt(sc);
		String[] words = new String[n];
		for (int i = 0; i < n; i++) {
			words[i] = getString(sc);
		}
		boolean isSuccess = true;
		List<String> used = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (i == 0) {
				used.add(words[i]);
			} else {
				String end = words[i - 1].split("")[words[i - 1].length() - 1];
				String start = words[i].split("")[0];
				if (!end.equals(start)) {
					isSuccess = false;
					break;
				} else if (used.contains(words[i])) {
					isSuccess = false;
					break;
				} else {
					used.add(words[i]);
				}
			}
		}

		if(isSuccess) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


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

namespace ABC145A
{
    class Program
    {
        static void Main(string[] args)
        {
            int r, s;

            var word = Console.ReadLine().Split(' ');
            r = int.Parse(word[0]);
            s = r * r;
            Console.WriteLine(s);

            Console.ReadKey();





        }
    }
}

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

const int PMAX = 10000000;

template <typename T>
class PersistentSegmentTree {
	struct node {
		T val;
		node *l, *r;
		node() {}
		node(T val) : val(val), l(nullptr), r(nullptr) {}
		void init(T v, node *left, node *right) {
			val = v;
			l = left;
			r = right;
		}
	};
	using func_t = function<T(T, T)>;
	const int n;
	const T id;
	func_t merge;
	vector<node> pool;
	int it;
	vector<node*> root;
	int size(int n) {
		int res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	node *new_node(int val = 0, node *l = nullptr, node *r = nullptr) {
		pool[it].init(val, l, r);
		return &pool[it++];
	}
	node *fix(node *x, int p, T val, int lb, int ub) {
		if (p < lb || ub <= p) return x;
		if (lb + 1 == ub) return new_node(val);
		int c = (lb + ub) / 2;
		auto nl = fix(x->l, p, val, lb, c);
		auto nr = fix(x->r, p, val, c, ub);
		return new_node(merge(nl->val, nr->val), nl, nr);
	}
	T sub(node *x, int l, int r, int lb, int ub) {
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) return x->val;
		int c = (lb + ub) / 2;
		return merge(sub(x->l, l, r, lb, c), sub(x->r, l, r, c, ub));
	}
public:
	PersistentSegmentTree(int n_, T id_, func_t merge_) : n(size(n_)), id(id_), merge(merge_), pool(PMAX) {
		for (int i = 1; i < n * 2; i++) {
			pool[i - 1].init(id, i < n ? &(pool[i * 2 - 1]) : nullptr, i < n ? &(pool[i * 2]) : nullptr);
		}
		it = n * 2 - 1;
		root.push_back(&pool[0]);
	}
	void update(int p, T val, int rt = -1) {
		if (rt == -1) rt = root.size() - 1;
		assert(0 <= rt && rt < (int)root.size());
		root.push_back(fix(root[rt], p, val, 0, n));
	}
	T find(int l, int r, int rt = -1) {
		if (rt == -1) rt = root.size() - 1;
		assert(0 <= rt && rt < (int)root.size());
		return sub(root[rt], l, r + 1, 0, n);
	}
	int getversion() {
		return root.size() - 1;
	}
};

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
	int n, q, com, x, y;
	cin >> n >> q;
	PersistentSegmentTree<int> st(n, INT_MAX, [](int l, int r) { return min(l, r); });
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			printf("%d\n", st.find(x, y));
		}
		else {
			st.update(x, y);
		}
	}
	return 0;
}

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

namespace VS_atcoder
{

    class Program
    {
        static void Main(string[] args)
        {

            long N = int.Parse(Console.ReadLine());
            long[] A = Console.ReadLine().Split(' ').Select(_ => long.Parse(_)).OrderByDescending(_ => _).ToArray();

            long difA_B = 0;

            for (int i = 0; i < A.Length; i++)
            {
                if (i % 2 == 0)
                {
                    difA_B += A[i];
                }
                else
                {
                    difA_B -= A[i];
                }
            }

            Console.WriteLine(difA_B);
            return;

        }


    }
}


Measured memory_bytes: 13396
def read_input():
    n, m, x = map(int, input().split())
    costs = [0] * (n + 1)

    alist = map(int, input().split())
    for a in alist:
        costs[a] = 1

    return n, m, x, costs


def submit():
    n, m, x, costs = read_input()


    print(min(sum(costs[:x]), sum(costs[x+1:])))


if __name__ == '__main__':
    submit()


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char S[101], T[101];

int main() {
  scanf("%s", S);
  scanf("%s", T);
  int len = strlen(S);
  for(int i = 0; i < len; i++) {
    int flag = true;
    for(int j = 0; j < len; j++) {
      if(S[(j + i) % len] != T[j]) {
        flag = 0; break;
      }
    }
    if(flag) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	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;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)




int main() {
	ll N, W;
	std::cin >> N >> W;
	ll w, v;
	vector<vll> t(N + 1, vll(1e5+11, 1e12));

	t[0][0] = 0;
	repeq(i, 1, N) {
		t[i][0] = 0;
		std::cin >> w >> v;
		repeq(j, 1, 1e5 + 10) {
			if (v > j) {
				t[i][j] = t[i - 1][j];
			}
			else {
				t[i][j] = min(t[i - 1][j - v] + w, t[i - 1][j]);
			}
		}
	}

	for (size_t i = t[N].size() - 1; i > 1; i--) {
		if (t[N][i] <= W) {
			std::cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 80256
n,k=map(int,input().split())

mod=10**9+7

pow_table={}
def eco_pow(x):
    if x in pow_table:
        return pow_table[x]
    else:
        pow_table[x]=pow(x,n,mod)
        return pow_table[x]
    
ans=0
res_dic={}
for i in range(k):
    now=k-i
    all_now_res=eco_pow(k//now)
    del_now_res=0

    for q in range(2*now,k+1,now):
        #print(now,q)
        del_now_res+=res_dic[q]

    res_dic[now]=(all_now_res-del_now_res)%mod
    #print(res_dic[now])
    ans+=res_dic[now]*now
    ans%=mod

print(ans)

Measured memory_bytes: 20692
using System;

namespace ABC106C
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            long K = long.Parse(Console.ReadLine());

            int oneSeq = 0;
            while(oneSeq < S.Length && S[oneSeq] == '1')
            {
                oneSeq++;
            }

            if (K <= oneSeq)
            {
                Console.WriteLine("1");
            }
            else
            {
                Console.WriteLine(S[oneSeq]);
            }

        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
int main() {
  int N;
  cin >> N;
  vi per(N + 1);
  int Ai;
  for (int i = 1; i < N; ++i) {
    cin >> Ai;
    per[Ai]++;
  }
  for (int i = 1; i <= N; ++i) {
    cout << per[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4028
(let ((o (concatenate 'list (read-line)))
      (e (concatenate 'list (read-line)))
      (lst '()))

  (loop for i in o
        for j in e
        do (progn (push i lst)
                  (push j lst)))

  (setq lst2
        (if (= (length o) (length e))
          (concatenate 'string (reverse lst))
          (concatenate 'string (reverse (push (car (reverse o)) lst)))))

  (format t "~A~%"
          lst2))


Measured memory_bytes: 11876
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b && c != b) cout << "Yes\n";
  else if(c == b && a != b) cout << "Yes\n";
  else if(c == a && a != b) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}



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

#%%
meanX = sum(X)//len(X)

a1 = 0
for x in X:
    a1 += (x -  meanX)**2
a2 = 0
for x in X:
    a2 += (x- meanX + 1) ** 2

a3 = 0
for x in X:
    a3 += (x - meanX - 1) **2

ans = min(a1, a2, a3)
print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int x = 0;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (a.at(i) == 1) x = 1;
  }
  if (x == 0) cout << - 1 << endl;
  else {
    int y = 1, memo = 0;
    while (1) {
      for (int i = memo; i < n; i++) {
        if (a.at(i) == y) {
          y++;
          memo = i + 1;
          if (memo == n) {
            cout << n - y + 1 << endl;
            return 0;
          }
          break;
        }
        if (i == n - 1) {
          cout << n - y + 1 << endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 1024