akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

template <typename Monoid> struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;

  private:
    int n;
    vector<Monoid> node;
    Monoid E;
    F f;

  public:
    SegmentTree(vector<Monoid> v, Monoid e, const F func) : f(func), E(e) {
        int sz = v.size();
        n = 1;
        while(n < sz) {
            n *= 2;
        }
        node.resize(2 * n - 1, E);
        for(int i = 0; i < sz; i++) {
            node[i + n - 1] = v[i];
        }
        for(int i = n - 2; i >= 0; i--) {
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void update(int i, Monoid val) {
        i += (n - 1);
        node[i] = val;
        while(i > 0) {
            i = (i - 1) / 2;
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    Monoid query(int a, int b, int i = 0, int l = 0, int r = -1) {
        if(r < 0) {
            r = n;
        }
        if(r <= a || b <= l) {
            return E;
        }
        if(a <= l && r <= b) {
            return node[i];
        }
        Monoid vl = query(a, b, 2 * i + 1, l, (l + r) / 2);
        Monoid vr = query(a, b, 2 * i + 2, (l + r) / 2, r);
        return f(vl, vr);
    }

    Monoid operator[](const int &i) const { return node[i + n - 1]; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    string s;
    cin >> n >> s >> q;
    vector<SegmentTree<int>> alp(
        26, SegmentTree<int>(vector<int>(n, 0), 0,
                             [](int a, int b) { return a + b; }));
    for(int i = 0; i < n; i++) {
        int c = s[i] - 'a';
        alp[c].update(i, 1);
    }
    while(q--) {
        int mode;
        cin >> mode;
        if(mode == 1) {
            int i;
            char c;
            cin >> i >> c;
            i--;
            int now = s[i] - 'a';
            int next = c - 'a';
            alp[now].update(i, 0);
            alp[next].update(i, 1);
            s[i] = c;
        } else {
            int l, r;
            cin >> l >> r;
            l--;
            r--;
            int ans = 0;
            for(int j = 0; j < 26; j++) {
                if(alp[j].query(l, r + 1) > 0) {
                    ans++;
                }
            }
            cout << ans << endl;
        }
    }
}

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


int main() {
  int N, M ;
  cin >> N >> M ;
  if(N > M){
    for(int i=0;i<N;i++) cout << M ; 
  }  
  else{
    for(int i=0;i<M;i++) cout << N ; 
  }  
    
  cout << endl ;
  return 0 ;
}

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

int t1[4001][4001], t2[2001][2001];
int n, k, x, y, ans;
char c;

main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> c;
    if (c == 'W') y += k;
    x %= 2 * k;
    y %= 2 * k;
    for (int j = 0; j < 2; j++) {
      t1[x + j * k][y + j * k]++;
      t1[x + j * k + k][y + j * k]--;
      t1[x + j * k][y + j * k + k]--;
      t1[x + j * k + k][y + j * k + k]++;
    }
  }
  for (int i = 0; i < 4 * k; i++) {
    for (int j = 1; j < 4 * k; j++) {
      t1[i][j] += t1[i][j - 1];
    }
  }
  for (int i = 1; i < 4 * k; i++) {
    for (int j = 0; j < 4 * k; j++) {
      t1[i][j] += t1[i - 1][j];
    }
  }
  for (int i = 0; i < 4 * k; i++) {
    for (int j = 0; j < 4 * k; j++) {
      t2[i % (2 * k)][j % (2 * k)] += t1[i][j];
    }
  }
  for (int i = 0; i < 2 * k; i++) {
    for (int j = 0; j < 2 * k; j++) {
      ans = max(ans, t2[i][j]);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 78464
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define all(v) v.begin(),v.end()
#define dis(it,it1) distance(it,it1)+1
#define MAX 200005
#define INF 9223372036854775807LL
#define MOD 1000000007
#define print(cs) printf("Case %lld: ",cs)
#define Yesno(ok) if(ok)puts("YES");else puts("NO")
#define yesno(ok) if(ok)puts("Yes");else puts("No")
ll lcm(ll a,ll b){return ((a*b)/__gcd(a,b));}
ll cnt=0;
ll binpow(ll a,ll b)
{
    if(b==0)return 1;
    ll res = binpow(a, b / 2);
    if (b&1)
        return (res%MOD * res%MOD * a%MOD)%MOD;
    else
        return (res%MOD * res%MOD)%MOD;
}
ll f[MAX],invf[MAX];
void init()
{
    ll i,j,k,l,r;
    f[0]=1;
    invf[0]=1;
    for(i=1;i<MAX;i++)
    {
        f[i]=(i*f[i-1])%MOD;
        invf[i]=binpow(f[i],MOD-2);
    }
}
ll ncr(ll n,ll r)
{
    ll res=(f[n]*invf[r])%MOD;
    res=(res*invf[n-r])%MOD;
    return res;
}
int main()
{
    init();
    ll i,j,k,l,r,n,m;
    in(n);in(m);
    ll a,b;
    in(a);in(b);
    ll ans=0;
    for(i=b+1,j=n-a;i<=m;i++)
    {
        ans+=((ncr(j+i-2,j-1)%MOD)*(ncr(a+m-i-1,m-i)%MOD))%MOD;
        ans%=MOD;
    }
    out(ans);endl;
}


Measured memory_bytes: 3328
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

mx = max(a)
a.remove(mx)

cur = 10**18
ai = 0

for ai in a:
    if abs(ai - mx//2) < cur:
        cur = abs(ai-mx//2)
        ans = ai
        
print(mx, ans)

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

int main() {
  int a,b,c,x,cnt = 0;

  cin >> a >> b >> c >> x;  
    
  rep(i,a){
    rep(j,b){
      rep(k,c){
        if(x == 500*i+100*j+50*k){
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B := getInt(), getInt()

	a := min(A, B)
	b := max(A, B)

	if a == 1 && b == 2 {
		out(3)
	} else if a == 1 && b == 3 {
		out(2)
	} else if a == 2 && b == 3 {
		out(1)
	}
}


Measured memory_bytes: 640
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, k = map(int, readline().split())
ab = [list(map(int, readline().split())) for _ in range(n)]

ab.sort()

cnt = 0
for i in range(n):
    cnt += ab[i][1]
    if cnt >= k:
        print(ab[i][0])
        exit()


Measured memory_bytes: 27632
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
typedef long long ll;


int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  int res = c - (a - b);
  if(res > 0) cout << res << endl;
  else cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc140/tasks/abc140_f

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

ll pow(ll a, ll e) {
  if (a < 0 || e < 0) {
    return 0;
  }

  if (e == 0) {
    return 1;
  }

  if (e % 2 == 0) {
    ll half = pow(a, e / 2);
    return half * half;
  }

  return a * pow(a, e - 1);
}

void solve() {
  ll N;
  cin >> N;

  ll length = 1 << N;

  VL ss(length);
  rep(i, length) {
    ll s;
    cin >> s;
    s *= -1;
    ss[i] = s;
  }

  sort(all(ss));

  multiset<ll> used;
  multiset<ll> not_used;

  used.insert(ss[0]);
  repf(i, 1, length) not_used.insert(ss[i]);

  while (!not_used.empty()) {
    VL used_this_time(0);

    for (auto s : used) {
      auto it = not_used.upper_bound(s);
      if (it == not_used.end()) drop("No");
      used_this_time.push_back(*it);
      not_used.erase(it);
    }

    for (auto s : used_this_time) {
      used.insert(s);
    }
  }

  cout << "Yes" << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 15616
#!/usr/bin/env ruby
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

s = 0
n.times do |i|
  s ^= a[i]
end

b = []

n.times do |i|
  b_i = s ^ a[i]
  b << b_i
end

puts b.join(' ')


Measured memory_bytes: 39512
#include "bits/stdc++.h"
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define qceil(n,d) ((n) > 0 ? ((n) - 1) / (d) + 1 : (n) / (d))
#define parity(a,b) ((a) & 1 == (b) & 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;

const pii dir[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

string S;
int X,Y;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> S >> X >> Y;
	deque<int> x,y;
	x.pub(0);
	int t = 0;
	for(char c : S){
		if(c == 'T'){
			t = 1 - t;
			if(t) y.pub(0);
			else x.pub(0);
		}else{
			if(t){
				++y.back();
			}else{
				++x.back();
			}
		}
	}
	
	bool dp[2][2][16002] = {};
	dp[0][1][x.front()] = 1;
	//cout << x.front() << endl;
	x.pof();
	t = 0;
	while(!x.empty()){
		dp[t][1][0] |= dp[t][0][0];
		dp[t][0][0] |= dp[t][1][0];
		int l = x.front();
		x.pof();
		//cout << l << endl;
		rep(i,2)rep(j,8001){
			 dp[1 - t][i][j + l] |= dp[t][i][j];
			 if(l < j){
			 	dp[1 - t][i][j - l] |= dp[t][i][j];
			 }else{
			 	dp[1 - t][1 - i][l - j] |= dp[t][i][j];
			 }
			 dp[t][i][j] = 0;
		}
		t = 1 - t;
	}
	dp[t][1][0] |= dp[t][0][0];
	dp[t][0][0] |= dp[t][1][0];
	bool res1 = X > 0 ? dp[t][1][X] : dp[t][0][-X];
	
	bool dp2[2][2][16002] = {};
	dp2[0][0][0] = dp2[0][1][0] = 1;
	t = 0;
	while(!y.empty()){
		int l = y.front();
		y.pof();
		rep(i,2)rep(j,8001){
			 dp2[1 - t][i][j + l] |= dp2[t][i][j];
			 if(l < j){
			 	dp2[1 - t][i][j - l] |= dp2[t][i][j];
			 }else{
			 	dp2[1 - t][1 - i][l - j] |= dp2[t][i][j];
			 }
			 dp2[t][i][j] = 0;
		}
		t = 1 - t;
		dp2[t][1][0] |= dp2[t][0][0];
		dp2[t][0][0] |= dp2[t][1][0];
	}
	
	bool res2 = dp2[t][1][abs(Y)];
	//cout << res1 << ' ' << res2 << endl;
	if(res1 & res2) cout << "Yes\n";
	else cout << "No\n";
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s,t;
bool fl;
struct edge{int to,cost;};
ll moji[30][ohara];
map<char,ll> mp;

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>s>>t;
    rep(i,Size(s))mp[s[i]]=1;
    rep(i,Size(alph)){
        rep(j,Size(s)+10){
            moji[i][j]=-1;
        }
    }
    rep(i,Size(s)){
        rep(j,Size(alph)){
            if(alph[j]==s[i])tmp=j;
        }
        moji[tmp][i]=i;
        //cout<<i<<" "<<tmp<<"\n";
    }
    rep(i,Size(alph)){
        rrrep(j,Size(s)-1,0){
            if(moji[i][j]==-1&&moji[i][j+1]!=-1)moji[i][j]=moji[i][j+1];
        }
    }
    //Cout(moji[19][0]);
    tmp=-1;
    rep(i,Size(alph)){
        if(t[0]==alph[i])tmp=i;
    }
    ll now=moji[tmp][0];
    if(mp[t[0]]==0){
        Cout(-1);
        return 0;
    }
    //Cout(now);
    int last=0;
    rrep(i,1,Size(t)){
        //Cout(now);
        if(mp[t[i]]==0){
            Cout(-1);
            return 0;
        }
        tmp=-1;
        rep(j,Size(alph)){
            if(t[i]==alph[j])tmp=j;
        }
        ll res=moji[tmp][now+1];
        //cout<<i<<" "<<res<<" "<<now<<"\n";
        if(res<=now){
            now=moji[tmp][0];
            ans+=Size(s);
            last=1;
        }
        else{
            now=res;
            last=0;
        }
    }
    ans+=Size(s);
    if(last){
    rep(i,Size(s)){
        if(s[i]==t[Size(t)-1]){
            tmp=i;
            break;
        }
    }
    ans-=Size(s)-tmp;
    }
    else{
        ans-=Size(s)-now;
    }
    Cout(ans+1);
    return 0;
}


Measured memory_bytes: 73168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
 
int main(){
  string S;
  cin >> S;
  for(int i=0;i<S.size();i++){
    if(S[i]=='L'){cout << "No" << endl; return 0;}
    i++;
  }
  for(int i=1;i<S.size();i++){
    if(S[i]=='R'){cout << "No" << endl; return 0;}
    i++;
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using std::cin;
using std::cout;
 
inline unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
  unsigned count = 0;
  for(unsigned i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}
 
inline void shell_sort(unsigned a[], unsigned n){
  const unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
  // pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)
 
  unsigned gap_num = 11, count = 0;
  while(gaps[--gap_num] > n);
 
  for(int i = gap_num; i >= 0; i--) count += insertion_sort(a,n,gaps[i]);
 
  cout << (gap_num+1) << '\n';
 
  for(; gap_num; gap_num--) cout << gaps[gap_num] << ' ';
  cout << gaps[0] << '\n';
 
  cout << count << '\n';
}
 
int main(){
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  unsigned n,i;
  cin >> n;
  auto a = new unsigned[n];
  for(i = 0; i < n; i++) cin >> a[i];
  shell_sort(a,n);
  for(i = 0; i < n; i++) cout << a[i] << '\n';
  delete[](a);
}

Measured memory_bytes: 4888
#include <bits/stdc++.h>
using  namespace std;
#define endl '\n'
#define ll long long
#define ce(x) cout << x << endl;
using db = long double;
const db pi = acos(-1);
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll t,i,j,y,z,k,a,b,x,n;
db th;

cin>>a>>b>>x;
if(x*2<a*b*a)	
// th=0;
th=atan((2.0*x)/(a*b*b));
else
th=atan( a/(2.0*(b-((x*1.0)/(a*a)))));
// ce(th)
th=180*th/pi;
th=90-th;
cout_p(th, 10);
}
//12 21 10		89.7834636934		
//4.2363947991


Measured memory_bytes: 256
/*
		@Author :- Gaurav Bharti
		National Institute of Technology, Jamshedpur.
*/
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define jaldibazi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
const int N=1e5+10;


int main(){
	jaldibazi;

    int n; cin>>n;
    map<ll,ll> m;
    ll ans=0;
    for(int i=0; i<n; ++i){
        ll a;cin>>a;
        ans+=a;
        m[a]++;
    }
 
    int q; cin>>q;
    for (int i=0; i<q;++i){
        ll b,c; cin>>b>>c;
        ans+=(c-b)*m[b];
        m[c]+=m[b];
        m[b]=0;
        cout<<ans<<endl;
    }

    return 0;
}

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

struct edge {int to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const int INf = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
static const int INF = 1000000000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll

bool colors[8];

signed main(){
    int n;
    int tourist=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int tmp;
        scanf("%d",&tmp);
        if(tmp<3200) colors[tmp/400] = true;
        else tourist++;
    }
    int counter=0;
    for(int i=0;i<8;i++) if(colors[i]) counter++;

    (counter!=0) ? printf("%d ",counter) : printf("1 ");
    printf("%d\n",counter+tourist);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

#define DIST_MAX (2*2*pow(10,8))

int main(){
	int n, m;
	cin >> n >> m;
	int a[n], b[n], c[m], d[m];
	for(int i=0; i<n; i++){
		cin >> a[i] >> b[i];
	}
	for(int i=0; i<m; i++){
		cin >> c[i] >> d[i];
	}

	for(int i=0; i<n; i++){
		int chkpnt = 0, min = DIST_MAX;
		for(int j=0; j<m; j++){
			int dist = abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(dist < min){
				min = dist;
				chkpnt = j;
			}
		}
		cout << chkpnt+1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, N):
        # par = parent
        self.par = [i for i in range(N)]
        return

    def root(self, x):
        if self.par[x] == x:
            return (x)
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def same(self, x, y):
        return (self.root(x) == self.root(y))

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if (x == y):
            return False

        self.par[x] = min(x, y)
        self.par[y] = min(x, y)
        return True


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


N, M = inpl()
uf = UnionFind(N)
for i in range(M):
    x, y, z = inpl()
    x -= 1
    y -= 1
    uf.union(x, y)

ans = []
for i in range(N):
    ans.append(uf.root(i))
print(len(set(ans)))


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

long long pow(long long a,int b)
{
	if (b==0)
	{
		return 1LL;
	}
	long long ans=pow(a,b/2);
	ans*=ans;
	if (b%2==1)
	{
		ans*=a;
	}
	return ans;
}

long long my(int n,long long x)
{
	if (n==0)
	{
		return x;
	}
	if (x==1)
	{
		return 0LL;
	}
	long long a=pow(2LL,n+1)-3LL;
	if (x<=a+1LL)
	{
		return my(n-1,x-1);
	}
	else if (x==a+2LL)
	{
		return my(n-1,a)+1LL;
	}
	else if (x==a*2LL+3LL)
	{
		return my(n-1,a)*2LL+1LL;
	}
	else
	{
		return my(n-1,a)+1LL+my(n-1,x-a-2LL);
	}
}

int main(int argc, char const *argv[])
{
	int n;
	long long x;
	cin>>n>>x;
	cout<<my(n,x)<<endl;
	return 0;
}


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

int main(){
  int n;cin >> n;
  int dp[45];dp[0]=1;dp[1]=1;
  for(int i=2;i<45;i++){
    dp[i]=dp[i-1]+dp[i-2];
  }
  cout << dp[n] << endl;
}



Measured memory_bytes: 3080
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
const double pi = acos(-1);

const int DEBUG = 1;

PL get(void) {
  ll x, y;
  cin >> x >> y;
  return PI(x, y);
}

const double inf = 5e15;
typedef pair<double, PI> PDPI;

double tertia(PL p1, PL p2, int n, vector<PL> &pt) {
  const double coef = 5 * pi - 20;
  // LIS, longest increasing subsequence
  VI m(n + 1);
  int l = 0;
  REP(i, 0, n) {
    int lo = 0;
    int hi = l + 1;
    while (hi - lo > 1) {
      int mid = (hi + lo) / 2;
      if (pt[m[mid]].second < pt[i].second) {
	lo = mid;
      } else {
	hi = mid;
      }
    }
    int newl = lo + 1;
    m[newl] = i;
    if (newl > l) {
      l = newl;
    }
  }
  int k = min(abs(p2.first - p1.first), abs(p2.second - p1.second)) + 1;
  double mi = 1.0 / 0.0;
  if (l == k) {
    mi = l * coef + 5.0 * pi;
  } else {
    mi = l * coef;
  }
  return mi;
}

double solve(PL p1, PL p2, int n, vector<PL> &pt) {
  // preprocess
  if (p1.first > p2.first) {
    p1.first = -p1.first;
    p2.first = -p2.first;
    REP(i, 0, n) {
      pt[i].first = -pt[i].first;
    }
  }
  if (p1.second > p2.second) {
    p1.second = -p1.second;
    p2.second = -p2.second;
    REP(i, 0, n) {
      pt[i].second = -pt[i].second;
    }
  }
  // trim
  vector<PL> pool;
  REP(i, 0, n) {
    if (p1.first <= pt[i].first && pt[i].first <= p2.first
	&& p1.second <= pt[i].second && pt[i].second <= p2.second) {
      pool.push_back(pt[i]);
    }
  }
  sort(pool.begin(), pool.end());
  int nn = pool.size();
  double mi = tertia(p1, p2, nn, pool);
  return mi;
}

int main(void) {
  PL p1 = get();
  PL p2 = get();
  int n;
  cin >> n;
  vector<PL> pt(n);
  REP(i, 0, n) {
    pt[i] = get();
  }
  double res = abs(p1.first - p2.first) + abs(p1.second - p2.second);
  res *= 100;
  double add = solve(p1, p2, n, pt);
  printf("%.15f\n", res + add);
}


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

int a[100], b[100];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		b[a[i]] = i;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) if (b[i] != i) ans++;
	if (ans > 2) puts("NO");
	else puts("YES");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int N;
    cin >> N;
    ve<pll> A(N);
    rep(i,N) cin >> A[i].se >> A[i].fi;
    sort(all(A));

    ll t = 0;
    rep(i,N){
        t += A[i].se;
        if(t <= A[i].fi) continue;
        
        cno;
        return 0;
    }
    cyes;
    
    
    
    

    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();

        if(input < 1200) {
            System.out.println("ABC");
        } else {
            System.out.println("ARC");
        }
    }
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int num1 = c / b;
  int num2 = a / d;
  if (c % b != 0) {
    num1++;
  }
  if(a % d != 0){
    num2++;
  }
  int cou1 = num1;
  int cou2 = num2;
  if(cou1 <= cou2){
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

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

struct BipartiteMatching {
    vector<vector<int>> G;
    vector<bool> used;
    vector<int> match;

    BipartiteMatching(int V) : G(V), used(V), match(V) {}

    void add_edge(int u, int v) {
        G[u].push_back(v);
        G[v].push_back(u);
    }

    bool dfs(int u) {
        used[u] = true;
        for (int v : G[u]) {
            int w = match[v];
            if (w < 0 || (!used[w] && dfs(w))) {
                match[u] = v;
                match[v] = u;
                return true;
            }
        }
        return false;
    }

    int bipartite_matching() {
        int res = 0;
        fill(match.begin(), match.end(), -1);
        for (int v = 0; v < G.size(); v++) {
            if (match[v] == -1) {
                fill(used.begin(), used.end(), false);
                if (dfs(v)) res++;
            }
        }
        return res;
    }
};

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

    int N, M;
    cin >> N >> M;
    vector<string> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    BipartiteMatching bm(N*M);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            if (S[i][j] == '#') continue;
            if (j < M - 1 && S[i][j+1] == '.') bm.add_edge(M * i + j, M * i + j + 1);
            if (i < N - 1 && S[i+1][j] == '.') bm.add_edge(M * i + j, M * (i + 1) + j);
        }
    }
    cout << bm.bipartite_matching() << "\n";
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            if (S[i][j] != '.') continue;
            if (bm.match[M * i + j] != -1) {
                int v = bm.match[M * i + j];
                int ii = v / M, jj = v % M;
                if (i == ii) {
                    S[i][j] = '>';
                    S[i][jj] = '<';
                } else {
                    S[i][j] = 'v';
                    S[ii][j] = '^';
                }
            }
        }
        cout << S[i] << "\n";
    }
}

Measured memory_bytes: 4280
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int h[] = new int[K+1];
    int landCt =0;
    int answer=0;
    h[0]=0;
    for(int i=1;i<=K;i++){
      h[i] = sc.nextInt();
    }
    for(int i=0;i<101;i++){
      landCt=0;
      for(int j=0;j<K;j++){
        if(h[j]==0&&h[j+1]>0){
          landCt=landCt+1;
        }
      }
      answer = answer + landCt;
      oneMinus(h);
    }
      System.out.println(answer);   
  }
  
  public static void oneMinus(int[] h){
    for(int i=0;i<h.length;i++){
      if(h[i]!=0){
        h[i]=h[i]-1;
      }
    }
  }
  
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for(int i = a; i < b; i++)
#define for_m(i, a, b) for(int i = a - 1; i >= b; i--)

//a = s1.size();
//vector<string> s1;
//string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    cin >> a1[i];
  }
  
  b++;
  
  for(i = 1; i < a; i++){
    for(j = 0; j < i; j++){
      if(a1[j] > a1[i]){
        c++;
      }
    }
    if(c == 0){
      b++;
    }
    c = 0;
  }
  cout << b << endl;
} 
  






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

for i in range(n, -1, -1):
    for j in range(n-i+1):
        s = n - i - j
        total = 10000 * i + 5000 * j + 1000 * s
        x = i + j + s
        if total == k and i + j + s == n:
            print(i, j, s)
            exit()
        elif total > k:
            break

print(str(-1), str(-1), str(-1))

Measured memory_bytes: 3064
n=int(input())
B=list(map(int,input().split()))
A=[B[0]]
for i in range(n-2):
    if B[i]<=B[i+1]:
        A.append(B[i])
    else:
        A.append(B[i+1])
A.append(B[n-2])
print(sum(A))

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n, d, x; cin >> n >> d >> x;
  vector<vector<int>> p(d, vector<int>(n));

  for(int i=0;i<d;++i) {
    for(int j=0;j<n;++j) {
      cin >> p[i][j];
    }
  }

  vector<vector<int>> diff(d-1, vector<int>(n));
  for(int i=0;i<d-1;++i) {
    for(int j=0;j<n;++j) {
      diff[i][j] = p[i+1][j] - p[i][j];
    }
  }

  for(int k=0;k<d-1;++k) {
    vector<vector<int>> dp(n+1, vector<int>(x+1));
    for(int i=1;i<=n;++i) {
      for(int j=1;j<=x;++j) {
        // cout << k << ":" << i << ":" << j << endl;
        dp[i][j] = dp[i-1][j];
        if(j - p[k][i-1] >= 0) {
          dp[i][j] = max(dp[i][j], dp[i][j-p[k][i-1]] + diff[k][i-1]);
        }
      }
    }
    x += dp[n][x];
  }
  cout << x << endl;
}



Measured memory_bytes: 4072
n =int(input())
num = 0
ans = 0

for i in range(1,n+1):
    while True:
        if i%2 == 0:
            i = i//2
            num += 1
        else:
            ans = max(ans,num)
            #print(i,num,ans)
            num = 0
            break
print(2**ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void bubbleSort(char [][3],int);
void selectionSort(char [][3],int);
//void copyArray(char [][3], char [][], int);
int isStable(char [][3],char [][3], int);

int main() {
  int n,i;
  char a[36][3],b[100][3],s[100][3];
  
  // input data
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%s",a[i]);
  
  // sort
  for(i=0;i<n;i++) strcpy(b[i],a[i]);
  bubbleSort(b,n);

  for(i=0;i<n;i++) strcpy(s[i],a[i]);
  selectionSort(s,n);
  
  // output sorted data
  for(i=0;i<n-1;i++) printf("%s ",b[i]);
  printf("%s\n",b[n-1]);
  if( isStable(a,b,n) ) printf("Stable\n");
  else printf("Not stable\n");

  for(i=0;i<n-1;i++) printf("%s ",s[i]);
  printf("%s\n",s[n-1]);
  if( isStable(a,s,n) ) printf("Stable\n");
  else printf("Not stable\n");

  return 0;
}

// Sort by bubble sort and asc.
void bubbleSort(char a[][3], int n) {
  int j,flag=1;
  char tmp[3];
  
  while(flag) {
    flag = 0 ;
    for(j=n-1;j>0;j--) {
      if( a[j][1] < a[j-1][1] ) {
	strcpy(tmp,a[j]);
	strcpy(a[j],a[j-1]);
	strcpy(a[j-1],tmp);
	flag = 1;
      }
    }
  }
  

}

// Sort by selection sort and asc.
void selectionSort(char a[][3], int n) {
  
  int i,j,cnt=0,minj,bef;
  char tmp[3];
  
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++) {
      if( a[j][1] < a[minj][1] ) {
	minj = j;
      }
    }
    if(a[i][1] != a[minj][1]){
      strcpy(tmp,a[i]);
      strcpy(a[i],a[minj]);
      strcpy(a[minj],tmp);
    }
  }
  
  
  
}



// check whether out is stable
int isStable(char in[][3],char out[][3], int n){
  int i,j,a,b;

  for(i=0;i<n;i++) {
    for(j=i+1;j<n;j++) {
      for(a=0;a<n;a++) {
	for(b=a+1;b<n;b++) {
	  if( in[i][1] == in[j][1] && in[i][0] == out[b][0] && in[i][1] == out[b][1] && in[j][0] == out[a][0] && in[j][1] == out[a][1] ){ return 0;}
	}
      }
    }
  }
  
  return 1;
}

Measured memory_bytes: 612
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        int N = Integer.parseInt(input.nextLine());

        for(int i = 0; i < N; i++) {
            String s = input.nextLine().replaceAll("Hoshino", "Hoshina");

            out.println(s);
        }
        out.flush();
        out.close();
System.exit(0);
    }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int bigint;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	ll k;
	bigint a,b,c;
	cin >>a >>b >>c >>k;
	bigint ans = 0;
	if(k %2 ) ans = b-a; else ans =a -b; 
	if(ans > (ll)1e18) cout <<"Unfair"<<"\n";
	else cout <<ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
    // Your code here!
    int N,M;
    char A[50][51],B[50][51];
    char *pstr;
    
    scanf("%d%d",&N,&M);
    
    for(int i = 0;i<N;i++){
        scanf("%50s",A[i]);
    }
    
    for(int i = 0;i<M;i++){
        scanf("%50s",B[i]);
    }
    
    for(int i = 0; i < N - M + 1 ;i++){
        for(int j = 0; j < N - M +1;j++){
            int flag = 0;
            for(int z = 0; z < M; z++){
                for(int k = 0; k < M;k++){
                    if(A[i+z][j+k] != B[z][k]){
                        flag = -1;
                        break;
                    }
                }
            }
            
            if(flag == 0){
                printf("Yes\n");
                return 0;
            }
        }
    }
    
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  int N = 700;
  rep(i,3)
  {
    if(S[i]=='o')
    {
      N += 100;
    }
  }
  cout << N << endl;
  return 0;
}


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

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

  vector<int> lblack(n+1);
  vector<int> rwhite(n+1);

  lblack[0] = 0;
  rwhite[n] = 0;
  rep(i,n){
    lblack[i+1] = lblack[i];
    if(s[i] == '#') lblack[i+1]++;
  }
  for(int i=n-1; i>=0; i-- ){
    rwhite[i] = rwhite[i+1];
    if(s[i] == '.') rwhite[i]++;
  }
  int res = INF;
  FOR(i, 0, n) {
    res = min( res, lblack[i] + rwhite[i]);
  }

  cout << res << endl;
}


Measured memory_bytes: 2180
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <functional>

#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
constexpr int INF = 1LL << 50;
using P = pair<int, int>;

template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    else {
        return false;
    }
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    else {
        return false;
    }
}
struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int as[3];
    rep(i, 0, 3) {
        cin >> as[i];
    }
    sort(as, as + 3);
    cout << (as[0] == 5 && as[1] == 5 && as[2] == 7 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int N,A,B;
	cin>>N>>A>>B;
	int ans=0;
	fyg(N+1,1){
		int C=y;int n=0;
		while(C>0){
			n+=C%10;
			C/=10;
		}
		if(n>=A&&n<=B){ans+=y;}
	}
	ce(ans)
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

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

	double ans = 0;
	double ans2;
	for (int i = 1; i < N + 1; i++) {
		if (i % 2 == 1) {
			ans += 1.0;
		}
	}
	ans2 = ans / N;

		cout << ans2 << endl;
	}
	    

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

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

fn main() {
    let v = read_vec::<usize>();
    let (a, b, c) = (v[0], v[1], v[2]);
    if a > c && c > b || a < c && c < b {
        println!("Yes");
    } else {
        println!("No");
    }
}

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

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


Measured memory_bytes: 4352
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>




using namespace std;

struct switches{
  long k;
  vector<long> s;
  //long s;
};

int main(){
  long n,m,ii,jj,tmp;
  vector<switches> sw;
  vector<long>     light;
  cin >> n >> m;

  sw.resize(m);
  light.resize(m);

  for(ii=0;ii<m;ii++){
    cin >> sw[ii].k;
    sw[ii].s.resize(n);

    for(jj=0;jj<n;jj++){
      sw[ii].s[jj] = 0;
    }

    for(jj=0;jj<sw[ii].k;jj++){
      cin >> tmp;
      //cout << "tmp:" << tmp << endl;
      sw[ii].s[tmp-1] = 1;
    }

  }

  //cout << "sw end" << endl;
  for(ii=0;ii<m;ii++){
    //cout << "ii:" << ii << endl;
    cin >> light[ii];
  }

  for(ii=0;ii<m;ii++){
    for(jj=0;jj<n;jj++){
      //cout << "sws" << sw[ii].s[jj] << ":" ;
    }
    //cout << endl;
  }

  //cout << "end of input" << endl;
  vector<long> state;
  long kk,ll,swstate,res=0;
  vector<long> arr;
  state.resize(n);
  arr.resize(m);
  
  for(ii=0;ii<pow(2,n);ii++){
    tmp = ii;
    //cout << "tmp:"<< tmp << endl;;
    //スイッチノ状態を作成
    for(jj=0;jj<n;jj++){
      state[jj] = tmp % 2;
      tmp = tmp / 2;
      //cout << state[jj] << ":" ;
    }
    
    //cout << endl;

    for(ll=0;ll<m;ll++){
      arr[ll] = 0;
    }
    //スイッチの状態で全ての電灯がつくかを確認
    //for(jj=0;jj<n;jj++){
    swstate = 0;

    //for(kk=0;kk<n;kk++){
    //  if(state[kk] == 1){
    //	for(ll=0;ll<n;ll++){
    //	  if(sw[kk].s[ll] == 1){
    //	    arr[ll]++ ;
    //	  }
    //	}
    //	//cout << "jj:"  << jj << "kk:" << kk << endl;
    //  }
    //}

    for(kk=0;kk<m;kk++){
      for(ll=0;ll<n;ll++){
	if(state[ll] == 1 && sw[kk].s[ll] == 1){
	  arr[kk]++;
	}
      }
    }
    tmp = 0;
    
    for(kk=0;kk<m;kk++){
      if((light[kk] % 2) == (arr[kk] % 2)){
	tmp++;
      }
    }

    if(tmp == m){
      res++;
    }
    //for(ll=0;ll<m;ll++){
    //  cout << "arr:" << arr[ll] << endl;
    //}
    //cout << "state" << ii << endl;
  }
  cout << res << endl;
  return 0;
}


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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())

int main() {
    lld N,K;
    cin >> N >> K;
    lld now = 1;
    lld ans = 0;
    while(true){
        now *= K;
        ans++;
        if(N < now){
            cout << ans << endl;
            exit(0);
        }
    }
}

Measured memory_bytes: 256