akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
}

ll faf(ll x) {
  return x*x*x*x*x;
}
 

int main(void) {

  ll x;
  cin >> x;

  for (ll b = -1010; b <= 1010; b++) {
    for (ll a = b + 1; a <= 1010; a++) {
      if (faf(a) - faf(b) == x) {
	cout << a << " " << b << endl;
	return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		
		System.out.println(Math.max(a*b, c*d));
	}
}


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

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

    auto first_l_after = vector<int>(s.length());
    int last_l = s.length() - 1;
    for (int i = s.length() - 1; i >= 0; i--) {
        if (s[i] == 'R') {
            first_l_after[i] = last_l;
        } else {
            last_l = i;
        }
    }
    auto first_r_before = vector<int>(s.length());
    auto last_r = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'L') {
            first_r_before[i] = last_r;
        } else {
            last_r = i;
        }
    }

    auto counter = vector<int>(s.length());
    for (int start = 0; start < s.length(); start++) {
        int final_pos = -1;
        if (s[start] == 'R') {
            auto dist_to_l = first_l_after[start] - start;
            if (dist_to_l % 2 == 0) {
                final_pos = first_l_after[start];
            } else {
                final_pos = first_l_after[start] - 1;
            }
        }
        if (s[start] == 'L') {
            auto dist_to_r = start - first_r_before[start];
            if (dist_to_r % 2 == 0) {
                final_pos = first_r_before[start];
            } else {
                final_pos = first_r_before[start] + 1;
            }
        }
        counter[final_pos]++;
    }

    for (int i = 0; i < s.length(); i++)
        printf("%d%c", counter[i], (i == s.length() - 1 ? '\n' : ' '));

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

constexpr int C = 1000000007;

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

  unsigned H, W;
  std::cin >> H >> W;
  vector<vector<char>> arr(H, vector<char>(W));
  vector<vector<int>> dp(H, vector<int>(W, 0));

  for (auto& h : arr)
  {
    for (auto& w : h)
    {   
      std::cin >> w;
    }   
  }
  
  for (size_t j = W; j > 0; --j)
  {
    if (arr[H-1][j-1] == '#') break;
    dp[H-1][j-1] = 1;
  }

  for (size_t i = H-1; i > 0; --i)
  {
    for (size_t j = W; j > 0; --j)
    {
      size_t a = i-1, b = j-1;
      if (arr[a][b] == '#') continue;
      if (b+1 == W)
      {
        dp[a][b] = dp[a+1][b];
      }
      else
      {
        dp[a][b] = (dp[a+1][b] + dp[a][b+1]) % C;
      }
    }
  }

  std::cout << dp[0][0];

  return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int n,k,ans;
    cin >> n >> k;
    ans = 1;
    for (int i = 0;i < n;i++){
        ans = min(ans+k,2*ans);
    }
    cout << ans << endl;

     

    return 0;

}


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

int main (void) {
    int n;

    scanf("%d", &n);

    if ( n%10 == 7 || (n%100)/10 == 7 || n/100 == 7 )
        printf("Yes\n");
    else
        printf("No\n");

    return EXIT_SUCCESS;
}


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

int sentou_matubi[10][10];

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

    for (int i = 1; i <= n; ++i) {
        int ketasu =
            i < 10 ? 1
                   : i < 100
                         ? 10
                         : i < 1000
                               ? 100
                               : i < 10000 ? 1000 : i < 100000 ? 10000 : 100000;
        int sentou = i / ketasu;
        int matubi = i % 10;
        sentou_matubi[sentou][matubi]++;
    }

    long long ans = 0LL;
    for (int i = 1; i <= 9; ++i) {
        for (int j = i; j <= 9; ++j) {
            int ij = sentou_matubi[i][j];
            int ji = sentou_matubi[j][i];
            ans += ij * ji;
            if (i != j) ans += ij * ji;
        }
    }

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

Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_MOD			1000000007								// 除数(10の9乗+7)
#define D_ITM_MAX		200000									// 最大アイテム数
#define D_ITM_PC		0										// アイテム - PC
#define D_ITM_POW		1										// アイテム - 電源
#define D_FACT_MAX		D_ITM_MAX								// 最大階乗数

// 内部構造体 - アイテム情報
typedef struct Itm {
	int miType;													// PC or 電源
	int miPos;													// 位置
} Itm;

// 内部変数
static FILE *szpFpI;											// 入力
static Itm sz1Itm[D_ITM_MAX];									// アイテム
static int siICnt;												// アイテム数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// ソート関数 - 位置昇順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	Itm *lzpVal1 = (Itm *)pzpVal1;
	Itm *lzpVal2 = (Itm *)pzpVal2;

	// 位置昇順
	if (lzpVal1->miPos > lzpVal2->miPos) {
		return 1;
	}
	else if (lzpVal1->miPos < lzpVal2->miPos) {
		return -1;
	}

	return 0;
}

// 積 - 取得
int
fGetModMulti(
	int piVal1					// <I> 値１
	, int piVal2				// <I> 値２
)
{
	return (int)((long long)piVal1 * (long long)piVal2 % D_MOD);
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// アイテム数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siICnt);

	// PC - 取得
	for (i = 0; i < siICnt; i++) {
		sz1Itm[i].miType = D_ITM_PC;
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d", &sz1Itm[i].miPos);
	}

	// 電源 - 取得
	for (i = 0; i < siICnt; i++) {
		sz1Itm[siICnt + i].miType = D_ITM_POW;
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d", &sz1Itm[siICnt + i].miPos);
	}

	// アイテム - ソート
	siICnt *= 2;
	qsort(sz1Itm, siICnt, sizeof(Itm), fSortFnc);

	// パターン数 - 取得
	int liPCnt = 1;
	int liICnt = 0;
	int liType;
	for (i = 0; i < siICnt; i++) {

		// 個数 - 加算
		if (liICnt == 0) {
			liICnt = 1;
			liType = sz1Itm[i].miType;
		}
		else if (sz1Itm[i].miType == liType) {
			liICnt++;
		}
		else {
			liPCnt = fGetModMulti(liPCnt, liICnt);
			liICnt--;
		}
	}

	return liPCnt;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

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


int main()
{
    //freopen("input.txt", "r", stdin);


    int k, a, b;
    cin >> k >> a >> b;
    int up = (a + k - 1) / k * k;
    if (up > b) cout << "NG\n";
    else cout << "OK\n";

}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for(int i = 111; i < 1000; i += 111) {
        	if(i >= n) {
        		System.out.println(i);
        		return;
        	}
        }
    }
}

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

int main(){
  int N;
  cin >> N;
  if ( (N-0) % 1000 == 0 || (N-111)%1000 == 0 || (N-222)%1000 == 0 || (N-333)%1000 == 0 || (N-444)%1000 == 0 ||(N-555)%1000 == 0 || (N-666)%1000 == 0 || (N-777)%1000 == 0 || (N-888)%1000 == 0 || (N-999)%1000 == 0 || (N-0) % 1110 ==0 || (N-1)%1110 == 0 ||(N-2)%1110 == 0 || (N-3)%1110 == 0 || (N-4)%1110 == 0 || (N-5)%1110 == 0 || (N-6)%1110 == 0 || (N-7)%1110 == 0 || (N-8)%1110 == 0 || (N-9)%1110 == 0 ){
  cout << "Yes" << endl;
  }
  else if( (N-0) % 1000 != 0 || (N-111)%1000 != 0 || (N-222)%1000 != 0 || (N-333)%1000 != 0 || (N-444)%1000 != 0 ||(N-555)%1000 != 0 || (N-666)%1000 != 0 || (N-777)%1000 != 0 || (N-888)%1000 != 0 || (N-999)%1000 != 0 || (N-0) % 1110 !=0 || (N-1)%1110 != 0 ||(N-2)%1110 != 0 || (N-3)%1110 != 0 || (N-4)%1110 != 0 || (N-5)%1110 != 0 || (N-6)%1110 != 0 || (N-7)%1110 != 0 || (N-8)%1110 != 0 || (N-9)%1110 != 0 ){
  cout << "No" << endl;
  }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define HohleFeuerwerke using namespace std
HohleFeuerwerke;
int n;
bool flag=true;
int main()
{
	ios::sync_with_stdio(false);
	cout.tie(0);cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		int tmp;cin>>tmp;
		if(tmp%2==0){
			if(tmp%3!=0&&tmp%5!=0) flag=false;
		}
	}
	if(flag) cout<<"APPROVED"<<endl;
	else cout<<"DENIED"<<endl;
	return 0;
}

Measured memory_bytes: 256
a = int(input())+1
b = int(input())+1
c = int(input())+1
n = int(input())

aa = (n // 500) + 1
bb = (n // 100) + 1
cc = (n // 50) + 1

cnt = 0

for i in range(0,min(aa,a)):
  for j in range(0,min(bb,b)):
    for k in range(0,min(cc,c)):
      if n == i*500+j*100+k*50:
        cnt += 1

print(cnt)

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

using namespace std;

#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

int main(void){

    int n;
    cin >> n;

    int x = 0, y = 1001001001;
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        x = max(x, a);
        y = min(y, a);
    }

    cout << x - y << "\n";

    return 0;
}


Measured memory_bytes: 3620
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] b = new int[N-1];
		for (int i = 0; i < N-1; i++)
			b[i] = sc.nextInt();
		int sum = b[0] + b[N-2];
		for (int i = 0; i < N-2; i++) {
			sum += Math.min(b[i], b[i+1]);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 21716
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
        m: usize,
        a: [[usize]; n],
    }
    let mut v = vec![0usize; m];
    for a in a {
        for a in a {
            v[a - 1] += 1;
        }
    }
    println!("{}", v.iter().filter(|x| **x == n).count());
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 1e5 + 10;
ll a[MAXN],temp[MAXN];
pair<ll,ll> bc[MAXN];

void solve(){
    ll n,m; cin>>n>>m;

    FOR(i,1,n) cin>>a[i];

    FOR(i,1,m) cin>>bc[i].second>>bc[i].first;

    sort(a+1,a+n+1);
    sort(bc+1,bc+m+1);
    reverse(bc+1,bc+m+1);

    ll j = 1,i = 1;
    ll sz = bc[j].second;

    while(i<=n){
        if(sz == 0){
            j++;
            if(j>m) break;
            sz = bc[j].second;
        }
        temp[i] = bc[j].first;
        sz--;
        i++;
    }

    ll ans = 0;

    FOR(i,1,n) ans += max(a[i],temp[i]);

    cout<<ans<<endl;
}

signed main(){

   FastRead;    



    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case "<<i<<": ";
        solve();
    }
}




Measured memory_bytes: 3328
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String T = scan.next();
        int count = S.length();
        
        for(int i=0;i<S.length();i++){
            if(Objects.equals(S.substring(i, i+1), T.substring(i, i+1))){
                count-=1;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 55524
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n;
    cin >> n;
    vector<int> w(n);
    rep(i,n) cin >> w[i];
    int t = 0;
    int s1 = 0, s2 = 0;
    int ans = 1000000;
    for ( int j = 0; j < n; j++)
    {
        s1 = 0;
        s2 = 0;
        for (int i = 0; i < t; i++)
        {
            s1 += w[i];
        }
        for (int i = t; i < n; i++)
        {
            s2 += w[i];
        }
        if(ans > abs(s2-s1)) ans = abs(s1-s2);
        t++;

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

Measured memory_bytes: 3724
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

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

	if (N == 0) {
		cout << 0 << endl;
		return 0;
	}

	string s;
	int sign = 1;
	while (N != 0) {
		if (N % 2 != 0) {
			s = "1" + s;
			N -= sign;
		} else {
			s = "0" + s;
		}

		sign *= -1;
		N /= 2;
	}

	cout << s << endl;
	return 0;
}


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

int main()
{
	int n, m;

	while (scanf("%d%d", &n, &m), n != 0 && m != 0){
		bool fr[501][501] = {false};
		bool mem[501] = {false};

		for (int i = 0; i < m; i++){
			int m_a, m_b;
			scanf("%d%d", &m_a, &m_b);

			// friend check
			fr[m_a][m_b] = true;
			fr[m_b][m_a] = true;
		}

		for (int i = 2; i <= n; i++){
			if (fr[1][i] == false){
				continue;
			}
			mem[i] = true;
			for (int j = 2; j <= n; j++){
				if (fr[i][j] == true){
					mem[j] = true;
				}
			}
		}

		int cnt = 0;

		for (int i = 2; i <= n; i++){
			if (mem[i] == true){
				cnt++;
			}
		}
		
		cout << cnt << endl;
	}

	return (0);
}

Measured memory_bytes: 1460
S = input()
N = len(S)
def palin(s):
  p = 1
  n = len(s)
  for i in range(n//2):
    if s[i] != s[n-i-1]:
      p = 0
      break
  return p == 1
if palin(S) and palin(S[:(N-1)//2]) and palin(S[(N+2)//2:]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll xorsum(ll n){
    if(n%4==0)return n;
    else if(n%4==1)return 1;
    else if( n%4==2) return (1^n);
    else return 0;
}
int main(){
    ll a,b;
    cin>>a>>b;
    
   cout<<(xorsum(a-1)^xorsum(b))<<endl;
}

Measured memory_bytes: 256
// 安定ソート(バブル、選択ソートの比較)

#include <iostream>
using namespace std;

class Card {
public:
    char mSuit;
    int mValue;

    Card() {
        mSuit = ' ';
        mValue = 0;
    }
    Card(char suit, int value) {
        mSuit = suit;
        mValue = value;
    }
};

void BubbleSort(Card A[], int N) {
    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j >= i + 1; j--) {
            if (A[j].mValue < A[j - 1].mValue) {
                Card cardT = A[j];
                A[j] = A[j - 1];
                A[j-1] = cardT;
            }
        }
    }
}

void SelectionSort(Card A[], int N) {
    int min{ 0 };
    for (int i = 0; i < N; i++) {
        min = i;
        for (int j = i; j < N; j++) {
            if (A[j].mValue < A[min].mValue) {
                min = j;
            }
        }
        if (i != min) {
            Card cardT = A[i];
            A[i] = A[min];
            A[min] = cardT;
        }
    }
}

bool isStable(Card C1[], Card C2[], int N) {
    for (int i = 0; i < N; i++) {
        if (C1[i].mSuit != C2[i].mSuit) {
            return false;
        }
    }
    return true;
}

void outputCardArr(Card card[], int N) {
    for (int i = 0; i < N; i++) {
        if (i != 0) cout << ' ';
        cout << card[i].mSuit << card[i].mValue;
    }
    cout << endl;
}
int main()
{
    int N{ 0 };
    cin >> N;

    Card Card1[36], Card2[36];
    for (int i = 0; i < N;i++) {
        char c;
        int n;
        cin >> c;
        cin >> n;
        Card1[i].mSuit = c;
        Card1[i].mValue = n;
        Card2[i].mSuit = c;
        Card2[i].mValue = n;

    }

    // バブルソートは安定ソート
    BubbleSort(Card1, N);
    SelectionSort(Card2, N);

    outputCardArr(Card1, N);
    cout << "Stable" << endl;

    outputCardArr(Card2, N);
    if(isStable(Card1, Card2,N)) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
   
}



Measured memory_bytes: 3092
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    int N, K;
    cin >> N >> K;
    vi D(K);
    vi ng(10);
    rep(i, K) {
        cin >> D[i];
        ng[D[i]] = 1;
    }

    for(int n = N;; ++n) {
        vi di;
        int x = n;
        bool ok = true;
        while(x > 0) {
            if(ng[x % 10]) {
                ok = false;
                break;
            }
            x /= 10;
        }
        if(ok) {
            cout << n << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
S = list(input())
T = list(input())

S1 = {}
for i, s in enumerate(S):
  if s in S1:
    S1[s].append(i)
  else:
    S1[s] = [i]
    
for str_key, keys in S1.items():
  t_str = []
  for k in keys:
    t_str.append(T[k])
  if len(set(t_str)) > 1:
    print('No')
    exit()
    
T1 = {}
for i, t in enumerate(T):
  if t in T1:
    T1[t].append(i)
  else:
    T1[t] = [i]
    
for str_key, keys in T1.items():
  s_str = []
  for k in keys:
    s_str.append(S[k])
  if len(set(s_str)) > 1:
    print('No')
    exit()
    
print('Yes')

Measured memory_bytes: 24096
#include<string>
#include<iostream>
#include<stdio.h>
#include<map>
using namespace std;
int main(){
    map<int,int> s;
    int i,n,a;
    scanf("%d\n",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        if(s[a]==0){
            s[a]=1;
        }
        else{
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
  return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repv(i,a,b) for(ll i=b-1;i>=a;i--)

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;}

int n,arr[100005];

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    int l=arr[0],r=arr[n-1];
    int cnt=0;
    for(int i=l;i<=r;i++)
    {
        int p=lower_bound(arr,arr+n,i)-arr;
        if(p==n-p) cnt++;
        // cout<<i<<" "<<p<<" "<<n-p<<" "<<cnt<<endl;
    }
    cout<<cnt<<endl;
}

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

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

int main()
{
    int N;
    cin >> N;
    unordered_map<int, int> list;
    for (int x = 1; x <= 100; x++)
        for (int y = 1; y <= 100; y++)
            for (int z = 1; z <= 100; z++)
                if (x * x + y * y + z * z + x * y + y * z + z * x <= N)
                    list[x * x + y * y + z * z + x * y + y * z + z * x]++;
    for (int i = 1; i <= N; i++)
        cout << list[i] << endl;
}

Measured memory_bytes: 4020
import java.util.Arrays;

public class Main {
  private static void solve() {
    int k = ni();
    int n = ni();

    int[] ret = new int[n];
    if (k % 2 == 0) {
      Arrays.fill(ret, k);
      ret[0] = k / 2;
    } else {
      Arrays.fill(ret, (k + 1) / 2);
      int last = n / 2;

      int ptr = n - 1;
      for (int i = 0; i < last; i++) {
        if (ret[ptr] == 1) {
          ret[ptr] = 0;
          ptr --;
        } else {
          ret[ptr] --;
          for (int j = ptr + 1;j < n; j ++) {
            ret[j] = k;
          }
          ptr = n - 1;
        }
      }
    }


    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < n; i++) {
      if (ret[i] == 0) break;
      sb.append(ret[i] + " ");
    }
    System.out.println(sb.substring(0, sb.length() - 1));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 54628
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>k>>n;
 ll a[n];
 for (int i = 0; i < n; ++i)
 {
 	cin>>a[i];
 c+=a[i];
 }
 if(c>=k)
{
	c("Yes");
}
else c("No");
  
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))

list = [0]*100000
for i in range(n):
  list[a[i]] += 1

ans = 0
for i in range(1,99999):
  sum = list[i-1]+list[i]+list[i+1]
  ans = max(sum, ans)
  
print(ans)

Measured memory_bytes: 20740
package main

import "fmt"

func main() {
	for {
	    var H, W int
		fmt.Scan(&H, &W)
		if H == 0 && W == 0 {
			break
		}
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				if i == 0 || i == H-1 || j == 0 || j == W-1 {
					fmt.Print("#")
				} else {
					fmt.Print(".")
				}
			}
			fmt.Println("")
		}
		fmt.Println("")
	}
}




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

using namespace std;

int main(){
  int n ;
  cin >> n;
  vector<long long> a(n);
  long long b = 0;
  for(int i = 0 ; i < n; i++){
    cin >> a[i];
    b += a[i]-1;
  }
  cout << b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b;
	cin >> a >> b;
	cout << (a <= b ? "unsafe" : "safe"); 
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef string::iterator state;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string pass;

string S;
int f(state &itr) {
    if(*itr == '[') {
        itr++;
        char operation = *itr;
        itr++;
        int a = f(itr);
        int b = f(itr);
        itr++;
        if(operation == '+') return a | b;
        if(operation == '*') return a & b;
        if(operation == '^') return a ^ b;
    }
    char moji = *itr;
    itr++;
    if(moji == 'a') return pass[0] - '0';
    if(moji == 'b') return pass[1] - '0';
    if(moji == 'c') return pass[2] - '0';
    if(moji == 'd') return pass[3] - '0';
}
int myhash;
int ans;
void g() {
    if(pass.size() == 4) {
        auto itr = S.begin();
        if(f(itr) == myhash) ans++;
        return;
    }
    for(char moji = '0'; moji <= '9'; moji++) {
        pass.push_back(moji);
        g();
        pass.pop_back();
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        cin >> S;
        if(S == ".") break;
        cin >> pass;
        state itr = S.begin();
        myhash = f(itr);
        ans = 0;
        pass = "";
        g();
        cout << myhash << " " << ans << endl;
    }
    return 0;
}



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

int n, m, k, b[200000];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m >> k;
	int sum = 0;
	set<pair<int, int>> rec;
	rec.insert(make_pair(0, 0));
	for(int i = 0; i < n; i++){
		int val;
		cin >> val;
		sum += val;
		rec.insert(make_pair(sum, i + 1));
	}
	auto it = rec.upper_bound({k, INT_MAX});
	it--;
	int mx = it -> second;
	for(int i = 0; i < m; i++){
		int val;
		cin >> val;
		if(k - val < 0) break;
		k -= val;
		it = rec.upper_bound({k, INT_MAX});
		it--;
		mx = max(mx, i + 1 + it -> second);
	}
	cout << mx << "\n";
	return 0;
}


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define MAXX 500005
#define INF INT_MAX

#define PI   3.14159265358979323846264338327950

#define PB push_back
#define PF push_front
#define F first
#define S second

#define fixx(n) fixed << setprecision(n)

#define ll 	 long long

#define mod  1000000007


int main()
{
	FAST;
	ll n;
	cin >> n;
	int ans = 0;
	ll p = 100;
	while(p < n){
		p += p/100;
		ans ++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
 

 
int main(void){
    int n;
    cin>>n;
    map<int,int>m;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        a--;
        m[i]=a;
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        if(m[m[i]]==i && i<m[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

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

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

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

    vector<ll> dep_ub(n);
    ll lb = a[n-1], ub = a[n-1];
    dep_ub[n-1] = ub;
    for(int i=n-2; i>=0; i--){
        lb = (lb + 1) / 2 + a[i];
        ub = ub + a[i];
        dep_ub[i] = ub;
    }

    if(!(lb <= 1 && 1 <= ub)){
        cout << -1 << endl;
        return 0;
    }

    ll cur = 1, ans = 1;
    for(int i=1; i<n; i++){
        cur = min(cur * 2, dep_ub[i]);
        ans += cur;
        cur -= a[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4524
#include<stdio.h>
int main()
{
    long long int N,i,C;
    int A[300000];
    scanf("%lld",&N);
    for(i=1;i<N;i++)
    {
        scanf("%lld",&C);
        A[C-1]++;
    }
    for(i=0;i<N;i++)
    {
        printf("%d\n",A[i]);
    }
    return 0;
}


Measured memory_bytes: 2512
n,x,y = map(int,input().split())

for i in range(1,n):
	ans = 0
	for j in range(1,n-i+1):
		if i+j <= x:
			ans += 1
			continue
		elif j >= y and i+j < n:
			ans += 1
			continue
		else:
			# x-j+1 = jからyまでの距離
			# y-i-j = yからi+j(目的地)までの距離
			#print(abs(x-j)+1+abs(y-i-j))
			if min(abs(x-j)+1+abs(y-i-j),i) == i:
				ans += 1
		num = i-(abs(x-j)+1)
		if num >= 0:
			d1 = y+num
			d2 = y-num
			if i+j < d1 and d1 <= n:
				ans += 1
			if i+j < d2 and d1 != d2:
				ans += 1
		#print(i,j,ans)
	print(ans)


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

int main() {
    int n,m;cin>>n>>m;
    int mx=0;
    for (int i=1;i*i<=m;i++)
        if (m%i==0) {
            int j=m/i;
            if (n<=i) {
                cout<<j<<endl;
                return 0;
            }
            if (n<=j)
                mx=i;
        }
    cout<<mx<<endl;
    return 0;
}

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

int main(){
  int A,B,ans,cnt;
  cin >> A >> B;
  ans=A+B;
  cnt=A-B;
  ans=max(ans,cnt);
  cnt=A*B;
  ans=max(ans,cnt);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
struct edge{ll from,to,cost;};
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,a,b,c;
    cin>>n>>m;
    ll d[n];
    bool maki[n];
    memset(maki,0,sizeof(maki));
    vector<edge> g;
    for(int i=1;i<n;i++)d[i]=1e18;
    d[0]=0;
    for(int i=0;i<m;i++){
        cin>>a>>b>>c;
        g.push_back({a-1,b-1,-c});
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(d[g[j].from]!=1e18&&d[g[j].to]>d[g[j].from]+g[j].cost){
                d[g[j].to]=d[g[j].from]+g[j].cost;
                if(i==n-1)maki[g[j].to]=true;
            }
        }
    }
    if(maki[n-1])cout << "inf"<<endl;
    else cout << -d[n-1] <<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,i,temp;
  cin>>n;
  string s;
  cin>>s;
  for(i=0;i<s.size();i++)
  {
      temp=s[i]-'A';
      temp=temp+n;
      temp=temp%26;
      s[i]=temp+'A';
  }
  cout<<s<<endl;
  return 0;
}


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

int main()
{

  int N;

  cin >> N;

  int j = 0;

  int count = 0;

  for (int i = N - 1; i > 0; i--)
  {
    j++;

    if (N == i + j && i != j)
    {
      count++;
    }
  }

  cout << count / 2 << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long k = sc.nextInt();
		long total = 0;
		for (long i = k; i <= n + 1; i++) {
		    long base = (n + n - i + 1) * i / 2 - (0 +  i - 1) * i / 2 + 1;
		    total += base;
		    total %= MOD;
		}
		System.out.println(total);
   }
}



Measured memory_bytes: 35760
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    string s, t;
    cin >> n >> s >> t;

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

    return 0;
}


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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++) cin >> s.at(i);
  vector<vector<int>> t(h, vector<int>(w + 1));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      t.at(i).at(j + 1) = t.at(i).at(j);
      if (s.at(i).at(j) == '1') t.at(i).at(j + 1)++;
    }
  }
  int ans = 10000;
  for (unsigned i = 0; i < (1 << (h - 1)); i++) {
    int step = __builtin_popcount(i), last = 0;
    for (int j = 0; j < w; j++) {
      bool good = true;
      int white = t.at(0).at(j + 1) - t.at(0).at(last);
      if (white > k) good = false;
      for (int l = 1; l < h; l++) {
        if (i & (1 << (l - 1))) {
          white = 0;
        }
        white += t.at(l).at(j + 1) - t.at(l).at(last);
        if (white > k) good = false;
      }
      if (not good) {
        if (j == last) {
          step = 10000;
        } else {
          last = j;
          step++;
        }
      }
    }
    ans = min(ans, step);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define f(i, n) for (int i=1; i <= n; i++)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  f(i,1000){
    int c = i*0.08;
    int d = i*0.1;
    if(a == c && b == d){
      cout << i << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  ll x,y;
  cin>>x>>y;
  ll ans=0;
  while(x<=y){
    x*=2;
    ans++;
  }
  cout<<ans<<endl;
}


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

using namespace std;

int main()
{

    string s, t;
    int c = 0;

    cin >> s >> t;

    int x = s.length();

    for (size_t i = 0; i < x; i++)
    {
        if(s[i] != t[i])
        {
            c++;
        }
    }
    
    cout << c;


    return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> inline void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int a,b,c;cin>>a>>b>>c;
  if(a+b+c>=22)puts("bust\n");
  else cout<<"win"<<endl;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

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

int H, M;
int B[51];
int a, b;

int main(){
    cin >> H >> M;
    for(int i = 1; i < M+1; i++){
        cin >> a >> b;
        B[a]++;
        B[b]++;
    }
    for(int i = 1; i < H+1; i++){
        cout << B[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
const int N = 105;
const int INF = 0x3f3f3f3f;
typedef long long ll;
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1


ll gcd(ll x, ll y) {
	if(y == 0) return x;
	else return gcd(y, x%y);
}
int main() {
	int T;
	scanf("%d", &T);
	while(T --) {
		ll A, B, C, D;
		scanf("%lld %lld %lld %lld", &A, &B, &C, &D);
		int fl = 1;
		if(fl && A >= B && D >= B) fl = 1;
		else fl = 0;

		ll backStep = D % B;
	//	printf("%lld\n", backStep);
		if(fl && C < B && backStep) {
			ll tt = gcd(backStep, B);
			
			ll x = A % B;
			x += (B - x - 1) / tt * tt;
		//	printf("%lld %lld\n", tt, x);
			if(x <= C && x + backStep >= B) fl = 1;
			else fl = 0;
		}
		if(fl && backStep == 0) {
			ll x = A % B;
			if(x <= C) fl = 1;
			else fl = 0;
		}

		if(fl) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A[100005],n,a,ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	sort(A+1,A+n+1);
	n/=2;
	printf("%d\n",A[n+1]-A[n]);
	return 0;
}

Measured memory_bytes: 640
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,10
def calc(d,n)
  s,x = S[d],0
  n = D-d  if n > D-d
  t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] }
  i = (0..25).max_by(n){t[_1]}
  i = n==1 ? i[0] : [i[0],i[n-1]].max_by {|i|
    l,L[i] = L[i],d
    c = t[i] + (calc(d+1,n-1) >> 5)
    L[i] = l
    x < c ? x=c : c
  }
  ((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

Measured memory_bytes: 15200
from collections import deque

N, *A = map(int, open(0).read().split())
V = N * (N - 1) // 2

serial = [[0 for _ in range(N)] for _ in range(N)]
k = 0
for i in range(N):
    for j in range(i + 1, N):
        serial[i][j] = serial[j][i] = k
        k += 1

G = [[] for _ in range(V)]
deg = [0] * V
for s, a in zip(serial, zip(*[iter(A)] * (N - 1))):
    for j in range(N - 2):
        G[s[a[j] - 1]].append(s[a[j + 1] - 1])
        deg[s[a[j + 1] - 1]] += 1

Q = deque((k, 1) for k, v in enumerate(deg) if v == 0)

ans = 0
cnt = len(Q)
while Q:
    v, ans = Q.popleft()
    for t in G[v]:
        deg[t] -= 1
        if deg[t] == 0:
            Q.append((t, ans + 1))
            cnt += 1

if cnt != V:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 148144
sx,sy, tx,ty = map(int, raw_input().split())
def f(sx,sy,tx,ty):
	path = ['D']
	path += ['R'] * (abs(tx - sx) + 1)
	path += ['U'] * (abs(ty - sy) + 1)
	path += ['L'] * (abs(tx - sx) + 1)
	path += ['D'] * (abs(ty - sy))
	return path

	
def g(sx,sy,tx,ty):
	path = []
	path += ['R'] * (abs(tx - sx))
	path += ['U'] * (abs(ty - sy) + 1)
	path += ['L'] * (abs(tx - sx)+1)
	path += ['D'] * (abs(ty - sy)+1) 
	return path + ['R']


print ''.join(f(sx,sy, tx,ty) + g(sx,sy,tx,ty))


Measured memory_bytes: 85548
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
	int a, b, i, ans, sum=0,c;
	scanf("%d%d", &a, &b);
	c = b - a;
	for (i = 1; i < c; i++){
		sum += i;
	}
	ans = sum - a;
	printf("%d", ans);



}


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

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a[3], k;
  cin >> a[0] >> a[1] >> a[2] >> k;

  int mx = -1, index = -1;
  REP(i,3){
    if(mx < a[i]){
      mx = a[i];
      index = i;
    }
  }

  llong ans = 0;
  REP(i,3){
    if(i == index){
      REP(j,k){
        a[i] *= 2;
      }
    }
    ans += a[i];
  }

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



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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define pi acos(-1.0)
#define eps 1e-8
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

lli n, W, ans, dp[105][1000005], w[105], v[105] ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    cin>> n >> W ;
    for(int i=1 ; i<=n ; i++) cin>> w[i] >> v[i] ;
    for(int j=1 ; j<=W ; j++)
      for(int i=1 ; i<=n ; i++)
        {
          dp[i][j]=max(dp[i-1][j], dp[i][j]) ;
          if(j-w[i]>=0) dp[i][j]=max({dp[i][j], dp[i-1][j-w[i]]+v[i]}) ;
          ans=max(dp[i][j], ans) ;
        }
    cout<< ans ;
  }


Measured memory_bytes: 286976
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,m,c[20],dp[50001],l,k,p=0;
  cin >>n>>m;
  for(int i=0;i<m;i++)
    cin >> c[i];

  for(int i=0;i<=n;i++){
    dp[i]=i;
    for(int j=0;j<m;j++){
      if(i-c[j]>=0){
	dp[i]=min(dp[i],dp[i-c[j]]+1); 
      }
    }
  }

  cout << dp[n]<<endl;
  return 0;
}

Measured memory_bytes: 1352