akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<bool>>;
const int MOD = 1e9 + 7;

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

    string s;
    int x, y;
    cin >> s >> x >> y;
    if (s.back() != 'T')
        s.push_back('T');

    bool v = false, ini = false;
    int cnt = 0;
    static bool reachable[2][16003], tmp[2][16003];
    reachable[1][8000] = true;
    for (int i = 0; i < s.length(); ++i) {
        if (s[i] == 'T') {
            if (!ini) {
                reachable[v][8000 + cnt] = true;
                ini = true;
            } else {
                for (int j = 0; j <= 16000; ++j) {
                    if (!reachable[v][j])
                        continue;
                    if (j - cnt >= 0)
                        tmp[v][j - cnt] = true;
                    if (j + cnt <= 16000)
                        tmp[v][j + cnt] = true;
                    reachable[v][j] = false;
                }
                swap(reachable[v], tmp[v]);
            }
            v ^= 1;
            cnt = 0;
            continue;
        }
        cnt++;
    }

    cout << (reachable[0][8000 + x] & reachable[1][8000 + y] ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;

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

    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    sort (arr, arr + n);

    int alice = 0;
    int bob = 0;
    if (n % 2 == 0)
    {
        for (int i = n - 1; i >= 0; i = i - 2)
        {
            alice = alice + arr[i];
            bob = bob + arr[i-1];
        }
    }
    else
    {
        for (int i = n - 1; i >= 0; i = i - 2)
        {
            alice = alice + arr[i];
            if (i != 0)
            {
                bob = bob + arr[i-1];
            }
            else
            {
                break;
            }
            
        }
    }
    
    cout << alice - bob <<endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int A,B,MAX;
scanf("%d",&A);
scanf("%d",&B);
if(A>=-100&&B<=100){
    if((A+B)>(A-B)&&(A+B)>(A*B)){
        MAX=A+B;
    }
    else if((A-B)>(A+B)&&(A-B)>(A*B)){
        MAX=A-B;
    }
    else if((A*B)>(A-B)&&(A*B)>(A+B)){
        MAX=A*B;
    }
}
printf("%d",MAX);
printf("\n");
}


Measured memory_bytes: 128
#include<iostream>
#include<stack>
using namespace std;
static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n,M[N][N];
int color[N],d[N],f[N],tt;
int nt[N];

int next(int u);
void dfs_visit(int r);
void dfs();

int main()
{
	int u,k,v;
	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			M[i][j] = 0;
		}
	}
	for(int i=0;i<n;i++){
		cin >> u >> k;
		u--;
		for(int j=0;j<k;j++){
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}
	
	dfs();
	return 0;
}

int next(int u)
{
	for(int v = nt[u];v<n;v++){
		nt[u] = v+1;
		if(M[u][v]) return v;
	}
	return -1;
}

void dfs_visit(int r)
{
	for(int i=0;i<n;i++) nt[i] = 0;
	stack<int> S;
	S.push(r);
	color[r] = GRAY;
	d[r] = ++tt;
	while(!S.empty()){
		int u = S.top();
		int v = next(u);
		if(v != -1){
			if(color[v]==WHITE){
				color[v] = GRAY;
				d[v] = ++tt;
				S.push(v);
			}
		}else{
			S.pop();
			color[u] = BLACK;
			f[u] = ++tt;
		}
	}
}

void dfs(){
	for(int i=0;i<n;i++){
		color[i] = WHITE;
		nt[i] = 0;
	}
	tt = 0;
	for(int u=0;u<n;u++){
		if(color[u] == WHITE) dfs_visit(u);
	}
	for(int i=0;i<n;i++){
		cout << i+1 << " " << d[i] << " " << f[i] << endl;
	}
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
using namespace std;

int solve(int n, const vector<int> & a) {
    multiset<int> fronts;  // of LISs
    REP_R (i, n) {
        auto it = fronts.upper_bound(a[i]);
        if (it != fronts.end()) {
            fronts.erase(it);
        }
        fronts.insert(a[i]);
    }
    return fronts.size();
}

int main() {
    int n; cin >> n;
    vector<int> a(n);
    REP (i, n) {
        cin >> a[i];
    }
    cout << solve(n, a) << endl;
    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
#define rad2deg(a) ((a)/M_PI * 180.0)
#define deg2rad(a) ((a)/180.0 * M_PI)
const std::string yes = "Yes";
const std::string no  = "No";

int main(){
    int n,q;
    std::cin >> n >> q;
    std::string s;
    std::cin >> s;
    std::vector<std::pair<int,int>> lr(q);
    rep(i,q){
        std::cin >> lr[i].first >> lr[i].second;
        lr[i].first--;
        lr[i].second--;
    }

    std::vector<int> ac(n+1,0);
    for(int i=0; i<s.size()-1; i++){
        if(s[i]=='A'&&s[i+1]=='C') ac[i+1]=ac[i]+1;
        else ac[i+1]=ac[i];
    }

    rep(i,q) std::cout << ac[lr[i].second] - ac[lr[i].first] << "\n";
    return 0;
}


Measured memory_bytes: 4528
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()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let input = read_vec::<i32>();
    let a = input[0];
    let b =input[1];
    let c = input[2];
    let ans  =if (a-c).abs() <= input[3] {
        "Yes".to_string()
    } else if (b- c ).abs() <= input[3] {
        if (a-b).abs() <= input[3]{
        "Yes".to_string()
        } else {
            "No".to_string()
        }
    } else {
        "No".to_string()
    };
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
    int H,W,i,j;
    while(true){
        cin>>H >>W;
        if(H==0&W==0){
            break;
        }
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                if(i==0||j==0||i==H-1||j==W-1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}



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

const int n = 4;
vector<int> a;
const int k = 7;
string ans = "";

void dfs(int i, int sum, string exp){
    if(i == n - 1){
        if(sum == k) ans = exp;
        return;
    }

    dfs(i + 1, sum + a[i + 1], exp + "+" + to_string(a[i + 1]));
    dfs(i + 1, sum - a[i + 1], exp + "-" + to_string(a[i + 1]));
}

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(0);
 
    string s;
    cin >> s;
    
    for(int i = n - 1; i >= 0; i--){
        a.push_back(s[i] - '0');
        s.pop_back();
    }
    reverse(a.begin(), a.end());
    
    dfs(0, a[0], to_string(a[0]));
    cout << ans + "=7" << endl;
}


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

int main() {
  int n, y;

  cin >> n >> y;

  for(int i = 0;i <= n;i++) {
    for(int j = 0;j <= n - i;j++) {
      int yen = i * 10000 + j * 5000 + (n - i - j) * 1000;
      if (yen == y) {
        cout << i << " " << j << " " << (n - i - j) << endl;
        return 0;
      }
    }
  }

  cout << -1 << " " << -1 << " " << -1 << endl;

}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		String s = getString(sc);
		String[] sa = s.split("");
		Arrays.sort(sa);

		boolean allDifferent = true;
		for (int i = 0; i < sa.length - 1; i++) {
			if (sa[i].equals(sa[i + 1])) {
				allDifferent = false;
				break;
			}

		}
		if (allDifferent) {
			System.out.println("yes");
		} else {
			System.out.println("no");
		}

	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

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

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

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

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

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

		return sc.next();
	}

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

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

}

class Status {
	long x;
	long tmpCoins;

	public Status(long x, long tmpCoins) {
		this.x = x;
		this.tmpCoins = tmpCoins;
	}
}


Measured memory_bytes: 23124
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
}

Measured memory_bytes: 21716
#include <cstdio>
using namespace std;
int main(void){
    
    int n;
    scanf("%d",&n);
    long long int a[n];
    int c1=0, c2=0;
    for(int i=0;i<n;i++){
      scanf("%lld",&a[i]);
      if(a[i] %2 == 1) c1++;
      else c2++;
    } 
    
    c2 += c1/2;
    c1 = c1 % 2;
    if(c1==0) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
using namespace std;

int main()
{
	int n, a;
	cin >> n >> a;
	if (n % 500 <= a) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;

#define fi first
#define se second
#define eb emplace_back
#define vec vector
#define all(x) x.begin(), x.end()
#define sign(x) max(-1, min(1, x))
#define die(x) { cout << (x); exit(0); }


int const N = 100 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;

int A, B, C, D, E, F;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  cin >> A >> B >> C >> D >> E >> F;

  vector<int> w(10240);
  vector<int> s(10240);

  w[A*100] = 1;
  w[B*100] = 1;
  for (int i = 0; i <= F; ++i) {
  	if(not w[i])
  		continue;
  	int x = i + 100 * A;
  	int y = i + 100 * B;
  	if(x <= F)
  		w[x] = 1;
  	if(y <= F)
  		w[y] = 1;
  }

  for (int i = F, last = F+10; i >= 0; --i) {
  	if(w[i])
  		last = i;
  	w[i] = last;
  }

  s[C] = 1;
  s[D] = 1;
  for (int i = 0; i <= F; ++i) {
  	if(not s[i])
  		continue;
  	int x = i + C;
  	int y = i + D;
  	if(x <= F)
  		s[x] = 1;
  	if(y <= F)
  		s[y] = 1;
  }

  int mass = 100*A;
  int best = 0;

  for (int i = F, last = F+10; i >= 0; --i) {
  	if(s[i])
  		last = i;
  	s[i] = last;
  }

  for(int i = 0; i <= F; ++i) {
  	for (int j = 0; j <= F; ++j) {
  		int x = w[i];
  		int y = s[j];

  		if(x+y <= F && 100*y <= x*E && y*mass > best*(x+y))
  			mass = x+y, best = y;
  	}
  }

  cout << mass << " " << best;
}

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

const int N = 2e5 + 10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    int ans = 0;
    for (int bit = 0; bit < 30; ++bit) {
        const int mod = 1 << (bit + 1), k = 1 << bit;
        vector<int> ta(n), tb(n);
        for (int i = 0; i < n; ++i) {
            ta[i] = a[i] & (mod - 1);
            tb[i] = b[i] & (mod - 1);
        }
        sort(tb.begin(), tb.end());
        int tot = 0;
        for (int i = 0; i < n; ++i) {
            [&]() {
                auto itl = lower_bound(tb.begin(), tb.end(), k - ta[i]);
                auto itr = upper_bound(tb.begin(), tb.end(), mod - ta[i] - 1);
                if (itl == tb.end() || itr == tb.begin()) return;
                if (itl >= itr) return;
                tot = (tot + (itr - itl)) % 2;
            }();
            [&]() {
                auto it = lower_bound(tb.begin(), tb.end(), mod - ta[i] + k);
                if (it == tb.end()) return;
                tot = (tot + (tb.end() - it)) % 2;
            }();
        }
        if (tot & 1) ans |= 1 << bit;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 6236
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int maxn=101;

int n,a[maxn];
vector<int> q,odd,eve;
vector<int> po[maxn*2],pe[maxn*2];
int to,te,s;
bool vis[maxn*2];
int match[maxn*2];

bool prime(int p)
{
	if (p<=2) return false;
	for(int i=2;i<=sqrt(p);i++)
		if (p%i==0) return false;
	return true;
}

bool calc(int p)
{
	for(int i=0;i<po[p].size();i++)
	{
		int nxt=po[p][i];
		if (vis[nxt]) continue;
		vis[nxt]=true;
		
		if (!match[nxt] || calc(match[nxt]))
		{
			match[nxt]=p;
			return true;
		}
	}
	return false;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	
	q.push_back(a[1]);
	for(int i=1;i<n;i++)
	{
		if (a[i]+1<a[i+1])
		{
			q.push_back(a[i]+1);
			q.push_back(a[i+1]);
		}
	}
	q.push_back(a[n]+1);
	
	odd.push_back(0);
	eve.push_back(0);
	for(int i=0;i<q.size();i++)
	{
		if (q[i]%2) odd.push_back(q[i]),to++;
		else eve.push_back(q[i]),te++;
	}
	
	for(int i=1;i<=to;i++)
	{
		for(int j=1;j<=te;j++)
		{
			if (prime(abs(odd[i]-eve[j])))
			{
				po[i].push_back(j);
				pe[j].push_back(i);
			}
		}
	}
	
	s=0;
	for(int i=1;i<=to;i++)
	{
		for(int j=1;j<=te;j++)
			vis[j]=false;
		if (calc(i)) s++;
	}
	
	int ans=s+((to-s)/2+(te-s)/2)*2+(to-s)%2*3;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>

#define INF 100000000

using namespace std;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int tmp, ans_tmp = 0, cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        tmp = i;
        ans_tmp = 0;
        for (int j = 0; j <= 4; j++)
        {
            ans_tmp += tmp % 10;
            tmp /= 10;
        }
        if (ans_tmp >= a && ans_tmp <= b)
            cnt += i;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

main(){
	int h, w, i, j;
	while(1){
		scanf("%d%d",&h,&w);
		
		if(h==0&&w==0)break;
		
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				printf("#");
			}
			printf("\n");
		}
		
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include<stdio.h>
int main(){
  int c,max=0;
  scanf("%d",&c);
  int V[c],C[c];
  for(int i=0;i<c;i++){
    scanf("%d",&V[i]);
  }
  for(int i=0;i<c;i++){
    scanf("%d",&C[i]);
  }
  for(int i=0;i<c;i++){
    if((V[i]-C[i]) > 0){
      max += (V[i]-C[i]);
    }
  }
  printf("%d\n",max);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int e;
	while (cin >> e) {
		if (e == 0)break;
		int m = (int)MOD;
		for (int i = 0; i <= 1000; i++) {
			for (int j = 0; j <= 100; j++) {
				if (i*i + j * j*j <= e) {
					m = min(m, i + j + e - i * i - j * j*j);
				}
			}
		}
		cout << m << endl;
	}
	return 0;
}



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

int main(){
	int N, M;
	cin >> N >> M;
	vector<vector<int>> R;
	for(int i=0;i<N;i++){
		vector<int> X;
		R.push_back(X);
	}
	for(int i=0;i<M;i++){
		int A, B;
		cin >> A >> B;
		A--;
		B--;
		R[A].push_back(B);
		R[B].push_back(A);
	}
	int mark[N];
	for(int i=0;i<N;i++){
		mark[i] = -1;
	}
	mark[0] = 0;
	queue<int> que;
	que.push(0);
	while(!que.empty()){
		int P = que.front();
		que.pop();
		for(int i=0;i<(int)R[P].size();i++){
			if(mark[R[P][i]] == -1){
				que.push(R[P][i]);
				mark[R[P][i]] = P;
			}
		}
	}
	cout << "Yes" << endl;
	for (int i=1;i<N;i++){
		cout << mark[i] + 1 << endl;
	}
}
	

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

int main() {
	int a[11], i;
	while (1){
		i = 1;
		cin >> a[0];
		if(a[0] == 0){break;}
		while (1){
			cin >> a[i];
			a[0] = a[0] - a[i];
			if (i == 9){break;}
			if (a[0] == 0){break;}
			i++;		
		}
		cout << a[0] << endl;
	}
}


Measured memory_bytes: 2988
#include <bits/stdc++.h>
using namespace std;
const long INF = 1000000000;
int main() {
    int n,k; cin >> n >> k;
    vector<long> h(n);
    for(int i = 0; i < n; i ++) cin >> h[i];
    vector<long> dp(n, INF);
    dp[0] = 0;
    for(int i = 1; i < n; i ++) {
        for(int j = 1; j <= min(i,k); j ++) {
            dp[i] = min(dp[i],abs(h[i]-h[i-j]) + dp[i-j]);
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4744
#include<bits/stdc++.h>
#define ll               long long int
#define fi           first
#define se            second
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}

int main()
{
     fast;
     int t=1;
      // cin>>t;
     while(t--)
     {
         ll n,i,a,b,k,j,c=0,d=0,sum=0,ans=0;
        string s,s1;
        cin>>s>>s1;
        n=s1.size();
        for(i=0;i<n-1;i++)
        {
            if(s[i]==s1[i])
                c++;
            else d++;
        }

    if(d==0)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

     }

   return 0;
}



Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 15;
int inf = 0x3fffffff;
int dist[N][N];

int main(void){
  int n;
  while(cin >> n) {
    int nt = 0;
    if (n == 0) { break; }
    REP(i, 0, N) {
      REP(j, 0, N) {
	dist[i][j] = i == j ? 0 : inf;
      }
    }
    REP(i, 0, n) {
      int a, b, c;
      cin >> a >> b >> c;
      nt = max(nt, max(a, b) + 1);
      dist[a][b] = min(dist[a][b], c);
      dist[b][a] = min(dist[b][a], c);
    }
    REP(k, 0, nt) {
      REP(i, 0, nt) {
	REP(j, 0, nt) {
	  dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	}
      }
    }
    int mi = inf, mini = -1;
    REP(i, 0, n) {
      int tot = 0;
      REP(j, 0, nt) {
	tot += dist[i][j];
      }
      if (mi > tot) {
	mi = tot;
	mini = i;
      }
    }
    cout << mini << " " << mi << endl;
  }
}

Measured memory_bytes: 3112
def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def main():
    n = int(input())
    f1 = divisors(n)
    f2 = factorization(n-1)
        
    s = 1
    for f_i in f2:
        s *=(f_i[1]+1)

    for d in f1[1:]:
        t = test(n,d)
        if t==1:
            s+=1

    print(s-1)
    

def test(n,k):

    while n>=k:
        if n%k==0:
            n//=k
        else:
            n%=k
    return n



if __name__ == "__main__":
    main()

Measured memory_bytes: 14100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
int inf=100000000;
ll INF=5000000000000000000;
ll MOD=1000000007;

ll mpow(ll x, ll n){
ll ans = 1;
while(n != 0){
if(n&1) ans = ans*x % MOD;
x = x*x % MOD;
n = n >> 1;
}
return ans;
}
ll kj(ll x){
ll s = 1;
for(ll i = 1; i <= x; i++){
s = s * i % MOD;
}
return s;
}
ll combination(ll a, ll b){
if(a == 0 && b == 0) return 1;
if(a < b || a < 0) return 0;
return (kj(a) * mpow(kj(b), MOD-2) % MOD) * mpow(kj(a-b), MOD-2) % MOD;
}

int main() {
    ll n,m,k;
    cin >> n >> m >> k;
    vector<vector<ll>> a(n+1,vector<ll>(m+1));
    for (ll i=1;i<n+1;i++){
        for (ll j=1;j<m+1;j++){
            a.at(i).at(j)=(((((i-1)*i)/2%MOD+((n-i)*(n-i+1))/2%MOD)*m)%MOD+((((j-1)*j)/2%MOD+((m-j)*(m-j+1))/2%MOD)*n)%MOD)%MOD;
            //cout << a.at(i).at(j) << " ";
        }
        //cout << endl;
    }
    ll ans=0;
    ll u=combination(n*m-2,k-2);
    for (int i=1;i<n+1;i++){
        for (int j=1;j<m+1;j++){
            ans=(ans+a.at(i).at(j)*u%MOD)%MOD;
        }
    }
    ans=ans*mpow(2,MOD-2)%MOD;
    cout << ans << endl;
}


Measured memory_bytes: 11136
/*Saurav Paul*/
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define boost		          ios_base::sync_with_stdio(0);
#define eb                    emplace_back
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1e9+7
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);

using namespace std;
///////////////////////

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef PAUL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define dbg(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif

////////////////////////

template<typename T>T set_bit(T N,T pos){return N=N | (1<<pos);}
template<typename T>T reset_bit(T N,T pos){return N= N & ~(1<<pos);}
template<typename T> bool check_bit(T N,T pos){return (bool)(N & (1<<pos));}
template<typename T>void bin_print(T N){bitset<25>bit(N);cerr<<bit.to_string()<<"\n";}
template<typename T> void max_self(T &a, T b){
	a=max(a,b);
}
template <typename T > void min_self(T &a, T b){
	a=min(a,b);
}
template <typename T > void add_self(T &a, T b){
	a+=b;
}
////////////////////////

template<typename T> void ara_read(T &v,ll n){
	ll temp;
	for(ll i=0; i< n; i++){
		scanf("%lld",&temp);
		v.emplace_back(temp);
	}
}
template<typename T> void ara_print(T &v){
	for(ll x : v)
		printf("%lld ",x);
	puts("");
}
////////////////////////
const int INF = 1e9 + 99;
typedef pair<int,int> Pair;
typedef vector<int> vec;;


int main()
{
	
	string s;
	cin >> s;
	sort(all(s));
	if(s[0]==s[1] && s[2]==s[3] && s[1]!=s[2])
		puts("Yes");
	else
		puts("No");
	
    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>

int main(void)
{
	double x1,y1,x2,y2,x3,y3,xp,yp,p,q;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) !=EOF)
	{
		if(x1==0&&y1==0)
		{
		}
		else
		{
			x2-=x1;
			x3-=x1;
			xp-=x1;
			y2-=y1;
			y3-=y1;
			yp-=y1;
			x1=0;
			y1=0;
		}

		p=(y2*xp-x2*yp)/(x3*y2-x2*y3);
		q=(y3*xp-x3*yp)/(x2*y3-x3*y2);
		
		double w=p+q;
		
		if(p>=0&&q>=0&&w<1)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

int getMaxVlue(int [][2], int , int );

int main(){

  int n,w;
  scanf("%d%d",&n,&w);
  int data[n+1][2];
  for(int i=1;i<=n;i++)
    scanf("%d%d",&data[i][0],&data[i][1]);
  printf("%d\n",getMaxVlue(data,n,w));

  return 0;
}

int getMaxVlue(int data[][2], int n, int w)
{

  int dp[n+1][w+1];
  for(int i=0;i<=w;i++)
    dp[0][i]=0;
  for(int i=0;i<=n;i++)
    dp[i][0]=0;

  for(int i=1;i<=n;i++){
    for(int j=1;j<=w;j++){
      if(j-data[i][1]>=0)
        dp[i][j]=max(dp[i-1][j],dp[i-1][j-data[i][1]]+data[i][0]);
      else
	dp[i][j]=dp[i-1][j];
    }
  }
  return dp[n][w];
}

Measured memory_bytes: 4964
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << max({A, B, C}) - min({A, B, C}) << endl;
  return 0;
}

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

ll INF = 1e+18;

int 
main()
{
  int N, K; cin >> N >> K;
  vector<int> m(N + 1);
  int kind = 0;
  rep(i, 1, N + 1){
    int tmp; cin >> tmp;
    m[tmp] += 1;
    if(m[tmp] == 1) ++kind;
  }

  int ans = 0;
  m.erase(remove(m.begin(), m.end(), 0), m.end());
  sort(m.begin(), m.end());
  rep(i, 0, kind - K){
    ans += m[i];
  }

  cout << ans << endl;

}

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

using namespace std;

typedef long long ll;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	double a,b,x;
	cin >> a >> b >> x;
	double y = 2*x/(a*a) - b;
	double t = a/(b-y);
	if(x<a*a*b/2) t = 2*x/(a*b*b);
	printf("%lf\n",90.0-atan(t)*(180/M_PI));

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 105;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, m;
char ans[MAXN][MAXN];
int main() {
	read(n), read(m);
	for (int i = 1; i <= 50; i++)
	for (int j = 1; j <= 100; j++)
		ans[i][j] = '.';
	for (int i = 51; i <= 100; i++)
	for (int j = 1; j <= 100; j++)
		ans[i][j] = '#';
	for (int i = 1; i <= m - 1; i++) {
		int r = i / 98 * 4, c = i % 98;
		if (c == 0) c += 98, r -= 4;
		if (c % 2 == 0) r += 2;
		else r += 3;
		ans[r][c + 1] = '#';
	}
	for (int i = 1; i <= n - 1; i++) {
		int r = i / 98 * 4, c = i % 98;
		if (c == 0) c += 98, r -= 4;
		if (c % 2 == 0) r += 2;
		else r += 3;
		ans[100 - r + 1][c + 1] = '.';
	}
	printf("%d %d\n", 100, 100);
	for (int i = 1; i <= 100; i++)
		printf("%s\n", ans[i] + 1);
	return 0;
}

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

using namespace std;

typedef pair<int, int> II;

#define bit(x, i) ((x >> i) & 1)

int L;
int n, r;
vector<pair<II, int>> edge;

int main()
{
    cin >> L;
    r = log2(L);
    n = r + 1;
    for (int i = 1; i < n; i++)
    {
        edge.push_back(make_pair(II(i, i+1), 0));
        edge.push_back(make_pair(II(i, i+1), 1 << (i-1)));
    }

    for (int i = 0; i < r; i++)
    {
        if (bit(L, i))
        {
            L -= (1 << i);
            edge.push_back(make_pair(II(i+1, n), L));
        }
    }
    cout << n << ' ' << edge.size() << '\n';
    for (int i = 0; i < edge.size(); i++)
    {
        cout << edge[i].first.first << ' '<< edge[i].first.second << ' ' << edge[i].second << '\n';
    }
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))
d = {}
d[1]=0
d[2]=abs(h[1]-h[0])
for i in range(3,N+1):
  d[i]=min(abs(h[i-1]-h[i-2])+d[i-1],abs(h[i-1]-h[i-3])+d[i-2])
print(d[N])

Measured memory_bytes: 23232
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	m := make([]string, n)
	for i := range m {
		fmt.Scan(&m[i])
	}

	hinaArare := make(map[string]struct{})
	for _, v := range m {
		hinaArare[v] = struct{}{}
	}

	if len(hinaArare) == 3 {
		fmt.Println("Three")
	} else {
		fmt.Println("Four")
	}
}


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

using namespace std;

int main(void) {
  vector<int> a;
  int b;
  std::cin >> b;
  a.push_back(b);
  cin >> b;
  a.push_back(b);
  cin >> b;
  a.push_back(b);
	if (a[2] == a[0] && a[0] == a[1]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
  return 0;
}

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

int main()
{
	for(int i = 1; i <= 9; i++)
	{
		for(int j = 1; j <= 9; j++)
		{
			printf("%dx%d=%d\n", i,j,i*j);
		}
	}

	return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


int solve(){

    string s;cin>>s;
    for(auto i:s) if(i=='7') return cout<<"Yes\n",0;
        cout<<"No"<<endl;


    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        final int inputNum = scan.nextInt();
        int[] values = new int[inputNum];
        float math = (float)0.0;
        for(int i = 0; i < inputNum; i++){
            values[i] = scan.nextInt();
        }
        for(int i = 0; i < inputNum; i++){
            math += (float)1 / values[i];
        }
        System.out.println((float)1 / math);
        
        scan.close();
    }
  
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=510;
int n,d[maxn][maxn];
void solve(vector<int> a,int tot) {
	if (a.size()<=1) return;
	for (int i=0;i<a.size();i++)
	for (int j=i+1;j<a.size();j+=2)
		d[a[i]][a[j]]=tot;
	vector<int> b; b.clear();
	for (int i=0;i<a.size();i+=2) b.push_back(a[i]);
	solve(b,tot+1); b.clear();
	for (int i=1;i<a.size();i+=2) b.push_back(a[i]);
	solve(b,tot+1);
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	vector<int> a; a.clear();
	for (int i=1;i<=n;i++) a.push_back(i);
	solve(a,1);
	for (int i=1;i<n;i++) {
		for (int j=i+1;j<=n;j++) printf("%d ",d[i][j]);
		printf("\n");
	}
	return 0;
}

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

typedef pair<int, int>P;

P tree[524300];
void update(int id, int d, int l, int r, int a, int b){
    int L = (id<<d) - 262144;
    int R = (id<<d) + (1<<d) - 1 - 262144;
    if(r < L || R < l)return;
    if(l<=L && R<=r){
        if(tree[id].first==0){
            tree[id].first = a;
            tree[id].second = b;
            //cout<<L<<" "<<R<<" -> "<<tree[id].first<<" "<<tree[id].second<<endl;
        }
        else if(tree[id].second+1==a){
            tree[id].second = b;
            //cout<<L<<" "<<R<<" -> "<<tree[id].first<<" "<<tree[id].second<<endl;
        }
        else{
            tree[id] = P(999999, 999999);
            //cout<<L<<" "<<R<<" -> "<<tree[id].first<<" "<<tree[id].second<<endl;
        }
    }
    else if(tree[id].first==999999){

    }
    else if(tree[id].first==0){
        update(id*2, d-1, l, r, a, b);
        update(id*2+1, d-1, l, r, a, b);
    }
    else{
        update(id*2, d-1,L,R,tree[id].first,tree[id].second);
        update(id*2+1, d-1,L,R,tree[id].first,tree[id].second);
        tree[id].first = 0;
        tree[id].second = 0;
        //cout<<L<<" "<<R<<" -> "<<tree[id].first<<" "<<tree[id].second<<endl;
        update(id*2, d-1, l, r, a, b);
        update(id*2+1, d-1, l, r, a, b);
    }
}

P check(int id, P p){
    if(id==0)return p;
    if(tree[id].first!=0){
        //cout<<tree[id].first<<" "<<tree[id].second<<endl;
        if(p.first==0){
            p=tree[id];
        }
        else if(p.second+1==tree[id].first){
            p.second=tree[id].second;
        }
        else{
            p = P(999999, 999999);
        }
    }
    return check(id/2, p);
}

int main(){
    int N, K, T;
    cin>>N>>K>>T;
    for(int i=0;i<T;i++){
        int l, r, x;
        cin>>l>>r>>x;
        update(1, 18, l, r, x, x);
    }
    int ans = 0;
    for(int i=1;i<=N;i++){
        P p = check(262144+i, P(0, 0));
        //cout<<i<<" : "<<p.first<<" "<<p.second<<endl;
        if(p.first==1 && p.second==K)ans++;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 6148
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a*b%2?"Odd":"Even") << endl;
}


Measured memory_bytes: 3048
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int x,y,z;cin >> x >> y >> z;
  cout << z << ' ' << x  << ' '<< y << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, k: usize,
        h: [i64; n],
    }
    let mut h = h;
    h.sort();
    let s: i64 = h[..n - min(n, k)].iter().sum();
    puts!("{}\n", s);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 10620
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()

using namespace std;

int main()
{
    IOS;
    map<char,int> mp;
    set<char> st;
    string s;
    cin>>s;
    repf(i,0,s.length())
    {
        st.insert(s[i]);
        mp[s[i]]++;
    }
    if(st.size()==2 && mp[*st.begin()]==2 && mp[*st.rbegin()]==2)
    {
        cout<<"Yes\n";
    }
    else cout<<"No\n";

}
 

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

using namespace std;

int main(){
    int N;cin>>N;
    vector<int>asiba(N);

    for(int i = 0; i < N; i++){
        cin>>asiba[i];
    }

    vector<int>cost(N,INT_MAX);
    cost[0] = 0;

    for(int i = 0; i < N -1; i++){
        if(i + 2 < N){
            cost[i+2] = min(cost[i+2], cost[i]+abs(asiba[i+2]- asiba[i]) );
        }
        cost[i + 1] = min(cost[i + 1], cost[i] + abs(asiba[i+1] - asiba[i]));
    }

    cout<<cost[N-1]<<endl;
}

Measured memory_bytes: 1024
import bisect
N,M,K=map(int,input().split())
SumA=[0]*(N+1)
SumB=[0]*(M+1)
A=list(map(int, input().split()))
B=list(map(int,input().split()))
for i in range(1,N+1):
    SumA[i]= A[i-1]+SumA[i-1]
for i in range(1,M+1):
    SumB[i] = B[i-1]+SumB[i-1]

ans = 0
for i in range(N+1):
    num = i
    rest = K-SumA[i]
    if rest<0:
        break;
    num += bisect.bisect_right(SumB, rest)-1
    ans = max(num, ans)

print(ans)



Measured memory_bytes: 49080
/* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod (int)(1e9+7)
#define MAXI (int)(1e17+100)
#define N 100005


// Driver code to test above functions
int32_t main()
{
    
 
   
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    //srand(time(0));

    int n;
    cin >> n;
    cout << n/2 + (n%2!=0);

    return 0;
    
} 



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

int main(){
    int N;
    int d[110];
    int num[110] = {0};
    int count = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> d[i];
    }
    for(int i = 0; i < N; i++){
        num[d[i]]++;
    }
    for(int i = 0; i < 110; i++){
        if(num[i] > 0){
            count++;
        }
    }
    cout << count << endl;

return 0;
}


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


int main(){
	int N, W, H, S, T;
	while( cin >> N, N ){
		int m[101][101] = {0};
		int ans=0;

		cin >> W >> H;
		for(int i=0 ; i < N ; i++ ){
			int x,y;
			cin >> x >> y;
			m[y-1][x-1] = 1;
		}
		cin >> S >> T;
		for(int y=0 ; y < H ; y++ ){
			for(int x=0 ; x < W ; x++ ){
				int num=0;
				if( x+S <= W && y+T <= H ){
					for(int my=y ; my < y+T ; my++ ){
						for(int mx=x ; mx < x+S ; mx++ ){
							num += m[my][mx];
						}
					}
				}
				ans = max( ans , num );
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h> 
#define ll long long 
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
using namespace std;  

int main()
{
   string s;
    cin>>s;
    stack <char> x;
    vector<char> v ;
    for(ll i=0;i<s.size();i++){
        if(s[i]!='B'){
            x.push(s[i]);
        }
        else{
            if(!x.empty()){
                x.pop();
            }
        }
    }
    
    while(!x.empty()){
        v.push_back(x.top());
        x.pop();
    }

    reverse(v.begin(),v.end());
    for(auto z : v){
        cout<<z;
    }
    return 0;
}



   

Measured memory_bytes: 3592
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  string S;
  int Cplace;
  int c = 0;
  cin >> S;
  bool flag = true;
  if(S[0] == 'A'){
    for(int i = 2; i < S.size() - 1; i++){
      if(S[i] == 'C'){
         c++;
         Cplace = i;
      }
    }
    if(c == 1){
      for(int i = 1; i < S.size(); i++){
        if(i != Cplace){
          if( 'a' <= S[i] && S[i] <= 'z'){
            continue;
          }else{
            flag = false;
          }
        }
      }
    }else{
      flag = false;
    }
  }else{
    flag = false;
  }
  if(flag) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

def main():
    N, K = map(int, input().split())
    A = [a for a in input().split()]
    L = defaultdict(int)

    for i in range(N):
        L[A[i]] += 1

    L = sorted(list(L.items()), key= lambda x : x[1], reverse = True)
    
    cnt = 0
    typ = 0

    for i in range(len(L)):
        typ += 1
        if typ > K:
            pair = L[i]
            cnt += pair[1]
    
    print(cnt)
if __name__ == "__main__":
    main()

Measured memory_bytes: 45688