akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
  public class Program
  {
    public static void Main(string[] args)
    {
      new Program().Solve(new ConsoleInput(Console.In, ' '));
    }
    public void Solve(ConsoleInput cin)
    {
      var n = cin.ReadInt;
      var sequence = cin.ReadIntArray(n);
      int distinctCount = (from x in sequence select x).Distinct().Count();
      if (n == distinctCount)
      {
        WriteLine("YES");
      }
      else
      {
        WriteLine("NO");
      }
    }
  }

  public class ConsoleInput
  {
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
      this._separator = separator;
      this._stream = stream;
      inputStream = new Queue<string>();
    }
    public string Read
    {
      get
      {
        if (inputStream.Count != 0) return inputStream.Dequeue();
        string[] tmp = _stream.ReadLine().Split(_separator);
        for (int i = 0; i < tmp.Length; ++i)
          inputStream.Enqueue(tmp[i]);
        return inputStream.Dequeue();
      }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
  }
}

Measured memory_bytes: 39880
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1000;

int n, m, k, res[N][N];
char s[N][N];
vector <int> g[N];

int main() {

	scanf("%d %d %d", &n, &m, &k);

	for (int i = 0; i < n; i++) {
		scanf("%s", s[i]);
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i][j] == '#') {
				g[i].push_back(j);
			}
		}
	}

	int cnt = 1;

	for (int i = 0; i < n; i++) {
		if (g[i].size() == 0) {
			continue;
		}
		int w = -1;
		for (int j = i - 1; j >= 0; j--) {
			if (g[j].size() != 0) {
				w = j;
				break;
			}
		}
		for (int row = w + 1; row <= i; row++) {
			int last = cnt;
			for (int j = 0; j < m; j++) {
				res[row][j] = last;
				if (s[i][j] == '#' && j != g[i].back()) {
					++last;
				}
			}
		}
		cnt += g[i].size();
	}

	for (int i = 0; i < n; i++) {
		if (res[i][0] != 0) {
			continue;
		}
		for (int j = 0; j < m; j++) {
			res[i][j] = res[i - 1][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			printf("%d ", res[i][j]);
		}
		puts("");
	}

	return 0;

}

Measured memory_bytes: 5824
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n;string s;cin>>n>>s;
  int ans=0;
  for(int i=1;i<n;i++){
    vi x(26,0);
    vi y(26,0);
    rep(j,i){
      x[s[j]-'a']++;
    }
    for(int j=i;j<n;j++){
      y[s[j]-'a']++;
    }
    int cnt=0;
    rep(j,26){
      if(x[j]>0&&y[j]>0)cnt++;
    }
    if(ans<cnt)ans=cnt;
  }
  cout(ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long ext_gcd(long long a, long long b, long long &p, long long &q) {  
    if (b == 0) { p = 1; q = 0; return a; }  
    long long d = ext_gcd(b, a%b, q, p);  
    q -= a/b * p;  
    return d;  
}
long long mod_inv(long long a, long long m) {
	long long x, y;
	long long d = ext_gcd(a, m, x, y);
	x %= m;
	if (x < 0) x += m;
	return x;
}
long long garner(vector<long long> r, vector<long long> m){
	int n = r.size();
	long long m_prod = 1;
	long long x = r[0] % m[0];
	for (long long i = 1; i < n; i++) {
		m_prod *= m[i - 1];
		long long t = (((r[i] - x + m[i]) % m[i]) * mod_inv(m_prod, m[i])) % m[i];
		if (t < 0) t += m[i];
		x += t * m_prod;
	}
	return x;
}
int main(){
	long long N; cin >> N; 
	if(N == 1){
		cout << 1 << "\n"; return 0; 
	}
	long long now = N * 2; 
	vector<long long> M; 
	for(long long i = 2; i * i <= N * 2; i++){
		if(now % i != 0) continue;
		long long mul = 1LL;  
		while(now % i == 0){
			mul *= i; now /= i; 
		}
		M.emplace_back(mul); 
	}
	if(now > 1){
		M.push_back(now); 
	}
  reverse(M.begin(), M.end()); 
	int D = M.size(); 
	long long ans = N * 2; 
	for(int i = 0; i < (1 << D); i++){
		vector<long long> R; 
		for(int j = 0; j < D; j++){
			if((i >> j) & 1) R.emplace_back(M.at(j) - 1); 
			else R.emplace_back(0); 
		}
		long long tmp = garner(R, M); 
		if(tmp == 0) tmp += N * 2; 
		ans = min(ans, tmp); //cout << tmp << endl; 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int a, b;
    cin >> a >> b;
    int i;
    for(i = 1; i < (b*100); i++){
       if( (int) (i * 0.08) == a && (int)(i * 0.1) == b){
           cout << i << endl;
           break;
       }
     }
     if(i == (b*100))
         cout<< -1 << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let s:Vec<char> = read::<String>().chars().collect();
    let mut x = 0i64;
    let mut mx = 0;
    for i in s {
        if i == 'I' {
            x += 1;
        } else {
            x -= 1;
        }
        mx = std::cmp::max(x, mx);
    }
    println!("{}", mx);
}


Measured memory_bytes: 2080
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
   int n;
   cin>>n;
   while(n--){
       double x1,x2,x3,y1,y2,y3;
       double px,py,r;
       scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
       double a1=(x2*x2+y2*y2-x1*x1-y1*y1)*(y3-y1);
       double b1 =(x3*x3+y3*y3-x1*x1-y1*y1)*(y2-y1);
        double a2 =(x3*x3+y3*y3-x1*x1-y1*y1)*(x2-x1);
        double b2 =(x2*x2+y2*y2-x1*x1-y1*y1)*(x3-x1);
        double c = (x2-x1)*(y3-y1)-(y2-y1)*(x3-x1);
        px=(a1-b1)/c/2;
        py=(a2-b2)/c/2;
        r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
        printf("%.3f %.3f %.3f\n",px,py,r);
   }
    return 0;
}


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


int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    int count=0;
    for(int i=0;i<n;i++){
        if(s[i]=='A')
            if(s[i+1]=='B')
                if(s[i+2]=='C')
                {count++;
                i=i+2;}
    }
    cout<<count;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	ll an = 1000;
	string S;
	cin >> S;
	rep(i, S.size() - 2) {
		int h = S.at(i)-48;
		int t = S.at(i + 1)-48;
		int o = S.at(i + 2)-48;
		an = min(an, ll(abs(h * 100 + t * 10 + o-753)));
	}
	
	cout << an << endl;
}


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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL


int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 0; i < n; i++) {
		cin >> b[i];
	}
	ll cana = 0;
	ll needb = 0;
	for(int i = 0; i < n; i++) {
		if(b[i]-a[i] >= 0LL) {
			cana+= ((b[i]-a[i])/2)*2;
		} else {
			needb-= (b[i]-a[i]);
		}
	}
	if(cana-needb*2 < 0LL) {
		cout << "No";
	} else {
		cout << "Yes";
	}
	return 0;
}



Measured memory_bytes: 384
N = int(input())
S = []
for i in range(N):
    S.append(input())

M = int(input())
T = []
for i in range(M):
    T.append(input())

ans_cand = [0]
for say in S:
    ans = 0
    for s in S:
        if say == s:
            ans += 1
    for t in T:
        if say == t:
            ans -= 1
        
    ans_cand.append(ans)
print(max(ans_cand))

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=LONG_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,m,i,ans[nmax],x,y;
int main()
{
	//freopen("sol.in","r",stdin);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	while(m--)
	{
		cin>>x>>y;
		if(x>y)swap(x,y);
		ans[x+1]++,ans[y+1]--;
	}
	for(i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		if(ans[i]&1)rc("NO");
	}
	rc("YES");
}

Measured memory_bytes: 768
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(String).chars().collect::<Vec<_>>();
    println!("{}", if n[0] == n[2] { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)

	sum := 0
	for i := 0; i < 5; i++ {
		x := nextInt()
		if x < 40 {
			sum += 40
		} else {
			sum += x
		}
	}
	fmt.Println(sum / 5)
}



Measured memory_bytes: 1092
#include<bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long dp[105][10];
int main(){
	int h,w,k;
	cin>>h>>w>>k;
	dp[0][1] = 1;
	for(int i=1; i<=h; i++){
		for(int state = 0; state<(1<<w-1); state++){
			int leddar[10]={0};
			for(int j=0; j<w-1; j++){
				if(state&(1<<j)) leddar[j+1] = 1;
			}
			bool pos = true;
			for(int j=1; j<w; j++){
				if(leddar[j]&&leddar[j+1]) pos = false;
			}
			if(!pos) continue;
			for(int j=1; j<=w; j++){
				if(leddar[j-1]){
					dp[i][j]+=dp[i-1][j-1];
				}
				else if(leddar[j]) dp[i][j]+=dp[i-1][j+1];
				else dp[i][j]+=dp[i-1][j];
				dp[i][j]%=mod;
			}
		}
	}
	cout<<dp[h][k];
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i < (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, i, ans=0;
  cin >> N;
  vi A(N);
  REP(0, N, i) {
    cin >> A[i];
  }

  vi S(N+1);
  S[0] = 0;
  REP(0, N, i) {
    S[i+1] = S[i] + A[i];
  }

  sort(all(S));

  i64 count = 1;
  REP(0, N, i) {
    if(S[i] == S[i+1]) {
      ++count;
    }
    else {
      ans += count * (count - 1) / 2;
      count = 1;
    }
  }
  ans += count * (count - 1) / 2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(ll)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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



int main(){
    int h,w;
    cin >> h >> w;
    int cc[10][10];
    int a[10]= {0};
    rep(i,10){
        rep(j,10) cin >> cc[i][j];
    }
    rep(i,h) rep(j,w){
        int num;
        cin >> num;
        if(num != -1){
            a[num]++;
        }
    }

    rep(k,10){
        rep(i,10){
            rep(j,10){
                cc[i][j] = min(cc[i][j], cc[i][k] + cc[k][j]);
            }
        }
    }
    ll ans=0;
    rep(i,10){
        ans += a[i]*cc[i][1];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
import math
a,b,x = map(int,input().split())
if a*a*b < 2*x:
    ans = math.degrees(math.atan(2 * (a*a*b - x) / a**3))
else:
    ans = math.degrees(math.atan((a*b*b)/(2*x)))
print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,d;
  cin>>n>>d;
  cout<<(n+d+d)/(d+d+1)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n, m;
    int l, r;
    cin >> n >> m;

    int max_l = -1;
    int min_r = 200000;
    REP(i, m) {
        cin >> l >> r;
        max_l = max(max_l, l);
        min_r = min(min_r, r);
    }

    if (max_l <= min_r) {
        cout << min_r - max_l + 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

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

int s(int n){
    int ret = 0;
    while(n > 0){
        ret += n%10;
        n /= 10;
    }
    return ret;
}

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

    int n;
    cin >> n;

    cout << (n%s(n)? "No": "Yes") << endl;
}

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

int main() {
  int A;
  cin >>A;
  // Aが奇数　=2n+1 奇数が A/2+1個　偶数がA/2個
  // Aが偶数　=2n   奇数が A/2個　　偶数がA/2個
  
  if(A%2==1){
    cout <<(A/2+1)*(A/2) <<endl;
  }
  else{
    cout <<(A/2)*(A/2) <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

struct UnionFind{
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unionSet(int x,int y){
        x=root(x);y=root(y);
        if(x==y)return 0;
        if(data[y]<data[x])swap(x,y);
        data[x]+=data[y],data[y]=x;
        return 1;
    }
    bool findSet(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0 ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m,k;
	cin>>n>>m>>k;	
	UnionFind uf(n);
	vi w(n);
	vvi in(m,vi(2));
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		uf.unionSet(a,b);
		in[i]={a,b};
	}
	rep(i,m){
		if(uf.root(in[i][0])==uf.root(in[i][1]))
			w[in[i][0]]--,w[in[i][1]]--;
	}
	rep(i,k){
		int a,b;
		cin>>a>>b;
		a--;b--;
		if(uf.root(a)==uf.root(b))
			w[a]--,w[b]--;
	}
	rep(i,n){
		cout<<uf.size(i)-1+w[i]<<" ";
	}
}








Measured memory_bytes: 7936
#include<stdio.h>
#include<string.h>

int main(void){
    char t[1001],w[11],end[]="END_OF_TEXT";
    int len,i,count=0;
    
    scanf("%s",&w);
    while(scanf("%s",&t)){
        if(strcmp(t,"END_OF_TEXT")==0)break;
        len=strlen(t);
        for(i=0;i<len;i++){
            if(t[i]<91 &&t[i]>64)t[i]+=32;
        }
        if(strcmp(t,w)==0)count++;
    }
    
    printf("%d\n",count);
    
    return 0;
}

Measured memory_bytes: 1812
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	int sum;
	int x,y;
	int kekka;
	
	while(1){
		cin >> x >> y;
		if ( cin.eof() ) { break; }
		sum = x + y;
		kekka = (double)log10((double) sum)+1;
		cout << kekka << endl;
	}
	
    return 0;
}

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

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word1 = input.readLine();
        String word2 = input.readLine();
        boolean state = true;
        for (int i = 0, j = word2.length() - 1; i < word1.length(); i++, j--) {
            if (word1.charAt(i) != word2.charAt(j)){
                state = false;
                break;
            }
        }
        if (state)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}


Measured memory_bytes: 23124
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	string s,t;
	cin>>s>>t;
	int n=s.length();
	int m=t.length();
	int mn=INT_MAX;
	for(int i=0;i+m<=n;i++){
		int x=i;
		int y=0;
		int error=0;
		while(y<m && x<n){
			if(s[x]!=t[y])
				error++;
			y++;
			x++;
		}
		mn=min(mn,error);
	}
	if(mn==INT_MAX)
		cout<<0;
	else
		cout<<mn;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



Measured memory_bytes: 3604
#import sys
MOD = 10 ** 9 + 7
#input = sys.stdin.readline
import math

import itertools

#import bisect

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


def main():
#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]
    n=int(input())
    a=list(map(int,input().split()))
    count=0
    temp=1
    for i in range(n):
        if a[i]==temp:
            temp+=1
        else:
            count+=1
    if count>=n:
        print(-1)
    else:
        print(count)

if __name__ == "__main__":
    main()

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  REP(i, N){
    cin >> P[i];
    P[i]--;
  }
  int ans = 0;
  REP(i, N){
    if(P[i] == i){
      ans++;
      if(i==N-1){
        
      }
      else{
        if(P[i+1] == i+1){
          swap(P[i], P[i+1]);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 764
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define ll long long
#define sz size()
#define all(x) x.begin(), x.end()
#define forn(x) for(ll i=1;i<=x;i++) 
#define sforn(x, y) for(ll i=1;i<=x;i++)for(ll j=1;j<=y;j++)
#define pii pair<ll, ll>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

/*
    LOL KEK CHEBUREK
 
    PIHALITI
 
 */

ll dp[1000000];

int main(){ speed;
    ll n, m;
    cin >> n >> m;
    for(ll i=0;i<=1000000;i++){
        dp[i] = 1e18;
    }
    dp[0] = 0;
    for(ll i=1;i<=m;i++){
        ll a, b;
        cin >> a >> b;
        ll mask = 0;
        for(ll j=1;j<=b;j++){
            ll c;
            cin >> c;
            mask |= (1ll << (c-1));
        }
        for(ll s = mask; s; s=(s-1)&mask){
            dp[s] = min(dp[s], a);
        }
    }
    for(ll mask=0;mask<(1ll<<n);mask++){
        for(ll s = mask; s; s=(s-1)&mask){
            dp[mask] = min(dp[mask], dp[s] + dp[mask^s]);
        }
    }
    if(dp[(1ll<<n)-1]!=1e18) cout << dp[(1ll<<n)-1] << endl;
    else cout << -1 << endl;
    return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int h,w;
  cin >> h >> w;
  vector<string> f(h);
  vector<vector<int>> dist(h,vector<int>(w,IINF));
  queue<pair<int,int>> q;
  for(int i=0;i<h;i++){
    cin >> f[i];
    for(int j=0;j<w;j++){
      if(f[i][j]=='#'){
        dist[i][j]=0;
        q.push({i,j});
      }
    }
  }

  int v[5]={0,1,0,-1,0};
  while(!q.empty()){
    auto now= q.front();
    q.pop();
    for(int i=0;i<4;i++){
      int ny = now.first+v[i];
      int nx = now.second+v[i+1];
      if(0<=nx&&nx<w&&0<=ny&&ny<h){
        if(dist[ny][nx]==IINF){
          dist[ny][nx]=dist[now.first][now.second]+1;
          q.push({ny,nx});
        }
      }
    }
  }
  int ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j < w;j++){
      ans=max(ans,dist[i][j]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13456
#include <cstdio>
#include <queue>
#include <iostream>

using namespace std;

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

    int a[]={1,2,4,3,5};
    std::priority_queue<long> q;
    long n,m,tmp;

    cin >> n;
    cin >> m;

   for (n; n>0 ; n--) {
       cin>>tmp;
        q.push(tmp);
    }

    while (m>0) {
        tmp=q.top();
        q.pop();
        tmp=tmp/2;
        q.push(tmp);
        m--;

    }
    tmp=0;
    while(!q.empty()){
        tmp+=q.top();
        
        q.pop();

    }
    cout<<tmp;

    return 0;


}

Measured memory_bytes: 1400
#include <stdio.h>
 
int main(void)
{
    int A[99][99] = { 0 }, i, j, N, t;
    char s, F[5] = "SHCD";
 
    scanf("%d\n", &N);
 
    for (i = 0; i < N; A[s][t] = 1, i++)
        scanf("%c %d\n", &s, &t);
 
    for (i = 0; i < 4; i++)
        for (j = 1; j < 14; j++)
            if (!A[F[i]][j])
                printf("%c %d\n", F[i], j);
 
    return 0;
}
 

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

using namespace std ; 

const int N = 1e6 + 7 ; 

int main(){
    ios_base::sync_with_stdio(0); 
    cin.tie(0) ; 
   // freopen("in.in" , "r" , stdin) ; 
    double r ; 
    cin>>r ; 
    cout<<fixed<<setprecision(20) << 2.0 * acos(-1)* r ;

    return 0 ; 
}

Measured memory_bytes: 3800
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll A, B, C, X, Y;
    ll a, b;
    ll answer = MAX_N * 10000;

    cin >> A >> B >> C >> X >> Y;

    rep(c, 2 * max(X, Y) + 1){
        a = max(ll(0), X - c / 2);
        b = max(ll(0), Y - c / 2);
        answer = min(a * A + b * B + c * C, answer);
        //cout << a << " " << b << " " << c << " " << answer << endl;
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String words = "aiueo";
		char a = sc.next().charAt(0);
		String answer = "consonant";
		if(words.indexOf(a) != -1) {
			answer = "vowel";
		}
		System.out.println(answer);
	}
}


Measured memory_bytes: 35456
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
c=0
for i in range(n):
    b[a[i]-1]+=1
for i in range(n):
    c+=b[i]*(b[i]-1)//2
for i in range(n):
    print(c-b[a[i]-1]+1)

Measured memory_bytes: 26268
# coding: utf-8
# Your code here!
N,M = map(int,input().split())
A = list(map(int,input().split()))

l = []
for i in range(N):
    num = A[i]
    while num > 0:
        l.append(num)
        num = int(num / 2)

l.sort(reverse = True)

s = sum(A)
p = 0

if len(l) >= M:
    for i in range(M):
        p += l[i] - int(l[i] / 2)

    print(s - p)
    
else :
    print(0)

Measured memory_bytes: 139212
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int h1,h2,m1,m2,k;
    cin >> h1 >> m1 >> h2 >> m2>> k;
    int time = h2*60 + m2 - h1*60 -m1;
    cout << time-k << endl;
    return 0;
}

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

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k < a) {
        cout << k << endl;
    } else if(a <= k && k <= a + b) {
        cout << a << endl;
    } else {
        cout << a - (k - (a + b)) << endl;
    }

}

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

using namespace std;

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

    long ans = 0;
    long c = 0;
    for(int i=0; i<s.size(); i++){
        if(s[i] == 'B'){
            c += 1;
        }else{
            ans+=c;
        }
    }

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 640
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
4 2 9
---+/

void main(string[] args) {
  long N, A, B;
  readf(" %d %d %d ", &N, &A, &B);
  min(A*N, B).writeln;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <complex>
#include <cmath>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

using Point = complex<double>;
const double eps = 1e-6;
auto cross_product(Point p1, Point p2) {
    return p1.real() * p2.imag() - p2.real() * p1.imag();
}
vector<Point> GrahamScan(vector<Point> v, int contains = 0) {
    Point minPoint = *min_element(v.begin(), v.end(), [](Point p1, Point p2) {
        return abs(p1.imag() - p2.imag()) > eps ? p1.imag() < p2.imag() : p1.real() < p2.real();
    });
    sort(v.begin(), v.end(), [&minPoint](Point p1, Point p2) -> bool {
        auto res = cross_product(p1 - minPoint, p2 - minPoint);
        return abs(res) < eps ? abs(p1 - minPoint) < abs(p2 - minPoint) : res > 0;
    });
    {
        int p = static_cast<int>(v.size()) - 1;
        while (p > 0 && abs(cross_product(v[p] - minPoint, v[p - 1] - minPoint)) < eps) {
            p--;
        }
        reverse(v.begin() + p, v.end());
    }
    vector<Point> res;
    for (int p = 0; p < static_cast<int>(v.size());) {
        if (res.size() < 2) {
            res.push_back(v[p++]);
        } else {
            Point p1 = res[res.size() - 1] - res[res.size() - 2];
            Point p2 = v[p] - res[res.size() - 1];
            if (cross_product(p1, p2) < (1 - 2 * contains) * eps) {
                res.pop_back();
            } else {
                res.push_back(v[p++]);
            }
        }
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<Point> v;
    REP(i, 0, n) {
        int a, b;
        cin >> a >> b;
        v.push_back(Point(a, b));
    }
    v = GrahamScan(v, 1);
    cout << v.size() << endl;
    for (auto &p : v) {
        cout << p.real() << " " << p.imag() << endl;
    }
    return 0;
}



Measured memory_bytes: 8232
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, A);
    IN(ll, B);
    IN(ll, H);
    IN(ll, M);
    double a = 90 - 0.5 * (60 * H + M);
    double b = 90 - 6 * M;
    // DUMP(a);
    // DUMP(b);
    double ax = A * cos(a * M_PI / 180);
    double ay = A * sin(a * M_PI / 180);
    double bx = B * cos(b * M_PI / 180);
    double by = B * sin(b * M_PI / 180);
    // DUMP(ax);
    // DUMP(ay);
    // DUMP(bx);
    // DUMP(by);
    FOUT(sqrt(pow(ax - bx, 2) + pow(ay - by, 2)));
}

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

int main(){
  int n;
  cin>>n;
  vector<tuple<string,int,int>> p(n);
  for(int i=0;i<n;i++){
    string S;
    int P;
    cin>>S>>P;
    p[i] = make_tuple(S,-P,i+1);
  }
  sort(p.begin(),p.end());
  for(int i=0;i<n;i++){
    cout<<get<2>(p[i])<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
  vector<int> a(3);
  for(int i=0;i<3;i++){
    cin >>a[i];
  }
  sort(a.begin(),a.end());
  if(a[2]-a[1] == a[0]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
const int MAXN = 100100;

class UnionFind{
    public:
        vector<int> par;
        vector<int> rank;

        UnionFind(int n){
            for(int i = 0; i < n; i++){
                par.push_back(i);
                rank.push_back(0);
            }
        }

        int find(int x){
            if(x == par[x])
                return x;
            else
                return par[x] = find(par[x]);
        }

        void unite(int x, int y){
            x = find(x);
            y = find(y);
            if(x == y) return;

            if(rank[x] < rank[y])
                par[x] = y;
            else{
                par[y] = x;
                if(rank[x] == rank[y]) rank[x]++;
            }
        }

        bool same(int x, int y){
            return find(x) == find(y);
        }
};

pair<ll, int> X[MAXN], Y[MAXN];

struct edge { ll u, v, cost; };
bool comp(const edge &e1, const edge &e2){
    return e1.cost < e2.cost;
}
edge es[2*MAXN];
int E;
int V;

ll kruskal(){
    sort(es, es+E, comp);
    UnionFind uf = UnionFind(V);
    ll res = 0;
    for(int i = 0; i < E; i++){
        edge e = es[i];
        if(!uf.same(e.u, e.v)){
            uf.unite(e.u, e.v);
            res += e.cost;
        }
    }   
    return res;
}

int main(){
    int N;
    cin >> N;
    REP(i,N){
        ll x,y;
        cin >> x >> y;
        X[i] = make_pair(x,i);
        Y[i] = make_pair(y,i);
    }

    sort(X, X+N);
    sort(Y, Y+N);

    REP(i,N-1){
        es[i].u = X[i].second;
        es[i].v = X[i+1].second;
        es[i].cost = X[i+1].first - X[i].first;
    }
    REP(i,N-1){
        es[N-1+i].u = Y[i].second;
        es[N-1+i].v = Y[i+1].second;
        es[N-1+i].cost = Y[i+1].first - Y[i].first;
    }

    V = N;
    E = 2*(N-1);
    ll ans = kruskal();
    cout << ans << endl;
    return 0;
}



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

using namespace std;

typedef unsigned long long int ll;

int main(int argc, char const *argv[])
{
	string s;
	cin >> s;

	if(s[1] == 'R'){
		s[1] = 'B';
	}
	else{
		s[1] = 'R';
	}

	cout << s << "\n";
}

Measured memory_bytes: 3624
N,M = map(int, input().split())
A = list(map(int,input().split()))

tot = sum(A)
cnt = 0

A = sorted(A,reverse = True)


for i in range(N):
    if A[i]/tot >= 1/(4*M):
        cnt += 1
    else:
        break


if cnt >= M:
    print('Yes')
else:
    print('No')

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vll l(n);
  rep(i,n) cin>>l[i];
  sort(l.rbegin(),l.rend());
  ll ans=0;
  rep(i,k) ans+=l[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n = gets.to_i
s1 = gets.chomp
s2 = gets.chomp

t1 = ""
i = 0
until i == n
    if s1[i] != s1[i + 1]
        t1 << "|"
        i += 1
    else
        t1 << "-"
        i += 2
    end
end

result = (t1[0] == "|") ? 3 : 6
1.upto(t1.length - 1){|i|
    case t1[i - 1]
    when "|" then result = ((result % 1000000007) * 2) % 1000000007
    else result = ((result % 1000000007) * 3) % 1000000007 if t1[i] != "|"
    end
}
puts result


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

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

    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    if( s < t )
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,x,y) for(int i=(int)(x);i<(int)(y);++i)
#define FORE(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)
#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)
#define PB push_back
#define ST first
#define ND second
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=2e5+7;

int ans=0;
int n,m,k,q;
int a[MAXN];
int dp[MAXN];
int num1,num2;
int a1[MAXN];
int a2[MAXN];
int r1,r2;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>n;
    FOR(i,0,n){
        char ch;
        cin>>ch;
        a[i]=ch-'0';
        if(a[i]==1)++num1;
    }
    ++num1;
    num2=num1-2;
    if(num2<0)num2+=2;
    FORE(i,1,n){
        dp[i]=dp[i%__builtin_popcount(i)]+1;
    }
    a1[n-1]=1;
    a2[n-1]=1;
    r1=a[n-1]%num1;
    if(num2!=0)r2=a[n-1]%num2;
    FORD(i,n-2,0){
        a1[i]=(a1[i+1]*2)%num1;
        if(num2!=0)a2[i]=(a2[i+1]*2)%num2;
        r1=(a1[i]*a[i]+r1)%num1;
        if(num2!=0)r2=(a2[i]*a[i]+r2)%num2;
    }
    FOR(i,0,n){
        if(a[i]==0){
            cout<<1+dp[(r1+a1[i])%num1]<<"\n";
        }else{
            if(num2!=0)cout<<1+dp[(r2-a2[i]+num2)%num2]<<"\n";
            else cout<<"0\n";
        }
    }
    return 0;
}


Measured memory_bytes: 6784
from itertools import accumulate

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)
B = sorted(B)
C = sorted(C)

acc_a = [0]*N
acc_c = [0]*N

i_a = 0
i_c = N-1
for i in range(N):
    b = B[i]
    while i_a < N and A[i_a] < b:
        acc_a[i] += 1
        i_a += 1

for i in reversed(range(N)):
    b = B[i]
    while i_c >= 0 and C[i_c] > b:
        acc_c[i] += 1
        i_c -= 1

acc_a = list(accumulate(acc_a))
acc_c = list(accumulate(acc_c[::-1]))
acc_c = acc_c[::-1]

ans = 0
for a, c in zip(acc_a, acc_c):
    ans += a*c
print(ans)


Measured memory_bytes: 25732
# -*- coding: utf-8 -*-

import sys
import os


def input_to_list():
    return list(map(int, input().split()))

for s in sys.stdin:
    m, f, r = list(map(int, s.split()))
    if m == f == r == -1:
        break

    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Measured memory_bytes: 7752
package main

import "fmt"

func main() {
	var K, A, B int
	fmt.Scan(&K, &A, &B)
	if B-A < 3 {
		fmt.Println(1 + K)
	} else { // B - A >= 3
		C := 1 // 手持ちのビスケットの数
		for {
			if A > C {
				K--
				C++
			} else {
				break
			}
		}
		if K >= 2 {
			d := K % 2
			C += (K / 2) * (B - A)
			if d > 0 {
				C++
			}
		} else {
			C++
		}
		fmt.Println(C)
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = n; i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	rep(i, n) cin >> p[i];
	sort(p.begin(), p.end());
	int ans = 0;
	rep(i, k) ans += p[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628