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

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static int h, w, sx, sy, gx, gy;
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        h = int.Parse(line[0]);
        w = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        sx = int.Parse(line[0]) - 1;
        sy = int.Parse(line[1]) - 1;
        line = Console.ReadLine().Trim().Split(' ');
        gx = int.Parse(line[0]) - 1;
        gy = int.Parse(line[1]) - 1;
        var map = new int[h, w];
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            for (int j = 0; j < w; j++) map[i, j] = s[j] == '.' ? -1 : -2;
        }
        getAns(map);
    }
    static void print(List<P> a)
    {
        foreach (var x in a) Console.WriteLine("x = {0} y = {1}", x.x, x.y);
    }
    static void getAns(int[,] map)
    {
        var dx = new int[] { 0, 1, 0, -1 };
        var dy = new int[] { 1, 0, -1, 0 };
        var q = new Queue<P>();
        var r0 = new List<P>();
        var r1 = new List<P>();
        var p0 = new P { x = sx, y = sy };
        q.Enqueue(p0);
        r0.Add(p0);
        map[sx, sy] = 0;
        while (true)
        {
            while (q.Count() > 0)
            {
                var t = q.Dequeue();
                var c = map[t.x, t.y];
                if (t.x == gx && t.y == gy) { Console.WriteLine(c); return; }
                for (int i = 0; i < 4; i++)
                {
                    var nx = t.x + dx[i];
                    var ny = t.y + dy[i];
                    if (nx >= 0 && nx < h && ny >= 0 && ny < w && map[nx, ny] == -1)
                    {
                        var np = new P { x = nx, y = ny };
                        q.Enqueue(np);
                        r0.Add(np);
                        map[nx, ny] = c;
                    }
                }
            }
            foreach (var x in r0)
            {
                for (int i = x.x - 2; i <= x.x + 2; i++)
                    for (int j = x.y - 2; j <= x.y + 2; j++)
                    {
                        if (i >= 0 && i < h && j >= 0 && j < w && map[i, j] == -1)
                        {
                            q.Enqueue(new P { x = i, y = j });
                            r1.Add(new P { x = i, y = j });
                            map[i, j] = map[x.x, x.y] + 1;
                        }
                    }
            }
            r0.Clear();
            if (r1.Count() == 0) { Console.WriteLine(-1); return; }
            foreach (var x in r1) r0.Add(x);
            r1.Clear();
        }
    }
}


Measured memory_bytes: 43496
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	private static String YES = "YES";
	private static String NO_ = "NO";

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int[] sides = new int[3];

		while ((line = br.readLine()) != null) {
			if (line.contains(" ")) {
				sides[0] = Integer.parseInt(line.split(" ")[0]);
				sides[1] = Integer.parseInt(line.split(" ")[1]);
				sides[2] = Integer.parseInt(line.split(" ")[2]);
				Arrays.sort(sides);
				if (Math.pow(sides[2], 2) == (Math.pow(sides[0], 2) + (Math
						.pow(sides[1], 2)))) {
					System.out.println(YES);
				} else {
					System.out.println(NO_);
				}
			}
		}
	}
}

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

int main() {

  string a;
  cin >> a;

  int count = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a.at(i) == '1') {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3576
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 50; i++) {
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if (m == -1 && f == -1 && r == -1) break;
            else {
                int sum = m + f;
                if (m == -1 || f == -1) System.out.println("F");
                else if (sum >= 80) System.out.println("A");
                else if (sum >= 65) System.out.println("B");
                else if (sum >= 50) System.out.println("C");
                else if (sum >= 30) {
                    if (r >= 50) System.out.println("C");
                    else System.out.println("D");
                }
                else System.out.println("F");
            }
        }

    }
}


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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define ll long long
#define eb emplace_back
#define all(c) (c).begin(), (c).end()
#define vi vector<int>
#define INF 100000000000000

int main() {
	int n, k, x;
	char a[51][51];
	rep(i, 51) {
		rep(j, 51)a[i][j] = 0;
	}
	ll s, ans;
	mcf_graph<int, ll> g(102);
	cin >> n >> k;
	rep(i, n) {
		rep(j, n) {
			cin >> s;
			g.add_edge(i, 50 + j, 1, INF-s);
		}
	}
	rep(i, n) {
		g.add_edge(100, i, k, 0);
		g.add_edge(50 + i, 101, k, 0);
	}
  g.add_edge(100, 101, 10000, INF);
	ans = (g.flow(100, 101,n*k)).second;
    ans=(INF*(n*k))-ans;
	x = 0;
	rep(i, n) {
		rep(j, n) {
			if ((g.get_edge(x)).flow == 1)a[i][j] = 'X';
			else a[i][j] = '.';
			x++;
		}
	}

	cout << ans << endl;
	rep(i, n) {
		cout << a[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3916
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

inline int nextInt(void) {
	register int ret = 0;
	register int neg = false;
	register int bit = getchar();
	
	for (; bit < '0'; bit = getchar())
		if (bit == '-')neg ^= true;
	
	for (; bit >= '0'; bit = getchar())
		ret = ret * 10 + bit - '0';
	
	return neg ? -ret : ret;
}

#define inf 2147483647

int n, m, mini[400005];

int find(int t, int l, int r, int x, int y) {
	if (x <= l && r <= y)
		return mini[t];
	int mid = (l + r) >> 1;
	if (y <= mid)
		return find(t << 1, l, mid, x, y);
	if (x > mid)
		return find(t << 1 | 1, mid + 1, r, x, y);
	else
		return min(
			find(t << 1, l, mid, x, mid),
			find(t << 1 | 1, mid + 1, r, mid + 1, y)
		);
}

void update(int t, int l, int r, int x, int y) {
	if (l == r)mini[t] = y;
	else {
		int mid = (l + r) >> 1;
		if (x <= mid)
			update(t << 1, l, mid, x, y);
		else
			update(t << 1 | 1, mid + 1, r, x, y);
		mini[t] = min(mini[t << 1], mini[t << 1 | 1]);
	}
}

signed main(void) {
	n = nextInt();
	m = nextInt();

	for (int i = 0; i <= (n << 2); ++i)mini[i] = inf;

	for (int i = 1; i <= m; ++i) {
		int c = nextInt();
		int x = nextInt();
		int y = nextInt();
		if (c)	// find(x, y)
			printf("%d\n", find(1, 1, n, x + 1, y + 1));
		else	// update(x, y)
			update(1, 1, n, x + 1, y);
	}

//	system("pause");
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a,b,c,d;
  cin>>a>>b>>c>>d;
  long long ans=a*c;
  ans=max(ans,a*d);
  ans=max(ans,b*c);
  ans=max(ans,b*d);
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<algorithm>
using namespace std;
long long A,B,C;
int main(){
	scanf("%lld%lld%lld",&A,&B,&C);
	if(A&B&C&1) printf("%lld\n",min(A*B,min(A*C,B*C)));
	else puts("0");
	return 0;
}

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

int main(){
	char w[101], s;
	int i=0;
	while(cin >> s){
		w[i]=s;
		i++;
	}
	int N=i;
	if(N%2!=0){
		cout << "No" << endl;
		return 0;
	}
	
	int count[101]={0};
	count[0]=1;
	char wchar[101];
	wchar[0]=w[0];
	int j, Num=1;
	i=1;
	
	for(i=1; i<N; i++){
		int flg=0;
		j=0;
		do{
			if(w[i]==wchar[j]){
				count[j]++;
				flg++;
			}
			else{
				j++;
			}
		
		}while(j<Num && flg<=0);
		if(j==Num){
			wchar[j] = w[i];
			count[j] = 1;
			Num++;
		}
	}
	
	for(j=0; j<Num; j++){
		if(count[j] %2 != 0){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : competitive_programing.cpp
// Author      : .Data_Nerd.
// Description : problem solving training
//============================================================================

#include <iostream>
#include <bits/stdc++.h>
#define PI acos(-1)
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a) * (b)).imag()
#define Data_Nerd ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define Y imag()
#define X real()
#define EPS 1e-7
#define mod 1000000007
#define OO 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef complex <ld> point;
typedef vector <point> polygon;
typedef tuple <ld, ld, ld> line;
typedef vector <point> spolygon;

line lineeq(point x, point y){
	ll a = y.Y - x.Y;
	ll b = x.X - y.X;
	ll c = -a * x.X - b * x.Y;
	ll gcd = abs(__gcd(a, __gcd(b, c)));
	if(a < 0 || (a == 0 && b < 0)) gcd *= -1;
	a /= gcd; b /= gcd; c /= gcd;
	return line(a, b, c);
}

point getpoint(line l1, line l2){
	ld y = (get<0>(l1) * get<2>(l2) - get<0>(l2) * get<2>(l1)) / (get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2));
	ld x = (get<2>(l1) * get<1>(l2) - get<2>(l2) * get<1>(l1)) / (get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2));
	return point(x, y);
}

bool onray(point a, point b, point c){
	return dot(b - a, c - a) > -EPS;
}

ll fact(ll n){
	if(n == 0) return 1;
	return n * fact(n - 1);
}

bool isPrime(ll q){
	if(q == 0 || q == 1) return false;
	for(ll i = 2; i * i <= q; i++) if(q % i == 0) return false;
	return true;
}

point rotate(point p, ld a){
	return p * polar((ld)1, a * PI / 180);
}

bool canBe(line l1, line l2){
	if(get<0>(l2) * get<1>(l1) - get<0>(l1) * get<1>(l2) != 0) return true;
	return false;
}

ld getangle(point p){
	return arg(p) * 180 / PI;
}

ll fp(ll base, ll x){
	if(x == 0) return 1;
	ll ans = fp(base, x / 2);
	ans = (ans * ans) % mod;
	if(x % 2)
		ans = ((base % mod) * ans) % mod;
	return ans;
}

ll GCD(ll a, ll b){
	if(b == 0) return a;
	if(a == 0) return b;
	return GCD(b, a % b);
}

ll LCM(ll a, ll b){
	return (a * b) / GCD(a, b);
}

ll fac[(int)1e4 + 7], inv[(int)1e4 + 7];

void calcFacAndInv(ll n){
    fac[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fac[i] = (i * fac[i - 1]) % mod;
        inv[i] = fp(fac[i], (ll)mod - 2);
    }
}

ll ncr(ll n, ll r){
    return ((fac[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r){
    return (fac[n] * inv[n - r]) % mod;
}

ll p[55][55] = {};

void pascal(){
    p[0][0] = 1;
    for(int i = 1; i < 55; i++) {
        p[i][0] = 1;
        for(int j = 1; j <= i; j++) p[i][j] = p[i - 1][j] + p[i - 1][j - 1];
    }
}

ll n, k, arr[100005], dp[100005];

ll solve(ll i){
	if(i == n - 1)
		return 0;
	if(dp[i] != -1)
		return dp[i];
	dp[i] = 2e9;
	for(ll j = 1; j <= k; ++j){
		if(i + j < n)
			dp[i] = min(dp[i], abs(arr[i] - arr[i + j]) + solve(i + j));
	}
	return dp[i];
}

int main() {
	Data_Nerd
	cin >> n >> k;
	memset(dp, -1, sizeof dp);
	for(ll i = 0; i < n; ++i) cin >> arr[i];
	cout << solve(0) << endl;
  	return 0;
}


Measured memory_bytes: 4864
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    a: usize,
    b: usize
    }
    let ans = if b % a == 0 {a + b} else {b - a};
    println!("{}", ans);
}


Measured memory_bytes: 2204
#include<stdio.h>

int main(void){
	
	int date[4][3][10] = {{{}}},i=0, j=0, k=0, n, a, b, c, d;
	
	scanf("%d",&n);
	
	for(i = 0; i < n; i++){
		scanf("%d %d %d %d",&a,&b,&c,&d);
		date[a-1][b-1][c-1] += d;
	}
	
	i = 0;
	
	for(i = 0; i < 4; i++){
		for(j = 0; j < 3; j++){
			for(k = 0; k < 10; k++){
				printf(" %d",date[i][j][k]);
			}
			printf("\n");
		}
		if(i < 3){
			printf("####################\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 612
N = int(input())
li = list(map(int,input().split()))

count = 0

while True:
    success = 0
    i = 0
    for num in li:
        if (num % 2) == 0:
            success += 1
    if(success == N):
        i = 0
        count += 1
        for num in li:
            li[i] = num / 2
            i += 1
    else:
        break
print(count)

Measured memory_bytes: 3188
using System;

namespace HowManyDivisors
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int cnt = 0;
			string input = Console.ReadLine();

			char[] CharSeparators = new char[] {' '};
			string[] array = input.Split(CharSeparators);

			string array1 = array[0];
			string array2 = array[1];
			string array3 = array[2];

			int a = int.Parse (array1);
			int b = int.Parse (array2);
			int c = int.Parse (array3);

			for(int i = a; i <= b; i++){
				if((c % i) == 0){
					cnt++;
				}
			}
			Console.WriteLine(cnt);
		}
	}
}

Measured memory_bytes: 5612
#include <stdio.h>

int main(void){
  int i,j,n,m,cn;
  char c,s[5]={'S','H','C','D','\0'};
  static int card[4][13];
  scanf("%d\n",&n);

  for(i=0;i<n;i++){
    scanf("%c %d\n",&c,&m);
    for(j=0;j<4;j++)
      if(s[j]==c)
        card[j][m-1]=1;
  }
  
  for(i=0;i<4;i++)
    for(j=0;j<13;j++)
      if(card[i][j]==0)
        printf("%c %d\n",s[i],j+1);

  return 0;
}
    

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

ans = 0

if k==0:
    print(n**2)
    exit()

for b in range(k+1,n+1):##境界の処理とか+1の有無とかが難しい
    quo = n//b
    by_rem = b-k
    ans += quo * by_rem
    
    ans += max(0, n%b-k+1)
    
    
    
print(ans) 

Measured memory_bytes: 39408
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <numeric>
#include <complex>
#define ll long long
using namespace std;

int main() {
	int x, ans = 1, hoge;
	cin >> x;
	for (int b = 2; b < pow(x, 0.5); b++) {
		for (int p = 2; pow(b, p) <= x; p++) {
			hoge = pow(b, p);
			if (ans < hoge)ans = hoge;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[15],s1[15];
    scanf("%s",s);
    scanf("%s",s1);
    int k=strlen(s);
    for(int i=0;i<k;i++)
    {
        if(s[i]!=s1[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}

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

int hoge(int n)
{
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        if (n % i == 0) {
            sum++;
        }
    }
    return sum;
}

int main()
{
    int N;
    cin >> N;
    
    int result = 0;
    for (int i = 1; i <= N; i+=2) {
        if (hoge(i) == 8) {
            result++;
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x,i;
    int s = 0;
    scanf("%d",&x);
    for(i = 1; i < 100000; i++)
    {
        s = i*(1+i)/2;
        if(s >= x)
        {
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

ll N;
ll H[MAX];

int main() {
    cin >> N;

    REP(i, N) {
        cin >> H[i];
    }

    bool flag = true;
    for(int i = 1;i<N;i++) {
        if(H[i-1]>H[i]){
            H[i] += 1;
            if(H[i-1]!=H[i]) {
                flag = false;
                break;
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

main(){
	int n,k,ans;
	int a[100010];
	char c;
	
	cin>>n>>k;
	for(int i = 1 ; i <= n ; i++){
		cin>>c;
		if(c == 'L')
			a[i] = 1;
		else
			a[i] = 2;
	}
	for(int i = 2 ; i <= n ; i++)
		if(a[i] == a[i-1])
			ans++;
	cout<<min(n-1,ans+2*k)<<endl;
} 

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

map< int, ll > ret;

const int  mod = 1000000007;
struct mint{
    ll x;
    mint (ll x=0) : x((x%mod+mod)%mod){}//カッコの中で初期化している
    mint& operator+=(const mint a){//operatorは構造体同士の比較に用いられる
        if((x +=a.x)>=mod) x-=mod;
        return *this;//thisとは現在のオブジェクトのこと
    }
    mint& operator-=(const mint a){
        if((x +=mod-a.x)>=mod) x-=mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x*=a.x)%=mod;
        return *this;
    }
    mint operator+(const mint a){
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a){
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a){
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const{
        if(!t) return 1;
        mint a=pow(t>>1);
        a*=a;
        if(t&1) a*=*this;
        return a;
    }
    mint inv() const{
        return pow(mod-2);//逆元
    }
    mint&operator/=(const mint a) {
        return (*this)*=a.inv();
    }
    mint&operator/(const mint a) const{
    mint res(*this);
    return res/=a;
    }
};

void prime_factor(int n) {
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] ++;
}
 
 
int main(void){
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++){
        prime_factor(i);
    }
    mint ans = 1;
    for(auto p : ret){
        ans *= p.second+1;
    }
    cout<<ans.x<<endl;
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

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

  for (ll h = 1; h <= 3500; h++){
    for (ll n = 1; n <= 3500; n++){
      ll A = 4*h*n-N*n-N*h;
      if (A == 0) continue;
      ll B = N*h*n;
      if (B % A != 0) continue;
      
      ll w = B / A;
      if (w <= 0) continue;
      cout << h << " " << n << " " << w << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(void) {
  int N, M, count = 0;
  scanf("%d\n%d", &N, &M);
  if (N > 1) count += N*(N-1)/2;
  if (M > 1) count += M*(M-1)/2;
  printf("%d", count);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int turn;
	int nokori[3] = {0,0,0};
	char card[3][101];
	
	scanf("%s %s %s",card[0],card[1],card[2]);
	
	turn = 0;
	while(card[turn][nokori[turn]] != '\0') {
		turn = card[turn][nokori[turn]++]-'a';
	}
	printf("%c\n",turn+'A');
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  sort(s.begin(), s.end());
  rep(i, n)
    cout << s[i];
  cout << endl;
  return 0;
}

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

#define all(x) x.begin(),x.end()
#define LB(V,x) lower_bound(all(V),x)-V.begin()

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using pi = pair<int32, int32>;
using pll = pair<int64, int64>;
using vi = vector<int32>;
using vll = vector<int64>;
using ll = int64;

void Main(){
    int N, ans, A;
    cin >> N >> ans;
    while(--N){
        cin >> A;
        ans = __gcd(ans,A);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256
N,W = map(int, input().split())
dp = [0]*(W+1)
temp = [0]*(W+1)

for i in range(1,N+1):
    v,w = map(int,input().split())
    for j in range(w, W+1):
        if v + temp[j-w] > temp[j]:
            dp[j] = temp[j-w]+v
    temp[0:W+1] = dp[0:W+1]

print(dp[W])

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

using namespace std;

using ull = unsigned long long;
using ll = long long;

#define READ freopen("input.txt", "r", stdin)
#define ROUT freopen("output.txt", "w", stdout)
#define pb push_back
#define endl '\n'

void fasterIO()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

///(Moan) ey (hoe) pakhi jeno (Oral) dibe <3

void fuck()
{
    int i, j, count=0;
    string s;
    cin>>s;
    for(i=0; i<4; i++){
        for(j=0; j<4; j++){
            if(i==j)
                continue;
            else if(s[i]==s[j]){
                s[j]='0';
            }
        }
    }
    for(i=0; i<4; i++){
        if(s[i]=='0')
            count++;
    }
    if(count==2)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

int main()

{
    ///READ;
    ///ROUT;
    fasterIO();

    fuck();

    return 0;
}



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

int main(){

    int n, m, l;
    cin >> n >> m >> l;


    int A[n][m], B[m][l];
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++) A[i][j] = 0;
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<l; j++) B[i][j] = 0;
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            scanf("%d", &A[i][j]);
        }
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<l; j++){
            scanf("%d", &B[i][j]);
        }
    }

    long long int C[n][l];

    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++) C[i][j] = 0;
    }

//this
    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            for(int r=0; r<m; r++){
                C[i][j] += A[i][r]*B[r][j];
            }
        }
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            if(j==l-1) printf("%lld", C[i][j]);
            else printf("%lld ", C[i][j]);
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3384
w, a, b = gets.chomp.split(" ").map(&:to_i)

result = 0

unless (a..a+w).include?(b) || (a..a+w).include?(b+w)
  if a+w < b
    result = b - (a + w)
  end

  if b < a
    result = a - (b + w)
  end
end

puts result


Measured memory_bytes: 1788
a, b, c, d = map(int, input().split())
cdiv = c
ddiv = d
while ddiv > 0:
  cdiv, ddiv = ddiv, cdiv % ddiv
M = c*d//cdiv

mnd = M-(c+d)//cdiv+1
ad = (a-1) % M
bd = b % M

print(mnd*(b//M)+bd-bd//c-bd//d-mnd*((a-1)//M)-ad+ad//c+ad//d)

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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  vector<string> s(2);
  cin >> s[0] >> s[1];
  s[1].pop_back();
  cout << (s[0] == s[1] ? "Yes\n" : "No\n");   
  return 0;
}

Measured memory_bytes: 3656
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let a = read::<usize>();
    let b = read::<usize>();
    let h = read::<usize>();
    let ans = (a + b) * h / 2;
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

ll N;
v C,S,F;

ll calc(ll i,ll sum){
    if(S[i] > sum){
        return S[i] + C[i];
    }
    else{
        if(sum -S[i] == 0)return sum+C[i];
        else{
            ll x = (sum-S[i]-1)/F[i] + 1;
            return S[i] + x *F[i]+C[i];
        }
    }
}

int main(){
    cin>>N;
    C.resize(N);
    S.resize(N);
    F.resize(N);
    rep(i,0,N-1){
        cin>>C[i]>>S[i]>>F[i];
    }

    rep(i,0,N){
        ll sum = 0;
        rep(j,i,N-1){
            sum = calc(j, sum);
            
        }
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC109_A_ABC333
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] inStrArr = Console.ReadLine().Split(' ');
			int a = int.Parse(inStrArr[0]);
			int b = int.Parse(inStrArr[1]);
			int c;

			bool ans = false;

			for (int i = 1; i <= 3; i++)
			{
				c = a * b * i;
				if (c % 2 == 1)
				{
					ans = true;
				}
			}

			if (ans == true) 
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
		}
	}
}

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

int main() {
  int N;
  cin >> N;
  vector<string>vec1(N);
  
  for (int i=0; i<N; i++){
    cin >> vec1.at(i);
  }
  
  int M;
  cin >> M;
  vector<string>vec2(M);
  
  for (int i=0; i<M; i++){
    cin >> vec2.at(i);
  }
  
  int answer=0;
  
  for (int i=0; i<N; i++){
    int prs=0;
    
    for (int j=0; j<N; j++){
      if (vec1.at(i) == vec1.at(j)){
        prs++;
      }
    }
        
    for (int j=0; j<M; j++){
      if (vec1.at(i) == vec2.at(j)){
        prs--;
      }
    }
    
    if (prs > answer){
      answer = prs;
    }
  }
  
  cout << answer << endl;
}

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

using namespace std;

int main() {
    int H, W; cin >> H >> W;
    vector<vector<char>> a(H, vector<char>(W));
    for(int i=0; i < H; i++) {
        for(int j=0; j < W; j++) {
            cin >> a[i][j];
        }
    }

    // 横の揃っているの削除
    for(int i=0; i < a.size(); i++) {
        bool flag = true;
        for(int j=0; j < a[i].size(); j++) if(a[i][j] == '#') flag = false;
        if(flag) {
            a.erase(a.begin() + i);
            i--;
        }
    }

    // 縦の揃っているの削除
    for(int j=0; j < a[0].size(); j++) {
        bool flag = true;
        for(int i=0; i < a.size(); i++) if(a[i][j] == '#') flag = false;
        if(flag) {
            for(int i=0; i < a.size(); i++) a[i].erase(a[i].begin() + j);
            j--;
        }
    }

    for(int i=0; i < a.size(); i++) {
        for(int j=0; j < a[i].size(); j++) {
            cout << a[i][j];
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 256
def TripleDots():

    Num = int(input())

    moji = str(input())

    if len(moji) > Num:
        moji_cut = moji[:Num] + '...'
        
    else:
        moji_cut = moji

    print(moji_cut)

if __name__ == '__main__':
    TripleDots()



Measured memory_bytes: 9160
s = input()


ans = 0
l = 0
r = len(s)-1

for i in range( len(s) ):
	if r <= l:
		break
	if s[l] == s[r]:
		l += 1
		r -= 1
	else:
		if (s[l] != 'x' and s[r] != 'x'):
			ans = -1
			break
		else:
			ans += 1
			if s[l] == 'x':
				l += 1
			else:
				r -= 1
print(ans)





Measured memory_bytes: 3316
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main() {

	int n;
	string s,t;
	cin >> n;
	cin >> s>>t;

	for (int i = 0; i < n ; i++) {
		cout << s[i] << t[i];

	}
	cout << endl;

	

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 250

int parent(int);
int left(int);
int right(int);

int main(){
  int heap,h[N],i;
  scanf("%d",&heap);

  for(i = 1;i < heap+1;i++){
    scanf("%d",&h[i]);
  }

  for(i = 1;i < heap+1;i++){
    printf("node %d: key = %d, ",i,h[i]);
    if(parent(i) >= 1){
      printf("parent key = %d, ",h[parent(i)]);
    }
    if(left(i) <= heap){
      printf("left key = %d, ",h[left(i)]);
    }
    if(right(i) <= heap){
      printf("right key = %d, ",h[right(i)]);
    }
    printf("\n");
  }
  return 0;
}

int parent(int i){
  return (i/2);
}

int left(int i){
  return (i*2);
}

int right(int i){
  return (2*i+1);
}

Measured memory_bytes: 600
N = int(input())
S = input()
L = [0] * N
e = 0

for i in range(N - 1):
  #E,Wが互い違いになっていると相殺されるため手数は変わらない
  #iが増える = カーソルが右に行くにつれ
  #Eが続けて増えると手数は減り(カーソルの方向へ向く人が増えるため)、
  #Wが続けて増えると手数は増える(カーソルと逆方向を向く人が増えるため)
  if S[i + 1] == "E":
    #累積和を取っていくとともに、東の方向を向いている人数を記録する
    #カーソルが西端にあるとき、Eの総数が手数となる
    ##Eが続けて増えるとき累積和が減り、Eの総数からカーソル以西のEが相殺され、
    ##カーソル以東のEだけが計上される
    e += 1
    if S[i] == "E":
      L[i + 1] = L[i] - 1
    else: 
      L[i + 1] = L[i]
  else:
    if S[i] == "W":
      L[i + 1] = L[i] + 1
    else:
      L[i + 1] = L[i]

ans = min(L) + e
print(ans)


Measured memory_bytes: 15244
N = int(input())
flg =0
for i in range(N):
    d1,d2 = map(int,input().split())
    if d1 != d2 :
        flg = 0
        continue
    elif d1 == d2:
        flg += 1
    
    if flg >= 3:
        break

if flg >= 3:
    print('Yes')
else:
    print('No')

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int dp[5][5][5][5];

bool solve(int* ISN, int* NKJ) {
  int& ret = dp[ISN[0]][ISN[1]][NKJ[0]][NKJ[1]];

  if(ret + 1) return ret;
  if(ISN[0] + ISN[1] == 0) return false;
  if(NKJ[0] + NKJ[1] == 0) return false;

  ret = 0;

  rep(i, 2) rep(j, 2) {
    if(!ISN[i]) continue;
    if(!NKJ[j]) continue;
    int tmp = NKJ[j];
    NKJ[j] += ISN[i];
    if(NKJ[j] >= 5) NKJ[j] = 0;
    ret |= !solve(NKJ, ISN);
    NKJ[j] = tmp;
  }
  return ret;
}

int main() {

  int ISN[2], NKJ[2]; cin >> ISN[0] >> ISN[1] >> NKJ[0] >> NKJ[1];
  minus(dp);
  cout << (solve(ISN, NKJ) ? "ISONO" : "NAKAJIMA") << endl;
  
  return 0;
}

Measured memory_bytes: 3072
import java.util.Scanner;

class Main {
    public static void main(String[] z) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            Point a = new Point(sc.nextDouble(), sc.nextDouble());
            Point b = new Point(sc.nextDouble(), sc.nextDouble());
            Point c = new Point(sc.nextDouble(), sc.nextDouble());
            Point p = new Point(sc.nextDouble(), sc.nextDouble());
            System.out.println(crossProduct(sub(a,b), sub(b, p)) < 0.0 &&
                    crossProduct(sub(b,c), sub(c, p)) < 0.0 &&
                    crossProduct(sub(c, a), sub(a, p)) < 0.0 ||
                    crossProduct(sub(a,b), sub(b, p)) > 0.0 &&
                    crossProduct(sub(b,c), sub(c, p)) > 0.0 &&
                    crossProduct(sub(c, a), sub(a, p)) > 0.0 ? "YES" : "NO");
        }
    }

    static double crossProduct(Point a, Point b) {
        return a.x * b.y - a.y * b.x;
    }
    static Point sub(Point a, Point b) {
        return new Point(b.x-a.x,b.y-a.y);
    }
}
class Point {
    double x;
    double y;

    Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
}



Measured memory_bytes: 31272
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        a: f64, b: f64,
        h: f64, m: f64,
    }
    let pi2 = 2. * std::f64::consts::PI;
    let h = pi2 * (60. * h + m) / (12. * 60.);
    let x1 = a * f64::sin(h);
    let y1 = a * f64::cos(h);
    let m = pi2 * m / 60.;
    let x2 = b * f64::sin(m);
    let y2 = b * f64::cos(m);
    let dx = x2 - x1;
    let dy = y2 - y1;
    println!("{}", (dx * dx + dy * dy).sqrt());
}


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

int main() {
  ll l,r;
  cin >> l >> r;
  ll ans=10000000;
  for(ll i=l;i<r;i++){
    for(ll i2=i+1;i2<=r;i2++){
      ll g=(i*i2)%2019;
      ans=min(ans,g);
      if(ans==0){cout << ans <<endl; return 0;}
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &h[i]);
    }
    sort(h.begin(), h.end());
    int ans = 1000000000;
    for (int i = k - 1; i < n; i++) {
        chmin(ans, h[i] - h[i - k + 1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 100000000

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int main(){
    cin.tie(0);
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;

    int l[q],r[q];

    rep(i,0,q){
        cin >> l[i] >> r[i];
        l[i]--;
        r[i]--;
    }
    int sum[n];
    rep(i,0,n) sum[i] = 0;
    int tmp = 0;
    rep(i,1,n){

        if(s[i-1] == 'A' && s[i] == 'C') tmp++;
        sum[i] = tmp;
        
    }
    rep(i,0,q){
        cout << sum[r[i]]-sum[l[i]] <<endl;
    }
    
}

Measured memory_bytes: 2176
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
int main() {
	ll a, b, x, y;
	cin >> a >> b >> x >> y;
	ll count = x * b + y * (a - x);
	cout << a * b - count << endl;
}

Measured memory_bytes: 3576
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception {
        InputStreamReader r = new InputStreamReader(System.in);
        int N = nextInt(r);
        int W = nextInt(r);
        long dp[][] = new long[N+1][W+1];
        for (int i = 1; i <= N; i++) {
            int wi = nextInt(r);
            int vi = nextInt(r);
            for (int j = 1; j <= W; j++) {
                if (j >= wi) {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i-1][j-wi]+vi);
                }
                dp[i][j] = Math.max(dp[i-1][j], dp[i][j]);
            }
        }
        System.out.println(dp[N][W]);
    }

    public static String nextString(InputStreamReader r) throws Exception {
        String res = "";
        while (true) {
            int c = r.read();
            if (c == 32 || c == 10 || c == -1) {
                break;
            }
            res += (char)c;
        }
        return res;
    }

    public static int nextInt(InputStreamReader r) throws Exception {
        return Integer.parseInt(nextString(r));
    }

    public static long nextLong(InputStreamReader r) throws Exception {
        return Long.parseLong(nextString(r));
    }
}


Measured memory_bytes: 127060
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;

int main()
{
	int a, b, c, x, y;
	int ans = 0, ndadd;
	cin >> a >> b >> c >> x >> y;
	if(a + b <= 2*c){
		ans += x*a + y*b;
	}
	else{
		int ab = min(x, y);
		ans += 2*ab*c;
		int rst = max(x, y) - ab;
		int rstnd = 2*rst*c;
		if(x>y) ndadd = min(rstnd, rst*a);
		else ndadd = min(rstnd, rst*b);
		ans += ndadd;
	}
	cout << ans << endl;
	return 0;
}

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

int n, res = 0;

void dfs(int sum, int count)
{
    if (sum == n) {
        res++;
      	return ;
    }
    if (count == 4) return;
    for (int i = 0; i <= 9; i++) {
        dfs(sum + i, count + 1);
    }
}

int main(void)
{
    while (cin >> n) {
        res = 0;
        dfs(0, 0);
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;



int main() {
  int N,M,X;
  cin >> N >> M >> X;

  int A[N];
  for(int i = 1; i <= M; i++){
    int a; cin >> a;
    A[a] = 1;
  }

  // N 
  int df = 0;
  for(int i = X + 1; i < N; i++){
    if(A[i] == 1) df++;
  }
  int db = 0;
  for(int i = X - 1; i >0; i--){
    if(A[i] == 1) db++;
  }
  int ans = min(df,db);
  cout << ans << endl;




	return 0;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int a;
	for(int i=0;i<s.size();i++){
		a^=s[i];
	}
	if(a==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
	return 0;
}

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

#define ll long long int

vector<ll>arr1,arr2;

ll bs(ll lower, ll upper, ll no){

    ll pos=-1;
    while(lower<=upper){
        ll mid=(lower+upper)/2;
        if(no-arr2[mid]>=0){
            pos=max(pos,mid);
        }
        if(arr2[mid]<no)
            lower=mid+1;
        else
            upper=mid-1;

    }
    return pos;
}

int main(){
    ll n,m,k,i,temp,prefix;
    prefix=0;
    cin>>n>>m>>k;
    for(i=0;i<n;i++){
        cin>>temp;
        arr1.push_back(prefix+temp);
        prefix=arr1[i];
    }
    prefix=0;
    for(i=0;i<m;i++){
        cin>>temp;
        arr2.push_back(prefix+temp);
        prefix=arr2[i];
    }
    ll ans=0;
    i=0;
    while(i<n){
        if(k-arr1[i]>=0)
            ans=max(ans,i+1);
        i++;
    }
    i=0;
    while(i<m){
        if(k-arr2[i]>=0)
            ans=max(ans,i+1);
        i++;
    }
    i=0;
    while(i<n){
        ll j=bs(0,m-1,k-arr1[i]);
        if(j>=0)
            ans=max(ans,i+j+2);
        i++;
    }
    cout<<ans;
}


Measured memory_bytes: 7932
#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 <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000009

int x[200005];
int s[200005];

int main() {
	int n;
	scanf("%d", &n);
	REP(i,n){
		scanf("%d", &x[i]);
		s[i] = x[i];
	}
	sort(s, s + n);
	int p = s[n / 2 - 1];
	int q = s[n / 2];
	REP(i, n) {
		printf("%d\n", (x[i] <= p) ? q : p);
	}
	return 0;
}

Measured memory_bytes: 3712
import numpy as np
N,W=map(int,input().split())
w=[0 for i in range(N)]
v=[0 for i in range(N)]
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0 for i in range(W+1)]
dp=np.array(dp)
for i in range(N):
    dp[w[i]:]=np.maximum(dp[w[i]:],dp[:W-w[i]+1]+v[i])
print(dp.max())



Measured memory_bytes: 21672
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL<<60LL)
typedef long long ll;

using namespace std;


vector<vector<ll>> g1(100001, vector<ll>());
vector<vector<ll>> g2(100001, vector<ll>());
vector<ll> ans(100001, 0);

ll root[100001];
ll mrank[100001];

void uf_init(ll n) {
	rep(i, n) {
		root[i] = i;
		mrank[i] = 1;
	}
}

ll find(ll x) {
	if (x == root[x]) return x;
	else return root[x] = find(root[x]);
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (mrank[x] > mrank[y]) {
		root[y] = x;
	}
	else {
		root[x] = y;
		if (mrank[x] == mrank[y]) mrank[y]++;
	}
}

int main() {
	ll n, m; cin >> n >> m;
	uf_init(100001);
	rep(i, m) {
		ll x, y, z; cin >> x >> y >> z;
		unite(x, y);
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i == root[i]) ans += 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 7296
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    string s;
    cin >> s;
    ll N = s.length();
    string out = "";
    rep(i,N){
        if(s[i]=='0') out += '0';
        else if(s[i]=='1') out += '1';
        else{
            if(out!="") out.erase(out.length()-1);
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
#define rep(i,l,r) for(ll i=l;i<=r;i++)

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    bool ku[110];
    for(ll i=1;i<110;i++){
        ku[i]=false;
    }
    for(ll i=1;i<10;i++){
        for(ll j=1;j<10;j++){
            ku[i*j]=true;
        }
    }
    ll n;cin>>n;
    if(ku[n]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import fractions

# 最小公倍数
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


a, b, c, d = map(int, input().split())
a=  a-1

c_a = a//c
c_b = b//c

d_a = a//d
d_b = b//d

lcm = lcm(min(c, d), max(c,d))

l_a = a//lcm
l_b = b//lcm




ans =  (b - a)  -  (c_b - c_a) - (d_b - d_a) + (l_b - l_a)

print(ans)



Measured memory_bytes: 5076
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

vector<int> g[100010];

int main(){
	int n,m; cin >> n >> m;
	REP(i,0,m){
		int a,b; cin >> a >> b;
		g[a-1].push_back(b-1);
		g[b-1].push_back(a-1);
	}
	
	deque<int> qu; qu.push_front(0); qu.push_back(g[0][0]);
	set<int> st; st.insert(0); st.insert(g[0][0]);
	
	while(1){
		int p = qu.front();
		int q = qu.back();
		
		for(auto e:g[p]){
			if(st.count(e)) continue;
			st.insert(e);
			qu.push_front(e);
			break;
		}
		
		for(auto e:g[q]){
			if(st.count(e)) continue;
			st.insert(e);
			qu.push_back(e);
			break;
		}
		
		if(p == qu.front() and q == qu.back()) break;
	}
	
	cout << qu.size() << endl;
	while(!qu.empty()) cout << qu.front() + 1 << " ", qu.pop_front();
	cout << endl;
	return 0;
}


Measured memory_bytes: 11392
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007


int main() {

  int N;
  cin >> N;

  int c = 0;
  for(int i = 0;i < N;i++) {
    int a;
    cin >> a;
    c = c^a;
  }

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

}


Measured memory_bytes: 256