akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

const int PrimeMax = 100001;
int is_prime[PrimeMax];
void Eratosthenes(int N){
  for(int i = 0; i < N; i++){
    is_prime[i] = 1;
  }
  is_prime[1] = 0;
  for(int i = 2; i*i < N ; i++){
    if(is_prime[i]){
      for(int j = 0; i * (j + 2) < N; j++){
        is_prime[i *(j + 2)] = 0;
      }
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  Eratosthenes(10000);
  int n ;
  while(cin >> n&&n){
    for(int i = n; i >=0;--i){
      if(is_prime[i] && is_prime[i-2]){
        cout << i-2 << " " <<i<<endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3048
#include <queue>
#include <iostream>
#define ll long long
using namespace std;

int main(){
  string s;
  priority_queue<ll> pq;
  while(cin >> s){
    if(s == "insert"){
      ll input;
      cin >> input;
      pq.push(input);
    }else if(s == "extract"){
      cout << pq.top() << '\n';
      pq.pop();
    }else{
      return 0;
    }
  } 
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

string S;

signed main()
{
    cin >> S;

    if(S.length() == 2 && S[0] == S[1]) {
        printf("1 2\n");
        return 0;
    }

    for(int i = 0; i < S.length() - 2; ++i) {
        if(S[i] == S[i+1] || S[i] == S[i+2] || S[i+1] == S[i+2]) {
            printf("%lld %lld\n", i+1, i+3);
            return 0;
        }
    }
    printf("-1 -1\n");

    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int a = 0, b = 0;
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0 && S.at(i) == '1') {
      a++;
    }
    if (i % 2 == 1 && S.at(i) == '0') {
      a++;
    } 
    if (i % 2 == 1 && S.at(i) == '1') {
      b++;
    }
    if (i % 2 == 0 && S.at(i) == '0') {
      b++;
    } 
  }
  cout << min(a, b) << endl;
}
  

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
void debug(vector<vector<ll>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
void debug(vector<ll>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
vector<vector<ll>>vec(ll x, ll y, ll w){
  vector<vector<ll>>v(x,vector<ll>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}
//m.emplace(x,0).fi->se++;

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  set<ll>s;
  rep(i,0,m+1)s.insert(i);
  vector<P>p(n);
  rep(i,0,n)cin>>p[i].se>>p[i].fi;
  sort(ALLR(p));
  rep(i,0,n){
    auto itr=s.lower_bound(p[i].se);
    if(itr!=s.end()){
      res+=p[i].fi;
      s.erase(itr);
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int a[(int)1e6],N,i,m;
int main()
{
	cin>>N;
	while(N--)cin>>i,a[i]++,a[i-1]++,a[i+1]++;
	i=0;
	while(i<1e5)m=max(m,a[i++]);
	cout<<m;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    ll x;
    cin >> x;
    
    ll cur = 100, ans = 0;
    while (cur < x) {
        cur = cur * 1.01;
        ans++;
    }

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


Measured memory_bytes: 3608
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(void){
	string s; cin >> s;
	string ans;
	rep(i, s.size()){
		if(s[i] == '0') ans += '0';
		else if(s[i] == '1') ans += '1';
		else{
			ans.pop_back();
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
#else

#endif



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    int K;
    string S;
    cin >> K >> S;
    if (K >= (int)S.size()) cout << S << "\n";
    else {
        cout << S.substr(0, K) << "...\n";
    }
}


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

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let n: String = read();
    let ns: Vec<char> = n.chars().collect();
    for _ in 0..ns.len() {
        print!("{}", "x")
    }
}


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

using namespace std;

//container util
#define SORT(c) sort((c).begin(),(c).end())

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

const int MAX = 100001;

int main(void){

	long long int N, K; cin >> N >> K;
	vector<long long int> cnt(MAX, 0);
	REP(i,N){
		int a, b; cin >> a >> b;
		cnt[a] += b;
	}

	long long int sum = 0;
	REP(i,MAX){
		if(sum + cnt[i] < K) sum += cnt[i];
		else{
			cout << i << endl;
			break;
		}
	}





	return 0;

}


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

typedef struct task {
    unsigned int A;
    unsigned int B;
} task;

int comp(const void *_a, const void *_b)
{
    task *a;
    task *b;

    a = (task *)_a;
    b = (task *)_b;

    if(a->B < b->B) {
        return -1;
    } else if(a->B > b->B) {
        return 1;
    } else {
        return 0;
    }
}

int main()
{
    int N;
    task *T;
    int i;
    unsigned int t;
    int is_success;

    scanf("%d", &N);
    T = (task *)malloc(sizeof(task) * N);
    for(i = 0; i < N; i++) {
        scanf("%d %d", &(T[i].A), &(T[i].B));
    }

    qsort(T, N, sizeof(task), comp);

    is_success = 1;
    t = 0;
    for(i = 0; i < N; i++) {
        t += T[i].A;
        if(t > T[i].B) {
            is_success = 0;
            break;
        }
    }

    if(is_success) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    free((void *)T);

    return 0;
}


Measured memory_bytes: 3324
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int N = sc.nextInt();
            int F = sc.nextInt();
            Map<String, Map<String, Integer>> cntMap = new HashMap<>();
            for (int i = 0; i < N; i++) {
                int M = sc.nextInt();
                List<String> itemList = new ArrayList<>();
                for (int j = 0; j < M; j++) {
                    itemList.add(sc.next());
                }

                Collections.sort(itemList);

                for (int j = 0; j < itemList.size(); j++) {
                    for (int k = j + 1; k < itemList.size(); k++) {
                        String from = itemList.get(j);
                        String to = itemList.get(k);
                        Map<String, Integer> map = cntMap.getOrDefault(from, new HashMap<>());

                        int cnt = map.getOrDefault(to, 0);
                        cnt++;

                        map.put(to, cnt);
                        cntMap.put(from, map);
                    }
                }
            }

            List<String> fromList = new ArrayList<>();
            List<String> toList = new ArrayList<>();

            cntMap.keySet().stream().sorted().forEach(from -> {
                Map<String, Integer> map = cntMap.get(from);
                map.keySet().stream().sorted().forEach(to -> {
                    if ( map.get(to) >= F ) {
                        fromList.add(from);
                        toList.add(to);
                    }
                });
            });

            System.out.println(fromList.size());
            for (int i = 0; i < fromList.size(); i++) {
                System.out.println(fromList.get(i) + " " + toList.get(i));
            }
        }
    }
}



Measured memory_bytes: 41900
n,*t=map(int,open(0).read().split())
c=sorted(t[-n:])
print(sum(c[:-1]))
e={i:[]for i in range(n)}
for a,b in zip(t[:-n:2],t[1:-n:2]):e[a-1]+=b-1,;e[b-1]+=a-1,
f=[0]*n
q=[0]
while q:
 v=q.pop();f[v]=c.pop()
 for w in e[v]:q+=[w]*(f[w]<1)
print(*f)

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)

string s;
ll k;

int main(){
  cin >> s >> k;
  for(ll i = 0;i<k;i++){
    if(s[i]!='1'){
      cout << s[i] <<endl;
      return 0;
    }
    if(i==k-1){
      cout << s[i] <<endl;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define BUFSIZE 10000
#include<math.h>
int N,R;

int main(void){
	scanf(" %d",&N);
	scanf(" %d",&R);
	if(N < 10){
		printf(" %d",R+100*(10-N));
	}else{
		printf(" %d",R);
	}
		
		
		
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int a, b;
    cin >> a >> b;
    int ans = 0;
    if (a >= b) {
        ans += a;
        --a;
    }
    else {
        ans += b;
        --b;
    }
    ans += max(a, b);
    cout << ans << endl;
    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 vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
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>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N;
    cin >> N;
    vl A(N);
    in(N,A);
    ve<pair<ll,int>> B;
    rep(i,N) B.pb({A[i],i+1});
    sort(all(B));
    reverse(all(B));
    
    vvl dp(N+1,vl(N+1,0));
    rep(i,N) dp[0][i+1] = dp[0][i] + B[i].fi*(ll)(abs(B[i].se-(i+1)));
    rep(i,N) dp[i+1][0] = dp[i][0] + B[i].fi*(ll)(abs(N-i - B[i].se));
    
    rep(i,N){
        rep(j,N){
            if(i+j+1 > N) continue;
            dp[i+1][j+1] = max(dp[i+1][j]+B[i+j+1].fi*(ll)abs(B[i+j+1].se - (j+1)) ,dp[i][j+1] + B[i+j+1].fi*(ll)abs(B[i+j+1].se - (N-i)));
            
        }
    }
    
    //outmat(dp);
    
    ll ans = 0;
    rep(i,N+1) rep(j,N+1) chmax(ans,dp[i][j]);
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 34620
N, S = open(0).read().split()

cnt = left = 0
for s in S:
    if s == "(":
        cnt += 1
    else:
        cnt -= 1

        if cnt < 0:
            left = max(left, -cnt)

S = "(" * left + S

right = 0
for s in S:
    if s == "(":
        right += 1
    else:
        right -= 1

S = S + ")" * right

print(S)

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

int main() {
    int N;
    int ans = 0;
    cin >> N;

    if (N < 105) {
        cout << ans << endl;
    } else if (N >= 105 && N < 135) {
        cout << ans+1 << endl;
    } else if (N >= 135 && N < 165) {
        cout << ans+2 << endl;
    } else if (N >= 165 && N < 189) {
        cout << ans+3 << endl;
    } else if (N >= 189 && N < 195) {
        cout << ans+4 << endl;
    } else
        cout << ans+5 << endl;
}
/*
int countDivisors(int N){
    int cnt = 2;
    for (int i = 2; i <= sqrt(N); i++) {
        if (N % i == 0) {
            cnt++;
            if (N / i != i) {
                cnt++;
            }
        }
    }
    return cnt;
}
*/

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


bool isPrime(int n){
	if(n<=1)return false;
	for(int i=2;i*i<=n;i++)
		if(n%i==0)return false;
	return true;
}

int main(){
	int n;
	while(cin>>n){
		int ans=0;
		for(int i=0;i<n;i++)
			if(isPrime(i+1)&&isPrime(n-i))ans++;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
import math
A, B, H, M = map(int, input().split())

A_ang = (60*H+M)*math.pi/ 360
B_ang = M*math.pi / 30

X_A = A*math.sin(A_ang)
Y_A = A*math.cos(A_ang)

X_B = B*math.sin(B_ang)
Y_B = B*math.cos(B_ang)

X_D = X_A - X_B
Y_D = Y_A - Y_B

ans = math.sqrt(X_D*X_D + Y_D*Y_D)

print(ans)

Measured memory_bytes: 9532
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
typedef long long ll;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;

int main(){
  vector<int> a(9);
  rep(i,9) cin >> a.at(i);
  int n;
  cin>>n;
  int b;
  vector<bool> c(9);
  rep(i,n){
    cin >> b;
    rep(j,9){
      if(a.at(j)==b)
        c.at(j) = true;
    }
  }

  if(c.at(0)*c.at(1)*c.at(2)==1||c.at(3)*c.at(4)*c.at(5)==1||c.at(6)*c.at(7)*c.at(8)==1||
    c.at(0)*c.at(3)*c.at(6)==1||c.at(1)*c.at(4)*c.at(7)==1||c.at(2)*c.at(5)*c.at(8)==1||
    c.at(0)*c.at(4)*c.at(8)==1||c.at(2)*c.at(4)*c.at(6)==1)
    cout << "Yes" << endl;
  else
    cout << "No" <<endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  bool b = true;
  if(S[0] != 'A') {
    b = false;
  }
  bool c = false;
  for(int i = 2; i < N - 1; i++) {
    if(S[i] == 'C' && c) {
      c = false;
      break;
    }
    if(S[i] == 'C' && !c) {
      c = true;
    }
  }
  if(!c) {
    b = false;
  }
  vector<char> alph = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
                       'n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int count = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 26; j++) {
      if(S[i] == alph[j]) {
        count ++;
        break;
      }
    }
  }
  if(count != N - 2) {
    b = false;
  }
  if(b) {
    cout << "AC" << endl;
  }
  else {
    cout << "WA" << endl;
  }
}

Measured memory_bytes: 3604
N = gets.to_i
C = gets.chomp
c = C.split('')

result = 0
while c.length > 1 do
    while(c[0] == 'R') do
        c.shift
    end
    while(c[-1] == 'W') do
        c.pop
    end
    if c.length < 2
        puts result
        exit
    end
    c.shift
    c.pop
    result += 1
end
puts result

Measured memory_bytes: 31368
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    char str[200];
    unsigned long long int K;
    
    scanf("%s", str);
    scanf("%llud", &K);
    int i = 0;
    for(i = 0; str[i] == '1'; i++){
    }
    
    if(K <= i){
        printf("1\n");
    }else{
        printf("%d\n", str[i] - '0');
    }
        
    return 0;
}

Measured memory_bytes: 128
#import "stdio.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        int n;
        scanf("%d", &n);
        if (n==1) {
            printf("Hello World\n");
        } else {
            int a,b;
            scanf("%d", &a);
            scanf("%d", &b);
            printf("%d", a+b);
        }
    }
    return 0;
}


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

const int N = 1e5 + 5;
const double inf = 1e18;
double x[N], y[N];
double dx[N], dy[N];
int n;

double f(double a) {
    double minx = inf, maxx = -inf, miny = inf, maxy = -inf;
    for (int i = 0; i < n; i++) { //n个点
        double nx = x[i] + a * dx[i];
        double ny = y[i] + a * dy[i];
        minx = min(minx, nx);
        maxx = max(maxx, nx);
        miny = min(miny, ny);
        maxy = max(maxy, ny);
    }
    return (maxx - minx) * (maxy - miny);
}

double ternary_search(double l, double r) {
   double ans = inf;
  int times = 300;
    while (times--) {
        double m1 = l + (r - l) / 3;
         double m2 = r - (r - l) / 3;
        //double m1 = (l*2+r) / 3;
        //double m2 = (r*2+l) / 3;
        double f1 = f(m1);
        double f2 = f(m2);
        ans = min(ans, f1);
         ans = min(ans, f2);
        if (f1 < f2) r = m2;
        else l = m1;
    }
    return ans;
}

int main() {
   // while (cin >> n) {
      cin>>n;
        //memset(dx, 0, sizeof(dx));
        //memset(dy, 0, sizeof(dy));

        string s;
        for (int i = 0; i < n; i++) {
            cin >> x[i] >> y[i] >> s;
            if (s == "R") dx[i] = 1;
            if (s == "L") dx[i] = -1;
            if (s == "U") dy[i] = 1;
            if (s == "D") dy[i] = -1;
        }


       // cout << fixed << setprecision(11) <<ternary_search(0, 1e9) << endl;
      printf("%.11f\n",ternary_search(0, 1e9));
   // }

    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int M=2e5+5;
int a[M];
int mark[M];
int ans[M];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=n;i>=1;i--){
		int ret=0;
		for(int j=i+i;j<=n;j+=i)
			if(mark[j])ret^=1;
		mark[i]=a[i]^ret;
	}
	int ct=0;
	for(int i=1;i<=n;i++)
		if(mark[i])ans[++ct]=i;
	printf("%d\n",ct);
	for(int i=1;i<=ct;i++)printf("%d%c",ans[i]," \n"[i==ct]);
	return 0;
}


Measured memory_bytes: 2944
class Node
  # property parent : Int32
  # property s : Int32
  # property r : Int32
  attr_accessor :parent, :s, :r # Ruby
    
  def initialize(n)
    @parent = -1
    @s = 1
    @r = 0
  end
end

class UnionFindTree
  
  # property nodes : Array(Node) # Crystal
  attr_accessor :nodes        # Ruby

  def initialize(n)
    @nodes = (0..n).to_a.map{ |i| Node.new(i) }
  end

  def root(x)
    t = nodes[x].parent
    return x if t < 0
    nodes[x].parent = root(t)
  end
  
  def unite(a, b)
    a = root(a)
    b = root(b)
    return false if a == b
    a, b = b, a if nodes[a].r < nodes[b].r
    nodes[a].r += 1 if nodes[a].r == nodes[b].r # by rank
    nodes[a].s += nodes[b].s                    # by size
    nodes[a].parent += nodes[b].parent # if negative value means size
    nodes[b].parent = a
    true
  end
  
  def unite_by_size(a, b)
    a = root(a)
    b = root(b)
    return false if a == b
    a, b = b, a if nodes[a].s < nodes[b].s
    nodes[b].parent = a
    nodes[a].s += nodes[b].s
    true
  end
  
  def unite_by_rank(a, b)
    a = root(a)
    b = root(b)
    return false if a == b
    a, b = b, a if nodes[a].r < nodes[b].r
    nodes[b].parent = a
    nodes[a].r += 1 if nodes[a].r == nodes[b].r
  end

  def same?(a, b)
    root(a) == root(b)
  end

  def size(node)
    -nodes[root(node)]
  end
  
  def parents; nodes.map{|i|i.parent} end
  def r; nodes.map{|i|i.r} end
  def s; nodes.map{|i|i.s} end
  #def diff_weight; @nodes.map{|i|i.diff_weight) end
end

n, m = gets.to_s.chomp.split.map{|i| i.to_i}
perm = gets.to_s.chomp.split.map{|i| i.to_i - 1 }
xys  = Array.new(m){ gets.to_s.chomp.split.map{|i| i.to_i - 1 } }

uf = UnionFindTree.new(n)
xys.each{|x,y| uf.unite(x,y); }
ans = (0...n).count{ |i| uf.same?(i, perm[i]) }

puts ans

Measured memory_bytes: 17740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define DBG(v) cerr << #v << " = " << (v) << endl;

const int mod = (int) 1e9 + 7;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	int n;
	string s;
	cin >> n >> s;

	if (s[0] == 'W') {
		cout << 0;
		return 0;
	}

	int cnt = 1;
	bool open = true;
	ll ans = 1;

	for (int i = 1; i < 2 * n; ++i) {
		if (s[i] == s[i - 1])
			open = !open;
		// DBG(open)
		if (open)
			cnt++;
		else {
			if (!cnt) {
				cout << 0;
				return 0;
			}
			(ans *= cnt--) %= mod;
		}
		ans %= mod;
	}
	DBG(ans)
	if (cnt) {
		cout << 0;
		return 0;
	}
	for (int i = 1; i <= n; ++i)
		(ans *= i) %= mod;
	cout << ans;
	return 0;
}


Measured memory_bytes: 720
import java.util.Scanner;
import static java.lang.Math.*;

//Distance Between Two Cities
public class Main{

	double R = 6378.1;
	
	double[] get(double n, double e){
		n = n*PI/180; e = e*PI/180;
		return new double[]{R*Math.sqrt((1-sin(n)*sin(n)))*sin(e), -R*Math.sqrt((1-sin(n)*sin(n)))*cos(e), R*sin(n)};
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			double n1 = sc.nextDouble(), e1 = sc.nextDouble(), n2 = sc.nextDouble(), e2 = sc.nextDouble();
			if(n1==-1&&e1==-1&&n2==-1&&e2==-1)break;
			double[] a = get(n1, e1), b = get(n2, e2);
			double x = acos((a[0]*b[0]+a[1]*b[1]+a[2]*b[2])/(Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])*Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2])));
			System.out.printf("%.0f\n", R*x);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
/*
Author:Jenil Mehta
Not yet serious but trying to be serious :)
Coding is lub
*/
 
#include <iostream>
#include <sstream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
typedef long long int ll;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
using namespace std;
void dfs(ll node, vector<ll> adj[], ll dp[], bool vis[]) 
{ 
    // Mark as visited 
    vis[node] = true; 
  
    // Traverse for all its children 
    for (ll i = 0; i < adj[node].size(); i++) { 
  
        // If not visited 
        if (!vis[adj[node][i]]) 
            dfs(adj[node][i], adj, dp, vis); 
  
        // Store the max of the paths 
        dp[node] = max(dp[node], 1 + dp[adj[node][i]]); 
    } 
} 
 vector <ll> a[100005];
ll find(vector<ll> adj[], ll n) 
{ 
    // Dp array 
    ll dp[n + 1]; 
    memset(dp, 0, sizeof dp); 
  
    // Visited array to know if the node 
    // has been visited previously or not 
    bool vis[n + 1]; 
    memset(vis, false, sizeof vis); 
  
    // Call DFS for every unvisited vertex 
    for (ll i = 1; i <= n; i++) { 
        if (!vis[i]) 
            dfs(i, adj, dp, vis); 
    } 
  
    ll ans = 0; 
  
    // Traverse and find the maximum of all dp[i] 
    for (ll i = 1; i <= n; i++) { 
        ans = max(ans, dp[i]); 
    } 
    return ans; 
} 
int main() {
   /*
   Jab Bhi Koi Ladaki Dekhun Meraa Dil Divaanaa Bole
Ole Ole Ole, Ole Ole Ole
Gaao Taraanaa Yaaraa Jhum Jhum Ke Haule Haule
Ole Ole Ole, Ole Ole Ole
Mujhako Lubhaati Hai Javaaniya Masti Lutaati Zidagaani Yahaan
Maane Na Kahanaa Paagal Mast Pavan Saa Dil Ye Dole
Ole Ole Ole, Ole Ole Ole
Ole Ole Ole, Ole Ole Ole
Jab Bhi Koi Ladaki Dekhun Meraa Dil Divaanaa Bole
Ole Ole Ole, Ole Ole Ole
Gaao Taraanaa Yaaraa Jhum Jhum Ke Haule Haule
Ole Ole Ole, Ole Ole Ole
   */
    ll n;
    cin>>n;
    ll m;
    cin>>m;
    ll i,j;
    
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        a[x].push_back(y);
    }
    ll ans=0;
    ans=find(a,n);
    cout<<ans<<endl;
}

Measured memory_bytes: 9984
#include <stdio.h>

int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x>=r && x<=W-r && y>=r && y<=H-r){
       printf("Yes\n");
    }else{
       printf("No\n");
    }
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp(x, y) make_pair(x, y)
#define pb(x) emplace_back(x)
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

typedef long long ll;
typedef vector<int> V;
typedef pair<int, int> pii;

const int mod = 998244353;
pii p[200010];
int a[200010];
ll dp[200010], n;
int tr[200010 << 2];
void upd(int x, int L, int R, int ind, int v)
{
    //printf("%d\n", x);
    if (L == R && L == ind) {
        tr[x] = v;
        return;
    }
    int mid = L + R >> 1;
    if (ind <= mid)
        upd(x << 1, L, mid, ind, v);
    else
        upd(x << 1 | 1, mid + 1, R, ind, v);
    tr[x] = max(tr[x << 1], tr[x << 1 | 1]);
}
int query(int x, int L, int R, int l, int r)
{
    if (l >= r)
        return l;
    if (l <= L && R <= r)
        return tr[x];
    int mid = L + R >> 1, res = l;
    if (l <= mid)
        res = max(res, query(x << 1, L, mid, l, r));
    if (r > mid)
        res = max(res, query(x << 1 | 1, mid + 1, R, l, r));
    return res;
}
int main()
{
    //IOS;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> p[i].ff >> p[i].ss;
    sort(p + 1, p + 1 + n);
    //for (int i = n; i >= 1; i--)
    //    printf("%d %d %d\n", i, p[i].ff, p[i].ss);
    dp[n] = 2, dp[n + 1] = 1;
    upd(1, 1, n, n, n);
    for (int i = n - 1; i >= 1; i--) {
        int x = lower_bound(p + 1, p + 1 + n, (pii){ p[i].ff + p[i].ss, 0 }) - p - 1;
        int tmp = query(1, 1, n, i, x);
        //printf("query: %d %d %d\n", i, x, tmp);
        dp[i] = (dp[i + 1] + dp[tmp + 1]) % mod;
        //cout << x << " " << tmp << " " << dp[i] << endl;
        upd(1, 1, n, i, tmp);
    }
    cout << dp[1];
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

vector<vector<ll> > v(100000);
ll dis1[100000];
ll disn[100000];
bool maki[100000],niko[100000];

void dfs1(ll n,ll d){
    dis1[n]=d;
    maki[n]=true;
    int eri=v[n].size();
    for(int i=0;i<eri;i++){
        if(!maki[v[n][i]]){
            dfs1(v[n][i],d+1);
        }
    }
    return;
}
void dfsn(ll n,ll d){
    disn[n]=d;
    niko[n]=true;
    int eri=v[n].size();
    for(int i=0;i<eri;i++){
        if(!niko[v[n][i]]){
            dfsn(v[n][i],d+1);
        }
    }
    return;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(maki,0,sizeof(maki));
    memset(niko,0,sizeof(niko));
    ll n;
    cin>>n;
    ll a,b;
    for(int i=0;i<n-1;i++){
        cin>>a>>b;
        a--;b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    dfs1(0,0);
    dfsn(n-1,0);
    ll num=0;
    for(int i=0;i<n;i++){
        if(dis1[i]<=disn[i])num++;
        else num--;
    }
    cout << ((num>0)?"Fennec":"Snuke")<<endl;
    return 0;
}

Measured memory_bytes: 12160
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(){

  stack <int> sa;
  string m;
  int cnt=0,result=0,high=0,tmp=0,h[20000],i;
  vector <int> amo;

  cin>>m;
  for(i=m.size()-1;i!=-1;i--){
    if(m[i]=='\\') tmp++;
    if(m[i]=='/') tmp--;
    high=max(high,tmp);
    h[i]=high;
  }

  for(i=0;i<m.size();i++){   
    if(m[i]=='\\'){
      sa.push(i);
    } else if(m[i]=='/' && !sa.empty()) {
      cnt+=i-sa.top();
      sa.pop();
      if(sa.empty()){
	amo.push_back(cnt);
	result+=cnt;
	cnt=0;
      }
    }
    if(i<m.size()-1) if(h[i+1]-h[i]) sa.pop();
  }
  if(amo.empty()) cout<<"0"<<endl<<"0"<<endl;
  else{
    cout<<result<<endl<<amo.size()<<" ";
    for(i=0;i<amo.size()-1;i++) cout<<amo[i]<<" ";
    cout<<amo[amo.size()-1]<<endl;
  }
  return 0;

}



Measured memory_bytes: 3348
import sys


n,k = [int(_) for _ in input().split()]
s = input()

all_0 = True
for i in range(len(s)):
    if s[i] == '1':
        all_0 = False
        break
if all_0:
    if k == 0:
        print(0)
    else:
        print(n)
    sys.exit()

c0 = 0
c1 = 0
a = [0]
b = []
v = 0
while s[v] == '0':
    c0 += 1
    s = s[1:]
b.append(c0)
c0 = 0
for i in range(len(s)):
    if s[i] == '1':
        c1 += 1
        if c0 != 0:
            b.append(c0)
        c0 = 0
    else:
        c0 += 1
        if c1 != 0:
            a.append(c1)
        c1 = 0
if c0 != 0:
    b.append(c0)
else:
    a.append(c1)
    b.append(0)
a.append(0)
# print(a)
# print(b)

s_a = [0]
s_b = [0]
for i in range(len(a)):
    s_a.append(s_a[i]+a[i])
for i in range(len(b)):
    s_b.append(s_b[i]+b[i])
# print(s_a)
# print(s_b)

ans = 0
if len(b) <= k:
    ans = n
else:
    for i in range(len(a)-k):
        # print(s_a[i+k+1] - s_a[i] + s_b[i+k] - s_b[i])
        ans = max(ans, s_a[i+k+1] - s_a[i] + s_b[i+k] - s_b[i])  
print(ans)


Measured memory_bytes: 8036
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

const i32 mod = 998244353;

i32 mod_pow (i32 r, i32 n) {
  i32 t = 1;
  i32 s = r;
  while (n > 0) {
    if (n & 1) t = (i64) t * s % mod;
    s = (i64) s * s % mod;
    n >>= 1;
  }
  return t;
}

i32 inv (i32 a) {
  return mod_pow (a, mod - 2);
}

i32 *fact = NULL;
i32 *iFact = NULL;
void init_fact (const i32 n) {
  fact = (i32 *) calloc (n + 1, sizeof (i32));
  fact[0] = 1;
  for (i32 i = 1; i <= n; ++i) {
    fact[i] = (i64) i * fact[i - 1] % mod;
  }
  iFact = (i32 *) calloc (n + 1, sizeof (i32));
  iFact[n] = inv (fact[n]);
  for (i32 i = n - 1; i >= 0; --i) {
    iFact[i] = (i64) (i + 1) * iFact[i + 1] % mod;
  }
}

i32 comb (i32 n, i32 k) {
  if (!(0 <= k && k <= n)) return 0;
  return (i64) fact[n] * iFact[k] % mod * iFact[n - k] % mod;
}

void run (void) {
  i32 k, n;
  scanf ("%" SCNi32 "%" SCNi32, &k, &n);
  init_fact (n + k);
  for (i32 i = 2; i <= 2 * k; ++i) {
    i32 c = 0;
    for (i32 j = 1, l = i - 1; j <= l; ++j, --l) {
      c += j <= k && l <= k ? 1 : 0;
    }
    i32 ans = 0;
    for (i32 j = 0, p = 1; j <= c; ++j, p = 2 * p % mod) {
      i32 way = (i64) comb (c, j) * p % mod;
      ans = (ans + (i64) way * comb (n - j + (k - (2 * c - j)) - 1, n - j)) % mod;
    }
    printf ("%" PRIi32 "\n", ans);
  }
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const ll MOD=1e9+7;
ll mfac(ll n){
	ll ret=1;
	REP(i,n){
		ret*=(i+1);
		ret%=MOD;
	}
	return ret;
}
int main(){
	ll N,M;
	cin>>N>>M;
	if (N>M){
		swap(N,M);
	}
	ll ret=0;
	if (M>=N+2){
		ret=0;
	}else{
		ret=mfac(N)*mfac(M)%MOD;
		if (N==M){
			ret<<=1;
			ret%=MOD;
		}
	}
	cout<<ret<<endl;
	return 0;
}

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

#define rep(i,n)	for(int i=0;i<n;i++)
int dx[] = { -1,0,1,0 }, dy[] = { 0,-1,0,1 };


int main() {
	int N;
	while (cin >> N, N) {
		int xmax = 0, ymax = 0, xmin = 0, ymin = 0;
		vector<int>x(N, 0), y(N, 0);
		for (int i = 1; i < N; i++) {
			int n, d; cin >> n >> d;
			x[i] = x[n] + dx[d];
			y[i] = y[n] + dy[d];
			xmax = max(x[i], xmax);
			ymax = max(y[i], ymax);
			xmin = min(x[i], xmin);
			ymin = min(y[i], ymin);
		}
		cout << xmax - xmin + 1 << " " << ymax - ymin + 1 << endl;
	}
}

Measured memory_bytes: 1196
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9+7;
ll dp[65][2][2][2][2][2];
vi num1,num2;

ll fun(ll pos,ll f1,ll f2,ll l1,ll l2,ll nz)
{

	if(pos==sz(num1)) return 1;

	if(dp[pos][f1][f2][l1][l2][nz]!=-1) return dp[pos][f1][f2][l1][l2][nz];

	ll ans=0;
	ll lim1=1,lim2=0;
	if(f1==1) lim1 = num1[pos];
	if(f2==1) lim2 = num2[pos];

	rep(x,lim2,2) rep(y,0,lim1+1)
	{
		if(x==1 && y==0) continue;
		ll nnz=1;
		if(nz==0)
		{
			if((y==1 && x==0)||(y==0 && x==1)) continue; 
			else if(y==0) nnz=0;
			else nnz=1;
		}

		ll nf1 = 0,nf2=0;
		if(f1==1 && y==lim1 ) nf1=1;
		if(f2==1 && x==lim2 ) nf2=1;

		ans = (ans+fun(pos+1,nf1,nf2,x,y,nnz))%mod;
	}
	return dp[pos][f1][f2][l1][l2][nz]=ans;
}

int solve()
{

	memset(dp,-1,sizeof dp);

	ll l,r;cin>>l>>r;
	while(r) num1.pb(r%2),r/=2;
	while(l) num2.pb(l%2),l/=2;


	// while(sz(num1)<64) num1.pb(0);
	while(sz(num2)<sz(num1)) num2.pb(0);

	reverse(num1.begin(), num1.end());
	reverse(num2.begin(), num2.end());

	// ll ans=0;
	// rep(st,0,65)
	// {
	// 	ans=ans+fun(st,)
	// }

	cout<<fun(0,1,1,0,0,0);

	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long lli;

void solve(lli a, lli b, lli c) {
  vector<lli> fa, fc;
  for(lli i = 1; i <= a; ++i) {
    if(a % i == 0) fa.push_back(i);
  }
  for(lli i = 1; i <= labs(c); ++i) {
    if(c % i == 0) {
      fc.push_back(i);
      fc.push_back(-i);
    }
  }

  if(c == 0) {

    for(lli i = 0; i < fa.size(); ++i) {
      for(lli k = 0; k < 2; ++k) {
	lli p = fa[i];
	lli r = a / fa[i];
	lli q, s;
	if(k == 0) {
	  if(b % p != 0) continue;
	  q = 0;
	  s = b / p;
	} else {
	  if(b % r != 0) continue;
	  s = 0;
	  q = b / r;
	}
	if((p > r || (p == r && q >= s)) && p*s + q*r == b) {
	  cout << p << " " << q << " " << r << " " << s << endl;
	  return;
	}
      }
    }

  } else {

    for(lli i = 0; i < fa.size(); ++i) {
      for(lli j = 0; j < fc.size(); ++j) {
	lli p = fa[i];
	lli r = a / fa[i];
	lli q = fc[j];
	lli s = c / fc[j];
	if((p > r || (p == r && q >= s)) && p*s + q*r == b) {
	  cout << p << " " << q << " " << r << " " << s << endl; 
	  return;
	}
      }
    }

  }
  cout << "Impossible" << endl;
}

int main() {
  lli a, b, c;
  while(cin >> a >> b >> c && (a|b|c)) {
    solve(a,b,c);
  }
  return 0;
}

Measured memory_bytes: 1216
N = int(input())
a = list(map(int,input().split(" ")))

dic = {}

for num in a:
	if num in dic:
		dic[num] += 1
	else:
		dic[num] = 1

ans = 0
for key,value in dic.items():
	if key > value:
		ans += value

	else:
		ans += (value - key)


print(ans)


Measured memory_bytes: 18168
use std::io::{Read, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    let mut iter = input.split_whitespace();

    loop {
        let m: i32 = iter.next().unwrap().parse().unwrap();
        let f: i32 = iter.next().unwrap().parse().unwrap();
        let r: i32 = iter.next().unwrap().parse().unwrap();
        if m==-1 && f==-1 && r==-1 {break}
        let j = m+f;
        let g = {
            if m==-1||f==-1 {b"F\n"} 
            else if j>=80  {b"A\n"} 
            else if j>=65 {b"B\n"}
            else if j>=50 {b"C\n"}
            else if j<30  {b"F\n"}
            else if r>=50 {b"C\n"}
            else {b"D\n"}
        };
        out.write(g).unwrap();
    }

}



Measured memory_bytes: 5008
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define N (ll)(1e17+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
ll dp[2000005];
ll func(ll n)
{
    if(dp[n]!=-1)
     return dp[n];
    if(n==1)
     return 1; 
    return dp[n]=n+func(n-1); 
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll t=1;
   //cin>>t;
   while(t--)
   {
       ll n,i,k,x,mx=0,sum=0,st,end;
       dd ans=0;
       memset(dp,-1,sizeof(dp));
       cin>>n>>k;
       vector <ll> v;
       for(i=0;i<n;i++)
       {
        cin>>x;
        v.pb(x);
       }
       for(i=0;i<k;i++)
         sum+=v[i];
       //cout<<func(v[0])<<"\n";  
        mx=sum; 
        st=0;
        end=k-1;
        for(i=k;i<n;i++)
        {
            sum+=v[i];
            sum-=v[i-k];
            //cout<<sum<<"\n";
            if(sum>mx)
            {
                st=i-k+1;
                end=i;
                mx=sum;
            }
        } 
        //cout<<st<<" "<<end<<"\n";
        for(i=st;i<=end;i++)
        {
            dd ans1=(dd)func(v[i])/v[i];
            //cout<<v[i]<<" "<<func(v[i])<<" "<<ans1<<"\n";
            ans+=ans1;
        } 
        //cout<<ans<<"\n";
        /*for(i=1;i<1001;i++)
        {
            dd yu=(dd)func(i)/i;
            cout<<i<<" "<<func(i)<<" "<<yu<<"\n";
        }*/
        //cout<<"\n";
        //cout<<st<<" "<<end<<"\n";
        cout<<fixed<<setprecision(12)<<ans<<"\n";
   }
}

Measured memory_bytes: 18036
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> vec(n);
	for( auto &i : vec ){
		cin >> i;
	}
	sort(vec.rbegin(), vec.rend());
	int sum = 0;
	for( int i = 0; i < k; ++i ){
		sum += vec.at(i);
	}
	cout << sum << endl;
	return 0;
}

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

ll solve() {
    ll N;
    cin >> N;
    vector<string> ans;
    function<void(string,int,int)> dfs = [&](string s, int a, int d) {
        if ( d == 0 ) {
            ans.push_back(s);
            return;
        }
        for ( int i = 0; i < a; i++ ) {
            string t(s);
            t.push_back('a'+i);
            dfs(t, a, d-1);
        }
        string t(s);
        t.push_back('a'+a);
        dfs(t, a+1, d-1);
        return;
    };

    dfs("", 0, N);
    for ( int i = 0; i < ans.size(); i++ ) {
        cout << ans[i] << "\n";
    }
    return 0;
}

int main() {
    solve();
    return 0;
}

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

void fnInput(int& rnTrgSu, int& rnTrgKin)
{
  cin >> rnTrgSu >> rnTrgKin;
}

int fnRcsSch(int nPos, int nTrgSu, int nTrgKin, vector<int>& rvnNumMoney)
{
  vector<int> cnvnMoney{10000, 5000, 1000};

  if (nTrgKin < 0)  return -1;
  if (nPos == rvnNumMoney.size() - 1)
  {
    rvnNumMoney[nPos] = nTrgSu;
    if (nTrgKin - cnvnMoney[nPos] * nTrgSu == 0)
      return 1;
    else
      return 0;
  }

  for (int i = 0; i <= nTrgSu; i++)
  {
    rvnNumMoney[nPos] = i;
    int nRtn = fnRcsSch(nPos + 1, nTrgSu - i, nTrgKin - cnvnMoney[nPos] * i, rvnNumMoney);
    if      (nRtn == -1)  return 0;
    else if (nRtn)        return 1;
  }

  return 0;
}

int fnExhSch(int nTrgSu, int nTrgKin)
{
  vector<int> vnNumMoney(3);

  if (fnRcsSch(0, nTrgSu, nTrgKin, vnNumMoney))
  {
    for (int i = 0; i < vnNumMoney.size(); i++)
    {
      if ( i )  cout << " ";
      cout << vnNumMoney[i];
    }
    cout << endl;
  }
  else
    cout << -1 << " " << -1 << " " << -1 << endl;
}

int main()
{
  int nTrgSu, nTrgKin;
  
  fnInput(nTrgSu, nTrgKin);
  fnExhSch(nTrgSu, nTrgKin);

  return 0;
}
 

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,i;
    int price=0;
    int max=0;
    scanf("%d",&n);
    int p[n];
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        if(max<p[i]){
            max = p[i];
        }
        price += p[i];
    }
    price -= max/2;
    printf("%d\n",price);

    return 0;
}

Measured memory_bytes: 128
//waz
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))
 
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;
 
#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))
 
int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

const int mod = 1e9 + 7;

int n;

int dp[4010][4010];

PII x[200010];

int& f(int x, int y) { return dp[x + 2005][y + 2005]; }

int inc(int x, int y)
{
	x += y;
	if (x >= mod) x -= mod;
	return x;
}

int dec(int x, int y)
{
	x -= y;
	if (x < 0) x += mod;
	return x;
}

int fpow(int a, int x)
{
	int ret = 1;
	for (; x; x >>= 1)
	{
		if (x & 1) ret = 1LL * ret * a % mod;
		a = 1LL * a * a % mod;
	}
	return ret;
} 

int fac[8010], ifac[8010];

int C(int n, int m)
{
	if (n < m || m < 0) return 0;
	return 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

int main()
{
	fac[0] = 1;
	for (int i = 1; i <= 8000; ++i)
		fac[i] = 1LL * fac[i - 1] * i % mod;
	ifac[8000] = fpow(fac[8000], mod - 2);
	for (int i = 8000; i; --i)
		ifac[i - 1] = 1LL * ifac[i] * i % mod;
	gi(n);
	for (int i = 1; i <= n; ++i)
		gii(x[i].fi, x[i].se), ++f(-x[i].fi, -x[i].se);
	for (int i = -2000; i <= 2000; ++i)
		for (int j = -2000; j <= 2000; ++j)
			f(i, j) = inc(f(i, j), f(i - 1, j)), f(i, j) = inc(f(i, j), f(i, j - 1));
	int ans = 0;
	for (int i = 1; i <= n; ++i)
		ans = inc(ans, f(x[i].fi, x[i].se));
	for (int i = 1; i <= n; ++i)
		ans = dec(ans, C((x[i].fi + x[i].se) << 1, x[i].fi << 1));
	ans = 1LL * ans * fpow(2, mod - 2) % mod;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 64512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;


int main() {
  int n = 1, x, cnt = 0;
  while(1){
    cin >> n >> x;
    if((n == 0)&&(x == 0)) break;
    for(int i = 1; i <= n-2; i++){
      for(int j = i + 1; j <= n-1; j++){
        for(int k = j+1; k <= n; k++){
          if(i + j + k == x) cnt++;
        }
      }
    }
    cout << cnt << endl;
    cnt = 0;
  }
}



Measured memory_bytes: 3072
x1,x2,x3,x4,x5=map(int,input().split())
if x1 == 0:
  print(1)
elif x2 == 0:
  print(2)
elif x3 == 0:
  print(3)
elif x4 == 0:
  print(4)
else:
  print(5)

Measured memory_bytes: 9172