akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{

	long a, b;
	char op;
	long ans;


	for (;;) {
		scanf("%ld %c %ld", &a, &op, &b);

		if (op == '?') { break; }

		if (op == '+') {
			ans = a + b;
		}
		else if (op == '-') {
			ans = a - b;
		}
		else if (op == '*') {
			ans = a * b;
		}
		else if (op == '/') {
			ans = a / b;
		}

		printf("%ld\n", ans);

	}

	return 0;
}

Measured memory_bytes: 600
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines.shift().split(/\s/).map((v) => v - 0)[0];
    let H = lines.shift().split(/\s/).map((v) => v - 0);
    let ans = 1, max = H[0];
    for (let n = 1; n < N; n++) {
        if (H[n-1] <= H[n] && H[n] >= max) ans++;
        if (max < H[n]) max = H[n];
    }
    console.log(ans);
}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main()
{
  int n;
  cin >> n;
  vector<string> s(n);
  int count = 0;
  int i, j;
  int alast = 0;
  int b1st = 0;
  int atob = 0;
  for(i = 0; i < n; i++)
  {
    cin >> s.at(i);
    if(s.at(i).at(0) == 'B' && s.at(i).at(s.at(i).length()-1) == 'A')
    {
      atob++;
    }
    else
    {
      if(s.at(i).at(s.at(i).length()-1) == 'A')
      {
        alast++;
      }
      if(s.at(i).at(0) == 'B')
      {
        b1st++;
      }
    }
    for(j = 1; j < s.at(i).length(); j++)
    {
      if(s.at(i).at(j-1) == 'A' && s.at(i).at(j) == 'B')
      {
        count++;
      }
    }
  }
  if(atob > 0 && alast == 0 && b1st == 0)
  {
    count += atob - 1; 
  }
  else
  {
    count += min(atob+alast, atob+b1st);
  }
  cout << count << endl;
}

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

int main(){
	int n, m; cin >> n >> m;
	bool used[n] = {1};
	vector<int> v[n];
	for(int i = 0; i < m; ++i){
		int a, b; cin >> a >> b;
		--a; --b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	deque<int> ans;
	int po = 0, yo = v[0][0];
	ans.push_front(po);
	ans.push_back(yo);
	used[yo] = 1;
	while(1){
		bool update = 0;
		for(int sina : v[po]){
			if(update) break;
			if(!used[sina]){
				po = sina;
				used[sina] = 1;
				ans.push_front(sina);
				update = 1;
			}
		}
		for(int sina : v[yo]){
			if(update) break;
			if(!used[sina]){
				yo = sina;
				used[sina] = 1;
				ans.push_back(sina);
				update = 1;
			}
		}
		if(!update) break;
	}
	cout << ans.size() << endl;
	while(ans.size()){
		cout << ans.front() + 1 << " ";
		ans.pop_front();
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 6784
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())

using ll=long long;
using ld=long double;
typedef pair<int,int> P;
#define INF 10101010

int main()
{
    string A,B,C;
    cin >> A;
    cin >> B;
    cin >> C;
    queue<char> A_q,B_q,C_q;

    rep(i,A.size()){
        A_q.push(A[i]);
    }
    rep(i,B.size()){
        B_q.push(B[i]);
    }
    rep(i,C.size()){
        C_q.push(C[i]);
    }
    char c='a';
    while(c!='e'){
        
        switch(c){
            case 'a':
                    
                if(A_q.empty()){
                    cout << 'A' << endl;
                    c='e';
                    break;
                }
                c=A_q.front();
                A_q.pop();

                break;
            case 'b':
                if(B_q.empty()){
                    cout << 'B' << endl;
                    c='e';
                    break;
                }
                c=B_q.front();
                B_q.pop();

                break;
            case 'c':
                if(C_q.empty()){
                    cout << 'C' << endl;
                    c='e';
                    break;
                }
                c=C_q.front();
                C_q.pop();

                break;
            defalut:
                break;
        }
    }
}

Measured memory_bytes: 256
def examA():
    R = I(); G = I()
    ans = G + (G-R)
    print(ans)



import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


Measured memory_bytes: 4036
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String S = br.readLine();
			String output = "consonant";
			if (S.equals("a") || S.equals("e") || S.equals("i") || S.equals("o") || S.equals("u")) {
				output = "vowel";
			}
			System.out.println(output);
		} catch (Exception e) {
			System.err.println("Error:" + e.getMessage());
		}
	}

}


Measured memory_bytes: 8148
require 'set'

def get_ints
  gets.split.map(&:to_i)
end

def get_int
  gets.chomp.to_i
end

MOD = 1000000007

params = []

N = get_int

premise = Hash.new(0)
additional = 0
result = 1

N.times do
  a, b = get_ints

  if a == 0 && b == 0
    additional += 1
  elsif a == 0
    premise[[0, -1]] += 1
  elsif b == 0
    premise[[1, 0]] += 1
  else
    gcd = a.gcd(b)
    a /= gcd
    b /= gcd

    if a < 0
      a *= -1
      b *= -1
    end

    premise[[a, b]] += 1
  end
end

premise.each do |(a, b), count|
  pair = b < 0 ? [-b, a] : [b, -a]
  pair_count = premise[pair]
  premise.delete(pair)

  result *= (2 ** count - 1) + (2 ** pair_count - 1) + 1
  result %= MOD
end

puts (result + additional - 1) % MOD


Measured memory_bytes: 34188
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, K;
int P[202020];

int lr[202020];

i64 modpow(i64 a, int p, i64 mod)
{
	if (p == 0) return 1;
	i64 ret = modpow(a, p / 2, mod);
	ret = ret * ret % mod;
	if (p % 2 == 1) ret = ret * a % mod;
	return ret;
}

i64 lhash[2][202020];
i64 mods[] = { 1000000007, 1000000009 };
i64 pows[2][202020];
i64 val[2][202020];

struct segtree
{
	static const int DEPTH = 18;
	static const int N = 1 << DEPTH;

	int val[2 * N], t;

	segtree(int ty) {
		t = ty;
		fill(val, val + 2 * N, t == 0 ? -1 : 10000000);
	}
	void update(int p, int v) {
		p += N;
		val[p] = v;
		p >>= 1;
		while (p) {
			if (t == 0) val[p] = max(val[p * 2], val[p * 2 + 1]);
			else  val[p] = min(val[p * 2], val[p * 2 + 1]);
			p >>= 1;
		}
	}
	int query(int L, int R) {
		L += N;
		R += N;
		int ret = (t == 0 ? -1 : 10000000);
		while (L < R) {
			if (t == 0) {
				if (L & 1) ret = max(ret, val[L++]);
				if (R & 1) ret = max(ret, val[--R]);
			} else {
				if (L & 1) ret = min(ret, val[L++]);
				if (R & 1) ret = min(ret, val[--R]);
			}
			L >>= 1; R >>= 1;
		}
		return ret;
	}
};

segtree segmin(1), segmax(0);

int main()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; ++i) scanf("%d", P + i);
	for (int i = 0; i < N; ++i) {
		segmin.update(i, P[i]);
		segmax.update(i, P[i]);
	}

	for (int i = 0; i < N - 1; ++i) lr[i] = (P[i] < P[i + 1]) ? 0 : 1;

	for (int t = 0; t < 2; ++t) {
		pows[t][0] = 1;
		for (int i = 0; i <= 200010; ++i) {
			pows[t][i + 1] = pows[t][i] * 2 % mods[t];
		}
		lhash[t][0] = 0;
		for (int i = 0; i < N - 1; ++i) {
			lhash[t][i + 1] = (lhash[t][i] + pows[t][i] * lr[i]) % mods[t];
		}
		for (int i = 0; i <= N - K; ++i) {
			int mx = segmax.query(i, i + K);
			int mn = segmin.query(i, i + K);
			val[t][i] = (lhash[t][max(0, i - 1)] + (lhash[t][N - 1] - lhash[t][min(N - 1, i + K)] + mods[t])) % mods[t];
			if (i != 0) {
				//if (P[i - 1] > P[i]) val[t][i] = (val[t][i] + mods[t] - pows[t][i - 1]) % mods[t];
				if (P[i - 1] > mn) val[t][i] = (val[t][i] + pows[t][i - 1]) % mods[t];
			}
			if (i != N - K) {
				//if (P[i] > P[i + 1]) val[t][i] = (val[t][i] + mods[t] - pows[t][i + K - 1]) % mods[t];
				if (mx > P[i + K]) val[t][i] = (val[t][i] + pows[t][i + K - 1]) % mods[t];
			}
			//printf("%d %d: %lld %lld\n", t, i, val[t][i], mods[t]);
		}
		//printf("%lld\n", lhash[t][N - 1]);
	}
	vector<pair<i64, i64>> aa;
	for (int i = 0; i <= N - K; ++i) aa.push_back({val[0][i], val[1][i]});
	sort(aa.begin(), aa.end());
	aa.erase(unique(aa.begin(), aa.end()), aa.end());

	printf("%d\n", (int)aa.size());
	return 0;
}


Measured memory_bytes: 21104
n = gets.to_i
t = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
max_h,min_h = 2.times.map{Array.new(n,1)}
min_h[0],min_h[-1] = t[0],a[-1]
max_t,max_a = 0,0
ans = 0
$mod = 10**9+7
f = true
for i in 0..n-1
  max_h[i] = t[i] < a[i] ? t[i] : a[i]
end
for i in 1..n-1
  min_h[i] = t[i] if t[i] != t[i-1]
  min_h[-i-1] = a[-i-1] if a[-i-1] != a[-i]
end
for i in 0..n-1
  max_t = max_h[i] if max_t < max_h[i]
  max_a = max_h[-i-1] if max_a < max_h[-i-1]
  f = false if max_t != t[i] || max_a != a[-i-1]
end
if f
  ans = 1
  for i in 0..n-1
    ans *= max_h[i]-min_h[i]+1
    ans %= $mod
  end
end
puts ans

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int bf(ll x){
    if (x<10 || x%2!=0) return 0;
    return bf(x-2) + (x%10==0?1:0);
}

ull better(ull x){
    if (x<10 || x%2!=0) return 0;
    ull d=10;
    ull ret=0;
    while(x>=d) {
        ret += x/d;
        d *= 5;
    }
    return ret;
}
int main() {
    READ(1);
    ull x;cin>>x;
    cout << better(x);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLL = vector<PLL>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();
const unsigned long long int ULLINF = numeric_limits<unsigned long long int>::max();

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

    LL n; cin >> n;
    map<char, LL> mp;
    vector<char> v(n);
    REP(i,n) cin >> v[i], mp[v[i]]++;
    vector<LL> r_index, w_index;
    REP(i,n) {
        if (v[i]=='W') w_index.push_back(i);
        else if (v[i]=='R') r_index.push_back(i);
    }

    if (mp['R']==0||mp['W']==0) { cout << 0 << endl; return 0; }

    LL count = 0;
    sort(w_index.begin(), w_index.end());
    sort(r_index.rbegin(), r_index.rend());

    for (LL i=0; i<min(mp['R'], mp['W']); i++){
        //cout << w_index[i] << " " << r_index[i] << endl;
        if (w_index[i]<r_index[i]) count++;
    }

    cout << count << endl;

    return 0;
}


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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> v(N);
  for (ll i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  ll ans = LLONG_MAX;
  for (ll x = -100; x <= 100; x++) {
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
      ll d = v.at(i) - x;
      sum += d * d;
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
/*input
NS
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
bool cnt[4];
int main()
{
	IOS;
	string s;
	cin>>s;
	for(char c:s){
		if(c=='N') cnt[0]=1;
		else if(c=='S') cnt[1]=1;
		else if(c=='E') cnt[2]=1;
		else cnt[3]=1;
	}
	if(cnt[0]^cnt[1]) cout<<"No\n";
	else if(cnt[2]^cnt[3]) cout<<"No\n";
	else cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <map>
#include <tuple>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using lli = long long int;
std::vector<int> A;
std::map<int, std::vector<int>> P;

int main(void){
    int n, k; scanf("%d%d", &n, &k);
    A.resize(n+1);
    REP(i, n){
        scanf("%d", &A[i+1]); A[i+1] += k - 1; A[i+1] %= k;
    }
    A[0] = 0; REP(i, n) (A[i+1] += A[i]) %= k;
    REP(i, n+1) P[A[i]].push_back(i);
    lli res = 0;
    for(auto& V : P){
        auto& vec = V.second;
        const int N = vec.size();
        int idx = 0, r = 0;
        while(idx < N){
            while(r < N and vec[r] - vec[idx] < k) r++;
            res += r - idx - 1;
            idx++;
        }
    }
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 22912
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
    int a, b, n, c=0;
    cin >> a >> b;

    for(int i=1;i<10;i++){
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                n = 10000*i + 1000*k + 100*j + 10*k + i;
                if((a <= n) && (n <= b))
                    c++;
            }

        }

    }    

    cout << c << '\n';
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define MAXN (int)(1e6)+1
#define MOD 998244353

using namespace std;

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pwi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector< vector<pair<int,lli > > > wGraph;
typedef vector<vector<int> > graph;
//typedef vector<vector<int> > matrix;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout<<std::fixed;
    cout<<std::setprecision(6);

    int n;
    cin>>n;
    map<string,lli> freq;


    lli res = 0;
    rep(x,n){
        string s;
        cin>>s;

        sort(s.begin(),s.end());

        if(freq.find(s)!=freq.end()){
            res+=freq[s];
            freq[s]++;
        }else{
            freq[s] = 1;
        }

    }

    cout<<res<<endl;

    return 0;

}


Measured memory_bytes: 11264
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
const int maxn=110;
ll qpow(ll a,ll x){
    ll ret=1;
    while (x){
        if (x&1)
            ret = ret*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return ret;
}
ll fac[maxn],inv[maxn];
ll init(){
    fac[0]=1;
    for (int i=1;i<maxn;i++)
        fac[i]=fac[i-1]*i%mod;
    inv[maxn-1]=qpow(fac[maxn-1],mod-2);
    for (int i=maxn-2;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
    return 0;
}
ll c(ll n,ll m){
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
   IOS;
   init();
   ll ans1,ans2;
   ll n , m;
   cin >> n >> m;
   if(n==0||n==1)ans1=0;
   else ans1=c(n,2);
   if(m==0||m==1)ans2=0;
   else ans2=c(m,2);
   cout<<ans1+ans2;
}


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

using namespace std;

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

	vector<pair<double, double>> arr;
	for (int i = 0; i < n; i++) {
		double x, y;
		cin >> x >> y;
		arr.push_back(make_pair(x, y));
	}

	int cnt = 0;
	d *= d;

	for (auto a: arr) {
		double dist = a.first * a.first + a.second * a.second;
		if (d >= dist) cnt++;
	}

	cout << cnt << "\n";
	
}

Measured memory_bytes: 7536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(),v.end()
#define endll "\n"

#define fin             freopen("input.txt","r",stdin);
#define fout            freopen("output.txt","w",stdout);


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    map<string , int > mp;
    string s;
    while(n--){
        cin >> s;
        if(mp.count(s)==false){
            mp[s]=1;
        }
        else{
            mp[s]++;
        }
    }
    int mx=0;
    for(auto it:mp){
        if(it.second>mx) mx=it.second;
    }
    for(auto it:mp){
        if(it.second==mx){
            cout << it.first << endl;
        }

    }

    return 0;
}



Measured memory_bytes: 19272
N = int(input())
H = list(map(int, input().split()))

M = H[0]
for i in range(0, N-1):
    if H[i+1] < M:
        print('No')
        quit()
    if H[i+1] - H[i] > 1:
        H[i+1] -= 1
        M = max(H[i+1], M)
print('Yes')

Measured memory_bytes: 14396
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static final int INF = Integer.MAX_VALUE;
    public int knapsack(int n, int w, int[] weights, int[] values, int sum) {
        Long[][] memo = new Long[n][sum + 1];
        for (int i = 0; i <= sum; i++) {
            dfs(weights, values, i, 0, memo);
        }
        int result = 0;
        for (int j = 0; j <= sum; j++) {
            if (memo[0][j] != null && memo[0][j] <= w) {
                result = j;
            }
        }
        return result;
    }
    private long dfs(int[] weights, int[] values, int sum, int i, Long[][] memo) {
        int n = values.length;
        if (sum <= 0) {
            return 0;
        }
        if (i >= n) {
            return INF;
        }
        if (memo[i][sum] != null) {
            return memo[i][sum];
        }
        long take = INF;
        if (sum >= values[i]) {
            take = weights[i] + dfs(weights, values, sum - values[i], i + 1, memo);
        }
        long skip = dfs(weights, values, sum, i + 1, memo);
        long result = Math.min(take, skip);
        return memo[i][sum] = result;
    }

    public static void main(String[] args)  {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String[] split = br.readLine().split(" ");
            int n = Integer.parseInt(split[0]);
            int w = Integer.parseInt(split[1]);
            int[] weights = new int[n];
            int[] values = new int[n];
            int sum = 0;
            for (int i = 0; i < n; i++) {
                split = br.readLine().split(" ");
                weights[i] = Integer.parseInt(split[0]);
                values[i] = Integer.parseInt(split[1]);
                sum += values[i];
            }
            Main app = new Main();
            long result = app.knapsack(n, w, weights, values, sum);
            System.out.println(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 396292
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int n;
string s;

int main(){

    cin >> n >> s;

    if(n % 2 == 0){
        for(int i = 0; i < s.length()/2; i++){
            if(s[i] != s[(s.length()/2)+i]){
                cout << "No";
                return 0;
            }
        }
    } else{
        cout << "No";
        return 0;
    }

    cout << "Yes";
}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){
    int n,m;
    cin>>n>>m;

    vector<int> a_(m);
    rep(i,m) cin>>a_[i];

    rep(i,m){
        n-=a_[i];
    }

    if(n>=0) cout << n;
    else cout << "-1";

    return 0;
}

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

using namespace std;

int x, y, z;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << ' ' << y << ' ' << z;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
from numba import jit

n,k=map(int,input().split())

@jit
def main():
  mod=10**9+7
  L=np.zeros(k+1,dtype='int64')
  ans=0
  for x in range(k,0,-1):
    lx=pow((k//x),n,mod)
    cnt=1
    while x*(cnt+1)<=k:
      cnt+=1
      lx-=L[x*cnt]
    L[x]=lx%mod
    ans+=(L[x]*x)%mod
  return ans%mod

if __name__=="__main__":
  print(main())

Measured memory_bytes: 115732
#include<bits/stdc++.h>
using namespace std;
int n,a[111111];
int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	--n;
	int w = (a[n]+1)/2;
	int id = lower_bound(a,a+n,w)-a;
	int X = a[id==n?id-1:id], Y = a[id==0?0:id-1];
	if(X - w >= w - Y)
		X = Y;
	printf("%d %d\n",a[n], X);
	return 0;
}


Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

//+-の順番が関係ない。
//+の数を決めれば-の数が決まる。
//kが決まればときのB-Aの範囲が決まる。
//kを全探索すればいい。

int main() {

	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;

	LL x = (LL)abs(b - a);

	for (int i = 0; i < n; i++) {
		LL a = i, b = n - i - 1;
		LL lb = a*(LL)c - b*(LL)d;
		LL ub = a*(LL)d - b*(LL)c;

		if (x >= lb && x <= ub) {
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif

//改造
typedef unsigned long long int ll;
using namespace std;

//ここから編集する

ll gcd(ll a, ll b) {

    while (a != b) {
        if (a > b) {
            a %= b;
            if (a == 0) a += b;
        } else if (a < b) {
            b %= a;
            if (b == 0) b += a;
        }
    }
    return a;

}

ll lcm(ll a,ll b){
    ll tmp = gcd(a,b);
//    cout << "途中:"<< a * b / tmp << endl;
    return a / tmp * b;
}

int main() {
    int n;
    ll ret = 1;
    ll tmp;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> tmp;
        ret = lcm(ret,tmp);
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <climits>
#include <iostream>
#include <queue>

using namespace std;

struct Point {
  int x;
  int y;
};

int H, W;
char board[50][50] = {{'#'}};
// distance from (0, 0)
int dist[50][50];

void BFS() {
  const int dy[] = {-1, 0, 1, 0, -1};
  const int dx[] = {0, 1, 0, -1, 0};

  queue<Point> q;
  q.push({0, 0});

  while (!q.empty()) {
    const auto p = q.front();
    q.pop();

    if (p.y == H - 1 && p.x == W - 1) {
      break;
    }

    for (int d = 0; d < 4; ++d) {
      const int ny = p.y + dy[d];
      const int nx = p.x + dx[d];
      if (ny < 0 || ny >= H || nx < 0 || nx >= W) {
        continue;
      }
      if (board[ny][nx] == '#') continue;
      if (dist[ny][nx] != INT_MAX)  // Ignore explored
        continue;
      dist[ny][nx] = dist[p.y][p.x] + 1;
      q.push({nx, ny});
    }
  }
}

int main() {
  cin >> H >> W;
  char c;

  int num_white = 0;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      cin >> c;
      board[i][j] = c;
      dist[i][j] = INT_MAX;
      if (c == '.') ++num_white;
    }
  }

  dist[0][0] = 0;
  BFS();
  if (dist[H - 1][W - 1] == INT_MAX) {
    cout << "-1" << endl;
  } else {
    cout << num_white - dist[H - 1][W - 1] - 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

  std::cin >> a >> b >> c;
  if (a == b) {
    std::cout << c << std::endl;
  } else if (a == c) {
    std::cout << b << std::endl;
  } else {
    std::cout << a << std::endl;
  }
}

Measured memory_bytes: 256
import numpy as np
N, D = [int(i) for i in input().split()]

list_coord = list()
for i in range(N):
  list_coord.append([int(i) for i in input().split()])
arr_coord = np.array(list_coord)

cnt = 0
for i in range(N):
    for j in range(N-i-1):
        a = np.array(list_coord[i])
        b = np.array(list_coord[N-j-1])
        dist = (abs(np.sum((a-b)**2)))**0.5
        #print(a, b, dist)
        if dist.is_integer():
            cnt+=1
            
print(cnt)

Measured memory_bytes: 13596
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
typedef long long ll;

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

    string s,t;
    cin >> s >> t;
    unordered_map<char,char> m,m2;
    bool ans = true;
    for(int i=0;i<s.length();i++){
        if(m.find(s[i])!=m.end()){
            if(m[s[i]]!=t[i]){
                ans = false;
                break;
            }
        }
        if(m2.find(t[i])!=m2.end()){
            if(m2[t[i]]!=s[i]){
                ans = false;
                break;
            }
        }
        m[s[i]] = t[i];
        m2[t[i]] = s[i];
    }
    if(ans)
        cout << "Yes";
    else
        cout << "No";
}

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

int main(){
    cin >> s;
    int n = s.size();
    int diff = 0;
    for (int i = 0; i < n/2; i++)
        if (s[i] != s[n - i - 1]) diff++;
    cout << diff;    
    return 0;
}

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

int main()
{
	long long int A, B, N;
	cin >> A >> B >> N;
	
	long long int x = N;
	if (N >= B-1)
	{
		x = B-1;
	}
	
	long long int ans = A*(x%B) / B;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll a,b,x,y;
  cin>>a>>b>>x>>y;
 cout<<x-(y-b)<<" "<<y+x-a<<" "<<a-(y-b)<<" "<<b+x-a<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  int N;
  cin >> N;
  N %= 1000;
  cout << (N ? 1000 - N : 0) << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <tuple>
#include <utility>
#include <stdlib.h>
#include <set>
#include <map>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define pb push_back
#define mp make_pair
using LL = long long;
using ULL = unsigned long long;

int main() {
	int n;
	cin >> n;
	set<int> a;
	rep (i, 0, n) {
		int num;
		cin >> num;
		if (a.count(num) == 0) a.insert(num);
		else a.erase(num);
	}
		
	cout << a.size() << endl;
	
	return 0;
}


Measured memory_bytes: 4864
import Control.Monad

main = do
  [n, m, c] <- map read.words <$> getLine :: IO [Int]
  b <- map read.words <$> getLine :: IO [Int]
  al <- replicateM n (map read.words <$> getLine :: IO [Int])
  print $ f al b c
  
f :: [[Int]] -> [Int] -> Int -> Int
f al b c
  | al == []  = 0
  | otherwise = (if sum (map (\(ai, bi) -> ai * bi) (zip (head al) b)) + c > 0 then 1 else 0) + f (tail al) b c

Measured memory_bytes: 1020
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define int long long
signed main() {
	string s; cin >> s;
	if (s[5] != '0') {
		cout << "TBD\n";
		return 0;
	}
	int p = s[6] - '0';
	cout << (p <= 4 ? "Heisei\n" : "TBD\n");
	return 0;
}

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

An = list(map(int,input().split()))

list1 = [ 0 for a in range(N)]

for i in An:
    list1[i-1] += 1

list2 = [int((a-1)*a/2) for a in list1]
sum1 = sum(list2)
# print(list2)
# print(An)
for i in An:
    if list1[i-1] != 2:
        a = sum1 - list1[i-1] + 1
        print(a)
    else:
        a = sum1 - 1
        print(a)
# print(list2)

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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  rep(i,n){
    if(s[i] == ','){
      cout << " ";
    }else{
      cout << s[i];
    }
  }
}

Measured memory_bytes: 256
import sys
from pprint import pprint
import math

A, B, H, M = map(int, sys.stdin.readline().split())

h_theta = 2*math.pi * (H / 12 + M / 60 / 12)
m_theta = 2*math.pi * (M / 60)

theta = h_theta - m_theta if h_theta >= m_theta else m_theta - h_theta 
# print(theta / math.pi * 360)
print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(theta)))

Measured memory_bytes: 10224
#include<bits/stdc++.h>
using namespace std;
const int nmax=100005;
vector<vector<int>> g(nmax);
int dist[nmax];
void bfs(int s){
  memset(dist,-1,sizeof(dist));
  queue<int> q;
  dist[s]=0;
  q.push(s);
  while(!q.empty()){
    int v=q.front();
    q.pop();
    for(int x=0;x<g[v].size();x++){
      if(dist[g[v][x]]!=-1){
        continue;
      }
      dist[g[v][x]]=dist[v]+1;
      q.push(g[v][x]);
    }
  }
}
int main(){
  int n;
  cin >> n;
  vector<int> F(n);
  for(int i=0;i<n-1;i++){
    int a,b;
    cin >> a >> b;
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bfs(0);
  for(int i=0;i<n;i++){
    F[i]=dist[i];
  }
  bfs(n-1);
  int cntf=0,cnts=0;
  for(int i=0;i<n;i++){
    if(F[i]<=dist[i]){
      cntf++;
    }
    else{
      cnts++;
    }
  }
  if(cntf>cnts){
    cout << "Fennec" << endl;
  }
  else{
    cout << "Snuke" << endl;
  }
}

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

#define int ll
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<pii>v(N);
  for(int i=0;i<N;i++)v[i]={A[i],i};
  sort(rng(v));
  reverse(rng(v));
  vector<vector<int>>dp(N+1,vector<int>(N+1,0));
  for(int i=1;i<=N;i++){
    for(int j=0;j<=i;j++){
      if(j-1>=0&&i-j-1>=0)dp[j][i-j]=max(dp[j-1][i-j]+v[i-1].first*(v[i-1].second-j+1),dp[j][i-j-1]+v[i-1].first*((N-(i-j))-v[i-1].second));
      else if(j-1>=0&&i-j-1<0)dp[j][i-j]=dp[j-1][i-j]+v[i-1].first*(v[i-1].second-j+1);
      else if(j-1<0&&i-j-1>=0)dp[j][i-j]=dp[j][i-j-1]+v[i-1].first*((N-(i-j))-v[i-1].second);
    }
  }
  int ans=0;
  for(int i=0;i<=N;i++)ans=max(ans,dp[i][N-i]);
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int x, y;
    cin >> x >> y;
    int maxl = x * 4, minl = x * 2;
    if(minl <= y && y <= maxl && y%2 == 0){
        puts("Yes");
    } else {
        puts("No");
    }
}

Measured memory_bytes: 3616
#include<iostream>
#include<complex>
#include<vector>
#include<iomanip>

using namespace std;

typedef complex<double> P;

#define EPS 1e-9
#define shosu(x) fixed<<setprecision(x)

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L(){;}
};
struct C{
  P c;double r;
  C(const P &c,double r):c(c),r(r){}
};

namespace std{//演算子の定義
  bool operator < (const P& a,const P& b){
    return real(a)!= real(b) ? real(a) < real(b) : imag(a) < imag(b);
    //return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b)
  }
  bool operator == (const P& a,const P& b){
    return a.real()==b.real() && a.imag()==b.imag();
  }
}

double dot(P a,P b){
  return real(conj(a)*b);
}

double cross(P a,P b){
  return imag(conj(a)*b);
}

int ccw(P a, P b, P c) {//3点の関係性
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;                               // a--c--b on line
}

P projection(const L &l, const P &p){//pの直線l上の射影の点
  double t=dot(p-l[0],l[0]-l[1])/norm(l[0]-l[1]);
  return l[0]+t*(l[0]-l[1]);
}

P reflection(const L &l, const P &p){//点pの直線lに関して対称な点
  return p+2.0*(projection(l,p)-p);
}

bool isOrthogonal(const L &l, const L &m){//2直線の直交判定
  return fabs(dot(l[1]-l[0], m[1]-m[0])) < EPS;
}

bool isParallel(const L &l, const L &m){//2直線の平行判定
  return fabs(cross(l[1]-l[0],m[1]-m[0])) < EPS;
}

bool intersectLL(const L &l, const L &m){//2直線の交差判定
  return !isParallel(l,m);
}

bool intersectSS(const L &s, const L &t) { //2線分の交差判定(完全に交差してないとだめ)
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

bool intersectSP(const L &s, const P &p) { //直線と点の交差判定
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

P crosspointSS(const L &a, const L &b){ //2線分の交点
double t1=abs(cross(a[1]-a[0],b[0]-a[0]));
double t2=abs(cross(a[1]-a[0],b[1]-a[0]));
return b[0]+(b[1]-b[0])*t1/(t1+t2);
}

double distanceSP(const L &s, const P &p) {//直線と点との距離
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}

double distanceSS(const L &s, const L &t) {//2線分の距離
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}


P inP(){
  double x,y;
  cin >> x >> y;
  P p(x,y);
  return p;
}

L inL(){
  P p1=inP();
  P p2=inP();
  L l(p1,p2);
  return l;
}

int main(){

  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    L l1,l2;
    l1=inL();
    l2=inL();

    cout << shosu(10) << distanceSS(l1,l2) << endl;
  }

}



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

int main() {
  int N, A;
  cin >> N >> A;
  if (N % 500 == 0)
    cout << "Yes" << endl;
  else if (N % 500 != 0) {
    if (N % 500 <= A) {
      cout << "Yes" << endl;
    }
    else if (N % 500 > A)  {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256
n, m = map(int,input().split())
arr = [int(input()) for _ in range(m)]
broken = set(arr)

mod = 10 ** 9 + 7

dp = [0] * (n+1)
dp[0] = 1

for i in range(1,n+1):
    if i in broken:
        continue
    
    if i == 1:
        dp[1] = dp[0]
        continue
    
    dp[i] = dp[i-1] + dp[i-2]

print(dp[n] % mod)

Measured memory_bytes: 460020
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define fast_io() ios::sync_with_stdio(false); cin.tie(nullptr)
#define fix(n) fixed << setprecision(n)

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    fast_io();
    
    ll a,b,c;
    cin >> a >> b >> c;

    ll count = 0;
    if(a == b)count++;
    if(a == c)count++;
    if(b == c)count++;
    
    cout << (count == 1 ? "Yes" : "No") << endl;

    return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3
#define MOD (ll)(1e9 + 7)

int main(){
    cin.sync_with_stdio(false);
    int n, i = 0;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    ll ans = 1, kind = -1;
    while(i < n) {
        if (i < n - 1 && s1[i] == s1[i + 1]) {
            if (kind == -1) ans = (ans * 6) % MOD;
            else if (kind == 0) ans = (ans * 2) % MOD;
            else ans = (ans * 3) % MOD;
            kind = 1;
            i++;
        } else {
            if (kind == -1) ans = (ans * 3) % MOD;
            else if (kind == 0) ans = (ans * 2) % MOD;
            else ans = (ans * 1) % MOD;
            kind = 0;
        }
        i++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll aa , bb;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->aa - ((fr*)q)->aa;}

// 約数記録
ll divi[1000001]={};
ll makedivi(ll n){
    while(n%2==0){
        n/=2;
        divi[2]++;
    }
    repp(i,3,1000001,2){
        if(n<i) break;
        while(n%i==0){
            n/=i;
            divi[i]++;
        }
    }
    // printf("%lld ",n);
    if(n>1) return 2;
    return 1;
    // return n;
}

int main(void){
    // char ;
    ll a,b,ans=0;
    scanf("%lld%lld",&a,&b);
    if(gcd(a,b)==1){
        printf("1\n");
        return 0;
    }
    // printf("%lld ",gcd(a,b));
    ans+=makedivi(gcd(a,b));
    // printf("%lld ",ans);
    rep(i,0,1000001){
        if(divi[i]){ 
            ans++;
            // printf("%lld %lld ",i,divi[i]);
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 2176
def main():
    n = int(input())
    D = [list(map(int,input().split())) for _ in range(n)]

    ans = [False]*n
    for i in range(n):
        ans[i] = D[i][0] == D[i][1]
    for i in range(2,n):
        if ans[i] and ans[i - 1] and ans[i - 2]:
            print("Yes")
            return
    print("No")
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 9196
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    int k, x;
    cin >> k >> x;
    int l = max(-1000000, x - k + 1);
    int r = min(1000000, x + k - 1);
    for (int i = l; i <= r; i++){
        cout << i << " ";
    }
    cout << endl;
    
}


Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		cs: Chars,
	}

	println!("{}{}{}", cs[0], cs.len()-2, cs.last().unwrap());
}



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

#define rep(i, u) for (int i = 0; i < u; i++)

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

int main() {
  int n;
  int a[100] = {};
  cin >> n;
  rep(i, n) cin >> a[i];

  rep(i, n) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = v;
    rep(i, n) {
      cout << a[i];
      if (i != n - 1) cout << ' ';
      else cout << endl; 
    }
  }
  return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N = 3e3 + 5;
int mod = 1e9 + 7;
double mem[N][N];
double a[N];
int n;
double DP(int i = 0, int cnt = 0){
    if(i == n){
        if(cnt > n/2 ){
            return 1;
        } else{
            return 0;
        }
    }
    double &ret = mem[i][cnt];
    if(ret != -1)
        return ret;
    return ret = DP(i+1, cnt+1) * a[i] + DP(i+1, cnt) * (1-a[i]);
}

int main() {
#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(false), cin.tie(0);
#endif
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    for(int i = 0; i<N; i++)
        for(int j=0; j<N; j++)
            mem[i][j] = -1;
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i];
    cout<<fixed<<setprecision(10)<<DP()<<'\n';

}










Measured memory_bytes: 74548
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [tuple(map(int, l.split())) for l in sys.stdin]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a = sorted([I() for _ in range(5)], key=lambda x: -(x%10 or 10))
    r = 0
    for c in a[:-1]:
        if c % 10 == 0:
            r += c
        else:
            r += (c//10+1) * 10
    r += a[-1]

    return r

print(main())




Measured memory_bytes: 5328
#include"bits/stdc++.h"
using namespace std;
int n,x[111111],y[111111],t[111111];

int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d%d%d",&t[i],&x[i],&y[i]);
	for(int i=1; i<=n; i++)
		if(x[i]+y[i]>t[i]||(t[i]-x[i]-y[i])%2!=0) { 
			printf("No");
			return 0;
		}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 1408
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
struct node{
    double val;
    int num;
    friend bool operator < (node x, node y){
        if(x.val/(1<<x.num) == y.val/(1<<y.num))
            return x.num < y.num;
        return x.val/(1<<x.num) < y.val/(1<<y.num);
    }
}a[6];
long long int n;
int main(){
    for(int i = 1; i <= 4; i ++)
        scanf("%lf",&a[i].val), a[i].num = i;
    scanf("%lld",&n);
    sort(a+1, a+5);
    n *= 8;
    long long int ans = 0;
    for(int i = 1; i <= 4; i ++){
        long long int k = n / (1<<a[i].num);
        ans += k * (long long int)a[i].val;
        n -= k * (1<<a[i].num);
    }
    printf("%lld",ans);
    return 0;
    
}

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

using namespace std;

int main(){
    int k;
    string a;
    cin >> k >> a;
    if(a.size() <= k){
        cout << a;
    }
    else{
        for(int i = 0;i < k;i++){
            cout << a[i];
        }
        cout << "...";
    }
} 


Measured memory_bytes: 3608